Reputation: 3353
DEBUG LOG:
E:\Projects\abb\Projects\WebApp\abb.web>karma start
DEBUG [plugin]: Loading karma-* from E:\Projects\abb\Projects\WebApp\abb
.web\node_modules
DEBUG [plugin]: Loading plugin E:\Projects\abb\Projects\WebApp\abb.web\n
ode_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin E:\Projects\abb\Projects\WebApp\abb.web\n
ode_modules/karma-jasmine.
INFO [karma]: Karma v0.12.16 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
DEBUG [temp-dir]: Creating temp dir at C:\Users\Kunal\AppData\Local\Temp\karma-8
6563066
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --
user-data-dir=C:\Users\Kunal\AppData\Local\Temp\karma-86563066 --no-default-brow
ser-check --no-first-run --disable-default-apps --disable-popup-blocking --disab
le-translate http://localhost:9876/?id=86563066
DEBUG [watcher]: Resolved files:
E:/Projects/abb/Projects/WebApp/abb.web/node_modules/karma-jasmi
ne/lib/jasmine.js
E:/Projects/abb/Projects/WebApp/abb.web/node_modules/karma-jasmi
ne/lib/adapter.js
E:/Projects/abb/Projects/WebApp/abb.web/app/js/vendor/angular.js
E:/Projects/abb/Projects/WebApp/abb.web/app/js/vendor/angular-ro
ute.js
E:/Projects/abb/Projects/WebApp/abb.web/test/lib/angular-mocks.j
s
E:/Projects/abb/Projects/WebApp/abb.web/app/js/app.debug.js
E:/Projects/abb/Projects/WebApp/abb.web/test/unit/homepage.spec.
js
DEBUG [web-server]: serving: E:\Projects\abb\Projects\WebApp\abb.web\nod
e_modules\karma\static/client.html
DEBUG [web-server]: serving: E:\Projects\abb\Projects\WebApp\abb.web\nod
e_modules\karma\static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/9uv4dB4yQPjZ7sZcWUuH
DEBUG [karma]: A browser has connected on socket 9uv4dB4yQPjZ7sZcWUuH
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
DEBUG [launcher]: Process Chrome exited with code 0
DEBUG [temp-dir]: Cleaning temp dir C:\Users\Kunal\AppData\Local\Temp\karma-8656
3066
INFO [launcher]: Trying to start Chrome again (1/2).
DEBUG [launcher]: Restarting Chrome
DEBUG [temp-dir]: Creating temp dir at C:\Users\Kunal\AppData\Local\Temp\karma-8
6563066
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --
user-data-dir=C:\Users\Kunal\AppData\Local\Temp\karma-86563066 --no-default-brow
ser-check --no-first-run --disable-default-apps --disable-popup-blocking --disab
le-translate http://localhost:9876/?id=86563066
DEBUG [web-server]: serving: E:\Projects\abb\Projects\WebApp\abb.web\nod
e_modules\karma\static/client.html
DEBUG [web-server]: serving: E:\Projects\abb\Projects\WebApp\abb.web\nod
e_modules\karma\static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/ei81-LVHlsfeDeCXWUuI
DEBUG [karma]: A browser has connected on socket ei81-LVHlsfeDeCXWUuI
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
DEBUG [launcher]: Process Chrome exited with code 0
DEBUG [temp-dir]: Cleaning temp dir C:\Users\Kunal\AppData\Local\Temp\karma-8656
3066
INFO [launcher]: Trying to start Chrome again (2/2).
DEBUG [launcher]: Restarting Chrome
DEBUG [temp-dir]: Creating temp dir at C:\Users\Kunal\AppData\Local\Temp\karma-8
6563066
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --
user-data-dir=C:\Users\Kunal\AppData\Local\Temp\karma-86563066 --no-default-brow
ser-check --no-first-run --disable-default-apps --disable-popup-blocking --disab
le-translate http://localhost:9876/?id=86563066
DEBUG [web-server]: serving: E:\Projects\abb\Projects\WebApp\abb.web\nod
e_modules\karma\static/client.html
DEBUG [web-server]: serving: E:\Projects\abb\Projects\WebApp\abb.web\nod
e_modules\karma\static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/rpgHU0_UF1MnvCwCWUuJ
DEBUG [karma]: A browser has connected on socket rpgHU0_UF1MnvCwCWUuJ
DEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: Process Chrome exited with code 0
DEBUG [temp-dir]: Cleaning temp dir C:\Users\Kunal\AppData\Local\Temp\karma-8656
3066
package versions: Node version: v0.10.28
"karma": "^0.12.16",
"karma-chrome-launcher": "^0.1.4",
"karma-jasmine": "^0.1.5",
config file:
// Karma configuration
// Generated on Sat May 24 2014 22:34:35 GMT+0530 (India Standard Time)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'app/js/vendor/angular.js',
'app/js/vendor/angular-route.js',
'test/lib/angular-mocks.js',
'app/js/app.debug.js',
'test/unit/**/*.spec.js'
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_DEBUG,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};
Chrome opens up with localhost://9876 and shows "karma - starting"
Not able to make karma work. Please help.
I have tried setting autowatch: true and disabling firewall but none of these worked.
Upvotes: 20
Views: 32778
Reputation: 3256
Adding
hostname: '127.0.0.1',
listenAddress: '127.0.0.1',
to the list of parameters passed to config.set
in karma.cong.js
fixed it for me.
Upvotes: 0
Reputation: 774
This worked for me:
Install puppeteer
npm install puppeteer --save-dev
Add this code to karma.conf.js
at the very top of your module exports function:
const puppeteer = require('puppeteer');
process.env.CHROME_BIN = puppeteer.executablePath();
Disable chrome sandbox:
browsers: ['ChromeHeadlessCI'],
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
}
Upvotes: 3
Reputation: 914
what worked for me was running npm rebuild
. See related gitlab discussion
so for it to work I run all these:
npm install && npm rebuild && npm test
Upvotes: 0
Reputation: 6837
I had similar issue on Jenkins builds server. Problem was with node-chrome docker container we used, which always referenced the latest image. When downgraded node-chrome to lower version (e.g. node16) the ng test
started to work again.
Upvotes: 0
Reputation: 17
Probably too late. But try increasing the captureTimeout
configuration value by a considerable factor. This might give the test script some time to capture the browser once it has completed initialisation.
Upvotes: 0
Reputation: 79
Try to set a NO_PROXY
exports
e.g.: export NO_PROXY="localhost, 0.0.0.0/4201, 0.0.0.0/9876"
Upvotes: 0
Reputation: 65
I had this issue when I'm using my Karma package with chrome version 93 on the windows server edition. Previously my build was running when on 92 chrome version but after upgrading the chrome to 93 the builds started failing.
Rollbacking my chrome resolved my issue.
Upvotes: 2
Reputation: 3413
Another cause is running outdated versions of karma and related packages (I suspect karma-chrome-launcher in particular).
Upvotes: 0
Reputation: 3871
Apparently karma files got corrupted, that's what helped me:
node_modules
folder completely.npm install
Upvotes: 3
Reputation: 10234
As Mikey mentioned, setting the NO_PROXY
works for me, however it is not via export
, but I have to do it inside the karma.conf.js
file for Karma
to pick this env variable up.
process.env.NO_PROXY = 'localhost, 0.0.0.0/4201, 0.0.0.0/9876';
process.env.no_proxy = 'localhost, 0.0.0.0/4201, 0.0.0.0/9876';
Hopefully it helps some hopeless ppl like me for a day....
Upvotes: 9
Reputation: 1158
My solution was to update my global installation of Karma to the latest version. I suspect that I could have also just re-installed the existing version as I think the Karma install had gotten corrupted because it didn't matter what browser I used Karma still couldn't connect to it (or it couldn't connect to Karma).
Upvotes: 1
Reputation: 4348
I was executing the command on the visual studio code terminal. When I switched to iTerm suddenly it worked.
Upvotes: 2