diff --git a/packages/internal-test-helpers/lib/ember-dev/assertion.ts b/packages/internal-test-helpers/lib/ember-dev/assertion.ts index 2f8f188d565..d931654d383 100644 --- a/packages/internal-test-helpers/lib/ember-dev/assertion.ts +++ b/packages/internal-test-helpers/lib/ember-dev/assertion.ts @@ -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); };