Skip to content

Commit

Permalink
fix(scripts-jest): update ts-jest configuration introduce in v29
Browse files Browse the repository at this point in the history
  • Loading branch information
Hotell committed May 31, 2023
1 parent 7e305b1 commit 45fb47c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
15 changes: 7 additions & 8 deletions scripts/jest/src/jest.preset.v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ const createConfig = (customConfig = {}) => {
},

transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.tsx?$': [
'ts-jest',
{
/** https://kulshekhar.github.io/ts-jest/docs/28.0/getting-started/options/isolatedModules */
isolatedModules: true,
},
],
},

transformIgnorePatterns: ['/node_modules/', '/lib-commonjs/', '\\.js$'],
Expand All @@ -68,13 +74,6 @@ const createConfig = (customConfig = {}) => {
path.resolve(packageRoot, 'node_modules'),
path.resolve(__dirname, '../node_modules'),
],

globals: {
'ts-jest': {
/** https://kulshekhar.github.io/ts-jest/docs/28.0/getting-started/options/isolatedModules */
isolatedModules: true,
},
},
testEnvironmentOptions: {
url: 'http://localhost',
},
Expand Down
12 changes: 6 additions & 6 deletions scripts/jest/src/jest.preset.v8.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ describe(`v8 preset`, () => {

expect(actual).toEqual(
expect.objectContaining({
globals: {
'ts-jest': {
isolatedModules: true,
},
},
moduleDirectories: [
'node_modules',
`${workspaceRoot}/scripts/jest/node_modules`,
Expand All @@ -33,7 +28,12 @@ describe(`v8 preset`, () => {
},
testEnvironment: 'jsdom',
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.tsx?$': [
'ts-jest',
{
isolatedModules: true,
},
],
},
restoreMocks: true,
clearMocks: true,
Expand Down

0 comments on commit 45fb47c

Please sign in to comment.