Tests doesnt work outside of libs and apps scope
See original GitHub issueCurrent Behavior
If you add a test file inside tools/generators directory, jest throws:
No tests found, exiting with code 1
Expected Behavior
Tests should work as expected
Steps to Reproduce
Create a test file in tools/generators/sum.spec.ts
describe('some test', async () => {
it('test sum', function () {
const num = 1 + 1
expect(num).toBeGreaterThanOrEqual(2)
})
})
Failure Logs
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
Environment
Node : 14.17.4 OS : darwin x64 yarn : 1.22.11
nx : Not Found @nrwl/angular : Not Found @nrwl/cli : 12.8.0 @nrwl/cypress : 12.8.0 @nrwl/devkit : 12.8.0 @nrwl/eslint-plugin-nx : 12.8.0 @nrwl/express : 12.8.0 @nrwl/jest : 12.8.0 @nrwl/linter : 12.8.0 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : 12.8.0 @nrwl/nx-cloud : Not Found @nrwl/react : 12.8.0 @nrwl/schematics : Not Found @nrwl/tao : 12.8.0 @nrwl/web : 12.8.0 @nrwl/workspace : 12.8.0 @nrwl/storybook : 12.8.0 @nrwl/gatsby : Not Found typescript : 4.3.5
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
nx test: Jest unit tests are failing to run in any test that ... - GitHub
Current Behavior An NX - Ionic and Vue workspace fails to run tests, many solutions tested and any seems to fix the issue:...
Read more >"No such module" when using @testable in Xcode Unit tests
Please check your Module Name that you try to import with @testable import "ModuleName" . The module name should be the same on...
Read more >New features in Android Studio Preview - Android Developers
This page lists the new features introduced in Android Studio preview releases. The preview builds provide early access to the latest features and ......
Read more >Usage of Angular libraries published to npm
Run or restart the ng serve Angular CLI command to see Bootstrap 4 work in your application. Using runtime-global libraries inside your applink....
Read more >Top 18 Most Common AngularJS Developer Mistakes - Toptal
Single page apps demand the front-end developers to become better software ... set foo in the inner scope to 2, but will not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@vsavkin I also created some scripts and generators in the tools directory. Of course I added all the needed unit tests for those scripts, but they won’t be tested by
nx testornx affected:test- although those files will have affect on the whole project, if the scripts have any bugs. I do not understand your suggestion to create a project. Do you mean an application or a library? And if yes, what kind of library?Hi there.
We don’t encourage folks to run jest from the root and instead encourage them to use
nx affected --target=test. The command then will only test the affected projects instead of all of them. I imagine you are running the jest command directly. You can do it but in this case you rerun all tests on all PRs.What I would suggest instead is to create a project in workspace.json and set its root to
tools/generators.Does it make sense?