Skip to content

Commit 78f1932

Browse files
Run tests as native ESM in modern Node.js
1 parent ad28fc5 commit 78f1932

6 files changed

Lines changed: 1196 additions & 14 deletions

File tree

jest.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2+
3+
const runNatively = !!process.features.typescript;
4+
25
module.exports = {
6+
runner: runNatively ? 'jest-light-runner' : undefined,
37
preset: 'ts-jest/presets/default-esm',
48
testEnvironment: 'node',
59
moduleDirectories: ['node_modules', 'src'],
@@ -9,6 +13,7 @@ module.exports = {
913
diagnostics: {
1014
ignoreCodes: [151001],
1115
},
16+
useESM: runNatively,
1217
},
1318
},
1419
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"eslint-config-prettier": "^8.3.0",
5555
"eslint-plugin-prettier": "^4.0.0",
5656
"jest": "^27.4.7",
57+
"jest-light-runner": "^0.7.10",
5758
"release-plan": "^0.9.0",
5859
"rimraf": "^3.0.2",
5960
"ts-jest": "^27.1.3",

0 commit comments

Comments
 (0)