Skip to content

Fail speech tests when a test callback throws - #6048

Merged
Eugene (OEvgeny) merged 6 commits into
mainfrom
OEvgeny/fix-test-speech-helper-errors
Nov 13, 2026
Merged

Eugene (OEvgeny) merged 6 commits into
mainfrom
OEvgeny/fix-test-speech-helper-errors

Conversation

@OEvgeny

@OEvgeny Eugene (OEvgeny) commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

The speech test helpers do not fail the test when a test callback throws, so useStartDictate.html passed with the dictating class forced on.

Changelog Entry

Fixed

  • 👷🏻 Fixed speech test helpers not failing the test when its callback throws, in PR #6048, by @OEvgeny

Description

actRecognizeOnce() ran its actor inside an async Promise executor and resolved when recognition ended, so an actor error became an unhandled rejection: it failed the test only if it reached the console before the test finished, and a recognition callback error hung the test until timeout. actRecognizeOnce() now waits for both callbacks and rejects with the first error, actSpeakOnce() rethrows speak callback errors, and two hook tests now await the helper.

Design

  • actSpeak() still turns a speak callback error into a SpeechSynthesisErrorEvent, because startRecognitionAfterFailedSynthesis.html throws on purpose to simulate a failed synthesis.
  • The mocked start() keeps the frame wait from Read the store with useSyncExternalStore() #6040 before it fires recognition events; only how its errors reach the test changed.

Specific Changes

  • __tests__/assets/esm/speech/speechPageObjects.js: actRecognizeOnce() rejects when either callback throws; actSpeakOnce() rethrows errors from its speak callback

  • hooks/useStartDictate.html, hooks/useStopDictate.html: await actRecognizeOnce(…)

  • I have added tests and executed them locally

  • I have added .changelog/<PR#>-<slug>.md

  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Speech failures are observed too late, so a throwing speakActor can leave the helper pending and the rejection unhandled when the actor waits for the utterance’s end event.

1 open issue
What changed in this PR

This PR improves speech-test reliability by propagating callback failures through the test helpers and awaiting recognition in two hook tests. It preserves the recognition frame delay introduced in #6040.

Changes:

  • Coordinate recognition callbacks and propagate speech callback errors.
  • Await recognition helpers in the start/stop dictation hook tests.
  • Add a changelog entry documenting the fix.
File Description
.changelog/​6048-fix-test-speech-helper-errors.md Documents the speech-test reliability fix.
__tests__/​html2/​hooks/​useStopDictate.html Awaits the recognition helper.
__tests__/​html2/​hooks/​useStartDictate.html Awaits the recognition helper.
__tests__/​assets/​esm/​speech/​speechPageObjects.js Updates callback completion and error propagation.

Review effort: Balanced

An actor waiting for the utterance's end event never finished when the speak callback threw, so the test hung until timeout with an unhandled rejection.
@OEvgeny
Eugene (OEvgeny) merged commit 3aeefe6 into main Nov 13, 2026
46 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the OEvgeny/fix-test-speech-helper-errors branch November 13, 2026 01:58
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.

3 participants