From 28155cdd331fbf84bbcdec6bba34ca6caa810807 Mon Sep 17 00:00:00 2001 From: Chris Garrett Date: Tue, 13 Aug 2019 19:26:22 -0700 Subject: [PATCH] wtf Edge --- .../lib/ember-dev/assertion.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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); };