- Need to configure
grunt-mocha-blanket
to pass LCOV info over (via https://github.com/alex-seville/blanket/blob/91528273af0fe495fdefd4ef8854d4a8a14ed56c/src/reporters/lcov_reporter.js#L27)- Should be able to pass it in via blanket events (like in the reporter https://github.com/ModelN/grunt-blanket-mocha/blob/063457ffdf4d83861dc01c5eff4f5530dac90964/support/grunt-reporter.js#L69)
- Write the coverage content into a string in the task (somewhere in https://github.com/ModelN/grunt-blanket-mocha/blob/063457ffdf4d83861dc01c5eff4f5530dac90964/tasks/blanket_mocha.js#L99).
- Might need to create a new option for the name of the LCOV file.
- Write to destination with something like https://github.com/kmiyashiro/grunt-mocha/blob/ce7fc530d33cf30fa7cc0f74b346ebc36a2061fe/tasks/mocha.js#L283
- Some initial work seems to be done via GruntBlanketMocha/grunt-blanket-mocha#22
Last active
August 29, 2015 14:07
-
-
Save naganowl/7b0ca4d282382f31bdae to your computer and use it in GitHub Desktop.
Adding LCOV generation to `grunt-mocha-blanket` to enhance `chaplin-mocha-grunt`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if window.PHANTOMJS or window.location.search.indexOf('cov=true') >= 0 | |
# Synchronously get Blanket. | |
request = new XMLHttpRequest() | |
request.open 'GET', '../vendor/bower/blanket/dist/qunit/blanket.js', no | |
request.send() | |
script = document.createElement 'script' | |
script.type = 'text/javascript' | |
# There is no event fired when HTML report is added to tests. | |
script.text = request.responseText + | |
# Add checkbox to toggle uncovered branches/lines. | |
""" | |
(function() { | |
var report = blanket.report; | |
blanket.report = function() { | |
report.apply(blanket, arguments); | |
$("#blanket-main .rs:contains('100 %')") | |
.parent(":not('.grand-total')").hide(); | |
$(".bl-success:not(.grand-total) > .rs:nth-child(4)").each(function() { | |
var statements = this.innerHTML.split('/'); | |
if (statements[1] != 0 && statements[0]/statements[1] !== 1) { | |
$(this.parentNode).show(); | |
} | |
}); | |
} | |
})(); | |
""" | |
script.setAttribute( | |
'data-cover-adapter' | |
'../node_modules/grunt-blanket-mocha/support/mocha-blanket.js' | |
) | |
script.setAttribute 'data-cover-flags', 'branchTracking' | |
script.setAttribute 'data-cover-never', '[\'templates\']' | |
script.setAttribute( | |
'data-cover-only' | |
'//src/(controllers|ext|lib|models|views)/' | |
) | |
script.setAttribute( | |
'data-cover-reporter' | |
'../vendor/bower/blanket/src/reporters/lcov_reporter.js' | |
) | |
script.setAttribute( | |
'data-cover-reporter-options' | |
'{ "toHTML": false}' | |
) | |
(document.body || document.head).appendChild script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment