Skip to content

Commit

Permalink
troubleshoot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fveracoechea committed Aug 9, 2024
1 parent 0f3f1f6 commit 19326b2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import type { Config } from 'jest';

const config: Config = {
preset: 'ts-jest',
testEnvironment: 'node',
preset: 'ts-jest/presets/default-esm', // or other ESM presets
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
// '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
// '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
tsconfig: './tsconfig.spec.json',
},
],
},
// automock: false,
// setupFiles: ['./jest.setup.ts'],
};
Expand Down
9 changes: 9 additions & 0 deletions lib/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"module": "NodeNext", // or "NodeNext"
"target": "ES2018",
"moduleResolution": "NodeNext", // or "NodeNext"
"esModuleInterop": true,
"allowImportingTsExtensions": true,
}
}

0 comments on commit 19326b2

Please sign in to comment.