Skip to content
Browse files

Fixed html report issue with Macintosh line endings (CR)

  • Loading branch information...
1 parent 8efd0e5 commit 8aed83294e6b9fdc89de7e9f2af8634adbcffc3b @asifrc asifrc committed Jan 17, 2014
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/instrumenter.js
  2. +1 −1 lib/report/html.js
View
2 lib/instrumenter.js
@@ -590,7 +590,7 @@
this.fixColumnPositions(this.coverState);
}
if (this.opts.embedSource) {
- this.coverState.code = sourceCode.split(/\r?\n/);
+ this.coverState.code = sourceCode.split(/(?:\r?\n)|\r/);
}
coverState = this.opts.debug ? JSON.stringify(this.coverState, undefined, 4) : JSON.stringify(this.coverState);
code = [
View
2 lib/report/html.js
@@ -376,7 +376,7 @@ Report.mix(HtmlReport, {
templateData = opts.templateData,
sourceText = fileCoverage.code && Array.isArray(fileCoverage.code) ?
fileCoverage.code.join('\n') + '\n' : sourceStore.get(fileCoverage.path),
- code = sourceText.split(/\r?\n/),
+ code = sourceText.split(/(?:\r?\n)|\r/),
count = 0,
structured = code.map(function (str) { count += 1; return { line: count, covered: null, text: new InsertionText(str, true) }; }),
context;

0 comments on commit 8aed832

Please sign in to comment.
Something went wrong with that request. Please try again.