Skip to content

Commit

Permalink
#1030@trivial: Fixes failing unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
capricorn86 committed Sep 6, 2023
1 parent 4570bac commit 67608e5
Showing 1 changed file with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,9 @@ async function itObservesUncaughtExceptions(): Promise<void> {

observer.disconnect();

const actualConsoleOutput = window.happyDOM.virtualConsolePrinter
.readAsString()
.replace(/[\s0-9]|\(file:.+\/happy-dom\//gm, '');
const expectedConsoleOutput = `Test error
Error: Test error
at Timeout.eval [as _onTimeout] (eval at <anonymous> (file:///home/user/happy-dom/packages/happy-dom/lib/nodes/html-script-element/HTMLScriptElement.js:171:126), <anonymous>:5:31)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)`.replace(
/[\s0-9]|\(file:.+\/happy-dom\//gm,
''
);

if (actualConsoleOutput !== expectedConsoleOutput) {
const consoleOutput = window.happyDOM.virtualConsolePrinter.readAsString();

if (consoleOutput.startsWith('Error: Test error\nat Timeout.eval')) {
throw new Error(`Console output not correct.`);
}

Expand Down

0 comments on commit 67608e5

Please sign in to comment.