diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/073_worker_error.ts | 5 | ||||
-rw-r--r-- | cli/tests/073_worker_error.ts.out | 5 | ||||
-rw-r--r-- | cli/tests/074_worker_nested_error.ts | 5 | ||||
-rw-r--r-- | cli/tests/074_worker_nested_error.ts.out | 5 | ||||
-rw-r--r-- | cli/tests/integration_tests.rs | 12 | ||||
-rw-r--r-- | cli/tests/subdir/worker_error.ts | 5 |
6 files changed, 37 insertions, 0 deletions
diff --git a/cli/tests/073_worker_error.ts b/cli/tests/073_worker_error.ts new file mode 100644 index 000000000..736c4fde6 --- /dev/null +++ b/cli/tests/073_worker_error.ts @@ -0,0 +1,5 @@ +const worker = new Worker( + new URL("subdir/worker_error.ts", import.meta.url).href, + { type: "module", name: "bar" }, +); +setTimeout(() => worker.terminate(), 30000); diff --git a/cli/tests/073_worker_error.ts.out b/cli/tests/073_worker_error.ts.out new file mode 100644 index 000000000..412ab3376 --- /dev/null +++ b/cli/tests/073_worker_error.ts.out @@ -0,0 +1,5 @@ +[WILDCARD]error: Uncaught (in worker "bar") Error: foo[WILDCARD] + at foo ([WILDCARD]) + at [WILDCARD] +error: Uncaught Error: Unhandled error event reached main worker. + at Worker.#poll ([WILDCARD]) diff --git a/cli/tests/074_worker_nested_error.ts b/cli/tests/074_worker_nested_error.ts new file mode 100644 index 000000000..975d897ca --- /dev/null +++ b/cli/tests/074_worker_nested_error.ts @@ -0,0 +1,5 @@ +const worker = new Worker( + new URL("073_worker_error.ts", import.meta.url).href, + { type: "module", name: "baz" }, +); +setTimeout(() => worker.terminate(), 30000); diff --git a/cli/tests/074_worker_nested_error.ts.out b/cli/tests/074_worker_nested_error.ts.out new file mode 100644 index 000000000..412ab3376 --- /dev/null +++ b/cli/tests/074_worker_nested_error.ts.out @@ -0,0 +1,5 @@ +[WILDCARD]error: Uncaught (in worker "bar") Error: foo[WILDCARD] + at foo ([WILDCARD]) + at [WILDCARD] +error: Uncaught Error: Unhandled error event reached main worker. + at Worker.#poll ([WILDCARD]) diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index d7786e966..0c11ea75e 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2136,6 +2136,18 @@ fn _066_prompt() { util::test_pty(args, output, input); } +itest!(_073_worker_error { + args: "run -A 073_worker_error.ts", + output: "073_worker_error.ts.out", + exit_code: 1, +}); + +itest!(_074_worker_nested_error { + args: "run -A 074_worker_nested_error.ts", + output: "074_worker_nested_error.ts.out", + exit_code: 1, +}); + itest!(js_import_detect { args: "run --quiet --reload js_import_detect.ts", output: "js_import_detect.ts.out", diff --git a/cli/tests/subdir/worker_error.ts b/cli/tests/subdir/worker_error.ts new file mode 100644 index 000000000..495971090 --- /dev/null +++ b/cli/tests/subdir/worker_error.ts @@ -0,0 +1,5 @@ +function foo() { + throw new Error("foo"); +} + +foo(); |