Repository navigation
Chore: Use promises in the shared test suite - #331
Merged
Merged
Conversation
- Cause: 12 tests in the shared suite finished by calling `done` from a callback. A failed assertion inside a `then` callback showed up as a 5 second timeout with no message, one inside a `loaded` or `complete` callback still waited for the timeout, and the tests depended on the runner supporting `done`. - Fix: Those tests are now `async` and await a promise. Assertions stay inside the same callbacks, in the same order; each callback is wrapped so that an error thrown in it rejects the promise, and the test fails straight away with that assertion's message. - Tests: No assertion added, dropped or changed, and no `src` change. The test count is unchanged (172; 29 in webaudio.test.ts and 21 in htmlaudio.test.ts).
zbdd
added a commit
that referenced
this pull request
Nov 21, 2026
Backport of #331. (cherry picked from commit 34f44ff) - Cause: 12 tests in test/suite.ts used a `done` callback. A failed check in a `then`, `loaded` or `complete` callback never reached `done`, so it showed up only as a 5 second timeout. - Fix: Those tests are now `async` and await a promise. A failed check in a `then` callback reports the check that failed, and one in a `loaded` or `complete` callback fails immediately. - Tests: The checks are the same, in the same order.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The shared test suite had 12 tests that finished by calling
donefrom a callback. They now return a promise instead, so a failed check inside a callback fails the test straight away with its real message, and the tests no longer depend on the runner'sdonesupport.Changes
donetests intest/suite.tsare nowasyncand await a promise.thencallback used to show up only as a 5 second timeout. It now reports the check that failed.loadedorcompletecallback used to wait for the timeout as well. It now fails immediately.