summaryrefslogtreecommitdiff
path: root/cli/js/dispatch_json_test.ts
blob: 11dadc620d91ba18c5813a98201af16646115009 (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 \\(.*dispatch_json\\.ts:.*\\)
    at Object.sendAsync \\(.*dispatch_json\\.ts:.*\\)
    at async Object\\.open \\(.*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);
      }
    );
});