Skip to content

Commit 73e4e3f

Browse files
Don’t try to call console.group unless the browser supports it.
1 parent 0312723 commit 73e4e3f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

test.new/static/js/test_helpers.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
}
1313
window.info = info;
1414

15-
// A function that acts like setTimeout, except with arguments reversed. This
15+
var CONSOLE_GROUP_SUPPORTED = ('console' in window) && console.group &&
16+
console.groupEnd;
17+
18+
// A function that acts like setTimeout, except with arguments reversed. This
1619
// is far more readable within tests.
1720
function wait(duration, fn) {
1821
return setTimeout(fn, duration);
@@ -206,7 +209,10 @@
206209
},
207210

208211
startSuite: function (suite) {
209-
console.group('Suite:', suite);
212+
if (CONSOLE_GROUP_SUPPORTED) {
213+
console.group('Suite:', suite);
214+
}
215+
210216
if (this.currentFixtures && this.currentFixtures.parentNode) {
211217
this.currentFixtures.remove();
212218
}
@@ -218,7 +224,9 @@
218224
},
219225

220226
endSuite: function (suite) {
221-
console.groupEnd();
227+
if (CONSOLE_GROUP_SUPPORTED) {
228+
console.groupEnd();
229+
}
222230
}
223231
};
224232

0 commit comments

Comments
 (0)