diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-10-20 05:05:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-20 15:05:42 +1100 |
commit | 7aba07cc7711adfa774afd8e77695f386127c4bc (patch) | |
tree | 3325f296ed175cf61b845fa0673e8356f84913b1 /cli/tests | |
parent | 57e95032c898cfdfe795e6924d402fdbe2ae59a8 (diff) |
fix(cli/worker): Print error stacks from the origin Worker (#7987)
Fixes #4728
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(); |