test: #10 set up vitest and add initial audio tests#11
Merged
Conversation
- Cover global state sharing across hook instances - Verify source reset and autoPlay behavior
- Cover source reset, seek deferral, error state, and event fanout - Verify hook state sharing and autoPlay behavior
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
Set up Vitest-based testing infrastructure and add initial unit tests for the audio manager and hook.
Related Issues
Changes
We needed a lightweight test runner to validate the global singleton audio manager and the React hook behavior without
introducing heavy setup or browser-based E2E tooling. Since this package is distributed as an ESM + TypeScript library,
the test tool needed to align with that environment and keep configuration overhead low.
Vitest was chosen because it is ESM‑friendly out of the box, integrates cleanly with TypeScript, and provides fast
feedback for library development. It also works well with @testing-library/react for hook tests and supports jsdom, which
lets us mock Audio/DOM APIs and test our logic without real media files or a full browser.
In short, Vitest gives us the simplest path to reliable unit/hook tests while matching the project’s ESM/TS setup and
keeping maintenance cost small.
setup with minimal configuration and fast feedback for library development.
real media files or a browser.
dependent tests stable and prevents runtime errors.
metadata, error state, stop behavior, event fanout).
scripts and dev dependencies.
How To Test
npm run test
Checklist
Breaking Changes (if any)
None.
Notes For Reviewers
None
Screenshots / Recordings (if UI changes)
N/A