Conversation
Adds native integration with Vitest v4's visual regression testing using the screenshot comparator API. This allows developers to use Vitest's native toMatchScreenshot matcher with Vizzly's visual testing platform. Features: - Native Vitest API - use toMatchScreenshot with no custom matchers - Screenshot comparator integration using Vitest's comparator API - Per-screenshot properties for multi-variant testing via comparatorOptions - TDD mode - local comparison with honeydiff and interactive dashboard - Cloud mode - team collaboration with visual reviews in web dashboard - Automatic mode detection and routing (TDD vs Cloud) - TypeScript support with module augmentation - Full ESM package (no build step required) The comparator receives pixel data from Vitest, converts to PNG using pngjs, and routes to either the TDD service (local) or screenshot server (cloud). Baselines are stored in .vizzly/baselines/ via custom resolveScreenshotPath. Package includes: - @vizzly-testing/vitest - Standalone SDK in clients/vitest/ - Unit tests validating plugin configuration and behavior - E2E test project demonstrating real-world usage - GitHub workflow for automated npm releases - Complete documentation and TypeScript declarations
This comment was marked as resolved.
This comment was marked as resolved.
- Remove examples/vitest-browser/ (duplicate of tests/integration/vitest-plugin/e2e/) - Remove docs/vitest-integration.md (all docs in clients/vitest/README.md) - Revert root README.md changes (no need to document in root)
- Move tests from tests/integration/vitest-plugin/ to clients/vitest/tests/ - Update CI workflow to run tests from client directory - Add test scripts to package.json (test:unit, test:e2e, test) - Update README with correct test paths - Fix import paths in unit tests - Follows same pattern as other client packages
- Remove duplicate package.json/package-lock.json from tests/e2e/ - Move vitest.config.js to root of vitest client package - Add Vitest dependencies to main package.json devDependencies - Update test scripts to run from package root - Update CI workflow paths - Simpler structure: one package.json, one lock file
|
@claude can you rereview this PR? |
This comment was marked as resolved.
This comment was marked as resolved.
Completely replaces Vitest's native screenshot testing by extending expect API with custom toMatchScreenshot matcher. This bypasses Vitest's baseline checking entirely and communicates directly with Vizzly server via HTTP POST. Changes: - Add setup.js that extends expect with custom matcher in browser context - Update plugin to inject setup file and pass env vars via define - Split unit and E2E tests into separate configs - Clean up properties API - first-class top-level options - Disable Vitest's native system with screenshotFailures: false - Remove --update flag hack from test-runner and CI workflow - Update README with implementation details The custom matcher captures screenshots in browser and POSTs directly to Vizzly server. In cloud mode tests always pass. In TDD mode comparison results are returned from local server.
Removed dead code and updated all documentation for initial v0.1.0 release: - Remove unused vizzlyComparator function and pixelDataToPNG helper - Remove pngjs import (no longer needed) - Update CHANGELOG with accurate features for custom matcher approach - Update package.json description to "Drop-in replacement" - Update TypeScript declarations to match actual API - Update file header comments to reflect implementation - Simplify setup.js options extraction (no backward compatibility needed) All tests passing. Package ready for npm publish.
dc1bf1f to
8a0b640
Compare
|
@claude rereview this PR -- the approach is completely different from the first two reviews now. |
This comment was marked as resolved.
This comment was marked as resolved.
- **Vitest SDK**: Send file paths directly from browser to server - **Client SDK**: Send file paths directly instead of converting to base64 - **TDD/API handlers**: Support both file paths and base64 (backward compatible) - **New utility**: image-input-detector for identifying input type - **Tests**: Updated to reflect new file path behavior This eliminates unnecessary file reading and base64 conversion in the client, making all test runners (Vitest, Playwright, Puppeteer) consistent.
- Remove unused toMatchScreenshot export from index.js (actual implementation is in setup.js) - Remove getTDDService helper and TDD service code (not needed in Node context) - Enhance error handling in setup.js with specific error types - Add baseline acceptance workflow note to README - Update TypeScript declarations to match actual exports - Fix unit tests to verify setup.js-based implementation
e0748d5 to
a485ec9
Compare
|
@claude rereview this PR |
|
Claude finished @Robdel12's task —— View job Re-reviewing PR: Vitest Browser Mode Plugin
|
Base64-encoded images can contain '/' as a valid base64 character. The previous detection logic checked for file paths before validating base64, causing base64 strings with '/' to be misidentified as file paths. Changed detection priority to check base64 validation FIRST, then file path patterns. This ensures base64 strings (even with '/') are correctly identified, while still supporting all file path variations. Fixes CI failure where PNG screenshots were treated as file paths.

Vitest Browser Mode Integration
This PR adds a Vitest v4 browser mode plugin that completely replaces Vitest's native visual testing with Vizzly.
Implementation
The plugin works by:
expectAPI with a customtoMatchScreenshotmatcher via a browser-side setup filescreenshotFailures: falseAPI
Users just add the plugin - no test changes required:
Files Changed
clients/vitest/src/setup.js(NEW) - Custom matcher implementation in browser contextclients/vitest/src/index.js- Plugin that injects setup file and passes env varsclients/vitest/vitest.e2e.config.js(NEW) - E2E test configurationclients/vitest/tests/- Updated tests for new implementationclients/vitest/README.md- Updated docs.github/workflows/ci.yml- Removed unnecessary --update flagsrc/services/test-runner.js- Removed wrong --update flag logicTesting