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

chore(testing): Upgrade Jest to v27 #2980

Closed
wants to merge 5 commits into from

Conversation

splitinfinities
Copy link
Contributor

@splitinfinities splitinfinities commented Jul 27, 2021

The upgrade from Jest 26 to Jest 27 included a refactor to use ESM and TypeScript within the package, invalidating the need for including the @types/jest package in consuming libraries. npm test after the npm link flow currently works as expected in this PR.

However, an oddity on this branch is the behavior around npm pack, which seems not to evaluate the testing package and it's provided jest references to 27. Under the pack behavior, we receive this result in a consuming stencil component library after running npm t

[ ERROR ]  
Class extends value #<Object> is not a constructor or null TypeError: Class extends value #<Object> is not a constructor or null at createTestRunner (/Users/will/Sites/Ionic/jest-27/node_modules/@stencil/core/testing/index.js:1330:37)
at Object.<anonymous> (/Users/will/Sites/Ionic/jest-27/node_modules/@stencil/core/testing/jest-runner.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1124:10) 
at Object.newLoader (/Users/will/Sites/Ionic/jest-27/node_modules/pirates/lib/index.js:104:7)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:816:12) 
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:93:18) 
at requireOrImportModule (/Users/will/Sites/Ionic/jest-27/node_modules/jest-util/build/requireOrImportModule.js:53:28)

Ticket: STENCIL-17

BREAKING CHANGE: Consuming libraries will need to remove typing. (More to come)

@splitinfinities splitinfinities self-assigned this Jul 27, 2021
@rwaskiewicz rwaskiewicz changed the title fix(testing) Upgrade Jest to v27 fix(testing): Upgrade Jest to v27 Jul 27, 2021
Fix is implemented for backward compatibility so it can work with both 26 and 27.
@splitinfinities splitinfinities requested a review from a team July 28, 2021 18:28
@splitinfinities splitinfinities changed the title fix(testing): Upgrade Jest to v27 chore(testing): Upgrade Jest to v27 Jul 28, 2021
@splitinfinities splitinfinities marked this pull request as draft July 28, 2021 19:21
@igorlino
Copy link

Hello @splitinfinities any progress so far ? It gets a bit confusing, when using the latest packages, but also the old ones :(

@rwaskiewicz
Copy link
Contributor

Hey @igorlino - we don't have a definitive timeline on this at the moment. For now, please use Jest v26, as v27 is not supported by Stencil just yet

@igorlino
Copy link

I see, ok thank you. Looks like jest 27 offers some significant performance improvements (https://jestjs.io/blog/2021/05/25/jest-27)

26 is unfortunately not working for me either on libraries added like:
nx g @nxext/stencil:lib my-lib --publishable --importPath=@lib/mylib-lib

So i'm truly stuck :(

@DominikPieper
Copy link

@igorlino if there aren't any apps/libs in the nx repo that uses jest 27 maybe try just replace 27 with 26. If something needs 27 as well (which comes with nx by default), it won't work and you're stuck right now for sure

@guilhermebc
Copy link

Any news?

@taisuke-j
Copy link

taisuke-j commented Nov 8, 2021

Just upgraded the jest version and seeing the same error. Subscribing to this thread now

@rwaskiewicz
Copy link
Contributor

This is the original work that Will and I did to see the level of effort as to what it would take to support Jest 27. This work is productionized in 2 separate PRs:

I'm going to close this PR as it is superseded by those two PRs I listed above.

I expect the first of the two to land in time for the next minor version of Stencil.

@rwaskiewicz rwaskiewicz mentioned this pull request Dec 16, 2021
14 tasks
@rwaskiewicz rwaskiewicz deleted the STENCIL-17-upgrade-jest branch February 4, 2022 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants