karma-runner / karma-runner/karma-coverage
Karma coverage empty with a simple sample
- Dominant language
- JavaScript
- Stars
- 771
- Forks
- 242
- PR merge metrics
- No merged PRs in 30d
Description
sample project:
https://github.com/njleonzhang/karma-study/tree/master/karma-2
Here is the config file:
```
// Karma configuration
module.exports = function(config) {
config.set({
// plugins
plugins: [
'karma-phantomjs-launcher',
'karma-coverage'
],
// list of files / patterns to load in the browser
files: [
'src/index.js',
'test/index.js'
],
reporters: ['coverage'],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/index.js': ['coverage']
},
coverageReporter: {
dir: './coverage',
// includeAllSources: true,
reporters: [
{ type: 'lcov', subdir: '.' },
{ type: 'text-summary' }
]
},
// enable / disable colors in the output (reporters and logs)
colors: true,
.....
}
```
result:
```
=============================== Coverage summary===============================
Statements : 100% ( 0/0 )
Branches : 100% ( 0/0 )
Functions : 100% ( 0/0 )
Lines : 100% ( 0/0 )
================================================================================
```
version:
"karma": "^1.7.1",
"karma-coverage": "^1.1.1",
Contributor guide
Research direction
Reproduce the report using the linked karma-2 sample project and its Karma configuration, focusing on src/index.js, test/index.js, and the coverage preprocessor settings. Compare the generated coverage output with the sample's execution, then verify that the coverage summary reports the expected source files and non-zero totals.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100