No Captured Browser when using with watch
See original GitHub issueUsing the following config:
grunt.initConfig({
karma: {
unit: {
options: {
autoWatch: false,
singleRun: true,
}
},
watch: {
options: {
autoWatch: false,
singleRun: false
},
background: true,
},
options: {
configFile: '<%= testFiles.karmaUnit %>',
browsers: browsers || ['Chrome']
}
},
watch: {
karma: {
files: ['karma.conf.js', 'src/main/resources/**/*.js', 'src/test/**/*.js'],
tasks: ['karma:unit:run']
},
options: {
atBegin: true
}
}
});
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('testwatch', ['karma:watch:start', 'watch:karma']);
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:
Running "karma:watch:start" (karma) task
Running "watch:karma" (watch) task
Waiting...OK
Running "karma:unit:run" (karma) task
[2014-01-06 12:11:25.495] [DEBUG] config - Loading config /Users/mhughes/ccad/development/firebird/core-plugins/silk/certificate-management/ui/karma.conf.js
No captured browser, open http://localhost:9876/
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⌚start’ does not wait until the browser is truly up and connected.
Issue Analytics
- State:
- Created 10 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Karma not running unit tests due to "No captured browser" ...
I had a face palm moment. karma start needs to be run in the same directory as your karma.conf.js file.
Read more >"WARN [karma]: No captured browser" message always ...
Expected behaviour Should not see any warnings when starting karma Actual behaviour The following output appears after i run karma start 21 ...
Read more >Unit testing JavaScript with Karma in 2021. Starting point
Karma was born in the era of AngularJS. This was a significant improvement of existed test tooling on the Web and was one...
Read more >Configuration File - Karma
The Karma configuration file can be written in JavaScript, CoffeeScript, or TypeScript and is loaded as a regular Node.js module. Unless provided as...
Read more >Step by Step Unit Testing in Angular
Unit testing is the process of software development where we will test smallest testable units or components of an application. It is also...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I see this warning although my tests seem to be running OK anyway.
Same problem here… does only occur when
autowach
is active