Skip to content

Commit

Permalink
Added some unit test logging
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Apr 8, 2020
1 parent 1593a7c commit 8e23a0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Expand Up @@ -3,7 +3,7 @@ root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
6 changes: 5 additions & 1 deletion spec/tracekit-spec.js
Expand Up @@ -117,7 +117,6 @@
//this.timeout(3000);

beforeEach(function () {

// Prevent the onerror call that's part of our tests from getting to
// mocha's handler, which would treat it as a test failure.
//
Expand All @@ -126,9 +125,14 @@
// be installed once.
oldOnErrorHandler = window.onerror;
window.onerror = function (message, url, lineNo, error) {
var shouldLog = message !== "__mocha_ignore__";
shouldLog && console.log("window.onerror(" + message + ", " + url + ", " + lineNo + ", " + error + ")");
if (message === testMessage || lineNo === testLineNo) {
shouldLog && console.log("matches test message and line number");
return true;
}

shouldLog && console.log("Calling previous handler", oldOnErrorHandler)
return oldOnErrorHandler.apply(this, arguments);
};
});
Expand Down

0 comments on commit 8e23a0b

Please sign in to comment.