stryker-karma-runner hangs when Karma can't connect to the browser
See original GitHub issueSummary
When running stryker with karma, stryker will hang forever during the initial test run if karma fails to connect to the browser. This is most easily tested by running stryker in an environment that proxies all HTTP calls.
This isn’t a huge issue, if you turn on log level trace, you can see karma launcher say “ChromeHeadless failed x times (timeout). Giving up.”, and then it hangs. The solution to the karma launcher not connecting is to make sure you export NO_PROXY='xxx'
. However, stryker-karma-runner should exit on a launcher failure instead of waiting forever.
Stryker config
Taken from the Angular Stryker Example project found here
const getAppFromConfig = require('@angular/cli/utilities/app-utils').getAppFromConfig;
const appConfig = getAppFromConfig();
module.exports = function (config) {
config.set({
files: [
// Exclude files so we can include only particular files later on
'!./**/*.ts',
'!./**/*.js',
`!./${appConfig.root}/**/*.d.ts`,
// Include source files and flag them for mutation
{ pattern: `./${appConfig.root}/**/*.ts`, included: false, mutated: true },
// Exclude test files to later include them again without the mutated flag set to true
`!./${appConfig.root}/**/*.spec.ts`,
`!./${appConfig.root}/test.ts`,
{ pattern: `./${appConfig.root}/**/*.spec.ts`, included: false, mutated: false },
{ pattern: `./${appConfig.root}/test.ts`, included: false, mutated: false },
// Ignore environment configuration files
`!./${appConfig.root}/environments/*.ts`,
// Other assets (HTML and CSS for the browser)
`./${appConfig.root}/**/*.html`,
`./${appConfig.root}/**/*.css`,
],
testRunner: 'karma',
mutator: 'typescript',
transpilers: ['webpack'],
reporter: ['html', 'clear-text', 'progress'],
testFramework: 'jasmine',
coverageAnalysis: 'off',
karmaConfig: {
frameworks: ['jasmine'],
browsers: ['ChromeHeadless'],
plugins: [
require.resolve('karma-jasmine'),
require.resolve('karma-chrome-launcher')
]
},
tsconfigFile: 'tsconfig.json',
webpack: {
configFile: 'webpack-stryker.conf.js'
},
logLevel: 'info',
timeoutMs: 10000
});
};
Stryker environment
Same as the example project.
stryker@0.19.2
stryker-api@0.13.0
stryker-html-reporter@0.12.1
stryker-karma-runner@0.12.2
stryker-typescript@0.9.1
stryker-webpack-transpiler@0.1.4
Your Environment
software | version(s) |
---|---|
node | 8.9.1 |
npm | 5.5.1 |
Ubuntu | 16.04 |
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Troubleshooting - Karma test runner
Open the URL in a browser and use the browsers devtools to investigate the problem. Typically you will want to open the URL,...
Read more >Karma cannot start Firefox - Stack Overflow
I'm sure that I installed karma-firefox-launcher into globle and local. And I can run the Chrome in the same way. How can I...
Read more >Karma plugin freezes since 2018.3
Opening the link manually in another browser finally causes the test execution to start, but the tests are then run in both ChromeHeadless...
Read more >Slow VPN connections cause Chrome Browser to hang with ...
Issue cannot be reproduced on his work network. OS: Windows 7. Troubleshooting Steps & More Info: 1) Could not provide crash ID's as...
Read more >Chrome browser always hangs and can not open Apex ...
This situation has been happening for a while. When using chrome browser to connect Apex Developer Guide, the browser ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think this is a bigger issue. Not only is
load_error
effected, but alsobrowser_error
. In general, when an error occurs, the promise from a karma run is not resolved, at all.Time to fix this one.
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.