I use Karma as my test runner when running my unit tests and while looking at the Karma Configuration documentation, I noticed that there exists different levels of logging.
Currently, our code base uses: logLevel: config.LOG_INFO,
Is there a reason to use this one instead of the others?
Possible values:
Also, anyone have an idea of what each log level does?
The property singleRun controls how Karma executes, if set to true , Karma will start, launch configured browsers, run tests and then exit with a code of either 0 or 1 depending on whether or not all tests passed.
The Karma configuration file can be written in JavaScript, CoffeeScript, or TypeScript and is loaded as a regular Node. js module. Unless provided as argument, the Karma CLI will look for a configuration file at. ./karma.conf.js.
Karma-parallelThis npm package splits your unit tests into multiple suites that run in parallel with each other, on different threads of your processor.
Is there a reason to use this one instead of the others?
Yes they each have varying levels of output. For example when trying to debug Karma errors that are difficult to track down and not being shown in the browser console or command window output (depending on where you have the configured results to display), you can change the following value in configuration which will yield more information output:
logLevel: config.LOG_DEBUG
This will give you a 'play by play' verbose detail of the Karma output.
Also, anyone have an idea of what each log level does?
The detailed documentation is sketchy at best and even the source on Github doesn't have great details. However the constants are somewhat self explanatory. Based on another property though, it dictates that these constants provide details in descending order (DEBUG
being the most verbose, and DISABLE
being the least/nothing):
LOG_DISABLE, LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG
https://github.com/karma-runner/karma/blob/c5dc62db7642b8ca9504e71319e3b80143b8510a/docs/dev/04-public-api.md
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With