Migrate from AVA to Node.js native test runner (original) (raw)

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

Prerequisites

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