Skip to content

Commit 5f4f3fa

Browse files
build(config): regenerate config before unit tests so runs are hermetic (#4432)
test:unit / test:unit:coverage / test:watch (and thus test, test:coverage) did not regenerate src/config/index.js first, so a run consumed whatever config the last dev/build/e2e wrote. When that file was generated under a different NODE_ENV, config keys that only exist under a project-specific env were absent, producing confusing non-deterministic failures (undefined config values -> bad URLs / ECONNREFUSED that read like broken tests). Add pretest:unit / pretest:unit:coverage / pretest:watch hooks that run generateConfig, respecting the current NODE_ENV. generateConfig already skips the write when content is byte-identical, so watch mode and concurrent workers are not disrupted. Closes #4424 Claude-Session: https://claude.ai/code/session_01XioM62H2iEMLsr686minjn
1 parent 5d88766 commit 5f4f3fa

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
"vite:preview": "vite preview",
3030
"test": "npm run test:unit",
3131
"test:all": "npm run test:unit && npm run test:e2e",
32+
"pretest:unit": "npm run generateConfig",
3233
"test:unit": "vitest run",
34+
"pretest:unit:coverage": "npm run generateConfig",
3335
"test:unit:coverage": "vitest run --coverage",
36+
"pretest:watch": "npm run generateConfig",
3437
"test:watch": "vitest",
3538
"test:coverage": "npm run test:unit:coverage",
3639
"test:e2e": "npm run generateConfig && npx playwright test --config playwright.config.js",

0 commit comments

Comments
 (0)