According to this post (and the general internet) if I want to run a Karma test without these kinds of code coverage commands...
__cov_9C0014nbzu2SxN3FICah6Q.f['35']++;
__cov_9C0014nbzu2SxN3FICah6Q.s['138']++;
...I simply need to set the --debug option in the terminal like so:
$ karma start karma.conf.js --browsers=Chrome --single-run=false --debug
However, when running your Karma tests via a Gulp task the documentation seems to be missing. I'm using a simply karma.start config object below. I've tried setting the debug property to either true or the strign '--debug', however neither seems to have an effect (although the tests do run/the runner doesn't crash).
karma.start({
configFile: __dirname + '/karma.conf.js',
exclude: excludeFiles,
singleRun: !!singleRun,
debug: '--debug'
}, karmaCompleted);
Any ideas how to set the debug option when running your Karma tests from a Gulp task?
Setting
debug: truein the options object I pass tokarma.startworks just as well as using--debugat the command line. In other words, what you said you did in your Gulpfile works to get thedebugoption to Karma. However,No, the page you link to shows that you also need to customize your configuration to tweak the preprocessor list so that when
--debugis used the list is empty. The problem you have is consistent with having failed to perform that customization correctly.Here is how the customization could be performed. This queries the value of
config.debugfrom the configuration that Karma has already parsed from the command line:Scanning
process.argvfor--debuglike suggested on the page you took the idea from won't work when you invoke Karma from Gulp because thedebugoption is passed directly through the configuration. Inspectingconfig.debugworks both at the command line and when Karma is invoked through it's programmatic API.