Karma singleRun

On my local machine I want npm test to watch files and re-test on change, so I use singleRun: false in karma.conf.js. This is pretty standard.

On Travis. this causes a timeout error. How do I override the singleRun option for travis-ci environment only?

Hi @Northskool,

For this, you can use node’s process.env function to set a local var to the value of CI (or false if unset), then use this as the value for singleRun in the config.

So your karma.conf.js will look something like this:

const ci = process.env.CI || false

module.exports = function(config) {
  config.set({
    singleRun: ci,
    ...
 }
}
1 Like