test: migrate from AVA to Node.js native test runner by parkerbxyz · Pull Request #346 · actions/create-github-app-token (original) (raw)

@parkerbxyz changed the base branch from main to beta

March 13, 2026 06:34

Copilot AI review requested due to automatic review settings

March 13, 2026 06:41

@parkerbxyz

Replace AVA with the built-in node:test module for testing. This changes snapshots from AVA's binary format to human-readable text files, which are more efficient for Git to track and easier to review in pull requests.

Changes:

Closes #344

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

Update references from ava/npx to node --test, point snapshot link to the new index.js.snapshot file, and add instructions for updating snapshots.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

Fix formatting for test execution instructions

@parkerbxyz

Use subtests so snapshot keys include '> stderr' and '> stdout' labels instead of opaque numeric counters, making the snapshot file easier to read and review.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

Use strictEqual for empty stderr/stdout instead of snapshotting them. This removes all the noisy empty-string entries from the snapshot file, cutting it from 355 to 228 lines.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

Use the built-in mock.timers.enable() from node:test instead of the @sinonjs/fake-timers package, removing another test dependency.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

Use the built-in execFile from node:child_process instead of execa, removing another dev dependency. Strip trailing newline from output to match execa's default behavior.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

Handle Windows-style line endings in execFile output by stripping \r?\n instead of just \n.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

Set maxBuffer to 10MB for execFile to avoid ENOBUFS on larger test output. Add mock.timers.reset() in a finally block for proper cleanup.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

The default 1MB maxBuffer is sufficient for test output. The try/finally inside the callback doesn't work because the test helper runs the main script after the callback returns, so the timer reset must happen on the outer promise via .finally().

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

Simplify the snapshot serializer to a plain identity function since we only snapshot strings. Replace the spread-then-delete env pattern with destructuring rest syntax to cleanly omit unwanted env vars.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

Sort test files for deterministic snapshot order across filesystems. Revert try/await/finally back to .finally() since test() is async and can never throw synchronously.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

@parkerbxyz

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@parkerbxyz

Co-authored-by: Copilot Autofix powered by AI 175728472+Copilot@users.noreply.github.com

@parkerbxyz

parkerbxyz added a commit that referenced this pull request

Mar 14, 2026

@parkerbxyz

AVA stores snapshots in a binary format (.snap), which produces no meaningful diffs and bloats Git history. This replaces AVA with the built-in node:test module, whose snapshot support generates human-readable text files that are easy to diff and review in pull requests.

The migration also replaces @sinonjs/fake-timers and execa with Node.js built-ins (node:test mock timers and node:child_process), removing three dev dependencies total.

All 22 test scenarios (66 subtests) pass with 100% code coverage.

Closes #344


Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com Co-authored-by: Copilot Autofix powered by AI 175728472+Copilot@users.noreply.github.com (cherry picked from commit f863ba5)

parkerbxyz added a commit that referenced this pull request

Mar 14, 2026

@parkerbxyz

AVA stores snapshots in a binary format (.snap), which produces no meaningful diffs and bloats Git history. This replaces AVA with the built-in node:test module, whose snapshot support generates human-readable text files that are easy to diff and review in pull requests.

The migration also replaces @sinonjs/fake-timers and execa with Node.js built-ins (node:test mock timers and node:child_process), removing three dev dependencies total.

All 22 test scenarios (66 subtests) pass with 100% code coverage.

Closes #344


Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com Co-authored-by: Copilot Autofix powered by AI 175728472+Copilot@users.noreply.github.com (cherry picked from commit f863ba5)

parkerbxyz added a commit that referenced this pull request

Mar 14, 2026

@parkerbxyz

AVA stores snapshots in a binary format (.snap), which produces no meaningful diffs and bloats Git history. This replaces AVA with the built-in node:test module, whose snapshot support generates human-readable text files that are easy to diff and review in pull requests.

The migration also replaces @sinonjs/fake-timers and execa with Node.js built-ins (node:test mock timers and node:child_process), removing three dev dependencies total.

All 22 test scenarios (66 subtests) pass with 100% code coverage.

Closes #344


Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com Co-authored-by: Copilot Autofix powered by AI 175728472+Copilot@users.noreply.github.com (cherry picked from commit f863ba5)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})