Skip to content

Commit

Permalink
Replace the setup-qunit rejects implementation Ember.onerror -> windo…
Browse files Browse the repository at this point in the history
…w.onerror
  • Loading branch information
NullVoxPopuli committed Apr 29, 2024
1 parent bd99e65 commit 4493832
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/internal-test-helpers/lib/ember-dev/setup-qunit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Ember from 'ember';

import { getDebugFunction, setDebugFunction } from '@ember/debug';
import { DEBUG } from '@glimmer/env';

Expand All @@ -13,8 +11,6 @@ import type { DebugEnv } from './utils';
import { setupWarningHelpers } from './warning';

declare global {
let Ember: any;

interface Assert {
rejects(promise: Promise<any>, expected?: string | RegExp, message?: string): Promise<any>;

Expand Down Expand Up @@ -55,9 +51,9 @@ export default function setupQUnit() {
message?: string
) {
let error: unknown;
let prevOnError = Ember.onerror;
let prevOnError = window.onerror;

Ember.onerror = (e: Error) => {
window.onerror = (e: string | Event) => {
error = e;
};

Expand All @@ -77,7 +73,7 @@ export default function setupQUnit() {
message
);

Ember.onerror = prevOnError;
window.onerror = prevOnError;
};

QUnit.assert.throwsAssertion = function (
Expand Down

0 comments on commit 4493832

Please sign in to comment.