Skip to content

Commit 2a99b2c

Browse files
authored
Add ESM support for JEST tests (#56)
1 parent 963b8cf commit 2a99b2c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

apollo-server/v4/integration-testing/jest.config.cjs

+3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
module.exports = {
33
preset: 'ts-jest',
44
testEnvironment: 'node',
5+
extensionsToTreatAsEsm: ['.ts'],
6+
testPathIgnorePatterns: ['.js'],
57
globals: {
68
// when we are testing we want to use a slightly different config
79
// to allow for jest types
810
'ts-jest': {
911
tsconfig: '<rootDir>/src/__tests__/tsconfig.json',
12+
useESM: true,
1013
},
1114
},
1215
};

apollo-server/v4/integration-testing/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "module",
77
"license": "MIT",
88
"scripts": {
9-
"test": "npm run compile && jest",
9+
"test": "npm run compile && node --experimental-vm-modules node_modules/jest/bin/jest.js",
1010
"postinstall": "npm run compile",
1111
"compile": "tsc",
1212
"start": "npm run compile && node ./dist/server.js"

0 commit comments

Comments
 (0)