Skip to content

Commit 5bf3428

Browse files
author
Daniel Del Core
committed
adds dedicated esm jest and ts config
1 parent fa45fcb commit 5bf3428

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

jest.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
12
module.exports = {
23
transform: {
34
'^.+\\.ts$': [
45
'ts-jest',
56
{
6-
tsconfig: 'tsconfig.json',
7+
tsconfig: 'tsconfig.test.json',
8+
useESM: true,
79
},
810
],
911
},
12+
extensionsToTreatAsEsm: ['.ts'],
1013
moduleFileExtensions: ['ts', 'js'],
1114
testRegex: '^.+\\.(spec|test)\\.(ts|js)$',
1215
snapshotSerializers: ['jest-serializer-html-string'],
@@ -15,6 +18,7 @@ module.exports = {
1518
'jest-watch-typeahead/testname',
1619
],
1720
moduleNameMapper: {
21+
'^(\\.{1,2}/.*)\\.js$': '$1',
1822
'@hypermod/(.*)$': '<rootDir>/packages/$1/src',
1923
'@codeshift/(.*)$': '<rootDir>/packages/$1/src',
2024
},

tsconfig.test.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"strict": true,
4+
"skipLibCheck": true,
5+
"module": "nodenext",
6+
"moduleResolution": "nodenext",
7+
"target": "es6",
8+
"resolveJsonModule": true,
9+
"esModuleInterop": true,
10+
"lib": [
11+
"es5",
12+
"scripthost",
13+
"es2015.core",
14+
"es2015.collection",
15+
"es2015.symbol",
16+
"es2015.iterable",
17+
"es2015.promise",
18+
"es2016",
19+
"es2017"
20+
]
21+
},
22+
"include": ["packages/**/*", "community/**/*", "scripts"],
23+
"exclude": ["./node_modules", "./plugin_packages"]
24+
}

0 commit comments

Comments
 (0)