summaryrefslogtreecommitdiff
path: root/cli/tests/unit/dispatch_bin_test.ts
blob: 83053461d443d66d170e316c5793e94a6943459d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {
  assert,
  assertEquals,
  assertMatch,
  unitTest,
  unreachable,
} from "./test_util.ts";

const readErrorStackPattern = new RegExp(
  `^.*
    at processErr \\(.*core\\.js:.*\\)
    at opAsyncHandler \\(.*core\\.js:.*\\)
    at handleAsyncMsgFromRust \\(.*core\\.js:.*\\).*$`,
  "ms",
);

unitTest(async function sendAsyncStackTrace(): Promise<void> {
  const buf = new Uint8Array(10);
  const rid = 10;
  try {
    await Deno.read(rid, buf);
    unreachable();
  } catch (error) {
    assertMatch(error.stack, readErrorStackPattern);
  }
});

declare global {
  // deno-lint-ignore no-namespace
  namespace Deno {
    // deno-lint-ignore no-explicit-any
    var core: any; // eslint-disable-line no-var
  }
}