Skip to content

Commit ed9862a

Browse files
committed
fix the jest config and enaable ESM for jest
1 parent fab2884 commit ed9862a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

jest.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { createDefaultEsmPreset } from 'ts-jest/dist/presets/create-jest-preset.js';
2+
3+
const tsJestTransformCfg = createDefaultEsmPreset().transform;
4+
5+
/** @type {import("jest").Config} **/
6+
export default {
7+
testEnvironment: 'node',
8+
transform: {
9+
...tsJestTransformCfg,
10+
},
11+
extensionsToTreatAsEsm: ['.ts'],
12+
waitForUnhandledRejections: true,
13+
testMatch: ['**/*.test.ts'],
14+
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"check": "tsc --noEmit --pretty",
2828
"build": "tsup",
2929
"watch": "tsup --watch",
30+
"testonly": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest ",
3031
"prerelease": ". ./resources/prepublish.sh",
3132
"release": "changeset publish"
3233
},

0 commit comments

Comments
 (0)