Skip to content

Commit

Permalink
πŸ› Prevent double / async errors from being thrown during tests (#15815)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha committed Jun 4, 2018
1 parent ac711ce commit 25c220a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/_init_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ function warnForConsoleError() {
expectedAsyncErrors = [];
consoleErrorSandbox = sinon.sandbox.create();
const originalConsoleError = console/*OK*/.error;
setReportError(() => {});
consoleErrorSandbox.stub(console, 'error').callsFake((...messages) => {
const message = messages.join(' ');
if (expectedAsyncErrors.includes(message)) {
Expand Down Expand Up @@ -342,6 +343,7 @@ function dontWarnForConsoleError() {
consoleErrorSandbox = sinon.sandbox.create();
consoleErrorStub =
consoleErrorSandbox.stub(console, 'error').callsFake(() => {});
setReportError(reportError);
}

// Used to restore error level logging after each test.
Expand Down

0 comments on commit 25c220a

Please sign in to comment.