-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
jest.config.ts
29 lines (27 loc) · 976 Bytes
/
jest.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/** @type {import('ts-jest').JestConfigWithTsJest} */
import type { JestConfigWithTsJest } from 'ts-jest';
// import { jsWithTsESM } from 'ts-jest/presets';
// https://jestjs.io/docs/ecmascript-modules
// https://kulshekhar.github.io/ts-jest/docs/getting-started/presets
// https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
// https://stackoverflow.com/questions/66154478/jest-ts-jest-typescript-with-es-modules-import-cannot-find-module
const defaultConfig: JestConfigWithTsJest = {
extensionsToTreatAsEsm: ['.ts', '.mts'],
// preset: 'ts-jest/presets/js-with-ts-esm',
testEnvironment: 'node',
transform: {
'^.+\\.[m]?ts$': [
'ts-jest',
{
useESM: true,
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1', // resolve .js to .ts
'^(\\.{1,2}/.*)\\.mjs$': '$1.mts', //resolve .mjs to .mts
},
automock: false,
testPathIgnorePatterns: ['/node_modules/', '.github/'],
};
export default defaultConfig;