Skip to content

Commit f0cb47a

Browse files
committed
Make karma config file a .cjs file
Fixes “require() of ES Module …/config.js not supported” error
1 parent 29e21af commit f0cb47a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

karma.conf.js renamed to karma.conf.cjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ module.exports = (karma) => {
4545
}
4646
});
4747

48+
config.files.push({
49+
pattern: "test/**/*.js",
50+
type: "module"
51+
});
52+
4853
if (config.logLevel !== karma.LOG_DISABLE) {
4954
console.debug("Karma Config:\n", nodeUtil.inspect(config, {
5055
depth: 10,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"lint": "eslint lib test/fixtures test/specs",
5656
"test": "npm run test:node && npm run test:typescript && npm run test:browser && npm run lint",
5757
"test:node": "mocha",
58-
"test:browser": "cross-env NODE_OPTIONS=--openssl-legacy-provider karma start --single-run",
58+
"test:browser": "cross-env NODE_OPTIONS=--openssl-legacy-provider karma start karma.conf.cjs --single-run",
5959
"test:typescript": "tsc --noEmit --strict --lib esnext,dom test/specs/typescript-definition.spec.ts",
6060
"coverage": "npm run coverage:node && npm run coverage:browser",
6161
"coverage:node": "nyc node_modules/mocha/bin/mocha",

0 commit comments

Comments
 (0)