Skip to content

[3c] Add test system: Vitest for unit tests + Playwright for browser smoke tests #28

@kalwalt

Description

@kalwalt

Summary

Add a test system — Vitest for unit tests and Playwright for browser-level smoke tests; wire up npm test

Environment

  • Product/Service: FeatureSET-Display — Testing infrastructure
  • Files: package.json, new tests/ directory

Problem Description

No tests exist today. There is no npm test script, no unit tests, and no automated verification that the wasm module loads correctly in a browser context. Changes to the native or JS layer cannot be validated before merging.

Expected Behavior

  • npm test runs the full test suite.
  • Unit tests cover JS-layer logic (gray → RGBA conversion, event dispatch, API methods).
  • A browser-level smoke test loads a known marker file and asserts the canvas is non-empty after processing.
  • Tests are fast enough to run in CI on every PR.

Actual Behavior

No tests exist. No npm test script. No CI validation.

Tasks

  • Pick a runner: recommend Vitest for unit tests + Playwright for browser smoke test
  • Write unit tests for key JS-layer logic (at minimum: pixel conversion in src/ARFset.js, API method contracts)
  • Write a Playwright smoke test that loads a known marker, runs the full pipeline, and asserts the canvas is non-empty
  • Add a npm test script to package.json
  • Wire the test suite into CI (see issue 3d)

Impact

High (long-term) — Without tests, regressions from any of the other roadmap changes cannot be caught automatically. Should be added before or alongside the major cleanup work (2d, 3a, 3b).

Additional Context

Vitest is recommended over Jest for its native ESM support and speed. Playwright is recommended for browser tests because it can run a real wasm module in a headless Chromium — jsdom cannot execute wasm. A single end-to-end smoke test covering marker load + canvas output provides the highest confidence with the least maintenance burden to start.

Dependencies: Toolchain refresh (3a) should land first so tests run against the updated build output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions