• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1const {test, afterEach} = require('node:test');
2const assert = require('node:assert');
3const { waitForAbort } = require('./wait-for-abort-helper');
4
5let testCount = 0;
6let signal;
7
8afterEach(() => {
9  assert.equal(signal.aborted, false);
10
11  waitForAbort({ testNumber: ++testCount, signal });
12});
13
14test("sync", (t) => {
15  signal = t.signal;
16  assert.equal(signal.aborted, false);
17  throw new Error('failing the sync test');
18});
19
20test("async", async (t) => {
21  await null;
22  signal = t.signal;
23  assert.equal(signal.aborted, false);
24  throw new Error('failing the async test');
25});
26