stryker-js: Frequent timeouts when running tests with Stryker
Summary
When Running Stryker I frequently see a score of 100% because of tests timing out. This not consitent and varies greatly between runs. The timeouts occur very frequent on a larger TypeScript React project but can also be repeated frequently on a small project.
Note that there is one empty test here and all that is needed to reproduce this is an import of a very simple React component.
The test file:
import Label from "./Label";
test("dummy", () => {});
The Label.tsx
being imported:
import React, { ReactElement, ReactChild } from "react";
type LabelProps = {
caption: ReactChild;
name?: string;
};
const Label = ({ caption, name }: LabelProps): ReactElement => {
return <label htmlFor={name}>{caption}</label>;
};
Label.displayName = "Label";
export default Label;
The initial test run always passed but then subsequent mutation runs sometimes fail with a timeout. These timeouts appear to occur about 20% of the time in the small sample project but are a lot more frequent on a large project. The timeouts in the small project always seem to be either 0, 2 or 4, there are a total of 4 mutant generated. I have seen a run with either 1 or 3 timeouts.
I have uploaded the sample project to a GitHub repository here
Stryker config
// This config was generated using a preset.
// Please see the handbook for more information: https://github.com/stryker-mutator/stryker-handbook/blob/master/stryker/guides/react.md#react
module.exports = function(config) {
config.set({
mutate: [
"src/**/*.ts?(x)",
"!src/*.ts?(x)",
"!src/**/*@(.test|.spec|Spec).ts?(x)"
],
mutator: "typescript",
testRunner: "jest",
reporters: ["progress", "clear-text", "html"],
coverageAnalysis: "off",
tempDirName: "stryker-tmp",
jest: {
projectType: "react"
}
});
};
Test runner config
Jest with the standard Create-React-App configuration.
Stryker environment
stryker-test@0.1.0 C:\Temp\stryker-test
+-- @stryker-mutator/core@2.3.0
| +-- @stryker-mutator/api@2.3.0
| +-- @stryker-mutator/util@2.3.0
+-- @stryker-mutator/html-reporter@2.3.0
| +-- @stryker-mutator/api@2.3.0 deduped
| +-- @stryker-mutator/util@2.3.0 deduped
+-- @stryker-mutator/jest-runner@2.3.0
| +-- @stryker-mutator/api@2.3.0 deduped
+-- @stryker-mutator/typescript@2.3.0
| +-- @stryker-mutator/api@2.3.0 deduped
| +-- @stryker-mutator/util@2.3.0 deduped
"react-scripts": "3.2.0"
jest@24.9.0
Test runner environment
# Test command
yarn test
"test": "react-scripts test",
Your Environment
software | version(s) |
---|---|
node | v10.15.3 |
npm | 6.11.3 |
Operating System | Windows 10 version 1809 |
Add stryker.log
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (10 by maintainers)
Nothing comes to my mind, other than either increasing
timeoutMS
in stryker config or decreasingmaxConcurrentTestRunners
to let’s say 2 (since you are using 4 by default [default for your CPU]),you could also try adding
enableFindRelatedTests
asfalse
injest
part of config.So basically try playing with this setup:
@mauricedb so probably it is caused by not enough resources on your PC 😕 try running stryker without heavy CPP apps, don’t slow down PC, since some inconsistencies can be caused by lag spikes
For now, it is the only solution. We are trying optimizing RSS consumption, but it is sometimes impossible since we are using 3rd party applications (like test runners, etc).
If a problem is solved, consider closing this issue 😃 we can always reopen it if the problem keeps occurring