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
package.json: Remove ava from devDependencies, update test script from c8 --100 ava tests/index.js to c8 --100 node --test tests/index.js
tests/index.js: Replace import test from "ava" with import { test } from "node:test", change t.snapshot(value, label) to t.assert.snapshot(value)
- Delete
tests/snapshots/ directory (binary AVA snapshot files)
- Generate new text-based snapshots with
node --test --test-update-snapshots tests/index.js
- Verify all 22 tests pass with 100% code coverage
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
tests/index.js, ~30 lines) uses AVA directly. All 22.test.jsfiles are standalone Node.js scripts with no AVA imports.test()→test(),t.snapshot()→t.assert.snapshot()execasubprocess spawning pattern,c8coverage, and all test helpers remain unchanged.Prerequisites
node:test). This should be revisited after upgrading to Node 24, where snapshot testing is fully stable.Implementation outline
package.json: RemoveavafromdevDependencies, update test script fromc8 --100 ava tests/index.jstoc8 --100 node --test tests/index.jstests/index.js: Replaceimport test from "ava"withimport { test } from "node:test", changet.snapshot(value, label)tot.assert.snapshot(value)tests/snapshots/directory (binary AVA snapshot files)node --test --test-update-snapshots tests/index.js