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/report_error_handled/__test__.jsonc | 4 ++++ .../run/report_error_handled/report_error_handled.ts | 19 +++++++++++++++++++ .../report_error_handled/report_error_handled.ts.out | 13 +++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 tests/specs/run/report_error_handled/__test__.jsonc create mode 100644 tests/specs/run/report_error_handled/report_error_handled.ts create mode 100644 tests/specs/run/report_error_handled/report_error_handled.ts.out (limited to 'tests/specs/run/report_error_handled') diff --git a/tests/specs/run/report_error_handled/__test__.jsonc b/tests/specs/run/report_error_handled/__test__.jsonc new file mode 100644 index 000000000..126687b95 --- /dev/null +++ b/tests/specs/run/report_error_handled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet report_error_handled.ts", + "output": "report_error_handled.ts.out" +} diff --git a/tests/specs/run/report_error_handled/report_error_handled.ts b/tests/specs/run/report_error_handled/report_error_handled.ts new file mode 100644 index 000000000..d18996c13 --- /dev/null +++ b/tests/specs/run/report_error_handled/report_error_handled.ts @@ -0,0 +1,19 @@ +addEventListener("error", (event) => { + console.log({ + cancelable: event.cancelable, + message: event.message, + filename: event.filename?.slice?.(-100), + lineno: event.lineno, + colno: event.colno, + error: event.error, + }); + event.preventDefault(); +}); + +onerror = (event) => { + console.log("onerror() called", event.error); +}; + +console.log(1); +reportError(new Error("foo")); +console.log(2); diff --git a/tests/specs/run/report_error_handled/report_error_handled.ts.out b/tests/specs/run/report_error_handled/report_error_handled.ts.out new file mode 100644 index 000000000..89fa30314 --- /dev/null +++ b/tests/specs/run/report_error_handled/report_error_handled.ts.out @@ -0,0 +1,13 @@ +1 +{ + cancelable: true, + message: "Uncaught Error: foo", + filename: "[WILDCARD]/report_error_handled.ts", + lineno: 18, + colno: 13, + error: Error: foo + at [WILDCARD]/report_error_handled.ts:18:13 +} +onerror() called Error: foo + at [WILDCARD]/report_error_handled.ts:18:13 +2 -- cgit v1.2.3