feat(test-utils): Add vitest infrastructure with browser commands#10064
Open
chrisgervang wants to merge 8 commits intochr/test-utils-vitest-entryfrom
Open
feat(test-utils): Add vitest infrastructure with browser commands#10064chrisgervang wants to merge 8 commits intochr/test-utils-vitest-entryfrom
chrisgervang wants to merge 8 commits intochr/test-utils-vitest-entryfrom
Conversation
377c434 to
6405bc2
Compare
f32303d to
b3812bc
Compare
c6b6e8c to
63446d4
Compare
b3812bc to
b49edc7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
b30d4db to
41e35a3
Compare
9211999 to
c337c4e
Compare
Add vitest configuration and setup files for running tests: - vitest.config.ts with node/scripts/headless/browser/render projects - test/setup/vitest-node-setup.ts with JSDOM polyfills and typed array equality - test/setup/vitest-browser-setup.ts with browser test driver bridge - test/setup/browser-commands.ts with captureAndDiffScreen and emulateInput - test/setup/vitest-browser-commands.d.ts with TypeScript declarations Add package.json scripts: test-headless, test-render, test-browser, test-ci Add devDependencies: @vitest/browser-playwright, @vitest/coverage-v8, @probe.gl/test-utils, pixelmatch, playwright, pngjs, sharp Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reduces code duplication between vitest-node-setup.ts and vitest-browser-setup.ts by extracting to typed-array-equality.ts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change import from @vitest/browser/context to vitest/browser to fix deprecation warning in newer vitest versions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… browser project - Add vitest/browser to optimizeDepsConfig to prevent flaky tests - Remove test/render/**/*.spec.ts from browser project (use render project instead) - Add clarifying comments throughout config Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use node project which includes test/smoke/**/*.spec.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1e3b04e to
eb67e83
Compare
The polyfills package has .node extension files that vitest/ESM cannot resolve. JSDOM already provides the browser APIs that polyfills would provide (TextEncoder, TextDecoder, atob, btoa, etc.) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests both node and headless browser environments in smoke test to verify vitest infrastructure works end-to-end. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
felixpalmer
approved these changes
Mar 10, 2026
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
Adds comprehensive vitest infrastructure for multi-environment testing: Node.js, scripts, headless browser (JSDOM), real browser (Playwright), and visual regression testing.
Change List
Closes #
Note
Medium Risk
Touches core test/CI wiring by introducing multi-project Vitest configuration, Playwright installation on postinstall, and new screenshot/input browser command plumbing; this may cause CI flakiness or platform-specific failures (native
sharp, golden image diffs).Overview
Adds a multi-project Vitest configuration (
node,scripts,headless,browser,render) with shared aliases, dependency pre-bundling, static asset serving, and optional V8 coverage for browser runs.Introduces custom Vitest browser commands (
captureAndDiffScreen,emulateInput,isHeadless) to replace@probe.gl/test-utils’swindow.browserTestDriver_*APIs, including Playwright screenshot capture +pixelmatch/sharpdiffing and iframe-aware input emulation.Updates test bootstrapping via new
vitest-node-setupandvitest-browser-setup(typed-array equality for tape compatibility, JSDOM polyfills for node, and a bridge wiringwindow.browserTestDriver_*tovitest/browsercommands), and extendspackage.jsonwith Playwright install + new focused test scripts and dependencies.Written by Cursor Bugbot for commit 908731d. This will update automatically on new commits. Configure here.