Skip to content

Commit 28155cd

Browse files
author
Chris Garrett
committed
wtf Edge
1 parent 546c308 commit 28155cd

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

packages/internal-test-helpers/lib/ember-dev/assertion.ts

+12-5
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,28 @@ export function setupAssertionHelpers(hooks: NestedHooks, env: DebugEnv) {
4343

4444
// The try-catch statement is used to "exit" `func` as soon as
4545
// the first useful assertion has been produced.
46+
let originalAssert = env.getDebugFunction('assert');
47+
4648
try {
47-
callWithStub(env, 'assert', func, (message, test) => {
49+
// Edge has issues with the callWithStub function for some reason, so we
50+
// have to do it manually here.
51+
env.setDebugFunction('assert', (message, test) => {
4852
sawCall = true;
49-
if (checkTest(test)) {
50-
return;
53+
if (!checkTest(test)) {
54+
actualMessage = message;
55+
throw BREAK;
5156
}
52-
actualMessage = message;
53-
throw BREAK;
5457
});
58+
func();
5559
} catch (e) {
5660
if (e !== BREAK) {
61+
env.setDebugFunction('assert', originalAssert);
5762
throw e;
5863
}
5964
}
6065

66+
env.setDebugFunction('assert', originalAssert);
67+
6168
check(assert, sawCall, actualMessage, expectedMessage);
6269
};
6370

0 commit comments

Comments
 (0)