From 5dbc07935d47eaad48ba0a7b1a816c644f9446cd Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 6 Dec 2022 15:58:18 -0500 Subject: fix(test): handle scenario where --trace-ops would cause an unhandled promise rejection (#16970) Closes #16969 --- cli/tests/testdata/test/trace_ops_caught_error/main.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cli/tests/testdata/test/trace_ops_caught_error/main.ts (limited to 'cli/tests/testdata/test/trace_ops_caught_error/main.ts') diff --git a/cli/tests/testdata/test/trace_ops_caught_error/main.ts b/cli/tests/testdata/test/trace_ops_caught_error/main.ts new file mode 100644 index 000000000..8194a8b2a --- /dev/null +++ b/cli/tests/testdata/test/trace_ops_caught_error/main.ts @@ -0,0 +1,12 @@ +Deno.test("handle thrown error in async function", async () => { + const dirPath = Deno.makeTempDirSync(); + const filePath = `${dirPath}/file.txt`; + try { + await Deno.stat(filePath); + } catch { + await Deno.writeTextFile(filePath, ""); + } finally { + await Deno.remove(filePath); + await Deno.remove(dirPath); + } +}); -- cgit v1.2.3