Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circular dependencies detection do not exclude tests in buildable libraries #9645

Closed
abrahamsaanchez opened this issue Apr 1, 2022 · 7 comments

Comments

@abrahamsaanchez
Copy link

Current Behavior

I can't build a buildable library because NX is detecting wrong circular dependecies.

I have two buildable libraries in a project, the first library creates a value object to make a date inmutable, the second library generates random instance of the first library (for test purpouses).

I write a test for the first library, in this test, I import the second library and the tests works properly but if I try to build the application I get a circular dependency error.

However, if I build the library using the command npx tsc --project libs\shared\domain\timestamp\tsconfig.lib.json the library builds without no problem and no circular dependencies.

This is the current dep graph of the application:

graph

I think the problem comes from the dependency detection, he should ignore the test files.

Expected Behavior

I should be able to build the library without a circular dependency error.

Steps to Reproduce

I have created a repo with the example https://github.com/abrahamsaanchez/circular-dependencies

Failure Logs

> NX Could not execute shared/domain/timestamp:build because it has a circular dependency

Environment

>  NX   Report complete - copy this into the issue template

   Node : 16.13.2
   OS   : win32 x64
   npm  : 8.4.1

   nx : 13.9.5
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 13.9.5
   @nrwl/eslint-plugin-nx : 13.9.5
   @nrwl/express : Not Found
   @nrwl/jest : 13.9.5
   @nrwl/js : 13.9.5
   @nrwl/linter : 13.9.5
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 13.9.5
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 13.9.5
   typescript : 4.5.5
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:
@AgentEnder AgentEnder added the scope: core core nx functionality label Apr 1, 2022
@abrahamsaanchez
Copy link
Author

Any update?

@abrahamsaanchez
Copy link
Author

abrahamsaanchez commented May 9, 2022

Updated the example repo to the 14.1.4, the error still remaining....

>  NX   Report complete - copy this into the issue template

   Node : 16.13.2
   OS   : win32 x64
   npm  : 8.4.1

   nx : 14.1.4
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.1.4
   @nrwl/eslint-plugin-nx : 14.1.4
   @nrwl/express : Not Found
   @nrwl/jest : 14.1.4
   @nrwl/js : 14.1.4
   @nrwl/linter : 14.1.4
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 14.1.4
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.1.4
   typescript : 4.5.5
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:

@AgentEnder can you give me some updates on this?

@dereekb
Copy link

dereekb commented May 14, 2022

Found a solution, you can use the implicitDependencies configuration to ignore dependencies.

#10290 (comment)

@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Nov 11, 2022
@abrahamsaanchez
Copy link
Author

Up this

@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants