You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
note: I'm tempted to file a feature request because 8 have seen any response from slack or stack on this, but I thought I (re)post here.
I'm finding it difficult to segregate a testing library that has code coverage for the library under test in with nx when running their cli commands. The goal is to have that within a build process and commit process to evaluate the coverage.
I've got a set up like so (just node, nothing else... well, jest too)
In utils-test it references utils correctly, and I can run tests, however when I start trying to aim for coverage, it’s a an amazing 0%, while when I use wallabyjs I see I have coverage around 98%.
The results are when I run the command nx affected:test --all --codeCoverage --skip-nx-cache
> [email protected] test:all /Users/me/git/libs
> nx affected:test --all --codeCoverage --skip-nx-cache
> NX WARNING Running affected:* commands with --all can result in very slow builds.
--all is not meant to be used for any sizable project or to be used in CI.
Learn more about checking only what is affected: https://nx.dev/latest/angular/cli/affected#affected.
> NX Running target test for projects:
- utils-test
With flags:
--codeCoverage=true
———————————————————————————————————————————————
> nx run utils-test:test --codeCoverage
PASS utils-test libs/utils-test/src/lib/models/countries.test.ts
PASS utils-test libs/utils-test/src/lib/models/states.test.ts
PASS utils-test libs/utils-test/src/lib/randomizers/boolean.test.ts
PASS utils-test libs/utils-test/src/lib/randomizers/numbers.test.ts
PASS utils-test libs/utils-test/src/lib/randomizers/arrays.test.ts
PASS utils-test libs/utils-test/src/lib/randomizers/strings.test.ts
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
----------|---------|----------|---------|---------|-------------------
Test Suites: 6 passed, 6 total
Tests: 25 passed, 25 total
Snapshots: 0 total
Time: 1.753 s, estimated 2 s
Ran all test suites.
———————————————————————————————————————————————
> NX SUCCESS Running target "test" succeeded
I honestly cannot figure out how to approach the utils-test\jest.config.js.
Currently I have for that file:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm finding it difficult to segregate a testing library that has code coverage for the library under test in with
nx
when running their cli commands. The goal is to have that within a build process and commit process to evaluate the coverage.I've got a set up like so (just node, nothing else... well, jest too)
In utils-test it references utils correctly, and I can run tests, however when I start trying to aim for coverage, it’s a an amazing 0%, while when I use
wallabyjs
I see I have coverage around 98%.The results are when I run the command
nx affected:test --all --codeCoverage --skip-nx-cache
I honestly cannot figure out how to approach the
utils-test\jest.config.js
.Currently I have for that file:
Equally I have for the
utils\jest.config.js
a minimal file (guys atwallabyjs.com
helped me with this part):from the root, I have this jest.config.js file:
and finally the preset file (which is also in the root):
How do you all set up isolated jest tests libraries with coverage?
Beta Was this translation helpful? Give feedback.
All reactions