Skip to content

Commit a9782c9

Browse files
committed
Update jest config to work with non barrel file imports
We need to compile when testing to have access to all the `import {} from foo.js` lines.
1 parent 3dd651b commit a9782c9

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

jest.config.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
module.exports = {
3-
preset: "ts-jest",
4-
testEnvironment: "node",
5-
silent: true,
3+
preset: 'ts-jest/presets/default-esm', // or other ESM presets
4+
testEnvironment: 'node',
5+
moduleNameMapper: {
6+
'^(\\.{1,2}/.*)\\.js$': '$1',
7+
},
8+
transform: {
9+
'^.+\\.tsx?$': [
10+
'ts-jest',
11+
{
12+
useESM: true,
13+
},
14+
],
15+
},
616
};

0 commit comments

Comments
 (0)