mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-26 06:34:20 +08:00
node:test changes, matching Node 24.22: - A subtest cancelled because its parent timed out has its mocks restored and its mock timers reset when it is cancelled, as Node's postRun resets the test's mock tracker. Before, a mocked method stayed mocked for the tests that ran after it. - Its afterEach chain and t.after hooks run at the next turn, once the runner has moved on to the next test, as Node runs them when the cancelled test's own run resumes. Before, they never ran. The chain is copied when the test is cancelled, since its ancestors drop their hooks when they finish. - Its hooks are then dropped, so closures that capture its context do not keep it alive. The registration parent is still not restored when the cancelled body settles: it belongs to the test that runs then. The timeout-cancel-cleanup fixture records the mocked method and the hook order against the next test's body and compares them with Node, plain and with SCRIPTC_SAN=1. It fails without this change.