Skip to content

Chore: Use promises in the shared test suite - #331

Merged
zbdd merged 2 commits into
mainfrom
zbdd/suite-promises
Nov 21, 2026
Merged

zbdd merged 2 commits into
mainfrom
zbdd/suite-promises

Conversation

@zbdd

@zbdd zbdd commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

The shared test suite had 12 tests that finished by calling done from 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's done support.

Changes

  • The 12 done tests in test/suite.ts are now async and await a promise.
  • A failed check in a then callback used to show up only as a 5 second timeout. It now reports the check that failed.
  • A failed check in a loaded or complete callback used to wait for the timeout as well. It now fails immediately.

zbdd added 2 commits November 21, 2026 17:55
- 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
zbdd merged commit 34f44ff into main Nov 21, 2026
2 checks passed
@zbdd
zbdd deleted the zbdd/suite-promises branch November 21, 2026 12:02
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.
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.

1 participant