Skip to content

Commit

Permalink
Merge pull request #70 from elwayman02/fix-renamer
Browse files Browse the repository at this point in the history
Fix renamer, lcov check was not accessing the proper object
  • Loading branch information
jschilli committed Jun 11, 2015
2 parents 13a08aa + 92c6b75 commit 651aac7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/reporters/lcov-reporter.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
var Reporter = require('../reporter');

var lcovRecord = function(data) {
var str = "",
var str = '',
lineHandled = 0,
lineFound = 0,
fileName = data.fileName;

if(this.options.lcovOptions && this.options.lcovOptions.renamer){
fileName = this.options.lcovOptions.renamer(fileName);
if (this.options.cliOptions && this.options.cliOptions.lcovOptions && this.options.cliOptions.lcovOptions.renamer){
fileName = this.options.cliOptions.lcovOptions.renamer(fileName);
}

str += 'SF:' + fileName + '\n';
Expand Down
8 changes: 5 additions & 3 deletions tests/unit/reporters/lcov-reporter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ describe('LCOV Reporter', function() {
it('should replace modules names with file names when requested', function () {
var expectedOutput = fs.readFileSync(path.join(__dirname, '../../fixtures/lcov-output-with-renamer.dat'), 'utf8');
var reporter = new LCOVReporter({
lcovOptions: {
renamer: function(moduleName){
return moduleName.replace(/^todomvc-ember-cli/, 'something-else');
cliOptions: {
lcovOptions: {
renamer: function (moduleName) {
return moduleName.replace(/^todomvc-ember-cli/, 'something-else');
}
}
}
});
Expand Down

0 comments on commit 651aac7

Please sign in to comment.