Open matthughes opened 10 years ago
@matthughes is this still an issue with the latest versions of grunt-karma/karma?
I'm able to reproduce this on grunt-karma 0.9.0 with karma 0.12.24.
When a watched file changes, Karma loads the config, then I get one of the following:
No captured browser, open http://localhost:9876/
, as @matthughes got.There is no server listening on port 9876
.Waiting for previous execution...
.Fatal error: read ECONNRESET
)I'm using PhantomJS as a browser and webpack for preprocessing.
Running singleRun
tests without watch works fine.
Here's my config:
grunt.initConfig({
// ...
karma: {
options: {
configFile: 'karma.config.js',
},
unit: {
singleRun: true
},
watch: {
background: true,
singleRun: false,
autoWatch: false
}
},
watch: {
test: {
options: {
spawn: false,
interrupt:true
},
files: ["test/**/*.js","src/**/*.js"],
tasks: ["karma:watch:run"]
}
}
});
grunt.registerTask("test", "karma:unit");
grunt.registerTask("testWatch", ["karma:watch:start", "watch:test"]);
Have you installed the appropriate launchers (e.g. karma-runner/karma-chrome-launcher for Chrome)? Because I had the very same issue until I found out that launchers are separate plugins although Karma config documentation says that the launcher for Chrome comes installed with Karma.
Yeah I have the phantomjs launcher installed and it works fine when I run it normally. This problem only occurs with watch.
On Sun, Jan 4, 2015 at 1:29 PM, erik wienhold notifications@github.com wrote:
Have you installed the appropriate launchers (e.g. karma-runner/karma-chrome-launcher https://github.com/karma-runner/karma-chrome-launcher for Chrome)? Because I had the very same issue until I found out that launchers are separate plugins.
— Reply to this email directly or view it on GitHub https://github.com/karma-runner/grunt-karma/issues/84#issuecomment-68647581 .
Have anyone come with a solution to this problem yet?
I'm also struggling with this issue, anyone got a fix?
What I've been doing is using nodemon
to kick of my tests when something changes, rather than using grunt watch
, but I'd prefer to use watch
I'm seeing this same issue with a very vanilla karma install (no grunt etc)
I solved this problem by downgrading to Phantom 1.9.8, seemed to work OK once I'd done this
+1
I see this warning although my tests seem to be running OK anyway.
Lol
Same problem here... does only occur when autowach
is active
Using the following config:
My goal is to have karma start up the background thread and then repeatedly run tests against it when files change. However, when I run 'testwatch', it appears the karma:unit:run tries to run before the Karma server really has had a chance to finish starting:
My browser does start and is connected to the aforementioned address, but it just appears to be a timing issue. If I modify a file after the initial startup, the tests run and are able to connect to the browser. That makes me think that 'karma:watch:start' does not wait until the browser is truly up and connected.