Repository navigation
test: consolidate coverage around public API workflows with Vitest - #45
Merged
Merged
Conversation
Exercise operation definition, authorization, HTTP delivery, validation, and query evidence through published package entries. Keep setup local to one consumer workflow. Make Vitest the default test command and preserve existing Bun coverage in required checks during the incremental migration.
Replace the Bun and Playwright Test suites with one Vitest configuration and command. Exercise supported package entries through operation, HTTP, message, Worker, and real Chromium app workflows; remove private state, protocol-helper, markup, and CSS implementation tests. Reuse the public runtime workflows against the npm archive. Retain public consumer type checks, enforce public test imports, and preserve the gallery and playground under dev. Update CI and desktop actions to run the unified suite. Verified with bun run check (102 tests), including Chromium, packed consumer and starter checks, plus bun run check:workflows.
Protect consumer guarantees omitted when consolidating the test suite: readable phone and desktop layouts throughout real request transitions, formatting edge cases in rendered reports, explicit nonce-compatible stylesheet installation per document, and logging failure isolation and spoof rejection. Exercise bridge overload, cancellation recovery, and transport disposal through an actual iframe. Keep all behavioral checks in the existing public Vitest suite, with no private imports or new test runner. Validation: bun run check passes, including 109 tests across seven files and packed-consumer and starter checks.
Split app workflows by authoring, export, presentation, views, reporting, embedding, and runtime behavior so each consumer capability can be reviewed and run independently with the existing Vitest browser fixture. Prefer roles and accessible names for headings, controls, feedback, and regions. Render app-owned calculation results as labelled native outputs, replacing test IDs and result selectors. Retain scoped text queries for prose without a meaningful role, and document the query and organization conventions for contributors. Validation: bun run check passes, including all 109 tests across 13 files, packed-consumer checks, and starter checks.
Exercise controlled inspection opening and closing requests before owner approval, and observe all host logger invocations before filtering so malformed delivery cannot evade assertions. Render same-shaped views through public APIs and reject foreign datasets, metrics, exports, and story evidence while retaining a successful owned-view workflow. Give ordinary iframe requests a ten-second deadline and select the one-second deadline only in the timeout workflow to avoid cancellation races. Validation: focused browser workflows and bun run check pass, including 115 tests across 13 files, packed-consumer checks, and starter checks.
Restore mobile interaction coverage alongside viewport layout checks with a targeted Chromium phone context using mobile and touch emulation. Exercise region selection, comparison controls, outside-tap calendar dismissal, inspection opening and closing, and filter persistence after reload through accessible queries and touch actions. Add viewport metadata to the consumer fixture so the emulated phone uses its actual screen width. Keep the existing Vitest runner and browser fixture lifecycle. Validation: focused mobile workflow and bun run check pass, including 116 tests across 13 files, packed-consumer checks, and starter checks.
|
@francoischalifour #45 currently conflicts with |
redox
approved these changes
Oct 7, 2026
Resolve the main merge while preserving one public Vitest suite. Keep annotation client and routing workflows, add screenshot-backed browser feedback and retry coverage, preserve displayed input during refresh, and exercise public appearance overrides. Keep developer fixtures under dev and source/style integrity checks under check:styles, rather than reintroducing Bun or Playwright Test runners. Preserve main’s annotation and styling implementations and development-server reload behavior. Validation: bun run check and bun run check:workflows pass, including 130 tests across 15 files, packed-consumer checks, and starter checks.
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.
Why
The existing suite split behavioral testing between Bun tests and Playwright Test. Many tests imported private modules, fabricated internal state, or asserted implementation details. This made refactoring expensive and distributed the testing conventions across several mechanisms.
The goal is a simpler foundation: only high-level public API tests, run with Vitest. Tests should describe what an app author, host integration, or reader can do with the package, and verify the results they observe.
For example, a filter change should prove that the displayed results, inspection evidence, and exported data remain consistent during refresh and failure. It should exercise the public client and view APIs rather than populate a query cache or construct an internal view state.
Architecture
Replace the separate behavioral runners with one Vitest configuration and one command:
bun run testNon-browser workflows run in Node against the built package. Browser workflows use the Playwright library to launch real Chromium from Vitest. Each browser test receives a fresh context, and fixture servers use automatically assigned ports.
Tests import the package through
@altertable/data-app/<entry>. Data, authorization decisions, and failures enter through public dependency injection. Lint rules prohibit private source imports and the retired test runners.Keep typechecking, linting, packaging, and starter validation as explicit checks.
bun run checkbuilds the package and runs the complete verification sequence.Public behavior covered
The replacement suite exercises:
Ordinary iframe workflows use a longer deadline. The timeout workflow explicitly selects a short deadline so cancellation tests do not race an unrelated timeout.
Organization and maintenance
Organize browser tests by consumer capability: authoring, embedding, export, presentation, reports, runtime, and views.
Prefer queries by role and accessible name for controls, headings, regions, dialogs, and feedback. App-owned calculation results use labelled native
<output>elements. Retain scoped text queries for prose and empty-state copy without a meaningful role.Move gallery and playground assets into
dev, keeping development examples separate from test fixtures. Update contributor setup, CI, and desktop actions to use the unified suite, including installing Chromium before running checks.Verification
Integrated the latest main, including annotations and the authored styling contract. Annotation workflows cover screenshot-backed feedback, host rejection and retry, retained displayed input, and host-owned drafts across iframe replacement. Public appearance overrides run in the same Vitest suite; source/style integrity remains an explicit tooling check.
bun run checkandbun run check:workflowspass locally: 130 tests across 15 files, plus packed-consumer and starter validation.