stryker-js
stryker-js copied to clipboard
Requiring `esm` causes `stryker run` to fail
We are using esm in our mocha tests, to support testing frontend classes that get transpiled to es6 code with import statements. When we add esm to our config, like suggested here, we are getting into the following error on stryker run:
14:49:20 (671196) INFO ConfigReader Using stryker.conf.json
14:49:20 (671196) INFO BroadcastReporter Detected that current console does not support the "progress" reporter, downgrading to "progress-append-only" reporter
14:49:20 (671196) INFO InputFileResolver Found 191 of 498 file(s) to be mutated.
14:49:23 (671196) INFO Instrumenter Instrumented 191 source file(s) with 10531 mutant(s)
14:49:23 (671196) INFO ConcurrencyTokenProvider Creating 8 checker process(es) and 7 test runner process(es).
14:49:26 (671196) WARN ChildProcessProxy Child process [pid 671311] exited unexpectedly with exit code 1 (without signal). Last part of stdout and stderr was:
0===r||!0===r.configurable||!0===r.writable||"function"==typeof r.get}})(),xs=R.inited?R.module.utilOwnPropertyNames:R.module.utilOwnPropertyNames=(function(){"use strict";return function(e){return A(e)?Object.getOwnPropertyNames(e):[]}})(),bs=R.inited?R.module.utilToRawMod......
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Socket.<anonymous> (node:internal/child_process:450:11)
at Socket.emit (node:events:390:28)
at Pipe.<anonymous> (node:net:687:12) {
innerError: undefined,
pid: 671305,
exitCode: 1,
signal: null
}
Calling it with --logLevel trace
reveals that the corresponding code snipped comes from node_modules/esm/esm/loader.js
Stryker config
{
"$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"_comment": "Stryker Mutator config",
"packageManager": "yarn",
"reporters": [
"html",
"clear-text",
"progress"
],
"mutate": [
"src/main/**/*.ts",
"!src/main/**/*Spec.ts"
],
"ignorePatterns": ["lib", "build", "www"],
"testRunner": "mocha",
"testRunnerNodeArgs": [
"--require",
"esm"
],
"mochaOptions": {
"extension": [
"ts",
"tsx"
],
"spec": [
"src/**/*Spec.ts"
],
"require": [
"src/test/ts-hook",
"ignore-styles",
"mocha-steps"
],
"package": "./package.json",
"ui": "bdd",
"async-only": false,
"grep": ".*"
},
"coverageAnalysis": "perTest",
"checkers": [
"typescript"
],
"tsconfigFile": "src/test/tsconfig.json"
}
Test runner config
.mocharc.js
'use strict';
module.exports = {
reporter: 'mocha-better-spec-reporter',
file: ['src/test/setupEnvironment.ts'],
extension: ['.ts'],
require: [
'esm',
'src/test/ts-hook',
'ignore-styles',
'mocha-steps'
],
recursive: true,
timeout: '10s',
exit: true,
};
Stryker environment
├─ @stryker-mutator/[email protected]
├─ @stryker-mutator/[email protected]
│ ├─ @stryker-mutator/[email protected]
│ ├─ @stryker-mutator/[email protected]
│ ├─ @stryker-mutator/[email protected]
├─ @stryker-mutator/[email protected]
│ ├─ @stryker-mutator/[email protected]
│ ├─ @stryker-mutator/[email protected]
├─ @stryker-mutator/[email protected]
│ ├─ @stryker-mutator/[email protected]
│ ├─ @stryker-mutator/[email protected]
├─ @stryker-mutator/[email protected]
│ ├─ @stryker-mutator/[email protected]
│ ├─ @stryker-mutator/[email protected]
├─ @stryker-mutator/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
Test runner environment
yarn run mocha --exit 'src/**/*Spec.ts'
Your Environment
software | version(s) |
---|---|
node | 16.13.0 |
yarn | 1.22.10 |
Operating System | |
NixOS | unstable |
Add stryker.log stryker.log
Hmm interesting. This should work. Could you create a small reproduction example? Either attach it here or point me to a git repo.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.