-
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.
test(examples): use preset util functions in all example projects
- Loading branch information
Showing
28 changed files
with
135 additions
and
256 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,17 +1,10 @@ | ||
import preset from 'ts-jest/presets/index.js' | ||
import { createJsWithBabelEsmPreset } from 'ts-jest' | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
...preset.jsWithBabelESM, | ||
transform: { | ||
'^.+\.[tj]sx?$': [ | ||
'ts-jest', | ||
{ | ||
babelConfig: true, | ||
isolatedModules: true, | ||
tsconfig: 'tsconfig-esm.json', | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
...createJsWithBabelEsmPreset({ | ||
babelConfig: true, | ||
tsconfig: 'tsconfig-esm.json', | ||
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,16 +1,9 @@ | ||
import preset from 'ts-jest/presets/index.js' | ||
import { createJsWithBabelEsmPreset } from 'ts-jest' | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
...preset.jsWithBabelESM, | ||
transform: { | ||
'^.+\.[tj]sx?$': [ | ||
'ts-jest', | ||
{ | ||
babelConfig: true, | ||
tsconfig: 'tsconfig-esm.json', | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
...createJsWithBabelEsmPreset({ | ||
babelConfig: true, | ||
tsconfig: 'tsconfig-esm.json' | ||
}) | ||
} |
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,15 +1,9 @@ | ||
const preset = require('ts-jest/presets') | ||
const { createJsWithBabelPreset } = require('ts-jest') | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...preset.jsWithBabel, | ||
transform: { | ||
'^.+\.[tj]sx?$': [ | ||
'ts-jest', | ||
{ | ||
babelConfig: true, | ||
isolatedModules: true, | ||
}, | ||
], | ||
}, | ||
...createJsWithBabelPreset({ | ||
babelConfig: true, | ||
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,11 +1,8 @@ | ||
const { createJsWithBabelPreset } = require('ts-jest') | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
transform: { | ||
'^.+\.[tj]sx?$': [ | ||
'ts-jest', | ||
{ | ||
babelConfig: true, | ||
}, | ||
], | ||
}, | ||
...createJsWithBabelPreset({ | ||
babelConfig: 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,16 +1,9 @@ | ||
import preset from 'ts-jest/presets/index.js' | ||
import { createJsWithTsPreset } from 'ts-jest' | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
...preset.jsWithTsESM, | ||
transform: { | ||
'^.+\.[tj]sx?$': [ | ||
'ts-jest', | ||
{ | ||
isolatedModules: true, | ||
tsconfig: 'tsconfig-esm.json', | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
...createJsWithTsPreset({ | ||
tsconfig: 'tsconfig-esm.json', | ||
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,15 +1,8 @@ | ||
import preset from 'ts-jest/presets/index.js' | ||
import { createJsWithTsPreset } from 'ts-jest' | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
...preset.jsWithTsESM, | ||
transform: { | ||
'^.+\.[tj]sx?$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: 'tsconfig-esm.json', | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
...createJsWithTsPreset({ | ||
tsconfig: 'tsconfig-esm.json' | ||
}) | ||
} |
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,14 +1,8 @@ | ||
const preset = require('ts-jest/presets') | ||
const { createJsWithTsPreset } = require('ts-jest') | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...preset.jsWithTs, | ||
transform: { | ||
'^.+\.[tj]sx?$': [ | ||
'ts-jest', | ||
{ | ||
isolatedModules: true, | ||
}, | ||
], | ||
}, | ||
...createJsWithTsPreset({ | ||
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,6 +1,6 @@ | ||
const preset = require('ts-jest/presets') | ||
const { createJsWithTsPreset } = require('ts-jest') | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...preset.jsWithTs, | ||
...createJsWithTsPreset() | ||
} |
17 changes: 5 additions & 12 deletions
17
examples/monorepo-app/tests/project-1/jest-esm-isolated.config.mjs
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,16 +1,9 @@ | ||
import preset from 'ts-jest/presets/index.js' | ||
import { createDefaultEsmPreset } from 'ts-jest' | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
...preset.defaultsESM, | ||
transform: { | ||
'^.+\\.tsx?$': [ | ||
'ts-jest', | ||
{ | ||
isolatedModules: true, | ||
tsconfig: 'tests/project-1/tsconfig-esm.json', | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
...createDefaultEsmPreset({ | ||
tsconfig: 'tests/project-1/tsconfig-esm.json', | ||
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,15 +1,8 @@ | ||
import preset from 'ts-jest/presets/index.js' | ||
import { createDefaultEsmPreset } from 'ts-jest' | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
...preset.defaultsESM, | ||
transform: { | ||
'^.+\\.tsx?$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: 'tests/project-1/tsconfig-esm.json', | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
...createDefaultEsmPreset({ | ||
tsconfig: 'tests/project-1/tsconfig-esm.json', | ||
}) | ||
} |
14 changes: 4 additions & 10 deletions
14
examples/monorepo-app/tests/project-1/jest-isolated.config.cjs
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,14 +1,8 @@ | ||
const preset = require('ts-jest/presets'); | ||
const { createDefaultPreset } = require('ts-jest'); | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...preset.defaults, | ||
transform: { | ||
'^.+\\.tsx?$': [ | ||
'ts-jest', | ||
{ | ||
isolatedModules: true, | ||
}, | ||
], | ||
}, | ||
...createDefaultPreset({ | ||
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,6 +1,6 @@ | ||
const preset = require('ts-jest/presets'); | ||
const { createDefaultPreset } = require('ts-jest'); | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...preset.defaults, | ||
...createDefaultPreset() | ||
} |
17 changes: 5 additions & 12 deletions
17
examples/monorepo-app/tests/project-2/jest-esm-isolated.config.mjs
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,16 +1,9 @@ | ||
import preset from 'ts-jest/presets/index.js' | ||
import { createDefaultEsmPreset } from 'ts-jest' | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
...preset.defaultsESM, | ||
transform: { | ||
'^.+\\.tsx?$': [ | ||
'ts-jest', | ||
{ | ||
isolatedModules: true, | ||
tsconfig: 'tests/project-2/tsconfig-esm.json', | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
...createDefaultEsmPreset({ | ||
tsconfig: 'tests/project-2/tsconfig-esm.json', | ||
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,15 +1,8 @@ | ||
import preset from 'ts-jest/presets/index.js' | ||
import { createDefaultEsmPreset } from 'ts-jest' | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
...preset.defaultsESM, | ||
transform: { | ||
'^.+\\.tsx?$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: 'tests/project-2/tsconfig-esm.json', | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
...createDefaultEsmPreset({ | ||
tsconfig: 'tests/project-2/tsconfig-esm.json', | ||
}) | ||
} |
14 changes: 4 additions & 10 deletions
14
examples/monorepo-app/tests/project-2/jest-isolated.config.cjs
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,14 +1,8 @@ | ||
const preset = require('ts-jest/presets'); | ||
const { createDefaultPreset } = require('ts-jest'); | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...preset.defaults, | ||
transform: { | ||
'^.+\\.tsx?$': [ | ||
'ts-jest', | ||
{ | ||
isolatedModules: true, | ||
}, | ||
], | ||
}, | ||
...createDefaultPreset({ | ||
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,6 +1,6 @@ | ||
const preset = require('ts-jest/presets'); | ||
const { createDefaultPreset } = require('ts-jest'); | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...preset.defaults, | ||
...createDefaultPreset() | ||
} |
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,17 +1,18 @@ | ||
import baseEsmCfg from './jest-esm.config.mjs' | ||
import { createDefaultEsmPreset } from 'ts-jest' | ||
|
||
const defaultPreset = createDefaultEsmPreset({ | ||
tsconfig: 'tsconfig-esm.spec.json', | ||
isolatedModules: true, | ||
}) | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
...baseEsmCfg, | ||
...defaultPreset, | ||
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'], | ||
testEnvironment: 'jsdom', | ||
transform: { | ||
...baseEsmCfg.transform, | ||
'^.+\\.(ts|tsx|js|jsx|mjs|cjs)$': [ | ||
'ts-jest', | ||
{ | ||
isolatedModules: true, | ||
tsconfig: 'tsconfig-esm.spec.json', | ||
useESM: true, | ||
}, | ||
], | ||
...defaultPreset.transform, | ||
'^.+\\.css$': '<rootDir>/config/jest/cssTransform.js', | ||
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': '<rootDir>/config/jest/fileTransform.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,17 +1,17 @@ | ||
import baseCfg from './jest.config.cjs' | ||
import { createDefaultEsmPreset } from 'ts-jest' | ||
|
||
const defaultPreset = createDefaultEsmPreset({ | ||
tsconfig: 'tsconfig-esm.spec.json', | ||
}) | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
...baseCfg, | ||
preset: 'ts-jest/presets/js-with-babel-esm', | ||
...defaultPreset, | ||
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'], | ||
testEnvironment: 'jsdom', | ||
transform: { | ||
...baseCfg.transform, | ||
'^.+\\.(ts|tsx|js|jsx|mjs|cjs)$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: 'tsconfig-esm.spec.json', | ||
useESM: true, | ||
}, | ||
], | ||
...defaultPreset.transform, | ||
'^.+\\.css$': '<rootDir>/config/jest/cssTransform.js', | ||
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': '<rootDir>/config/jest/fileTransform.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,16 +1,16 @@ | ||
const baseCfg = require('./jest.config.cjs') | ||
const { createDefaultPreset } = require('ts-jest') | ||
|
||
const defaultPreset = createDefaultPreset({ | ||
tsconfig: 'tsconfig.spec.json', | ||
isolatedModules: true, | ||
}) | ||
|
||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...baseCfg, | ||
transform: { | ||
...baseCfg.transform, | ||
'^.+\\.(ts|tsx|js|jsx|mjs|cjs)$': [ | ||
'ts-jest', | ||
{ | ||
isolatedModules: true, | ||
tsconfig: 'tsconfig.spec.json', | ||
}, | ||
], | ||
...defaultPreset.transform, | ||
}, | ||
} |
Oops, something went wrong.