cli
cli copied to clipboard
test: try waiting for log and otherwise timeout
๐ Thanks for submitting a pull request! ๐
Summary
- Replace arbitrary
pause()delays with event-basedwaitForLogMatching()in integration tests to reduce flakiness - Enhance
waitForLogMatching()to check existing output buffer before listening for future events - Add configurable timeout parameter with clear error messages when events don't occur
Details
Problem: Tests used await pause(TIME) to wait for file watcher events. This is flaky because:
- On slow machines, 500ms might not be enough
- On fast machines, we wait longer than necessary
- No feedback when something actually goes wrong
Solution: Replace blind delays with waitForLogMatching() which:
- Resolves immediately when the expected log message appears
- Uses the original timeout as a maximum wait time (safety net)
- Throws a clear error if the event never happens
For us to review and ship your PR efficiently, please perform the following steps:
- [ ] Open a bug/issue before writing your code ๐งโ๐ป. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire ๐ฅ (e.g. incident related), you can skip this step.
- [ ] Read the contribution guidelines ๐. This ensures your code follows our style guide and passes our tests.
- [ ] Update or add tests (if any source code was changed or added) ๐งช
- [ ] Update or add documentation (if features were changed or added) ๐
- [ ] Make sure the status checks below are successful โ
A picture of a cute animal (not mandatory, but encouraged)
๐ Benchmark results
Comparing with beee1443c8bed59aa7d0ae381e4f299f8e8b70d7
- Dependency count: 1,044 (no change)
- Package size: 304 MB โฌ๏ธ 0.00% increase vs. beee1443c8bed59aa7d0ae381e4f299f8e8b70d7
- Number of ts-expect-error directives: 378 (no change)