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

Jest 24 and jest-preset-angular 7 changes #1029

Closed
4 tasks done
vitalyiegorov opened this issue Jan 26, 2019 · 11 comments · Fixed by #1135
Closed
4 tasks done

Jest 24 and jest-preset-angular 7 changes #1029

vitalyiegorov opened this issue Jan 26, 2019 · 11 comments · Fixed by #1135

Comments

@vitalyiegorov
Copy link

vitalyiegorov commented Jan 26, 2019

After updating to latest Jest(24.0.0) and jest-angular-preset(7.0.0-alpha.2) which has some breaking changes:
https://github.com/thymikee/jest-preset-angular/blob/release/7/CHANGELOG.md

This is only showing warnings for now but the main problem is that it does not find tsconfig.spec.json anymore.

Debugging jest-builder showed that change in https://github.com/nrwl/nx/blob/7.1.x/packages/builders/src/jest/jest.builder.ts#L47:

tsConfig: path.join('<rootDir>', path.relative(builderConfig.root, options.tsConfig))

fixes tests.

Also its weird that I cannot override globals Jest settings in my jest.config.js which I think would be expected.

Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)

Expected Behavior

Running jest unit tests normally as was before an update to latest Jest and jest-preset-angular

Current Behavior

File not found: tsconfig.spec.json (resolved as: .../tsconfig.spec.json)

It resolves always to monorepo root folder, not to lib folder.

@FrozenPandaz
Copy link
Collaborator

I'm excited for the changes in Jest 24 :) I think we'll wait for ts-jest and angular-preset-angular to stabilize before we decide what to do. More than likely, it will have limited impact on the current usage of jest since most things are handled within the builder.

@YonatanKra
Copy link

So what can be done in the meantime? My tests don't run now. I have the same issue as #1054.

@nongrata081
Copy link

@YonatanKra If you downgrade jest to v23.6.0 it should work

@YonatanKra
Copy link

YonatanKra commented Feb 18, 2019

For some reason it doesn't happen locally - only on circle-ci. I've set the version to just 23.6.0 in package.json (without ~ nor ^) but to no avail.
Actually, locally it works with jest 24.1.0. I guess it must be a circleci issue.

@TekSiDoT
Copy link

This issue is now relevant to https://www.npmjs.com/advisories/786 , not upgrading to Jest >= 24 will report security issues with a dependency (braces) during installations and npm audits.

@FrozenPandaz
Copy link
Collaborator

thymikee/jest-preset-angular#224 was merged and I tested it with Nx with the changes that @vitalyiegorov mentioned and it's looking good. I'll write the migrations tonight :)

@viceice
Copy link
Contributor

viceice commented Mar 11, 2019

jest-preset-angular v7 was released. So no more a blocker.

@tencho12
Copy link

@YonatanKra If you downgrade jest to v23.6.0 it should work

downgrading is not working. is there any other alternative?

@dgroh
Copy link

dgroh commented Jul 18, 2019

I still get with version 7.1.1:

File not found: /src/tsconfig.spec.json

@dgroh
Copy link

dgroh commented Jul 18, 2019

For those who are still facing this issue, this solution has helped me.*

thymikee/jest-preset-angular#286

@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 Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants