Skip to content

Instantly share code, notes, and snippets.

@y-lohse
Last active August 29, 2015 14:10
Show Gist options
  • Save y-lohse/4b09cdf3a2fae560a65f to your computer and use it in GitHub Desktop.
Save y-lohse/4b09cdf3a2fae560a65f to your computer and use it in GitHub Desktop.
Karma wildcard autowatch

Steps to reproduce:

  • place ignored.js in a subfolder called wc
  • run npm install
  • start the tests karma start karma.conf.js
  • edit wc/ignored.js

The tests are not re-run when wc/ignored.js is edited, but they are when index.js is.

//This file should be in a subfolder called "wc", but gists don't allow that
it('should restart the tests when edited but it doesnt', function(){
expect(true).toBe(true);
});
it('should restart the tests when edited', function(){//and it does indeed
expect(true).toBe(false);
});
module.exports = function(config){
config.set({
basePath : './',
files : [
'index.js',
'wc/*',
],
exclude : [],
preprocessors: {},
autoWatch : true,
singleRun: false,
usePolling: true,
frameworks: ['jasmine'],
browsers : ['Chrome'],
reporters: ['progress'],
plugins : [
'karma-chrome-launcher',
'karma-jasmine',
],
})}
{
"name": "karmatest",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"jasmine-core": "^2.1.2",
"karma": "^0.12.25",
"karma-chrome-launcher": "^0.1.5",
"karma-jasmine": "^0.3.0"
}
}
@maksimr
Copy link

maksimr commented Nov 21, 2014

karma-jasmine will fall if it used not inside describe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment