-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate globals config to transformer config (#3780)
DEPRECATION Define `ts-jest` config under `globals` is now deprecated. Please define the config via transformer config instead.
- Loading branch information
Showing
53 changed files
with
405 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`partial successfully runs the tests inside const-enum with 'isolatedModules: true' 1`] = ` | ||
"FAIL __tests__/import-from-d-ts-no-js.spec.ts | ||
● Test suite failed to run | ||
Cannot find module '../hoo-constant' from '__tests__/import-from-d-ts-no-js.spec.ts' | ||
However, Jest was able to find: | ||
'../hoo-constant.d.ts' | ||
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'json', 'node']. | ||
See https://jestjs.io/docs/configuration#modulefileextensions-arraystring | ||
> 1 | import { HooConstEnum } from '../hoo-constant' | ||
| ^ | ||
2 | | ||
3 | const getTwo = (): string => HooConstEnum.two | ||
4 | | ||
at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/resolver.js:487:11) | ||
at Object.<anonymous> (__tests__/import-from-d-ts-no-js.spec.ts:1:1) | ||
PASS __tests__/import-from-d-ts-has-js.spec.ts | ||
"PASS __tests__/import-from-d-ts-has-js.spec.ts | ||
PASS __tests__/import-from-d-ts-no-js.spec.ts | ||
PASS __tests__/import-from-ts.spec.ts" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
/** @type {import('../../../dist').InitialOptionsTsJest} */ | ||
module.exports = { | ||
automock: true, | ||
globals: { | ||
'ts-jest': { | ||
isolatedModules: true, | ||
tsconfig: { | ||
allowJs: true, | ||
}, | ||
}, | ||
}, | ||
moduleNameMapper: { | ||
react$: '<rootDir>/node_modules/react', | ||
}, | ||
transform: { | ||
'^.+.[tj]sx?$': '<rootDir>/../../../legacy.js', | ||
'^.+.[tj]sx?$': [ | ||
'<rootDir>/../../../legacy.js', | ||
{ | ||
isolatedModules: true, | ||
tsconfig: { | ||
allowJs: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 15 additions & 15 deletions
30
e2e/ast-transformers/transformer-options/jest-isolated.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
/** @type {import('../../../dist').InitialOptionsTsJest} */ | ||
module.exports = { | ||
globals: { | ||
'ts-jest': { | ||
isolatedModules: true, | ||
astTransformers: { | ||
before: [ | ||
{ | ||
path: '<rootDir>/node_modules/@formatjs/ts-transformer/ts-jest-integration', | ||
options: { | ||
removeDefaultMessage: true, | ||
transform: { | ||
'^.+.[tj]sx?$': [ | ||
'<rootDir>/../../../legacy.js', | ||
{ | ||
isolatedModules: true, | ||
astTransformers: { | ||
before: [ | ||
{ | ||
path: '<rootDir>/node_modules/@formatjs/ts-transformer/ts-jest-integration', | ||
options: { | ||
removeDefaultMessage: true, | ||
}, | ||
}, | ||
}, | ||
], | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
transform: { | ||
'^.+.[tj]sx?$': '<rootDir>/../../../legacy.js', | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
/** @type {import('../../dist').InitialOptionsTsJest} */ | ||
module.exports = { | ||
globals: { | ||
'ts-jest': { | ||
isolatedModules: true, | ||
}, | ||
}, | ||
transform: { | ||
'^.+.tsx?$': '<rootDir>/../../legacy.js', | ||
'^.+.tsx?$': [ | ||
'<rootDir>/../../legacy.js', | ||
{ | ||
'ts-jest': { | ||
isolatedModules: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
/** @type {import('../../dist').InitialOptionsTsJest} */ | ||
module.exports = { | ||
collectCoverageFrom: ['**/*.js', '**/*.ts', '!**/node_modules/**', '!**/coverage/**'], | ||
globals: { | ||
'ts-jest': { | ||
isolatedModules: true, | ||
}, | ||
}, | ||
transform: { | ||
'^.+.tsx?$': '<rootDir>/../../legacy.js', | ||
'^.+.tsx?$': [ | ||
'<rootDir>/../../legacy.js', | ||
{ | ||
isolatedModules: true, | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/** @type {import('../../dist').InitialOptionsTsJest} */ | ||
module.exports = { | ||
globals: { | ||
'ts-jest': { | ||
diagnostics: false, | ||
}, | ||
}, | ||
transform: { | ||
'^.+.tsx?$': '<rootDir>/../../legacy.js', | ||
'^.+.tsx?$': [ | ||
'<rootDir>/../../legacy.js', | ||
{ | ||
diagnostics: false, | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
/** @type {import('../../dist').InitialOptionsTsJest} */ | ||
module.exports = { | ||
globals: { | ||
'ts-jest': { | ||
diagnostics: { | ||
exclude: ['**/__tests__/diagnostics.spec.ts'], | ||
}, | ||
}, | ||
}, | ||
transform: { | ||
'^.+.tsx?$': '<rootDir>/../../legacy.js', | ||
'^.+.tsx?$': [ | ||
'<rootDir>/../../legacy.js', | ||
{ | ||
diagnostics: { | ||
exclude: ['**/__tests__/diagnostics.spec.ts'], | ||
}, | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
/** @type {import('../../dist').InitialOptionsTsJest} */ | ||
module.exports = { | ||
globals: { | ||
'ts-jest': { | ||
diagnostics: { | ||
ignoreCodes: 'TS2741', | ||
}, | ||
}, | ||
}, | ||
transform: { | ||
'^.+.tsx?$': '<rootDir>/../../legacy.js', | ||
'^.+.tsx?$': [ | ||
'<rootDir>/../../legacy.js', | ||
{ | ||
diagnostics: { | ||
ignoreCodes: 'TS2741', | ||
}, | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/** @type {import('../../dist').InitialOptionsTsJest} */ | ||
module.exports = { | ||
globals: { | ||
'ts-jest': { | ||
isolatedModules: true, | ||
}, | ||
}, | ||
transform: { | ||
'^.+.tsx?$': '<rootDir>/../../legacy.js', | ||
'^.+.tsx?$': [ | ||
'<rootDir>/../../legacy.js', | ||
{ | ||
isolatedModules: true, | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
/** @type {import('../../dist').InitialOptionsTsJest} */ | ||
module.exports = { | ||
globals: { | ||
'ts-jest': { | ||
diagnostics: { | ||
warnOnly: true, | ||
}, | ||
}, | ||
}, | ||
transform: { | ||
'^.+.tsx?$': '<rootDir>/../../legacy.js', | ||
'^.+.tsx?$': [ | ||
'<rootDir>/../../legacy.js', | ||
{ | ||
diagnostics: { | ||
warnOnly: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/** @type {import('../../dist').InitialOptionsTsJest} */ | ||
module.exports = { | ||
globals: { | ||
'ts-jest': { | ||
isolatedModules: true, | ||
}, | ||
}, | ||
transform: { | ||
'^.+.tsx?$': '<rootDir>/../../legacy.js', | ||
'^.+.tsx?$': [ | ||
'<rootDir>/../../legacy.js', | ||
{ | ||
isolatedModules: true, | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
{ | ||
"jest": { | ||
"globals": { | ||
"ts-jest": { | ||
"isolatedModules": true | ||
} | ||
}, | ||
"transform": { | ||
"^.+\\.tsx?$": "./foo-transformer.js" | ||
"^.+\\.tsx?$": ["./foo-transformer.js", { | ||
"isolatedModules": true | ||
}] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.