For some reason when trying to re-run previously passing test suites I now get a Typescript build error error TS2304: Cannot find name 'setTimeout'
I think the issue is something that arrived with a more recent Typescript version and hasn't changed since. However, I don't see a lot of examples of setTimeout not being defined so I'm stuck to know what I need to change.
Does anyone know what I can do to mitigate?
The Error
The error in full...
FAIL test/core/partition.test.ts
● Test suite failed to run
test/core/partition.test.ts:86:36 - error TS2304: Cannot find name 'setTimeout'.
86 await new Promise((resolve) => setTimeout(resolve, 10));
The failing line is this one https://github.com/cefn/lauf/blob/f95614e808df33fe951ed0830732c40307ddeee5/modules/store/test/core/partition.test.ts#L86
The failure happens against the same checked-out commit from a repo which had CI running on every commit and which previously passed.
The commit is the latest on main... https://github.com/cefn/lauf/commit/f95614e808df33fe951ed0830732c40307ddeee5
The record that this same commit passed green in the past is at https://github.com/cefn/lauf/actions/runs/1714116971/jobs/2345711821
Unfortunately the CI build steps had pnpm install without --frozen-lockfile so it's not totally clear what minor version of each package was used when it last passed (8 months ago).
Attempts to solve
It happens whether I run pnpm install --frozen-lockfile or pnpm install. The same issue remains after running pnpm up --latest across the repo to try and upgrade e.g. jest, typescript.
The same error persists if I set compilerOptions.lib:["dom", "ES2020"] in tsconfig.json and if I add testEnvironment:"jsdom" to jest.config.js