I am trying to run my javascript unit tests from my build tool gradle. If I from my project source repository run karma the tests pass, but from that same location if I run the same commands using gradle the test hangs. I have to cntl + C out.
The browser that karma launches just hangs open. Upon further inspection I can see that my tests are passing, yet the browser doesn't exit.
karma start --single-run true
08 10 2015 16:38:07.607:INFO [karma]: Karma v0.13.10 server started at http://localhost:9876/
08 10 2015 16:38:07.612:INFO [launcher]: Starting browser Safari
08 10 2015 16:38:08.349:INFO [Safari 9.0.0 (Mac OS X 10.11.0)]: Connected on socket S0oEA_C63p3UJxq_AAAA with id 27120637
08 10 2015 16:38:08.388:INFO [Safari 9.0.0 (Mac OS X 10.11.0)]: Connected on socket Sm-S0etS3fGu-MB_AAAB with id 66671614
Safari 9.0.0 (Mac OS X 10.11.0): Executed 2 of 2 SUCCESS (0.009 secs / 0 secs)
TOTAL: 2 SUCCESS
gradle karma
:karma
08 10 2015 16:50:09.773:INFO [karma]: Karma v0.13.10 server started at http://localhost:9876/
08 10 2015 16:50:09.779:INFO [launcher]: Starting browser Firefox
08 10 2015 16:50:11.201:INFO [Firefox 41.0.0 (Mac OS X 10.11.0)]: Connected on socket 9AFBXsk5EfGKsFt_AAAA with id 32194330
08 10 2015 16:50:17.260:WARN [Firefox 41.0.0 (Mac OS X 10.11.0)]: Disconnected (1 times)
> Building 0% > :karma
Gradle Task
task karma(type:Exec) {
commandLine 'karma', 'start', '--single-run true'
}
Karma Console
SUCCESS test all the core libraries debug.html:35:1
SUCCESS should be three debug.html:35:1
Skipped 0 tests debug.html:25:29
I pulled this gradle task directly from stackoverflow here
I figured it out.
In my karma.conf.js file I had
singleRun: false
once I changed it to true it worked
FIX
change this setting in your karma.conf.js file
singleRun: true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With