Skip to content

Commit

Permalink
Fix JS errors with branchData property
Browse files Browse the repository at this point in the history
  • Loading branch information
tntim96 committed Nov 1, 2012
1 parent 3dd50ce commit 5130913
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/resources/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ try {

if (! top.opener._$jscoverage) {
top.opener._$jscoverage = {};
top.opener._$jscoverage.branchData = {};
}
}
}
Expand All @@ -22,6 +23,7 @@ try {

if (! top._$jscoverage) {
top._$jscoverage = {};
top._$jscoverage.branchData = {};
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/jscoverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function jscoverage_init(w) {
if (! jscoverage_isInvertedMode) {
if (! w._$jscoverage) {
w._$jscoverage = {};
w._$jscoverage.branchData = {};
}
}
}
Expand Down Expand Up @@ -496,6 +497,8 @@ function jscoverage_recalculateSummaryTab(cc) {
var file;
var files = [];
for (file in cc) {
if (file === 'branchData')
continue;
files.push(file);
}
if (files.length === 0)
Expand Down Expand Up @@ -1092,6 +1095,8 @@ function jscoverage_quote(s) {
function jscoverage_serializeCoverageToJSON() {
var json = [];
for (var file in _$jscoverage) {
if (file === 'branchData')
continue;
var coverage = _$jscoverage[file];

var array = [];
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ if (! window.jscoverage_report) {
var json = [];
for (var file in _$jscoverage) {
var coverage = _$jscoverage[file];
if (file === 'branchData')
continue;

var array = [];
var length = coverage.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ public void shouldInstrumentForFileSystem() throws URISyntaxException {

String expectedSource = IoUtils.loadFromClassPath("/test-instrumented-file-system.js");
// assertThat(instrumentedSource, equalTo(expectedSource));
//IoUtils.copy(new StringReader(instrumentedSource), new File("src/test-integration/resources/test-instrumented-file-system.js"));
assertEquals(expectedSource, instrumentedSource);//.replaceAll("\r\n","\n"));
}

Expand All @@ -388,6 +389,7 @@ public void shouldInstrumentForServer() throws URISyntaxException {

String expectedSource = IoUtils.loadFromClassPath("/test-instrumented-server.js");
// assertThat(instrumentedSource, equalTo(expectedSource));
//IoUtils.copy(new StringReader(instrumentedSource), new File("src/test-integration/resources/test-instrumented-server.js"));
assertEquals(expectedSource, instrumentedSource);//.replaceAll("\r\n","\n"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ try {

if (! top.opener._$jscoverage) {
top.opener._$jscoverage = {};
top.opener._$jscoverage.branchData = {};
}
}
}
Expand All @@ -22,6 +23,7 @@ try {

if (! top._$jscoverage) {
top._$jscoverage = {};
top._$jscoverage.branchData = {};
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/test-integration/resources/test-instrumented-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ if (! window.jscoverage_report) {
var json = [];
for (var file in _$jscoverage) {
var coverage = _$jscoverage[file];
if (file === 'branchData')
continue;

var array = [];
var length = coverage.length;
Expand Down Expand Up @@ -89,6 +91,7 @@ try {

if (! top.opener._$jscoverage) {
top.opener._$jscoverage = {};
top.opener._$jscoverage.branchData = {};
}
}
}
Expand All @@ -107,6 +110,7 @@ try {

if (! top._$jscoverage) {
top._$jscoverage = {};
top._$jscoverage.branchData = {};
}
}
}
Expand Down

0 comments on commit 5130913

Please sign in to comment.