Skip to content

fix: convert jest.config-e2e from ESM to CJS to fix Node 24 Windows e2e#2306

Merged
ava-silver merged 4 commits into
masterfrom
ava.silver/chore/fix-windows-e2e-node24-ebadf
May 5, 2026
Merged

fix: convert jest.config-e2e from ESM to CJS to fix Node 24 Windows e2e#2306
ava-silver merged 4 commits into
masterfrom
ava.silver/chore/fix-windows-e2e-node24-ebadf

Conversation

@ava-silver

@ava-silver ava-silver commented May 4, 2026

Copy link
Copy Markdown
Contributor

What and why?

After a windows-latest runner image update (git 2.54.0 → 2.53.0), two CI failures appeared on master:

1. Windows e2e EBADF crash (all Node versions)

EBADF: bad file descriptor, fstat in node:internal/modules/esm/translators killed jest before any tests ran. Root cause: the e2e project setup calls yarn set version stable without a .yarnrc.yml, so Yarn 4 defaults to PnP mode. PnP hooks into Node's ESM loader for module resolution, which calls createCJSModuleWrap when loading CJS packages. On the updated runner, this fstat call fails with EBADF.

Fix: write nodeLinker: node-modules into .yarnrc.yml after yarn set version stable so the e2e project uses regular node_modules instead of PnP.

2. Windows Node 22 unit test crash

Jest workers crashed immediately on startup with "4 child process exceptions" when NODE_OPTIONS: -r dd-trace/ci/init loaded [email protected]. Nodes 20 and 24 were unaffected. Upgrading to 5.99.1 resolves the incompatibility with the updated runner's Node 22.

Both failures were reproducible on Corentin's unrelated PR, confirming they are runner regressions.

How?

  • .github/workflows/ci.yml: add echo "nodeLinker: node-modules" >> .yarnrc.yml after yarn set version stable in both e2e project setup steps (Linux and Windows)
  • package.json: bump dd-trace from 5.72.0 to 5.99.1
  • jest.config-e2e.mjsjest.config-e2e.js: converted to CJS as belt-and-suspenders alongside the nodeLinker fix

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)

The .mjs extension forces Node's ESM loader which calls createCJSModuleWrap
when wrapping ts-jest (a CJS module). On the updated windows-latest runner
(git 2.53.0), Node 24 throws EBADF: bad file descriptor during this CJS wrap.

Converting to .js (CJS by default, no "type": "module" in package.json)
avoids the ESM/CJS interop layer entirely.

Confirmed: same EBADF failure appears on Corentin's unrelated PR, showing
this is a runner image regression not specific to any code change.

ava-silver commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

@ava-silver ava-silver added the chores Related to the CI or developer experience label May 4, 2026
@ava-silver
ava-silver marked this pull request as ready for review May 4, 2026 20:46
@ava-silver
ava-silver requested a review from a team as a code owner May 4, 2026 20:46
@ava-silver
ava-silver requested a review from Drarig29 May 4, 2026 20:49
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Co-authored-by: Corentin Girard <[email protected]>
@ava-silver
ava-silver merged commit ac11958 into master May 5, 2026
74 of 80 checks passed
@ava-silver
ava-silver deleted the ava.silver/chore/fix-windows-e2e-node24-ebadf branch May 5, 2026 15:59
@ava-silver ava-silver mentioned this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chores Related to the CI or developer experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants