Nx: many jest test failures after upgrade to jest 24 (via 7.7 upgrade)

Created on 16 Mar 2019  路  10Comments  路  Source: nrwl/nx

For some libs I'm getting:

TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):

Other libs, I'm starting the test and they never run:

Test Suites: 0 of 7 total
Tests:       0 total
Snapshots:   0 total
Time:        89s

After 89s I stopped it.

Following the instructions here: https://huafu.github.io/ts-jest/user/config/diagnostics for ts-jest diagnostics has zero effect on whether they run or not.

Should this have been pushed as an 8.x release with breaking changes?

more info needed repro needed bug

Most helpful comment

Thx for the quick responses. So the behavior definitely changed with the new versions of jest and ts-jest. So to be backwards compatible it would be nice if diagnostics would be disabled in nx v7.x
And for v8.x it would be nice if this setting can be changed through an cli option. Or, in case the workaround with setting the option in the package.json works (as suggested in
https://github.com/nrwl/nx/issues/1059) it would be great if this is documented.

All 10 comments

We also face the problem that with the new version of ts-jest (which is used now due to the changes), the first run of our tests takes very long (500+ seconds). With cached test there seems no difference.

I think there a two possible solutions:

  1. Pass through the ts-jest settings from the jest.config.js file and merge them with the nx default settings. So then every user has control over settings itself and can disabled the diagnostics. Currently the ts-jest settings are overwritten completely.

  2. Add a new option to the cli to allow to disabled the diagnostics in ts-jest

Hi all, is there a repo I can take a look at?

Is this only some projects or all projects?

Sadly our repo is private. But basically it applies to all repositories. The thing is for small repos you will not see any difference.

I just saw there is already an issue for this problem: https://github.com/nrwl/nx/issues/1059

1059 is indeed an issue but should be addressed seperately.

I did some testing and it seems like the diagnostics option is for any Typescript compilation errors encountered. It should tell you where the compilation errors are and should disappear after they are fix. If this was the behavior before, until version 8, we can have diagnostics disabled by default to make it a non-breaking change. And then make it enabled by default for version 8.

Same with us, private repo. However when I removed that particular test suite that had the failing diagnostics, then the tests just ran forever without actually starting:

Test Suites: 0 of 7 total
Tests:       0 total
Snapshots:   0 total
Time:        89s

Thx for the quick responses. So the behavior definitely changed with the new versions of jest and ts-jest. So to be backwards compatible it would be nice if diagnostics would be disabled in nx v7.x
And for v8.x it would be nice if this setting can be changed through an cli option. Or, in case the workaround with setting the option in the package.json works (as suggested in
https://github.com/nrwl/nx/issues/1059) it would be great if this is documented.

Same here: even simple tests take forever to complete (350s+)

Hey guys there are many issues lately which seem unrelated but they are - nx isn't playing nice with jest-preset-angular and so tests don't work.

Can someone share a working config: jest.config.js and tsconfig.spec.json, etc.?

Can we please create a separate issue for the performance issues? I will turn the diagnostics to warn today.

Was this page helpful?
0 / 5 - 0 ratings