Skip to content

Commit 58f9655

Browse files
chore: opt out switch for esm patching in test runner
1 parent a554b70 commit 58f9655

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

.github/workflows/unit-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
node_version:
1515
- "18.19.0"
1616
- "18"
17-
- "20.6.1" # `import`ing cjs code is broken on 20.6.0
17+
- "20.6.0"
1818
- "20"
1919
- "22"
2020
- "23"
@@ -40,7 +40,7 @@ jobs:
4040
if: ${{
4141
matrix.node_version == '18.19.0' ||
4242
matrix.node_version == '18' ||
43-
matrix.node_version == '20.6.1'
43+
matrix.node_version == '20.6.0'
4444
}}
4545
- run: npm install -g npm@latest
4646
if: ${{

api/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"lint:fix": "eslint . --ext .ts --fix",
3535
"lint": "eslint . --ext .ts",
3636
"test:browser": "karma start --single-run",
37-
"test": "nyc mocha 'test/**/*.test.ts'",
37+
"test": "cross-env MOCHA_DONT_PATCH_ESM=true nyc mocha 'test/**/*.test.ts'",
3838
"test:webworker": "karma start karma.worker.js --single-run",
3939
"cycle-check": "dpdm --exit-code circular:1 src/index.ts",
4040
"version": "node ../scripts/version-update.js",
@@ -80,6 +80,7 @@
8080
"@types/webpack-env": "1.16.3",
8181
"babel-plugin-istanbul": "7.0.0",
8282
"cross-var": "1.1.0",
83+
"cross-env": "6.0.3",
8384
"dpdm": "3.13.1",
8485
"karma": "6.4.4",
8586
"karma-chrome-launcher": "3.1.0",

experimental/packages/opentelemetry-instrumentation/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"tdd:node": "npm run test -- --watch-extensions ts --watch",
4949
"tdd:browser": "karma start",
5050
"test:cjs": "nyc mocha 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'",
51-
"test:esm": "nyc node --experimental-loader=./hook.mjs ../../../node_modules/mocha/bin/mocha 'test/node/*.test.mjs'",
51+
"test:esm": "cross-env MOCHA_DONT_PATCH_ESM=true nyc node --experimental-loader=./hook.mjs ../../../node_modules/mocha/bin/mocha 'test/node/*.test.mjs'",
5252
"test": "npm run test:cjs && npm run test:esm",
5353
"test:browser": "karma start --single-run",
5454
"version": "node ../../../scripts/version-update.js",
@@ -91,6 +91,7 @@
9191
"babel-plugin-istanbul": "7.0.0",
9292
"codecov": "3.8.3",
9393
"cross-var": "1.1.0",
94+
"cross-env": "6.0.3",
9495
"karma": "6.4.4",
9596
"karma-chrome-launcher": "3.1.0",
9697
"karma-coverage": "2.2.1",

package-lock.json

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

ts-node.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { pathToFileURL } = require('url');
33

44
require('ts-node/register');
55

6-
const shouldPatchEsm = process.execArgv.every(arg => !arg.includes('loader'));
7-
if (shouldPatchEsm) {
6+
if (process.env.MOCHA_DONT_PATCH_ESM == null) {
87
register('ts-node/esm', pathToFileURL(__filename));
98
}

0 commit comments

Comments
 (0)