From 89f0b796bd442ff352c3f93f69156ca6d85bfd5e Mon Sep 17 00:00:00 2001 From: Mohammad Sulaiman Date: Tue, 5 Nov 2024 08:39:05 +0200 Subject: chore: deprecate run itests (#26444) --- tests/specs/run/unhandled_rejection_sync_error/__test__.jsonc | 4 ++++ .../unhandled_rejection_sync_error.ts | 6 ++++++ .../unhandled_rejection_sync_error.ts.out | 6 ++++++ 3 files changed, 16 insertions(+) create mode 100644 tests/specs/run/unhandled_rejection_sync_error/__test__.jsonc create mode 100644 tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts create mode 100644 tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts.out (limited to 'tests/specs/run/unhandled_rejection_sync_error') diff --git a/tests/specs/run/unhandled_rejection_sync_error/__test__.jsonc b/tests/specs/run/unhandled_rejection_sync_error/__test__.jsonc new file mode 100644 index 000000000..3f09f9c36 --- /dev/null +++ b/tests/specs/run/unhandled_rejection_sync_error/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --check unhandled_rejection_sync_error.ts", + "output": "unhandled_rejection_sync_error.ts.out" +} diff --git a/tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts b/tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts new file mode 100644 index 000000000..0dabb1cb7 --- /dev/null +++ b/tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts @@ -0,0 +1,6 @@ +globalThis.addEventListener("unhandledrejection", (e) => { + console.log("unhandled rejection at:", e.promise, "reason:", e.reason); + e.preventDefault(); +}); + +throw new Error("boom!"); diff --git a/tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts.out b/tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts.out new file mode 100644 index 000000000..0c1115ef2 --- /dev/null +++ b/tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts.out @@ -0,0 +1,6 @@ +[WILDCARD] +unhandled rejection at: Promise { + Error: boom! + at file:///[WILDCARD]unhandled_rejection_sync_error.ts:6:7 +} reason: Error: boom! + at file:///[WILDCARD]unhandled_rejection_sync_error.ts:6:7 -- cgit v1.2.3