Skip to content

Commit 3dba4ec

Browse files
authored
feat: set minimum support TypeScript version at 4.3 (#3428)
BREAKING CHANGE: Minimum support TypeScript version is now 4.3 since Jest 28 requires it
1 parent 41b4ae8 commit 3dba4ec

13 files changed

Lines changed: 35 additions & 199 deletions

File tree

e2e/__tests__/ast-transformers.test.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,16 @@ describe('transformer-options', () => {
3737

3838
describe('hoist-jest', () => {
3939
const HOIST_JEST_DIR_NAME = 'hoist-jest'
40-
const NON_TS_FACTORY_DIR_NAME = 'non-ts-factory'
41-
const TS_FACTORY_DIR_NAME = 'ts-factory'
40+
const DIR = path.join(__dirname, '..', AST_TRANSFORMERS_DIR_NAME, HOIST_JEST_DIR_NAME)
4241

43-
describe('non-ts-factory', () => {
44-
const DIR = path.join(__dirname, '..', AST_TRANSFORMERS_DIR_NAME, HOIST_JEST_DIR_NAME, NON_TS_FACTORY_DIR_NAME)
45-
46-
beforeAll(() => {
47-
runNpmInstall(DIR)
48-
execa.sync('npm', ['install', '--no-package-lock', '--no-shrinkwrap', '--no-save', tsJestBundle], {
49-
cwd: DIR,
50-
})
42+
beforeAll(() => {
43+
runNpmInstall(DIR)
44+
execa.sync('npm', ['install', '--no-package-lock', '--no-shrinkwrap', '--no-save', tsJestBundle], {
45+
cwd: DIR,
5146
})
52-
53-
executeTest(`${AST_TRANSFORMERS_DIR_NAME}/${HOIST_JEST_DIR_NAME}/${NON_TS_FACTORY_DIR_NAME}`)
5447
})
5548

56-
describe('ts-factory', () => {
57-
beforeAll(() => {
58-
runNpmInstall(path.join(__dirname, '..', AST_TRANSFORMERS_DIR_NAME, HOIST_JEST_DIR_NAME, TS_FACTORY_DIR_NAME))
59-
})
60-
61-
executeTest(`${AST_TRANSFORMERS_DIR_NAME}/${HOIST_JEST_DIR_NAME}/${TS_FACTORY_DIR_NAME}`)
62-
})
49+
executeTest(`${AST_TRANSFORMERS_DIR_NAME}/${HOIST_JEST_DIR_NAME}`)
6350
})
6451

6552
describe('transformer-in-ts', () => {

e2e/ast-transformers/hoist-jest/non-ts-factory/jest-isolated.config.js renamed to e2e/ast-transformers/hoist-jest/jest-isolated.config.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import('../../../../dist').InitialOptionsTsJest} */
1+
/** @type {import('../../../dist').InitialOptionsTsJest} */
22
module.exports = {
33
automock: true,
44
globals: {
@@ -9,11 +9,10 @@ module.exports = {
99
},
1010
},
1111
},
12-
roots: ['<rootDir>', '<rootDir>/../__tests__'],
1312
moduleNameMapper: {
1413
react$: '<rootDir>/node_modules/react',
1514
},
1615
transform: {
17-
'^.+.[tj]sx?$': 'ts-jest',
16+
'^.+.[tj]sx?$': '<rootDir>/../../../dist/index.js',
1817
},
1918
}

e2e/ast-transformers/hoist-jest/non-ts-factory/package-lock.json

Lines changed: 0 additions & 95 deletions
This file was deleted.

e2e/ast-transformers/hoist-jest/non-ts-factory/package.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

e2e/ast-transformers/hoist-jest/ts-factory/package-lock.json renamed to e2e/ast-transformers/hoist-jest/package-lock.json

File renamed without changes.

e2e/ast-transformers/hoist-jest/ts-factory/package.json renamed to e2e/ast-transformers/hoist-jest/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
}
1313
}
1414
},
15-
"roots": ["<rootDir>", "<rootDir>/../__tests__"],
1615
"moduleNameMapper": {
1716
"react$": "<rootDir>/node_modules/react"
1817
},
1918
"transform": {
20-
"^.+\\.[tj]sx?$": "<rootDir>/../../../../dist/index.js"
19+
"^.+\\.[tj]sx?$": "<rootDir>/../../../dist/index.js"
2120
}
2221
}
2322
}

e2e/ast-transformers/hoist-jest/ts-factory/jest-isolated.config.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"@types/jest": "^27.0.0",
6666
"babel-jest": ">=27.0.0 <28",
6767
"jest": "^27.0.0",
68-
"typescript": ">=3.8 <5.0"
68+
"typescript": ">=4.3"
6969
},
7070
"peerDependenciesMeta": {
7171
"@babel/core": {

src/config/__snapshots__/config-set.spec.ts.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Object {
6060
Object {
6161
"factory": [Function],
6262
"name": "hoist-jest",
63-
"version": 3,
63+
"version": 4,
6464
},
6565
],
6666
}
@@ -74,7 +74,7 @@ Object {
7474
Object {
7575
"factory": [Function],
7676
"name": "hoist-jest",
77-
"version": 3,
77+
"version": 4,
7878
},
7979
Object {
8080
"factory": [Function],
@@ -93,7 +93,7 @@ Object {
9393
Object {
9494
"factory": [Function],
9595
"name": "hoist-jest",
96-
"version": 3,
96+
"version": 4,
9797
},
9898
Object {
9999
"factory": [Function],
@@ -118,7 +118,7 @@ Object {
118118
Object {
119119
"factory": [Function],
120120
"name": "hoist-jest",
121-
"version": 3,
121+
"version": 4,
122122
},
123123
],
124124
}
@@ -138,7 +138,7 @@ Object {
138138
Object {
139139
"factory": [Function],
140140
"name": "hoist-jest",
141-
"version": 3,
141+
"version": 4,
142142
},
143143
],
144144
}
@@ -152,7 +152,7 @@ Object {
152152
Object {
153153
"factory": [Function],
154154
"name": "hoist-jest",
155-
"version": 3,
155+
"version": 4,
156156
},
157157
Object {
158158
"factory": [Function],

src/transformers/hoist-jest.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ const printer = ts.createPrinter()
168168
describe('hoist-jest', () => {
169169
test('should have correct transformer name and version', () => {
170170
expect(name).toBe('hoist-jest')
171-
expect(version).toBe(3)
171+
expect(version).toBe(4)
172172
})
173173

174174
test('should hoist correctly when not using @jest/globals', () => {

0 commit comments

Comments
 (0)