Skip to content

🔧 JS SDKs: migrate tests off Vitest #142

@Robdel12

Description

@Robdel12

Summary

Migrate the JS SDK packages’ test suites off Vitest and onto Node’s built-in test runner (node:test), to match the CLI.

Context

  • CLI tests already run via node --test (see root package.json test script).
  • JS SDK packages under clients/ currently run vitest run and import from vitest in tests.

Packages

  • clients/storybook (@vizzly-testing/storybook)
  • clients/static-site (@vizzly-testing/static-site)
  • clients/vitest (@vizzly-testing/vitest) is a Vitest integration; likely keep Vitest here unless there’s a clear benefit + no loss of coverage.

Work Items

  • Replace Vitest runner scripts:
    • npm test -> node --test ...
    • npm test:watch -> node --test --watch ...
  • Rename or adjust discovery:
    • either rename tests/**/*.spec.js -> tests/**/*.test.js, or pass explicit globs so Node finds tests.
  • Port test APIs:
    • import { describe, it } from 'node:test'
    • assertions via node:assert/strict
    • replace vi.fn()/spies with node:test mock helpers (or lightweight stubs) following the CLI patterns.
  • Remove Vitest config + deps from affected packages:
    • delete vitest.config.js
    • remove vitest from devDependencies
  • Ensure CI stays green:
    • .github/workflows/ci.yml client jobs already run npm test; they should pass without Vitest.

Acceptance Criteria

  • clients/storybook: npm test passes on Node 22/24 without vitest installed.
  • clients/static-site: npm test passes on Node 22/24 without vitest installed.
  • No vitest dependency/config remains in those packages.
  • CI client jobs remain green without changing their high-level steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions