nx
nx copied to clipboard
Disable Circular Dependency Check
Description
Our project is composed of a core, testing and several plugin packages, our testing package is utilized by our e2e tests to spin up a test server, the package has a dependency on core. Our core package has its own e2e tests and these utilize the testing package, within our core package we have a dev dependency on the testing package.
Currently I cannot build the solution because it results in Nx complaining about the circular dependency, it seems like a perfectly valid setup to me; we don't have a build time dependency on testing in core, we have a dependency in our tests only.
I have seen the various issues related to this and there are two proposed suggestions:
-
Use explicit dependsOn directives with the !package-name syntax This does not work at all in my situation
-
Move tests to a seperate package Would be impractical to do this, because not only would core require an e2e testing package, so would all of our plugins and their siblings.
It would be helpful if there were a way to bypass this check somehow
Motivation
It's widely requested, see: #2570, #10290, #9645
As of yet none of those discussions talk about a use case where you have a plugin ecosystem for which it's extremely beneficial to have a standardised framework for writing tests.
Suggested Implementation
A couple of possible implementations:
- Opt-in flag to disable the check
- Config directive to exclude certain paths from this check
- Ability to not consider tests to be part of the overall graph
- Ignore dev dependencies
Alternate Implementations
Another implementation might be to ignore circular dependencies when analyze source files is set to false.