MacOS X 10.8.4, node v0.10.12, karma 0.9.4, Chrome 28.0.1500.71
In order to investigate on the problem submitted here (https://github.com/xolvio/real-time-development-with-meteor/issues/17) , i've installed the karma source and run the tests.
imac-de-laurent:karma laurent$ git checkout v0.9.4 Previous HEAD position was 8606695... chore: release v0.8.6 HEAD is now at 5fe6a57... chore: release v0.9.4 imac-de-laurent:karma laurent$ grunt Running "build:client" (build) task >> Created static/karma.js Running "test:unit" (test) task Running "simplemocha:unit" (simplemocha) task 239 tests complete (3 seconds) Running "test:tasks" (test) task Running "simplemocha:tasks" (simplemocha) task 12 tests complete (6 ms) Running "test:client" (test) task Running /Users/laurent/dev/karma/bin/karma start test/client/karma.conf.js --single-run --no-auto-watch --reporters=dots --browsers=Chrome INFO [karma]: Karma v0.9.4 server started at http://localhost:9876/ INFO [launcher]: Starting browser Chrome WARN [launcher]: Chrome have not captured in 5000 ms, killing. INFO [launcher]: Trying to start Chrome again. WARN [launcher]: Chrome have not captured in 5000 ms, killing. INFO [launcher]: Trying to start Chrome again. WARN [launcher]: Chrome have not captured in 5000 ms, killing. [Error] Fatal error: Client unit tests failed.
Chrome is launched ,but it says he cannot open http://localhost:9876/?id=15999490.
if i open the page with another browser (Firefox), the page opens -> it's related to Chrome ....
The version of karma we use is 0.8.6, so i tryed this too
imac-de-laurent:karma laurent$ git checkout v0.8.6 Previous HEAD position was 5fe6a57... chore: release v0.9.4 HEAD is now at 8606695... chore: release v0.8.6 imac-de-laurent:karma laurent$ npm install npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] 'repositories' (plural) Not supported. npm WARN package.json Please pick one as the 'repository' field npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. imac-de-laurent:karma laurent$ grunt Running "build:client" (build) task >> Created static/testacular.js Running "build:jasmine" (build) task >> Created adapter/jasmine.js Running "build:mocha" (build) task >> Created adapter/mocha.js Running "build:ngScenario" (build) task >> Created adapter/angular-scenario.js Running "build:require" (build) task >> Created adapter/require.js Running "build:qunit" (build) task >> Created adapter/qunit.js Running "jshint:server" (jshint) task >> 41 files lint free. Running "jshint:grunt" (jshint) task >> 7 files lint free. Running "jshint:client" (jshint) task >> 1 file lint free. Running "jshint:jasmine" (jshint) task >> 1 file lint free. Running "jshint:mocha" (jshint) task >> 1 file lint free. Running "jshint:qunit" (jshint) task >> 1 file lint free. Running "jshint:ngScenario" (jshint) task >> 1 file lint free. Running "jshint:require" (jshint) task >> 1 file lint free. Running "test:unit" (test) task Running "simplemocha:unit" (simplemocha) task Running "test:tasks" (test) task Running "simplemocha:tasks" (simplemocha) task Running "test:client" (test) task Running /Users/laurent/dev/karma/bin/karma start test/client/karma.conf.js --single-run --no-auto-watch --reporters=dots --browsers=Chrome WARN [config]: JASMINE is not supported anymore. Please use `frameworks = ["jasmine"];` instead. WARN [config]: JASMINE_ADAPTER is not supported anymore. Please use `frameworks = ["jasmine"];` instead. WARN [config]: LOG_INFO is not supported anymore. Please use `karma.LOG_INFO` instead. ERROR [config]: Config file must export a function! module.exports = function(config) { config.set({ // your config }); }; [Error] Fatal error: Client unit tests failed.
Oops another problem !
Install Karma from NPM npm install karma or npm install -g karma.
If you really wanna use the master from github, you need to do grunt build, check out http://karma-runner.github.io/0.8/dev/contributing.html
Of course i did a grunt build ! and previously the install was done with npm that's why i jumped into the master.
Please reopen the issue :)
@lc3t35 Are you having this issue with Karma installed from NPM ?
Also, can you check out the console in the browser ? Is there any error ?
Let's deal first with karma 0.9.4 and the initial Chrome problem : karma was installed from npm (v 0.8.6) , the problem is the same with grunt test on version 0.9.4.
There is no error in the browser's console : difficult to catch because Chrome is quickly closed but with Command - Option - J, i succeeded to display it, nothing is displayed there.
Chrome works fine otherwise : it can access to Internet web sites, if i run a locahost server on port 3000, i can access to the local server.
@lc3t35 I think you are still describing using karma from a git repo, in which case you can init your workspace with ./scripts/init-dev-env.js.
Here is the log of the 3 commands : init, build, test
imac-de-laurent:karma laurent$ ./scripts/init-dev-env.js Adding symbolic link: /Users/laurent/dev/karma/scripts/validate-commit-msg.js linked to /Users/laurent/dev/karma/.git/hooks/commit-msg Checking for grunt-cli... grunt-cli is already installed: grunt-cli v0.1.9 grunt v0.4.1 Installing dependencies... npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN prefer global [email protected] should be installed with -g npm WARN prefer global [email protected] should be installed with -g npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] 'repositories' (plural) Not supported. npm WARN package.json Please pick one as the 'repository' field npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No repository field. imac-de-laurent:karma laurent$ grunt build Running "build:client" (build) task >> Created static/karma.js Done, without errors. imac-de-laurent:karma laurent$ grunt test Running "test:unit" (test) task Running "simplemocha:unit" (simplemocha) task 239 tests complete (3 seconds) Running "test:tasks" (test) task Running "simplemocha:tasks" (simplemocha) task 12 tests complete (8 ms) Running "test:client" (test) task Running /Users/laurent/dev/karma/bin/karma start test/client/karma.conf.js --single-run --no-auto-watch --reporters=dots --browsers=Chrome INFO [karma]: Karma v0.9.4 server started at http://localhost:9876/ INFO [launcher]: Starting browser Chrome WARN [launcher]: Chrome have not captured in 5000 ms, killing. INFO [launcher]: Trying to start Chrome again. WARN [launcher]: Chrome have not captured in 5000 ms, killing. INFO [launcher]: Trying to start Chrome again. WARN [launcher]: Chrome have not captured in 5000 ms, killing. [Error] Fatal error: Client unit tests failed.
Modifying test/client/karma.conf.js : logLevel: config.LOG_DEBUG, captureTimeout: 10000
Running "test:client" (test) task
Running /Users/laurent/dev/karma/bin/karma start test/client/karma.conf.js --single-run --no-auto-watch --reporters=dots --browsers=Chrome
DEBUG [plugin]: Loading plugin karma-jasmine.
DEBUG [plugin]: Loading plugin karma-chrome-launcher.
DEBUG [plugin]: Loading plugin karma-firefox-launcher.
DEBUG [plugin]: Loading plugin karma-junit-reporter.
DEBUG [plugin]: Loading inlined plugin (defining ).
INFO [karma]: Karma v0.9.4 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
DEBUG [launcher]: Creating temp dir at /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-12624730
DEBUG [launcher]: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-12624730 --no-default-browser-check --no-first-run --disable-default-apps --start-maximized http://localhost:9876/?id=12624730
DEBUG [watcher]: Resolved files:
/Users/laurent/dev/karma/node_modules/karma-jasmine/lib/jasmine.js
/Users/laurent/dev/karma/node_modules/karma-jasmine/lib/adapter.js
/Users/laurent/dev/karma/test/client/mocks.js
/Users/laurent/dev/karma/static/karma.src.js
/Users/laurent/dev/karma/test/client/testacular.spec.js
WARN [launcher]: Chrome have not captured in 10000 ms, killing.
DEBUG [launcher]: Process Chrome exitted with code 0
DEBUG [launcher]: Cleaning temp dir /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-12624730
INFO [launcher]: Trying to start Chrome again.
DEBUG [launcher]: Creating temp dir at /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-12624730
DEBUG [launcher]: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-12624730 --no-default-browser-check --no-first-run --disable-default-apps --start-maximized http://localhost:9876/?id=12624730
WARN [launcher]: Chrome have not captured in 10000 ms, killing.
DEBUG [launcher]: Process Chrome exitted with code 0
DEBUG [launcher]: Cleaning temp dir /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-12624730
INFO [launcher]: Trying to start Chrome again.
DEBUG [launcher]: Creating temp dir at /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-12624730
DEBUG [launcher]: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-12624730 --no-default-browser-check --no-first-run --disable-default-apps --start-maximized http://localhost:9876/?id=12624730
WARN [launcher]: Chrome have not captured in 10000 ms, killing.
DEBUG [launcher]: Process Chrome exitted with code 0
DEBUG [karma]: Chrome failed to capture, aborting the run.
DEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: Killing Chrome
DEBUG [launcher]: Cleaning temp dir /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-12624730
[Error]
Fatal error: Client unit tests failed.
i remind you that it works with firefox !
bin/karma start test/client/karma.conf.js --single-run --no-auto-watch --reporters=dots --browsers=Firefox
DEBUG [plugin]: Loading plugin karma-jasmine.
DEBUG [plugin]: Loading plugin karma-chrome-launcher.
DEBUG [plugin]: Loading plugin karma-firefox-launcher.
DEBUG [plugin]: Loading plugin karma-junit-reporter.
DEBUG [plugin]: Loading inlined plugin (defining ).
INFO [karma]: Karma v0.9.4 server started at http://localhost:9876/
INFO [launcher]: Starting browser Firefox
DEBUG [launcher]: Creating temp dir at /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-20269639
DEBUG [launcher]: /Applications/Firefox.app/Contents/MacOS/firefox-bin http://localhost:9876/?id=20269639 -profile /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-20269639 -no-remote
DEBUG [watcher]: Resolved files:
/Users/laurent/dev/karma/node_modules/karma-jasmine/lib/jasmine.js
/Users/laurent/dev/karma/node_modules/karma-jasmine/lib/adapter.js
/Users/laurent/dev/karma/test/client/mocks.js
/Users/laurent/dev/karma/static/karma.src.js
/Users/laurent/dev/karma/test/client/testacular.spec.js
DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma/static/client.html
DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma/static/karma.js
DEBUG [karma]: New browser has connected on socket 424sUREfYk13Y5qS_zhD
INFO [Firefox 22.0.0 (Mac OS X 10.8)]: Connected on socket id 424sUREfYk13Y5qS_zhD
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma/static/context.html
DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma-jasmine/lib/adapter.js
DEBUG [web server]: serving: /Users/laurent/dev/karma/static/karma.src.js
DEBUG [web server]: serving: /Users/laurent/dev/karma/test/client/testacular.spec.js
DEBUG [web server]: serving: /Users/laurent/dev/karma/test/client/mocks.js
DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma-jasmine/lib/jasmine.js
.......
Firefox 22.0.0 (Mac OS X 10.8): Executed 7 of 7 SUCCESS (0.093 secs / 0.003 secs)
DEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: Killing Firefox
DEBUG [launcher]: Process Firefox exitted with code 0
DEBUG [launcher]: Cleaning temp dir /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-20269639
Weird, it looks like you might have some proxy set up for Chrome, resp. on a system level (Chrome is started with a clean profile so it should not have any proxies set, however it does use proxy settings from OS; I believe Firefox does not respect OS proxy settings).
Is Chrome GUI starting ? What's going on there in the browser ?
Yep, Chrome GUI is starting, it tryes to open http://localhost:9876/?id=3318198 3 times, and then is killed as shown in the log.
I already looked into Chrome's preferences to search for a proxy setting, but i found nothing relevant :(
If i run a local server on localhost:9876, Chrome can open the page with localhost:9876, so it's not a problem of used port, localhost denied access, ...
If i run a local server on localhost:9876, keep it running and run grunt test, karma is launched on port 9878, and Chrome cannot open localhost:9878/..., but it can access to localhost:9876 !
If i run grunt test, and try with Safari to access to karma, i can see Karma v0.9.4 in green, and the log shows
EBUG [karma]: New browser has connected on socket VpkgU-TASu8tDUzWFytC INFO [Safari 6.0.5 (Mac OS X 10.8.4)]: Connected on socket id VpkgU-TASu8tDUzWFytC WARN [launcher]: Chrome have not captured in 10000 ms, killing. DEBUG [launcher]: Process Chrome exitted with code 0
But it fails to access in Chrome.
What a nightmare !
What can you see in the browser ? Is it still loading something ? Check out
the status bar.
Check out OS proxy settings, Chrome uses that.
On Tue, Jul 30, 2013 at 2:53 AM, Laurent Roger [email protected]:
Yep, Chrome GUI is starting, it tryes to open
http://localhost:9876/?id=3318198 3 times, and then is killed as shown in
the log.
I looked into Chrome's preferences to search for a proxy setting, but i
found nothing relevant :(—
Reply to this email directly or view it on GitHubhttps://github.com/karma-runner/karma/issues/635#issuecomment-21780593
.
here is a screencopy (sorry it's in french)

The request is not hitting Karma. Proxy is the only thing that comes to my mind. Or firewall.
A firewall would block also a request from FF or Safari.
In order to get more information and be sure that there is no proxy, I modified node_modules/karma-chrome-launcher/index.js
return [
'--user-data-dir=' + this._tempDir,
'--no-default-browser-check',
'--no-first-run',
'--disable-default-apps',
'--start-maximized',
'--enable-logging',
'--v=1',
'--no-proxy-server'
].concat(flags, [url]);
I run grunt test and this launches Chrome in debug mode and no-proxy
DEBUG [launcher]: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-64901747 --no-default-browser-check --no-first-run --disable-default-apps --start-maximized --enable-logging --v=1 --no-proxy-server http://localhost:9876/?id=64901747
in /Users/
[1122:16387:0801/153013:VERBOSE1:ipc_sync_channel.cc(385)] Canceling pending sends [1122:1799:0801/153013:VERBOSE1:ipc_sync_channel.cc(385)] Canceling pending sends [1136:1799:0801/153023:VERBOSE1:ipc_sync_channel.cc(385)] Canceling pending sends [1136:16899:0801/153023:VERBOSE1:ipc_sync_channel.cc(385)] Canceling pending sends [1148:16899:0801/153033:VERBOSE1:ipc_sync_channel.cc(385)] Canceling pending sends [1148:1799:0801/153033:VERBOSE1:ipc_sync_channel.cc(385)] Canceling pending sends
OMG ! I've checked the /etc/hosts file and it was corrupted (a previous user has edited the file and saved it as RTF file, so a lot of garbage instead a clean expected TXT) -> fix it by erasing the bad hosts with good "hosts~orig" file -> Chrome can now access to localhost.
Running "test:client" (test) task
Running /Users/laurent/dev/karma/bin/karma start test/client/karma.conf.js --single-run --no-auto-watch --reporters=dots --browsers=Chrome
DEBUG [plugin]: Loading plugin karma-jasmine.
DEBUG [plugin]: Loading plugin karma-chrome-launcher.
DEBUG [plugin]: Loading plugin karma-firefox-launcher.
DEBUG [plugin]: Loading plugin karma-junit-reporter.
DEBUG [plugin]: Loading inlined plugin (defining ).
INFO [karma]: Karma v0.9.4 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
DEBUG [launcher]: Creating temp dir at /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-16492887
DEBUG [launcher]: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-16492887 --no-default-browser-check --no-first-run --no-proxy-server --disable-default-apps --start-maximized --enable-logging --v=1 http://localhost:9876/?id=16492887
DEBUG [watcher]: Resolved files:
/Users/laurent/dev/karma/node_modules/karma-jasmine/lib/jasmine.js
/Users/laurent/dev/karma/node_modules/karma-jasmine/lib/adapter.js
/Users/laurent/dev/karma/test/client/mocks.js
/Users/laurent/dev/karma/static/karma.src.js
/Users/laurent/dev/karma/test/client/testacular.spec.js
DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma/static/client.html
DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma/static/karma.js
DEBUG [karma]: New browser has connected on socket oAAWLzdgNXUQwWIpN5jh
INFO [Chrome 28.0.1500 (Mac OS X 10.8.4)]: Connected on socket id oAAWLzdgNXUQwWIpN5jh
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma/static/context.html
DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma-jasmine/lib/jasmine.js
DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma-jasmine/lib/adapter.js
DEBUG [web server]: serving: /Users/laurent/dev/karma/test/client/mocks.js
DEBUG [web server]: serving: /Users/laurent/dev/karma/static/karma.src.js
DEBUG [web server]: serving: /Users/laurent/dev/karma/test/client/testacular.spec.js
.......
Chrome 28.0.1500 (Mac OS X 10.8.4): Executed 7 of 7 SUCCESS (0.064 secs / 0.01 secs)
DEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: Killing Chrome
DEBUG [launcher]: Process Chrome exitted with code 0
DEBUG [launcher]: Cleaning temp dir /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-16492887
thanks to http://superuser.com/questions/559950/cannot-resolve-localhost-on-mac-os-mountain-lion
I was able to solve this problem by changing the karma.conf.js to use a different port than the default 8080. No need to muck with the /etc/hosts file.
// web server port
// port = 8080;
port = 9876;
@durp: I met this issue just now, I have closed many windows services before, after suspecting that and tried by reopening them,but I failed, and then I try your solution, it works for me. Thanks.
Thanks @lc3t35, your solution was just what I needed. I had a malformed /etc/hosts file (just an extra comma where it didn't belong), but it would've taken me a long time to find on my own. Thanks!
Thanks @lc3t35, your solution worked !
thank you @lc3t35 your solution helped me out!! 👏 🙏
Most helpful comment
OMG ! I've checked the /etc/hosts file and it was corrupted (a previous user has edited the file and saved it as RTF file, so a lot of garbage instead a clean expected TXT) -> fix it by erasing the bad hosts with good "hosts~orig" file -> Chrome can now access to localhost.
Running "test:client" (test) task Running /Users/laurent/dev/karma/bin/karma start test/client/karma.conf.js --single-run --no-auto-watch --reporters=dots --browsers=Chrome DEBUG [plugin]: Loading plugin karma-jasmine. DEBUG [plugin]: Loading plugin karma-chrome-launcher. DEBUG [plugin]: Loading plugin karma-firefox-launcher. DEBUG [plugin]: Loading plugin karma-junit-reporter. DEBUG [plugin]: Loading inlined plugin (defining ). INFO [karma]: Karma v0.9.4 server started at http://localhost:9876/ INFO [launcher]: Starting browser Chrome DEBUG [launcher]: Creating temp dir at /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-16492887 DEBUG [launcher]: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-16492887 --no-default-browser-check --no-first-run --no-proxy-server --disable-default-apps --start-maximized --enable-logging --v=1 http://localhost:9876/?id=16492887 DEBUG [watcher]: Resolved files: /Users/laurent/dev/karma/node_modules/karma-jasmine/lib/jasmine.js /Users/laurent/dev/karma/node_modules/karma-jasmine/lib/adapter.js /Users/laurent/dev/karma/test/client/mocks.js /Users/laurent/dev/karma/static/karma.src.js /Users/laurent/dev/karma/test/client/testacular.spec.js DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma/static/client.html DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma/static/karma.js DEBUG [karma]: New browser has connected on socket oAAWLzdgNXUQwWIpN5jh INFO [Chrome 28.0.1500 (Mac OS X 10.8.4)]: Connected on socket id oAAWLzdgNXUQwWIpN5jh DEBUG [karma]: All browsers are ready, executing DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma/static/context.html DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma-jasmine/lib/jasmine.js DEBUG [web server]: serving: /Users/laurent/dev/karma/node_modules/karma-jasmine/lib/adapter.js DEBUG [web server]: serving: /Users/laurent/dev/karma/test/client/mocks.js DEBUG [web server]: serving: /Users/laurent/dev/karma/static/karma.src.js DEBUG [web server]: serving: /Users/laurent/dev/karma/test/client/testacular.spec.js ....... Chrome 28.0.1500 (Mac OS X 10.8.4): Executed 7 of 7 SUCCESS (0.064 secs / 0.01 secs) DEBUG [launcher]: Disconnecting all browsers DEBUG [launcher]: Killing Chrome DEBUG [launcher]: Process Chrome exitted with code 0 DEBUG [launcher]: Cleaning temp dir /var/folders/mg/27j371qn68943s9ych8g50jm0000gp/T/karma-16492887thanks to http://superuser.com/questions/559950/cannot-resolve-localhost-on-mac-os-mountain-lion