test: migrate from Web Test Runner to Vitest#21
Merged
cristinecula merged 6 commits intomainfrom Feb 7, 2026
Merged
Conversation
- Replace WTR with Vitest for test infrastructure - Add dual project setup: unit tests (jsdom) and storybook tests (browser) - Migrate unit tests (fetch, path) to Vitest syntax with vi.* mocks - Convert UI tests (render, item-click, use-pref) to Storybook interaction tests - Add @storybook/addon-vitest integration for browser-based testing - Update package.json scripts: test, test:unit, test:storybook, test:watch NEO-927
a0c3b6b to
1ddedec
Compare
|
- Add @types/react for Storybook type definitions - Add skipLibCheck to tsconfig.json for Storybook type compatibility - Fix unused 'within' import in render.stories.ts - Fix window type casts in use-pref.stories.ts
- Create stories/helpers/render-hook.ts utility for testing Pion hooks - Use Storybook args pattern in render.stories.ts instead of window globals - Simplify use-pref.stories.ts using renderHook utility - Remove all window global usage from story tests
cristinecula
commented
Feb 6, 2026
This was referenced Feb 6, 2026
Replace local stories/helpers/render-hook.ts with @Neovici/testing@2.2.0 which now provides the same renderHook functionality for Pion hooks.
Contributor
Author
|
@megheaiulian I removed the custom renderHook |
- Add HTML snapshots to RenderNavTest, RenderNavWithCallbacks, and RenderPaginationTest - Use vitest expect for snapshot assertions (storybook/test uses Chai which lacks snapshot support) - Snapshots capture DOM structure before user interactions
114fc09 to
5ef94aa
Compare
Move snapshot assertions out of story play functions to avoid vitest expect being bundled into the deployed Storybook UI, which caused 'Cannot read properties of undefined' errors. The interaction tests remain and provide sufficient coverage.
megheaiulian
approved these changes
Feb 7, 2026
|
🎉 This PR is included in version 1.6.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
Changes
Infrastructure
vitest.config.tswith two projects:unit: jsdom environment for pure logic testsstorybook: browser mode with Playwright for UI tests.storybook/main.jsto include@storybook/addon-vitest.storybook/vitest.setup.tsfor Storybook project annotationspackage.jsonscripts:test,test:unit,test:storybook,test:watchDependencies
vitest,jsdom,@vitest/browser,@vitest/browser-playwright,@storybook/addon-vitest,playwrightsinon,@open-wc/testing,@open-wc/testing-helpers,@web/test-runner-playwright,@types/mocha,@neovici/testing,shadow-dom-testing-libraryTests
fetch.test.tsandpath.test.tsfrom Mocha/Chai/sinon to Vitestrender,item-click, anduse-preftests to Storybook interaction testsTest Results
All 41 tests pass:
NEO-927