stryker-js: no coverage and error
Summary
I get an error (times a lot [])
(11272) ERROR log4js A worker log process hung up unexpectedly { Error: read ECONNRESET at TCP.onread (net.js:659:25) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }
and report is bad (like it doesn’t test good(?))
function add(a, b) {
return a + b;
}
module.exports = add;
const add = require("../src/add.js");
describe("add.js", () => {
it("2 + 4 should equal 6", () => {
expect(add(2, 4)).toBe(6);
});
});
Command I run:
- node ./node_modules/stryker/bin/stryker run --basePath=C:\Users\19gro\Desktop\hi
Stryker config
const basePath = process.argv[3].replace("--basePath=", "");
const path = require("path");
module.exports = config => {
config.set({
"coverageAnalysis": "perTest",
"files": [
path.join(basePath, "src/**/*.js"),
path.join(basePath, "tests/**/*.js")
],
"karma": {
"config": {
basePath,
"browsers": [ "ChromeHeadless" ]
},
"configFile": "../../karma.conf.js",
"project": "custom"
},
"mutate": [ path.join(basePath, "src/**/*.js") ],
"mutator": "javascript",
"packageManager": "npm",
"reporter": [ "html", "clear-text" ],
"testFramework": "jasmine",
"testRunner": "karma"
});
};
Karma config
module.exports = config => {
config.set({
"basePath": config.basePath || "/",
"browsers": config.coverage ? [ "ChromeHeadless" ] : [ "Chrome" ],
"client": { "clearContext": false },
"colors": true,
"coverageReporter": {
"dir": "reports",
"reporters": [
{
"subdir": "coverage",
"type": "html"
}
]
},
"failOnEmptyTestSuite": false,
"files": [
"./src/**/*.js",
"./tests/**/*.spec.js"
],
"frameworks": [ "jasmine" ],
"preprocessors": {
"./src/**/*.js": [ "webpack", "sourcemap" ],
"./tests/**/*.spec.js" : [ "webpack", "sourcemap" ]
},
"reporters": config.coverage ? [ "progress", "coverage" ] : [ "progress", "kjhtml" ],
"webpack": {
"cache": true,
"devtool": "inline-source-map",
"module": {
"rules": [
{
"enforce": "post",
"exclude": /node_modules|\.spec\.js$|tests/,
"test": /\.js$/,
"use": {
"loader": "istanbul-instrumenter-loader",
"options": { "esModules": true }
}
}
]
}
}
});
};
Stryker environment
+-- stryker - current
+-- stryker-api - current
+-- jasmine@3.2.0
+-- karma@3.0.0
Your Environment
software | version(s) |
---|---|
node | 10.6.0 |
npm | 6.1.0 |
Operating System | win 10 |
Add stryker.log
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (19 by maintainers)
@simondel sent
We have an open issue to add the option to specify a project root: https://github.com/stryker-mutator/stryker/issues/650
Because your karma config always points to the
hi/
folder in your use case, the tests that contain the mutants and/or are instrumented to collect code coverage are never executed since they are infront-tools/.stryker-tmp/sandboxXXXXXXXXXX
.This is unfortunately not a use case that we support right now.
Sounds good 👍
I’ll send you it this evening I suppose or tomorrow, since on GitHub I have older version.