Jasmine + Karma skipping tests

Hi everyone. I am having a bit of an issue that I can not seem to figure out for the past couple of days. 

 

I am using Node + Karma + Jasmine to do Unit tests for my Javascript project. 

When i run Karma + Jasmine for the first time in webstorm all my test run fine, as of now i have 75 tests. If i run the tests again from the run window it only executes 49 of the tests and when i look at the results, some of the test files have not run. It stays that way. Some time it will not catch the changes to files as well.  

 

I have tried a bunch of things like disabling cache and running chrome in Incognito mode but neither works. The only way I can consitantly get all tests to run is either Close webstorm and reopen it or refresh the chrome browser running karma.

Any feedback would be greatly appreciated and thanks for taking the time to read and help with this issue. 

 

3 comments
Comment actions Permalink

haven't heard of such issues... Test project (or, at least, karma configuration file plus package.json) would be helpful.

More questions:

- when you change nothing in your tests/sources and just hit Rerun, do you see all your tests?

- if you change a single test file and re-run, do you see all tests from this file?

- do you have 'auto-run' enabled?

 

The more infor you can provide the better, as right now I have no clue what is going on

0
Comment actions Permalink

Hi Elena. 

 

Here is some more feedback. 

  • When the test rerun i do not see all of them running. Thr first time runs all 15 test files,but every time after that only runs 12 of them.
  • The changed tests sometimes are not updated when the tests run again.
  • I have auto run enabled, but i have tried with out it also.

 

Bellow are my Karma and Package code:

{
"name": "fdmb_html5",
"version": "1.0.0",
"description": "Testing Require.js code with Karma\r ==================================",
"main": "karma.conf.js",
"directories": {
"test": "test"
},
"dependencies": {
"generator-jasmine": "^0.2.2",
"jasmine": "^2.4.1",
"jasmine-core": "^2.4.1",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.2",
"karma-jasmine": "^0.3.6",
"karma-requirejs": "^0.2.2",
"requirejs": "^2.1.22"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Nestor Correa",
"license": "ISC"
}
// Karma configuration
// Generated on Mon Dec 21 2015 15:26:05 GMT-0500 (Eastern Standard Time)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine', 'requirejs'],


// list of files / patterns to load in the browser
files: [
{pattern: 'lib/**/*.js', included: false},
{pattern: 'src/**/*.js', included: false},
{pattern: 'test/**/*Spec.js', included: false},
{pattern: 'test/stubs/**/*.json', included: true},
{pattern: 'test/stubs/**/*.xml', included: false, served:true},

'test/test-main.js'
],


// list of files to exclude
exclude: [
//'src/App.js'
],

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

// Concurrency level
// how many browser should be started simultanous
concurrency: Infinity
})
};

 

 

 

0
Comment actions Permalink

can't recreate using same config and packages... Can you try composing a sample project that shows up the issue, if providing actual project is not an option?

0

Please sign in to leave a comment.