-
Notifications
You must be signed in to change notification settings - Fork 790
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
feat(test): jest 27 support #3189
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this commit restores running the `npm test` command as a part of the root level package.json's `test.end-to-end` script (and readds it to CI). this commit provides support for jest 27 in stencil. this is accomplished by no longer pulling default options from the jest-cli package, which now encapsulates its contents through an `exports` field in its package.json file. during the course of this work, it was discovered the same fields/defaults were used with Jest 24, 25, & 26. Those options have been pulled out into a helper function to be provided for Jest v24 thru 27 to ensure a consistent experience. this helper will be removed in a future version of Stencil. the test runner for consumers is locked to jest-jasmine2 for backwards compatability in this commit. jest-runner exposes its default export differently in jest 27. the creation of a stencil test runner has been updated to handle the differences between jest v27 and v26 (and under). jest, jest-cli, jest-environment-node were all updated to the latest patch version to test with the latest and greatest versions of the libraries.
rwaskiewicz
force-pushed
the
jest-27-bin-cli-args
branch
from
December 15, 2021 19:16
387e06e
to
91e7ec1
Compare
update minimum required version for consumers to v27
rwaskiewicz
commented
Dec 15, 2021
@@ -6,12 +6,12 @@ import path from 'path'; | |||
|
|||
describe('jest-config', () => { | |||
it('pass --maxWorkers=2 arg when --max-workers=2', () => { | |||
const args = ['test', '--ci', '--e2e', '--max-workers=2']; | |||
const args = ['test', '--ci', '--max-workers=2']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was exactly the same as the one below it. I'm guessing this is copy/pasta, but could be wrong. The test name differentiation suggests this shouldn't run with the --e2e
flag. I can pull this into a separate commit if desired
This was referenced Dec 16, 2021
Closed
ltm
approved these changes
Jan 4, 2022
This was referenced Jan 4, 2022
Closed
Thank you !!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run build
) was run locally and any changes were pushednpm test
) were run locally and passednpm run test.karma.prod
) were run locally and passednpm run prettier
) was run locally and passedPull request type
Please check the type of change your PR introduces:
What is the current behavior?
Jest 27 is not supported due to an issue when trying to reach into a private jest-cli package. This commit provides a fix for that aspect of Jest 27 support (and gets us most of the way there)
GitHub Issue Number: see 'other information' section below
What is the new behavior?
this commit restores running the
npm test
command as a part of theroot level package.json's
test.end-to-end
script (and readds it toCI).
this commit provides support for jest 27 in stencil. this is
accomplished by no longer pulling default options from the jest-cli
package, which now encapsulates its contents through an
exports
fieldin its package.json file. during the course of this work, it was
discovered the same fields/defaults were used with Jest 24, 25, & 26.
Those options have been pulled out into a helper function to be provided
for Jest v24 thru 27 to ensure a consistent experience. this helper will
be removed in a future version of Stencil.
the test runner for consumers is locked to jest-jasmine2 for backwards
compatibility in this commit.
jest-runner exposes its default export differently in jest 27. the
creation of a stencil test runner has been updated to handle the
differences between jest v27 and v26 (and under).
jest, jest-cli, jest-environment-node were all updated to the latest
patch version to test with the latest and greatest versions of the
libraries.
Does this introduce a breaking change?
Testing
With this branch, I ran:
npm clean && npm i -D jest@27 jest-cli@27 jest-environment-node@27 && npm ci && npm run build && npm run test.end-to-end
to run the end to end tests, which simulate a small application running spec tests with the version of Jest installed (we pull from Stencil's installed version of Jest/that's why the end to end tests were temporarily removed).I then ran that command above for each major version of Jest we support today [24, 25, 26].
I ran the karma tests locally as one last check before moving on.
Next, I ran
git reset --hard && npm clean && npm ci && npm run build && pack
to generate a tarball for this branch. With the Stencil CLI (npm init stencil
-> choose 'component') I spun up a new component library, & installed the tarball. For each version of Jest [24, 25, 26, 27] I rannpm i -D jest@VER jest-cli@VER && npm t -- --no-cache
to verify this worked in the real world (or at least on a small, sample representation)Finally, I installed my tarball in a local copy of Ionic Framework Core, then updated Jest:
And was able to run the tests to completion in Ionic Framework Core:
Other information
This PR supersedes:
This PR fixes: