Skip to content

Commit 6255301

Browse files
committed
Prevent uncaught errors to make test fails when they are expected and are fired during template effects flush
1 parent 997ccef commit 6255301

File tree

1 file changed

+4
-3
lines changed
  • packages/svelte/tests/runtime-legacy

1 file changed

+4
-3
lines changed

packages/svelte/tests/runtime-legacy/shared.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,11 @@ async function run_test_variant(
450450
'Expected component to unmount and leave nothing behind after it was destroyed'
451451
);
452452

453-
// TODO: This seems useless, unhandledRejection is only triggered on the next task
454-
// by which time the test has already finished and the next test resets it to null above
453+
// uncaught errors like during template effects flush
455454
if (unhandled_rejection) {
456-
throw unhandled_rejection; // eslint-disable-line no-unsafe-finally
455+
if (!config.expect_unhandled_rejections) {
456+
throw unhandled_rejection; // eslint-disable-line no-unsafe-finally
457+
}
457458
}
458459
}
459460
}

0 commit comments

Comments
 (0)