Skip to content

Make Async Array tests deterministic - #1889

Closed
Trivikram Kamat (trivikr) wants to merge 1 commit into
microsoft:mainfrom
trivikr:test-client-node-async-array-foreach
Closed

Trivikram Kamat (trivikr) wants to merge 1 commit into
microsoft:mainfrom
trivikr:test-client-node-async-array-foreach

Conversation

@trivikr

@trivikr Trivikram Kamat (trivikr) commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Found while working on #1888. Before that change, build/bin/all.js ignored sub-package exit codes, so this intermittent failure never failed CI.

The map, mapAsync and forEach tests asserted that the helpers yielded at least once, but yielding is time based (2ms in test mode). On fast machines the whole array was processed before the threshold, so the tests failed intermittently.

Stall on the first item for longer than the yield threshold so the first time check always triggers a yield.

The map, mapAsync and forEach tests asserted that the helpers yielded
at least once, but yielding is time based (2ms in test mode). On fast
machines the whole array was processed before the threshold, so the
tests failed intermittently.

Stall on the first item for longer than the yield threshold so the
first time check always triggers a yield.
@dbaeumer

Copy link
Copy Markdown
Member

Trivikram Kamat (@trivikr) thanks. I fixed this yesterday using a fake timer.

@trivikr
Trivikram Kamat (trivikr) deleted the test-client-node-async-array-foreach branch October 16, 2026 15:57
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