karma-runner / karma-runner/karma-coverage
Suddenly, no coverage reports are generated anymore. Require.js incompatibility?
- Dominant language
- JavaScript
- Stars
- 771
- Forks
- 242
- PR merge metrics
- No merged PRs in 30d
Description
Currently, I do not get the coverage reporter to work anymore. I have the following karma.conf.js:
`
// Karma configuration
// Generated on Tue Jan 19 2016 15:33:28 GMT+0100 (Mitteleuropäische Zeit)
module.exports = function(config) {
"use strict";
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: ["mocha", 'requirejs', 'chai'],
plugins : ['karma-ie-launcher', 'karma-firefox-launcher', 'karma-chrome-launcher', 'karma-coverage', "karma-mocha", 'karma-requirejs', 'karma-chai'],
// list of files / patterns to load in the browser
files: [
//config for require.js
{pattern: 'test/browser/test-main.js', included: true, watched: true},
//the code to test
{pattern: 'src/test-test/**/*.js', included: false, watched: true, served: true},
//the actual tests
{pattern: 'test/browser/**/*.js', included: false, watched: true}
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'**/src/test-test/**/*.js': ["coverage"]
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage'],
// 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_DEBUG,
// 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: ['Firefox', 'Chrome', 'IE'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
coverageReporter: {
instrumenterOptions: {
istanbul: { noCompact: true }
}
}
});
```
};
`
The test-main.js for require.js adds all test files to the require.js config. All required files are being loaded and the tests run. When inspecting the code within the browser, I noticed, that the src/test-test/*_._.js are not instrumented.
Is something wrong with the preprocessors or is it an incompatibility with require.js?
The very same configuration used to work and the reports were generated under coverage/... Unfortunately, I lost track by which update it stopped working.
Contributor guide
Research direction
Start with karma.conf.js and test/browser/test-main.js, then inspect the preprocessors entry for src/test-test/**/*.js and the RequireJS loading path. Reproduce the browser run and verify whether the loaded source files are instrumented and whether coverage/... reports are generated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100