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

@W-16676971: drop support for Jest v.26 and v.27 #300

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2.1

supported-jest-versions: &supported-jest-versions ["local", "26", "27", "28", "29"]
supported-jest-versions: &supported-jest-versions ["local", "28", "29"]

deploy_filters: &deploy_filters
filters:
Expand Down Expand Up @@ -58,23 +58,11 @@ jobs:
equal: [<<parameters.jest-version>>, "local"]
steps:
- run:
name: Override version of jest@<<parameters.jest-version>>
name: Override version of jest@<<parameters.jest-version>> and jest-environment-jsdom@<<parameters.jest-version>>
command: |
yarn remove jest jest-environment-jsdom -W --dev
yarn add jest@<<parameters.jest-version>> -W --dev
- when:
condition:
equal: [<<parameters.jest-version>>, "26"]
steps:
- run: yarn clean
- run: yarn install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition below is no longer needed since jest 28/29 is now implied (if the jest version is not "local"):

            - when:
                condition:
                  or:
                    - equal: [<<parameters.jest-version>>, "28"]
                    - equal: [<<parameters.jest-version>>, "29"]

- when:
condition:
or:
- equal: [<<parameters.jest-version>>, "28"]
- equal: [<<parameters.jest-version>>, "29"]
steps:
- run: yarn add jest-environment-jsdom@<<parameters.jest-version>> -W --dev
yarn add jest-environment-jsdom@<<parameters.jest-version>> -W --dev
- run:
name: Run linter
command: yarn lint
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/jest-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@lwc/engine-dom": ">=5.0.0",
"@lwc/engine-server": ">=5.0.0",
"@lwc/synthetic-shadow": ">=5.0.0",
"jest": "^26 || ^27 || ^28 || ^29"
"jest": "^28 || ^29"
},
"dependencies": {
"@lwc/jest-resolver": "16.1.0",
Expand Down
1 change: 0 additions & 1 deletion packages/@lwc/jest-preset/ssr/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
module.exports = {
// Jest 26 default testEnvironment is jsdom: https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults
testEnvironment: 'node',
moduleFileExtensions: ['ts', 'js', 'html'],
snapshotSerializers: [require.resolve('../src/ssr/html-serializer.js')],
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/jest-resolver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@lwc/jest-shared": "16.1.0"
},
"peerDependencies": {
"jest": "^26 || ^27 || ^28 || ^29"
"jest": "^28 || ^29"
},
"engines": {
"node": ">=10"
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/jest-serializer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"pretty-format": "^29.7.0"
},
"peerDependencies": {
"jest": "^26 || ^27 || ^28 || ^29"
"jest": "^28 || ^29"
},
"engines": {
"node": ">=10"
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/jest-transformer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"peerDependencies": {
"@lwc/compiler": ">=2.48.0",
"jest": "^26 || ^27 || ^28 || ^29"
"jest": "^28 || ^29"
},
"engines": {
"node": ">=10"
Expand Down
5 changes: 0 additions & 5 deletions packages/@lwc/jest-transformer/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ module.exports = {
// type getCacheKey = (sourceText: string, sourcePath: string, options: { configString: string }) => string;
transformConfig = rest[0];
configString = transformConfig.configString;
} else if (rest.length === 2) {
// Handle jest@26 arguments
// type getCacheKey = (sourceText: string, sourcePath: string, configStr: string, options: any) => string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the whole else if block can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed this. The comment is harmless but yes I guess it is redundant now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove it .

configString = rest[0];
transformConfig = rest[1];
} else {
throw new Error('Unexpected transform arguments.');
}
Expand Down