Closed CarlosRosario closed 5 years ago
@CarlosRosario thanks for reporting this issue.
It seems that the mutant is causing an error of which Stryker is not aware. Causing browsers to disconnect from karma which goes unnoticed by stryker.
Could you please provide more information? What does your karma.conf and stryker.conf look like. What karma plugins do you have installed.
Even better would be a small github project that reproduces this issue. If you set maxConcurrentTestRunners
to 1
, you should be able to reliably reproduce the issue.
Hi @nicojs ,
Thanks for the quick response. As far as karma plugins i'm using:
My Stryker configuration looks like:
config.set({
logLevel: 'all',
files: [
{ pattern: '/path/to/jsFile.js', mutated: true, included: true},
'/path/to/jsFile.spec.js',
{ pattern: '/path/to/otherNecessaryFiles.js', mutated: false, included: true},
],
testRunner: 'karma',
testFramework: 'jasmine',
coverageAnalysis: 'perTest',
reporter: ['html', 'progress', 'event-recorder'],
maxConcurrentTestRunners: 6,
timeoutMs: 240000,
karmaConfig: {
singleRun: false,
browsers: ['chrome'],
preprocessors: {
'/path/to/otherNecessaryFiles.js': ['browserify'],
'/path/to/jsFile.spec.js': ['browserify']
},
frameworks: ['browserify', 'jasmine'],
// I've toyed around with different values for these configurations. I think the ones here are default values, but i'm not too sure.
retryLimit: 3,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 100000,
captureTimeout: 180000
}
});
I'll work on creating a sample angular project that reproduces this issue. What did you mean by your last comment? I'm currently seeing the issue no matter what i've set maxConcurrentTestRunners
to.
Small Edit: I've also tried using the browserDisconnectTimeout
karma configuration property, and it seemed to help, but not consistently.
Here's a sample angular project that reproduces the issue with 1 maxConcurrentTestRunner
https://github.com/CarlosRosario/StrykerInfiniteLoopDemoProject
You should just have to do an npm install and be able to run stryker right away after that. I wasn't able to reproduce the issue happening for more than one concurrent test runner.. i was thinking maybe it's because only a small number of mutants are generated for the small code i wrote.
Hi Carlos, thanks for all the trouble. I think i found the issue.
We should never let karma handle timeouts. As a work around: remove timeoutMs: 240000
from your stryker config will force Stryker to handle timeouts.
The mutant is causing an infinite loop, which is not a problem normally for Stryker. It will kill the child process and spawn a new one, marking the mutant as a timeout. The problem is that not stryker, but Karma is reporting the timeout.
Karma itself has a mechanism of reporting timeouts when it hasn't heard from the browser in x time. We assumed that the karma process would still be responsive afterwards, but it is not (never assume anything). I think we should fix this by forcing a timeout to be handled by Stryker.
Just out of curiosity, how come the bug doesn't manifest when there are more than 1 concurrent runners? I tried forcing a couple hundred mutations (just having a function that returned a number multiplied by 1 over and over again).. but i was never able to reproduce the issue with more than 1 concurrent test runner.
@nicojs Is this still a thing or has it been fixed since?
As we haven't heard anything about this so far, I'm closing this issue. If it's still a problem, let us know!
Hello,
I am using Stryker on an AngularJS project with the following npm modules:
Whenever Stryker mutates native Javscript for/while loops that use increment/decrement operators, those mutations cause Karma to disconnect and mark all remaining mutations as 'survived'. The error message i see in the console looks like:
These error messages repeat for a while and then jumps straight to 99% with the remaining mutations marked as 'survived' mutants.
I created a simple angular service and corresponding Jasmine spec file to make sure i could isolate and reproduce the issue i am seeing:
stryker_test.service.js
stryker_test.service.spec.js
So far i am able to get around this issue by commenting out the code inside of applyMutations() in the UpdateOperatorMutator.js code:
stryker/src/mutators/UpdateOperatorMutator.js
If it helps debug, i am using angular v1.4.7 and Jasmine v2.5.2. I'm not sure if this is a Stryker issue or a Karma issue.
Edit: I also saw this issue and thought it sounded kind of similar to what i am seeing. I'm not using karma-nightmare though.
Edit 2: Changing my for loop to use index+=1 instead of index++ also gets rid of the issue, but i'm pretty sure it's just sneaking past Stryker so i never get into infinite loop scenarios during mutation testing.