diff options
author | Nayeem Rahman <muhammed.9939@gmail.com> | 2019-08-27 16:33:39 +0100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-08-27 11:33:39 -0400 |
commit | b6a4ec7d163810d52750f04ec2073b13f8943991 (patch) | |
tree | 5ad6f92fe6ec3b859e0c50274e28894f312ea7dd /js/dispatch_json_test.ts | |
parent | 725eb9810590e8237df68ec5580daaf0fa77e7d3 (diff) |
Improve error stacks for async ops (#2820)
Diffstat (limited to 'js/dispatch_json_test.ts')
-rw-r--r-- | js/dispatch_json_test.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/js/dispatch_json_test.ts b/js/dispatch_json_test.ts new file mode 100644 index 000000000..47e5cef2f --- /dev/null +++ b/js/dispatch_json_test.ts @@ -0,0 +1,19 @@ +import { testPerm, assertMatch, unreachable } from "./test_util.ts"; + +const openErrorStackPattern = new RegExp( + `^.* + at unwrapResponse \\(js\\/dispatch_json\\.ts:.*\\) + at sendAsync.* \\(js\\/dispatch_json\\.ts:.*\\) + at async Object\\.open \\(js\\/files\\.ts:.*\\).*$`, + "ms" +); + +testPerm({ read: true }, async function sendAsyncStackTrace(): Promise<void> { + await Deno.open("nonexistent.txt") + .then(unreachable) + .catch( + (error): void => { + assertMatch(error.stack, openErrorStackPattern); + } + ); +}); |