Nx: After update to Nx 9.2.2, unit test are not executed

Created on 6 Apr 2020  路  7Comments  路  Source: nrwl/nx

Expected Behavior

After update executing unit tests works fine.

Current Behavior

After update unit tests are not being executed.
I'm receiving message

No tests found, exiting with code 0

Interesting thing is that when I create application from scratch tests works fine.
What I noticed is that changing testMach from

testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],

to

testMatch: ['**/+(*.)+(spec|test).[tj]s?(x)']

in jest.config.js file solves the problem.

Previous version of jest namely 24.9.0 works fine.

repro needed testing tools

Most helpful comment

I upgraded a simple project from 8 to 10 - this issue seems to still be there...

Having this regex also fixes it: ['**/+(*.)+(spec|test).+(ts|js)?']

All 7 comments

What is the name of the test file?

The tests in https://github.com/nrwl/nx-examples are still running with the above regex (with the +).

Can you please provide a repo that we can pull down to take a look?

Hah, I was trying to prepare repo with the issue, but it turned out that when I recreate my yarn.lock file everything started working fine... :) closing this issue

Strange, had the same issue, did not go away with recreating package-lock, but the change to testMatch in jest.config.js did work. Everything was getting filtered out under the testPathIgnorePatterns

Run with --passWithNoTests to exit with code 0
In /my/path/to/app
138 files checked.
testMatch: */+(.)+(spec|test).+(ts|js)?(x) - 0 matches
testPathIgnorePatterns: /node_modules/ - 138 matches
testRegex: - 0 matches
Pattern: - 0 matches

I can confirm this is currently still an issue.

I upgraded from an Angular version 8 project to version 9 using the nx migrate procedure.
All goes fine, but the issue is indeed that the testMatch needs to be changed as stated above.

testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)']

to

testMatch: ['**/+(*.)+(spec|test).[tj]s?(x)']

I willing to investigate how to automate this in the migration if I can get some help from somebody from the nrwl team if possible.

I've had the same issue and changing the regex seems to work.
I upgraded from 8.12.10 to 9.6.0

I can confirm this is currently still an issue.

I upgraded from an Angular version 8 project to version 9 using the nx migrate procedure.
All goes fine, but the issue is indeed that the testMatch needs to be changed as stated above.

testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)']

to

testMatch: ['**/+(*.)+(spec|test).[tj]s?(x)']

I willing to investigate how to automate this in the migration if I can get some help from somebody from the nrwl team if possible.

I upgraded a simple project from 8 to 10 - this issue seems to still be there...

Having this regex also fixes it: ['**/+(*.)+(spec|test).+(ts|js)?']

I upgraded a simple project from 8 to 10 - this issue seems to still be there...

Having this regex also fixes it: ['**/+(*.)+(spec|test).+(ts|js)?']

Same for me! +1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danieldanielecki picture danieldanielecki  路  3Comments

elliotmendiola picture elliotmendiola  路  3Comments

dereklin picture dereklin  路  3Comments

joelmuskwe picture joelmuskwe  路  3Comments

ZempTime picture ZempTime  路  3Comments