Skip to content

Commit

Permalink
chore: make jest tests work in src (not build) files
Browse files Browse the repository at this point in the history
  • Loading branch information
enapupe committed Nov 14, 2023
1 parent 2e9f04c commit 1c4544f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
15 changes: 13 additions & 2 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
module.exports = {
preset: 'ts-jest',
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1'
},
extensionsToTreatAsEsm: ['.ts'],
transform: {
'^.+\\.(mt|t|cj|j)s$': [
'ts-jest',
{
useESM: true
}
]
},
testEnvironment: 'node',
testMatch: [
'<rootDir>/build/**/__tests__/*.js'
'<rootDir>/**/__tests__/*.ts'
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"scripts": {
"lint": "yarn ts-standard",
"fix": "yarn ts-standard --fix",
"test": "yarn build && cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --runInBand",
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --runInBand",
"build": "tsc -p tsconfig.json",
"build-release": "tsc -p tsconfig.release.json",
"clean": "tsc -b --clean && rm -rf build/*",
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"module": "ESNext",
"esModuleInterop": true,
"moduleResolution": "Node",
"rootDir": "./src",
"outDir": "build",
"sourceMap": true,
"strictNullChecks": true,
Expand All @@ -21,4 +20,4 @@
"include": [
"src/**/*.ts",
]
}
}

0 comments on commit 1c4544f

Please sign in to comment.