Skip to content

fix(tap): exclude nested node_modules from test file discovery - #209

Merged
mroderick merged 1 commit into
mainfrom
fix/taprc-exclude-nested-node-modules
Sep 7, 2026
Merged

mroderick merged 1 commit into
mainfrom
fix/taprc-exclude-nested-node-modules

Conversation

@mroderick

Copy link
Copy Markdown
Contributor

Fixes a flaky ENOENT: unlink './idempotency.db' failure in test:verify-coverage-min.

Root cause: the .taprc include glob packages/frameworks/**/*.test.js matches test files reached through pnpm workspace symlinks inside node_modules (for example packages/frameworks/express/node_modules/@idempot/sqlite-store/sqlite.test.js, which resolves back to packages/stores/sqlite/sqlite.test.js). The existing exclude: node_modules/** only matches a root-level node_modules, so tap ran the same file twice in parallel. The sqlite store's default path is the CWD-relative ./idempotency.db, so the two workers raced on one physical file; whichever worker ran its cleanup unlinkSync second threw ENOENT.

Change: add **/node_modules/** to the exclude list (the original root-level pattern stays). Symlinked duplicates no longer run; the real test files still run and still feed coverage.

Verification: two consecutive test:verify-coverage-min runs pass at 100% coverage on this branch, where the duplicate previously made the gate fail roughly once every few runs locally. CI stayed green only by scheduling luck.

All duplicates reachable through node_modules symlinks (same file as a real test elsewhere)
  • packages/frameworks/express/node_modules/@idempot/sqlite-store/sqlite.test.jspackages/stores/sqlite/sqlite.test.js
  • packages/frameworks/bun/node_modules/@idempot/core/tests/fingerprint.test.jspackages/core/tests/fingerprint.test.js
  • packages/frameworks/fastify/node_modules/@idempot/core/tests/errors.test.jspackages/core/tests/errors.test.js
  • packages/frameworks/hono/node_modules/@idempot/core/tests/validation.properties.test.jspackages/core/tests/validation.properties.test.js
  • packages/stores/redis/node_modules/@idempot/core/tests/content-negotiation.test.jspackages/core/tests/content-negotiation.test.js
  • packages/frameworks/fastify/node_modules/fastify/test/conditional-pino.test.js (upstream fastify test, also matched by the framework glob)

Excluding these also stops the duplicated execution time and coverage double-counting they caused.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying idempot-js with  Cloudflare Pages  Cloudflare Pages

Latest commit: dfebe37
Status: ✅  Deploy successful!
Preview URL: https://819b0b60.idempot-js.pages.dev
Branch Preview URL: https://fix-taprc-exclude-nested-nod.idempot-js.pages.dev

View logs

@mroderick
mroderick marked this pull request as ready for review September 7, 2026 10:00
@mroderick
mroderick merged commit a328215 into main Sep 7, 2026
13 checks passed
@mroderick
mroderick deleted the fix/taprc-exclude-nested-node-modules branch September 7, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant