Skip to content

Commit

Permalink
refactor(config): remove support for tsConfig option (#2127)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
One currently uses `tsConfig` should change to `tsconfig` in your `jest.config.js` or `package.json`
  • Loading branch information
ahnpnl authored Nov 10, 2020
1 parent 152374c commit 3cc9b80
Show file tree
Hide file tree
Showing 13 changed files with 212 additions and 316 deletions.
4 changes: 2 additions & 2 deletions docs/user/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ All options have default values which should fit most of the projects. Click on
| Option | Description | Type | Default |
|---|---|---|---|
| [**`compiler`**][compiler] | [TypeScript module to use as compiler.][compiler] | `string` | `"typescript"` |
| [**`tsConfig` or `tsconfig`**][tsConfig] | [TypeScript compiler related configuration.][tsConfig] | `string`\|`object`\|`boolean` | _auto_ |
| [**`tsconfig`**][tsconfig] | [TypeScript compiler related configuration.][tsconfig] | `string`\|`object`\|`boolean` | _auto_ |
| [**`isolatedModules`**][isolatedModules] | [Disable type-checking][isolatedModules] | `boolean` | _disabled_ |
| [**`astTransformers`**][astTransformers] | [Custom TypeScript AST transformers][astTransformers] | `object` | _auto_ |
| [**`diagnostics`**][diagnostics] | [Diagnostics related configuration.][diagnostics] | `boolean`\|`object` | _enabled_ |
Expand Down Expand Up @@ -260,7 +260,7 @@ npx ts-jest config:migrate package.json
</div></div>

[compiler]: compiler
[tsConfig]: tsConfig
[tsconfig]: tsconfig
[isolatedModules]: isolatedModules
[astTransformers]: astTransformers
[compilerHost]: compilerHost
Expand Down
6 changes: 3 additions & 3 deletions docs/user/config/tsConfig.md → docs/user/config/tsconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
"jest": {
"globals": {
"ts-jest": {
"tsConfig": "tsconfig.test.json"
"tsconfig": "tsconfig.test.json"
}
}
}
Expand Down Expand Up @@ -76,7 +76,7 @@ module.exports = {
"jest": {
"globals": {
"ts-jest": {
"tsConfig": {
"tsconfig": {
"importHelpers": true
}
}
Expand Down Expand Up @@ -114,7 +114,7 @@ module.exports = {
"jest": {
"globals": {
"ts-jest": {
"tsConfig": false
"tsconfig": false
}
}
}
Expand Down
57 changes: 0 additions & 57 deletions e2e/__tests__/__snapshots__/logger.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -244,63 +244,6 @@ exports[`ts-jest logging deprecation warning with packageJson config should pass
================================================================================
`;
exports[`ts-jest logging deprecation warning with tsConfig config should pass using template "default" 1`] = `
√ jest
↳ exit code: 0
===[ STDOUT ]===================================================================
===[ STDERR ]===================================================================
ts-jest[config] (WARN) The option \`tsConfig\` is deprecated and will be removed in ts-jest 27, use \`tsconfig\` instead
PASS ./Hello.spec.ts
Hello Class
√ should create a new Hello
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: XXs
Ran all test suites.
================================================================================
`;
exports[`ts-jest logging deprecation warning with tsConfig config should pass using template "with-babel-7" 1`] = `
√ jest
↳ exit code: 0
===[ STDOUT ]===================================================================
===[ STDERR ]===================================================================
ts-jest[config] (WARN) The option \`tsConfig\` is deprecated and will be removed in ts-jest 27, use \`tsconfig\` instead
PASS ./Hello.spec.ts
Hello Class
√ should create a new Hello
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: XXs
Ran all test suites.
================================================================================
`;
exports[`ts-jest logging deprecation warning with tsConfig config should pass using template "with-babel-7-string-config" 1`] = `
√ jest
↳ exit code: 0
===[ STDOUT ]===================================================================
===[ STDERR ]===================================================================
ts-jest[config] (WARN) The option \`tsConfig\` is deprecated and will be removed in ts-jest 27, use \`tsconfig\` instead
PASS ./Hello.spec.ts
Hello Class
√ should create a new Hello
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: XXs
Ran all test suites.
================================================================================
`;
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`] = `
√ jest
↳ exit code: 0
Expand Down
16 changes: 0 additions & 16 deletions e2e/__tests__/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,5 @@ describe('ts-jest logging', () => {
})
})
})

describe('with tsConfig config', () => {
const testCase = configureTestCase('simple', {
tsJestConfig: {
tsConfig: true,
}
})

testCase.runWithTemplates(allPackageSetsWithPreset, 0, (runTest, { testLabel }) => {
it(testLabel, () => {
const result = runTest()
expect(result.status).toBe(0)
expect(result).toMatchSnapshot()
})
})
})
})
})
15 changes: 1 addition & 14 deletions src/__helpers__/fakers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { resolve } from 'path'

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

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

export const rootDir = filePath('')

export function tsJestConfig(options?: Partial<TsJestConfig>): TsJestConfig {
return {
isolatedModules: false,
compiler: 'typescript',
transformers: options?.transformers ?? Object.create(null),
babelConfig: undefined,
tsConfig: undefined,
stringifyContentPathRegex: undefined,
diagnostics: { ignoreCodes: [], pretty: false, throws: true },
...options,
}
}

function getJestConfig<T extends Config.ProjectConfig>(
options?: Partial<Config.InitialOptions | Config.ProjectConfig>,
tsJestOptions?: TsJestGlobalOptions,
Expand Down
Loading

0 comments on commit 3cc9b80

Please sign in to comment.