Skip to content

Commit

Permalink
wtf Edge
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Garrett committed Aug 14, 2019
1 parent 546c308 commit 28155cd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/internal-test-helpers/lib/ember-dev/assertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,28 @@ export function setupAssertionHelpers(hooks: NestedHooks, env: DebugEnv) {

// The try-catch statement is used to "exit" `func` as soon as
// the first useful assertion has been produced.
let originalAssert = env.getDebugFunction('assert');

try {
callWithStub(env, 'assert', func, (message, test) => {
// Edge has issues with the callWithStub function for some reason, so we
// have to do it manually here.
env.setDebugFunction('assert', (message, test) => {
sawCall = true;
if (checkTest(test)) {
return;
if (!checkTest(test)) {
actualMessage = message;
throw BREAK;
}
actualMessage = message;
throw BREAK;
});
func();
} catch (e) {
if (e !== BREAK) {
env.setDebugFunction('assert', originalAssert);
throw e;
}
}

env.setDebugFunction('assert', originalAssert);

check(assert, sawCall, actualMessage, expectedMessage);
};

Expand Down

0 comments on commit 28155cd

Please sign in to comment.