Skip to content

test: load runtime config tests from a temp directory - #11

Merged
3m1n3nc3 merged 1 commit into
mainfrom
fix/config-test-isolation
Nov 5, 2026
Merged

3m1n3nc3 merged 1 commit into
mainfrom
fix/config-test-isolation

Conversation

@3m1n3nc3

@3m1n3nc3 3m1n3nc3 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Fixes the failing tests in the Publish to NPM run for 1.5.0 (job). In that run, 13 Express tests got { payload: ... } with snake_case keys where they expected { data: ... }.

Cause

Two tests in tests/config.spec.ts wrote resora.config.cjs (with rootKey: 'payload' and preferredCase: 'snake') into the repository root. Vitest runs test files in parallel, so when tests/express.spec.ts loaded the runtime config at the wrong moment, it picked up that file. The failure depends on timing, which is why the same commit passed CI.

Fix

Those two tests now write the config into a temporary directory and point process.cwd() at it with vi.spyOn. Nothing is written to the repository root any more, and the backup/restore code is no longer needed.

Testing

I ran pnpm test five times while watching for resora.config.cjs in the repository root. All 234 tests passed each time, and the file never appeared. pnpm lint passes.

After this merges, re-run the publish workflow manually with version 1.5.0.

@3m1n3nc3 3m1n3nc3 self-assigned this Nov 5, 2026
@codecov

codecov Bot commented Nov 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@3m1n3nc3
3m1n3nc3 merged commit 662cc35 into main Nov 5, 2026
4 checks passed
@3m1n3nc3
3m1n3nc3 deleted the fix/config-test-isolation branch November 5, 2026 13:21
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