Skip to content

Commit 3cc9b80

Browse files
authored
refactor(config): remove support for tsConfig option (#2127)
BREAKING CHANGE: One currently uses `tsConfig` should change to `tsconfig` in your `jest.config.js` or `package.json`
1 parent 152374c commit 3cc9b80

13 files changed

Lines changed: 212 additions & 316 deletions

File tree

docs/user/config/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ All options have default values which should fit most of the projects. Click on
207207
| Option | Description | Type | Default |
208208
|---|---|---|---|
209209
| [**`compiler`**][compiler] | [TypeScript module to use as compiler.][compiler] | `string` | `"typescript"` |
210-
| [**`tsConfig` or `tsconfig`**][tsConfig] | [TypeScript compiler related configuration.][tsConfig] | `string`\|`object`\|`boolean` | _auto_ |
210+
| [**`tsconfig`**][tsconfig] | [TypeScript compiler related configuration.][tsconfig] | `string`\|`object`\|`boolean` | _auto_ |
211211
| [**`isolatedModules`**][isolatedModules] | [Disable type-checking][isolatedModules] | `boolean` | _disabled_ |
212212
| [**`astTransformers`**][astTransformers] | [Custom TypeScript AST transformers][astTransformers] | `object` | _auto_ |
213213
| [**`diagnostics`**][diagnostics] | [Diagnostics related configuration.][diagnostics] | `boolean`\|`object` | _enabled_ |
@@ -260,7 +260,7 @@ npx ts-jest config:migrate package.json
260260
</div></div>
261261

262262
[compiler]: compiler
263-
[tsConfig]: tsConfig
263+
[tsconfig]: tsconfig
264264
[isolatedModules]: isolatedModules
265265
[astTransformers]: astTransformers
266266
[compilerHost]: compilerHost
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = {
3737
"jest": {
3838
"globals": {
3939
"ts-jest": {
40-
"tsConfig": "tsconfig.test.json"
40+
"tsconfig": "tsconfig.test.json"
4141
}
4242
}
4343
}
@@ -76,7 +76,7 @@ module.exports = {
7676
"jest": {
7777
"globals": {
7878
"ts-jest": {
79-
"tsConfig": {
79+
"tsconfig": {
8080
"importHelpers": true
8181
}
8282
}
@@ -114,7 +114,7 @@ module.exports = {
114114
"jest": {
115115
"globals": {
116116
"ts-jest": {
117-
"tsConfig": false
117+
"tsconfig": false
118118
}
119119
}
120120
}

e2e/__tests__/__snapshots__/logger.test.ts.snap

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -244,63 +244,6 @@ exports[`ts-jest logging deprecation warning with packageJson config should pass
244244
================================================================================
245245
`;
246246
247-
exports[`ts-jest logging deprecation warning with tsConfig config should pass using template "default" 1`] = `
248-
√ jest
249-
↳ exit code: 0
250-
===[ STDOUT ]===================================================================
251-
252-
===[ STDERR ]===================================================================
253-
ts-jest[config] (WARN) The option \`tsConfig\` is deprecated and will be removed in ts-jest 27, use \`tsconfig\` instead
254-
PASS ./Hello.spec.ts
255-
Hello Class
256-
√ should create a new Hello
257-
258-
Test Suites: 1 passed, 1 total
259-
Tests: 1 passed, 1 total
260-
Snapshots: 0 total
261-
Time: XXs
262-
Ran all test suites.
263-
================================================================================
264-
`;
265-
266-
exports[`ts-jest logging deprecation warning with tsConfig config should pass using template "with-babel-7" 1`] = `
267-
√ jest
268-
↳ exit code: 0
269-
===[ STDOUT ]===================================================================
270-
271-
===[ STDERR ]===================================================================
272-
ts-jest[config] (WARN) The option \`tsConfig\` is deprecated and will be removed in ts-jest 27, use \`tsconfig\` instead
273-
PASS ./Hello.spec.ts
274-
Hello Class
275-
√ should create a new Hello
276-
277-
Test Suites: 1 passed, 1 total
278-
Tests: 1 passed, 1 total
279-
Snapshots: 0 total
280-
Time: XXs
281-
Ran all test suites.
282-
================================================================================
283-
`;
284-
285-
exports[`ts-jest logging deprecation warning with tsConfig config should pass using template "with-babel-7-string-config" 1`] = `
286-
√ jest
287-
↳ exit code: 0
288-
===[ STDOUT ]===================================================================
289-
290-
===[ STDERR ]===================================================================
291-
ts-jest[config] (WARN) The option \`tsConfig\` is deprecated and will be removed in ts-jest 27, use \`tsconfig\` instead
292-
PASS ./Hello.spec.ts
293-
Hello Class
294-
√ should create a new Hello
295-
296-
Test Suites: 1 passed, 1 total
297-
Tests: 1 passed, 1 total
298-
Snapshots: 0 total
299-
Time: XXs
300-
Ran all test suites.
301-
================================================================================
302-
`;
303-
304247
exports[`ts-jest logging with unsupported version test with TS_JEST_DISABLE_VER_CHECKER is not set in process.env should pass using template "with-unsupported-version" 1`] = `
305248
√ jest
306249
↳ exit code: 0

e2e/__tests__/logger.test.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,5 @@ describe('ts-jest logging', () => {
123123
})
124124
})
125125
})
126-
127-
describe('with tsConfig config', () => {
128-
const testCase = configureTestCase('simple', {
129-
tsJestConfig: {
130-
tsConfig: true,
131-
}
132-
})
133-
134-
testCase.runWithTemplates(allPackageSetsWithPreset, 0, (runTest, { testLabel }) => {
135-
it(testLabel, () => {
136-
const result = runTest()
137-
expect(result.status).toBe(0)
138-
expect(result).toMatchSnapshot()
139-
})
140-
})
141-
})
142126
})
143127
})

src/__helpers__/fakers.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { resolve } from 'path'
44

55
import { createCompilerInstance } from '../compiler/instance'
66
import { ConfigSet } from '../config/config-set'
7-
import type { BabelConfig, TsCompiler, TsJestConfig, TsJestGlobalOptions } from '../types'
7+
import type { BabelConfig, TsCompiler, TsJestGlobalOptions } from '../types'
88
import type { ImportReasons } from '../utils/messages'
99

1010
export function filePath(relPath: string): string {
@@ -13,19 +13,6 @@ export function filePath(relPath: string): string {
1313

1414
export const rootDir = filePath('')
1515

16-
export function tsJestConfig(options?: Partial<TsJestConfig>): TsJestConfig {
17-
return {
18-
isolatedModules: false,
19-
compiler: 'typescript',
20-
transformers: options?.transformers ?? Object.create(null),
21-
babelConfig: undefined,
22-
tsConfig: undefined,
23-
stringifyContentPathRegex: undefined,
24-
diagnostics: { ignoreCodes: [], pretty: false, throws: true },
25-
...options,
26-
}
27-
}
28-
2916
function getJestConfig<T extends Config.ProjectConfig>(
3017
options?: Partial<Config.InitialOptions | Config.ProjectConfig>,
3118
tsJestOptions?: TsJestGlobalOptions,

0 commit comments

Comments
 (0)