Please provide us with the following information:
Windows 10
Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here:
1.0.0-beta.31
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
run ng test on slow machine.
Normally this include a stack trace and some more information.
14 02 2017 15:51:47.924:INFO [karma]: Karma v1.4.1 server started at http://0.0.0.0:9876/
14 02 2017 15:51:47.926:INFO [launcher]: Launching browser Chrome with unlimited concurrency
14 02 2017 15:51:48.262:INFO [launcher]: Starting browser Chrome
14 02 2017 15:51:49.888:ERROR [launcher]: Cannot start Chrome
14 02 2017 15:51:51.122:ERROR [launcher]: Chrome failed 0 times (cannot start). Giving up.
14 02 2017 15:51:51.719:INFO [Chrome 56.0.2924 (Windows 7 0.0.0)]: Connected on socket Ip7Jk-wjVEYSiLOXAAAA with id 56789584
Chrome 56.0.2924 (Windows 7 0.0.0): Executed 0 of 16 SUCCESS (0 secs / 0 secs)
I tried to set captureTimeout in karma.config.js but it doesn't seem to change anything. Gives up too quick. Browser does start but by than its too late.
This is an environment specific issue that only some projects will face, hence the CLI doesn't account for.
It's a karma config issue too, so, in my project, where I face something similar, I modified karma.conf.js to include:
module.exports = function (config) {
config.set({
...
...
// Based on: https://github.com/karma-runner/karma/issues/598#issuecomment-160977724
captureTimeout: 60 * 1000,
browserDisconnectTimeout: 15 * 1000,
browserDisconnectTolerance: 5,
browserNoActivityTimeout: 15 * 10000,
});
};
It might also be a version issue. In my project we had this happen on the CLI server so we ended up using Chrome Portable instead, works nicely.
Something like:
var chromePath = path.join(__dirname, "./tools/Chrome/App/Chrome-bin/chrome.exe");
var browsers = [chromePath];
var customLaunchers = {};
customLaunchers[chromePath] = {
base: 'Chrome'
};
module.exports = function (config) {
config.set({
...
customLaunchers: customLaunchers,
browsers: browsers,
...
});
};
All these timeouts don't seem to have any impact. It just waits about a second and gives up no matter what.
But there's something interesting. If I don't have any Chrome windows open then it works. It will start a browser, wait, run tests, close the browser and exit. But if Chrome is already running it will open a new tab (not window) and give up after a sec.
On my other machine it always opens a new window, not a tab no matter if Chrome is running or not.
If the behaviour stays different even after deleting node_modules and installing npm again, it may not be a CLI issue or even a karma issue.
Things to try:
Ensure both browsers are latest version of Chrome
Completely delete Chrome and reinstall it. Look for files on your user and app data folders. In early versions of Chrome, it installed in user folder, while newer versions install in program files. If you had Chrome since the old user folder days, it sometimes acts weird. I had this before in old machines
Closing because this doesn't seem to be a CLI issue. I'd say to ask around https://github.com/karma-runner/karma describing what you see happening with the tab vs new window behaviour.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
This is an environment specific issue that only some projects will face, hence the CLI doesn't account for.
It's a karma config issue too, so, in my project, where I face something similar, I modified
karma.conf.jsto include:It might also be a version issue. In my project we had this happen on the CLI server so we ended up using Chrome Portable instead, works nicely.
Something like: