Skip to content

feat(preferred): add wait-for-expect replacements - #1109

Open
Creatixpy wants to merge 1 commit into
e18e:mainfrom
Creatixpy:feat/wait-for-expect-replacements
Open

feat(preferred): add wait-for-expect replacements#1109
Creatixpy wants to merge 1 commit into
e18e:mainfrom
Creatixpy:feat/wait-for-expect-replacements

Conversation

@Creatixpy

@Creatixpy Creatixpy commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Closes #1099.

Add wait-for-expect to the preferred manifest, mapping it to the existing node:test and vitest replacements. Projects already using either runner can remove the extra dependency and use the runner's built-in assertion retries.

The migration guide shows how waitForExpect(checkReady, 4500, 50) becomes vi.waitFor(checkReady, { timeout: 4500, interval: 50 }) or t.waitFor(checkReady, { timeout: 4500, interval: 50 }). Both examples preserve asynchronous assertion callbacks and await. The guide explains that callbacks must throw or reject to trigger a retry; returning false alone does not cause another attempt.

The explicit options preserve the package's default timeout and interval. Both runners otherwise default to a shorter 1,000 ms timeout, and matching settings does not guarantee identical scheduling or timeout behavior. The guide also documents minimum versions and Vitest's automatic advancement of fake timers.

One commit changes only manifests/preferred.json and docs/modules/wait-for-expect.md.

Validation

  • Package build, lint, PR manifest validation, and git diff --check passed using Node 24.18.0 and pnpm 10.33.3.
  • Both sides of the documentation examples were extracted and executed in disposable fixtures using wait-for-expect 4.0.0, Vitest 0.34.5 and 5.0.0, and node:test. All six runner/version combinations passed on Node 22.22.2 and 24.18.0, including examples with readiness delayed beyond the runners' default one-second timeout.
  • Additional fixture checks passed for synchronous and asynchronous assertion retries, persistent failure, custom timeout/interval settings, non-throwing callbacks, and Vitest fake timers. Validation fixtures remain outside the contribution.
  • Verified the built preferredReplacements and all exports, replacement references, and documentation URL.
  • All five GitHub checks passed on 9d94d9f: the Node 20.x, 22.x, 24.x, and latest build/lint matrix, plus PR validation.

Implementation assisted by AI tools.

@Creatixpy

Copy link
Copy Markdown
Contributor Author

Hi @43081j and @dreyfus92, thanks again for your feedback on #1105!

When you have time, I'd appreciate your review of this PR and whether the mapping and migration guide follow the project's guidelines and fit its preferred structure. If you spot a missed case, a compatibility concern, or a simpler approach, please point it out — I'm happy to make any changes needed to align with the project's requirements.

If you have any questions about the changes or validation, please feel free to ask.

Thanks for your time!

@dreyfus92

Copy link
Copy Markdown
Member

we appreciate your efforts, but please stop pinging us. also please respect the pr's template, your agent shouldn't be overwriting it.

we will review it eventually when time & energy matches, thanks again ✌🏻

@Creatixpy

Copy link
Copy Markdown
Contributor Author

Thanks for pointing that out; I will update the PR documentation to comply with the repository's rules as soon as possible. Also, I won't tag you unless you let me know that it's allowed in a specific case; I apologize for that and really appreciate the feedback. We're in this together to drive improvements.

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.

[Replacement]: wait-for-expect

2 participants