Skip to content

test(core): use unique temp file paths in extends config tests#1080

Merged
fi3ework merged 1 commit intomainfrom
fix/flaky-extends-test
Mar 20, 2026
Merged

test(core): use unique temp file paths in extends config tests#1080
fi3ework merged 1 commit intomainfrom
fix/flaky-extends-test

Conversation

@fi3ework
Copy link
Copy Markdown
Member

Summary

Background

The extends.test.ts unit tests are flaky on CI (macOS and Windows). Rsbuild's loadConfig cache-busts native import() using ?t=${Date.now()}, which has millisecond resolution. Sequential tests that reuse the same temp config file path can collide when two loadConfig calls land in the same millisecond, causing Node.js to return the previous test's cached module.

Implementation

  • Generate a unique config file path per test case via crypto.randomUUID() instead of sharing a single fixed path.
  • Switch cleanup from beforeEach to afterEach since paths are now created inside each test.

User Impact

None — test-only change.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Rsbuild's loadConfig cache-busts native import() with Date.now(),
which has millisecond resolution. Sequential tests reusing the same
file path can collide and receive a stale cached module. Use
crypto.randomUUID() to generate a unique config path per test case.
@fi3ework fi3ework changed the title fix(core): use unique temp file paths in extends config tests test(core): use unique temp file paths in extends config tests Mar 20, 2026
@fi3ework fi3ework merged commit 6682e52 into main Mar 20, 2026
18 checks passed
@fi3ework fi3ework deleted the fix/flaky-extends-test branch March 20, 2026 06:53
@9aoy 9aoy mentioned this pull request Mar 26, 2026
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