Skip to content

Commit b5bf125

Browse files
committed
es modules: config changes for testing
jest and ts-jest need to be more aware of es support. Use new loader to handle filetype qualified names. Signed-off-by: Chris. Webster <[email protected]>
1 parent 317616e commit b5bf125

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
"cleanbranch": "node ./build/script/delete-test-branches.js",
1616
"lint": "eslint -c .eslintrc.js --ext .ts,.js \"{lib,script,tests,tests-config}/**/*.{ts,tsx,js}\"",
1717
"start": "node server.js",
18-
"test": "jest --env=node",
19-
"test:config": "jest --env=node --testRegex=/tests-config/.*\\.test\\.ts",
18+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --env=node",
19+
"test:clean": "jest --clearCache && npm test",
20+
"test:config": "npm run test -- --testRegex=/tests-config/.*\\.test\\.ts",
2021
"test:watch": "jest --watch --notify --notifyMode=change --coverage",
2122
"ci": "npm run lint && jest --env=node --ci --reporters=default --reporters=jest-junit"
2223
},
@@ -28,13 +29,20 @@
2829
"lib/*.ts"
2930
],
3031
"jest": {
32+
"extensionsToTreatAsEsm": [".ts"],
3133
"moduleFileExtensions": [
3234
"ts",
3335
"tsx",
3436
"js"
3537
],
38+
"preset": "ts-jest/presets/default-esm",
39+
"resolver": "ts-jest-resolver",
3640
"transform": {
37-
"\\.(ts|tsx)$": "ts-jest"
41+
"\\.(ts|tsx)$": ["ts-jest",
42+
{
43+
"useESM": true
44+
}
45+
]
3846
},
3947
"testRegex": "/tests/.*\\.test\\.(ts|tsx|js)$"
4048
},
@@ -60,6 +68,7 @@
6068
"jest-junit": "^16.0.0",
6169
"test-smtp-server": "0.9.8",
6270
"ts-jest": "^29.2.4",
71+
"ts-jest-resolver": "^2.0.1",
6372
"ts-node": "^10.9.2",
6473
"typescript": "^5.5.4"
6574
},

0 commit comments

Comments
 (0)