summaryrefslogtreecommitdiff
path: root/js/dispatch_json_test.ts
blob: 47e5cef2fa1e9448d6d52b9d13410ba926e2387d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
      }
    );
});