Skip to content

Migrate from AVA to Node.js native test runner #344

Closed

Description

@parkerbxyz

Summary

Migrate from AVA to the Node.js native test runner (node:test) with built-in snapshot support. This would replace AVA's binary snapshot format with human-readable text-based snapshots that are more Git-friendly.

Motivation

AVA stores snapshots in a binary format (tests/snapshots/index.js.snap), which is inefficient for Git — binary files produce no meaningful diffs and bloat repository history. The Node.js native test runner (available since v22.3.0, stable since v23.4.0) provides snapshot support that generates human-readable CommonJS text files, making snapshot changes easy to review in pull requests.

Why this is straightforward

  • Only one file (tests/index.js, ~30 lines) uses AVA directly. All 22 .test.js files are standalone Node.js scripts with no AVA imports.
  • Direct API mapping: test() → test(), t.snapshot() → t.assert.snapshot()
  • The execa subprocess spawning pattern, c8 coverage, and all test helpers remain unchanged.

Prerequisites

  • Node.js ≥22 (for snapshot support in node:test). This should be revisited after upgrading to Node 24, where snapshot testing is fully stable.

Implementation outline

  1. package.json: Remove ava from devDependencies, update test script from c8 --100 ava tests/index.js to c8 --100 node --test tests/index.js
  2. tests/index.js: Replace import test from "ava" with import { test } from "node:test", change t.snapshot(value, label) to t.assert.snapshot(value)
  3. Delete tests/snapshots/ directory (binary AVA snapshot files)
  4. Generate new text-based snapshots with node --test --test-update-snapshots tests/index.js
  5. Verify all 22 tests pass with 100% code coverage

Activity

  1. self-assigned this
    on Mar 13, 2026
  2. added 4 commits that reference this issue on Mar 13, 2026
    dea3da2
    3676088
    016c18d
    f863ba5
  3. create-app-token-action-releaser commented on Mar 13, 2026

    @create-app-token-action-releaser
    Contributor

    🎉 This issue has been resolved in version 3.0.0-beta.5 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

  4. added 2 commits that reference this issue on Mar 14, 2026
    70835b0
    68c2ded
  5. create-app-token-action-releaser commented on Mar 14, 2026

    @create-app-token-action-releaser
    Contributor

    🎉 This issue has been resolved in version 3.0.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

  6. added a commit that references this issue on Mar 14, 2026
    496a7ac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions