Skip to content

Fix flaky tests on src/validations/theme.test.ts #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025
Merged

Conversation

karreiro
Copy link
Contributor

@karreiro karreiro commented Jul 21, 2025

The tests were a bit flaky due to a race condition in the beforeEach setup. The code used forEach with async operations to create test directories, but forEach doesn't wait for async functions to complete.

That caused a race between directory creation and test execution, leading to ENOENT errors when tests tried to write files before directories existed.

The fix involved replacing forEach with Promise.all() to ensure all directory creation operations are completed before test execution begins. This change eliminates the timing-dependent behavior that caused the intermittent failures.

Before:

image

After:

image

@karreiro karreiro requested a review from Arkham July 21, 2025 11:34
@karreiro karreiro requested a review from a team as a code owner July 21, 2025 11:34
@karreiro karreiro merged commit 0c32ffa into main Jul 21, 2025
4 checks passed
@github-actions github-actions bot mentioned this pull request Aug 14, 2025
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.

2 participants