I have a collection of Jest tests that run in CI. They normally pass, and when they fail, jest normally shows the error location and stack trace and failures are easy to fix.
However, occasionally, seemingly random tests fail with a mysterious stacktrace that gives no indication what the actual issue is. Instead, Jest just points to the actual test declaration function and gives no other helpful info.
What sort of failure does this indicate in Jest? I’m struggling to understand the class of issue that this indicates.
Example failure:
FAIL __test__/server/api/v1/externalApi.test.ts (338.997 s, 790 MB heap size)
● external API v1 › with base project › Should be able to get all runs for a project
372 | });
373 |
> 374 | it("Should be able to get all runs for a project", async () => {
| ^
375 | //simulate the project being published
376 | await hexVersionRepo.update(hexVersion.id, {
377 | published: true,
at it (__test__/server/api/v1/externalApi.test.ts:374:5)
at describe (__test__/server/api/v1/externalApi.test.ts:125:3)
at Object.describe (__test__/server/api/v1/externalApi.test.ts:63:1)
And then a separate log of the stacktrace shows the following:
Error:
at it (/home/circleci/project/packages/integration-tests/__test__/server/api/v1/externalApi.test.ts:374:5)
at _dispatchDescribe (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-circus/build/jestAdapterInit.js:596:26)
at describe (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-circus/build/jestAdapterInit.js:564:44)
at describe (/home/circleci/project/packages/integration-tests/__test__/server/api/v1/externalApi.test.ts:125:3)
at _dispatchDescribe (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-circus/build/jestAdapterInit.js:596:26)
at describe (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-circus/build/jestAdapterInit.js:564:44)
at Object.describe (/home/circleci/project/packages/integration-tests/__test__/server/api/v1/externalApi.test.ts:63:1)
at Runtime._execModule (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-runtime/build/index.js:1247:24)
at Runtime._loadModule (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-runtime/build/index.js:909:12)
at Runtime.requireModule (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-runtime/build/index.js:812:12)
at jestAdapter (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-circus/build/runner.js:92:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runTestInternal (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-runner/build/testWorker.js:262:16)
at runTest (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-runner/build/testWorker.js:326:7)
at Object.worker (/home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/jest-runner/build/testWorker.js:480:12)

