Skip to content

Commit

Permalink
fix: drop support for Jest v26 and v27 @W-16676971 (#300)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Jest v26 and v27 are no longer supported
  • Loading branch information
lesya7 authored Sep 5, 2024
1 parent 2a880cf commit fc4e50d
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 25 deletions.
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
- 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;
configString = rest[0];
transformConfig = rest[1];
} else {
throw new Error('Unexpected transform arguments.');
}
Expand Down

0 comments on commit fc4e50d

Please sign in to comment.