Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only specifying some types of watermarks results in an error #144

Closed
nmalaguti opened this issue Apr 14, 2015 · 2 comments
Closed

Only specifying some types of watermarks results in an error #144

nmalaguti opened this issue Apr 14, 2015 · 2 comments

Comments

@nmalaguti
Copy link
Contributor

This is blocked by issue #143.

Specifying only statements and lines results in an error from Istanbul.

coverageReporter: {
  watermarks: {
    statements: [ 50, 75 ],
    lines: [ 50, 75 ]
  }
}
ERROR [coverage]: [TypeError: Cannot read property '1' of undefined]
TypeError: Cannot read property '1' of undefined
    at Object.module.exports.classFor (karma-coverage/node_modules/istanbul/lib/report/common/defaults.js:22:29)
    at tableRow (karma-coverage/node_modules/istanbul/lib/report/text.js:119:49)
    at walk (karma-coverage/node_modules/istanbul/lib/report/text.js:159:20)
    at karma-coverage/node_modules/istanbul/lib/report/text.js:162:9
    at Array.forEach (native)
    at walk (karma-coverage/node_modules/istanbul/lib/report/text.js:161:19)
    at TextReport.Report.mix.writeReport (karma-coverage/node_modules/istanbul/lib/report/text.js:200:9)
    at writeReport (karma-coverage/lib/reporter.js:69:16)
    at karma-coverage/lib/reporter.js:304:13
    at Array.forEach (native)

This appears to be because Istanbul expects the watermarks object to have all 4 types specified. I'm not sure if this is an issue with Istanbul or if karma-coverage should merge any specified watermarks with a set of defaults.

From https://github.com/gotwarlost/istanbul/blob/master/lib/report/common/defaults.js:

{
  statements: [ 50, 80 ],
  lines: [ 50, 80 ],
  functions: [ 50, 80],
  branches: [ 50, 80 ]
}
nmalaguti added a commit to nmalaguti/karma-coverage that referenced this issue Apr 14, 2015
Merges in specified watermarks with the Istanbul defaults.

Closes karma-runner#144
nmalaguti added a commit to nmalaguti/karma-coverage that referenced this issue Jun 1, 2015
Merges the coverageReporter config with the options passed to
each reporter.

Merges in specified watermarks with the Istanbul defaults.

Added tests for watermarks

Closes karma-runner#143, karma-runner#144
@dignifiedquire
Copy link
Member

@nmalaguti can this be closed now that #145 is merged?

@nmalaguti
Copy link
Contributor Author

Yes. Resolved by #145.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants