问题描述
简单地运行“stryker run”,正在创建突变并且一切似乎运行顺利,直到我收到干运行失败的错误:
22:19:29 (12628) DEBUG JestTestRunner Running jest with --findRelatedTests flag. Set jest.enableFindRelatedTests to false to run all tests on every mutant.
22:24:17 (9652) DEBUG TimeoutDecorator Timeout expired,restarting the process and reporting timeout
22:24:19 (9652) DEBUG ChildProcessproxy disposing of worker process 12952
22:24:21 (9652) DEBUG ChildProcessproxy Kill 12952
22:24:26 (9652) DEBUG ChildProcessproxy Started ChildProcesstestRunnerWorker in child process 20336
22:24:38 (9652) ERROR DryRunExecutor Initial test run timed out!
22:24:38 (9652) DEBUG Stryker Not removing the temp dir because an error occurred
22:24:38 (9652) ERROR Stryker Unexpected error occurred while running Stryker Error: Something went wrong in the initial test run
at DryRunExecutor.validateResultCompleted (C:\Users\avalchev\IdeaProjects\project\node_modules\@stryker-mutator\core\dist\src\process\3-dry-run-executor.js:61:15)
at DryRunExecutor.timeDryRun (C:\Users\avalchev\IdeaProjects\project\node_modules\@stryker-mutator\core\dist\src\process\3-dry-run-executor.js:71:14)
at processticksAndRejections (internal/process/task_queues.js:95:5)
at async C:\Users\avalchev\IdeaProjects\project\node_modules\@stryker-mutator\core\dist\src\concurrent\pool.js:62:28
请记住,当我的配置为 true 时,我收到 Set jest.enableFindRelatedTests 为 false。如果我将它设置为 false,调试器会说 Set jest.enableFindRelatedTests 为 true。所以这就是为什么我把它全部删除了
这是我的配置:
/**
* @type {import('@stryker-mutator/api/core').StrykerOptions}
*/
module.exports = {
_comment:
"This config was generated using 'stryker init'. Please see the guide for more information: https://stryker-mutator.io/docs/stryker-js/guides/angular",mutate: [
"*/.ts","!**/*.spec.ts","!**/*test.ts"
],testRunner: "jest","jest": {
"projectType": "custom","configFile": "jest.config.js","config": {
"testEnvironment": "jest-environment-jsdom-sixteen"
}
},tempDirName: "stryker-tmp",reporters: ["progress","clear-text","html"],concurrency: 4,concurrency_comment:
"Recommended to use about half of your available cores when running stryker with angular",coverageAnalysis: "perTest",};
解决方法
在 Stryker 配置文件中,我添加了 timeoutMS
设置以增加每次测试使用的时间。我将其设置为 30 秒(30000)。
timeoutMS: 30000 // Use extended timeoutMs for test run to remove Time Out Results