Skip to content

test: migrate tests to cross-runtime node:test#11

Closed
BottieMcBotface wants to merge 3 commits intomainfrom
test/node-test-cross-runtime
Closed

test: migrate tests to cross-runtime node:test#11
BottieMcBotface wants to merge 3 commits intomainfrom
test/node-test-cross-runtime

Conversation

@BottieMcBotface
Copy link
Copy Markdown
Collaborator

Summary

Migrate every *.bun.test.ts file in this repo to *.test.ts using node:test plus @std/expect, so the test suite runs under Bun, Deno, and Node 24+ from one set of source files. Pure mechanical migration, no feature work.

What's in scope

  • Rename all 12 *.bun.test.ts files to *.test.ts:
    • examples/runtime-matrix.test.ts
    • src/fs/getFileInfo.test.ts
    • src/gh/gh.test.ts
    • src/git/git.test.ts
    • src/script/FileLogging.test.ts
    • src/script/OutputContext.test.ts
    • src/script/Script.test.ts
    • src/script/parseScriptArgs.test.ts
    • src/script/splitCommandLines.test.ts
    • src/sh/run.test.ts
    • src/utils/utils.test.ts
    • tools/getPathToRepoRoot.test.ts
  • Replace import { test } from 'bun:test' with node:test (or the local shim) and import { expect } from '@std/expect'.
  • Add src/test/testlib.ts: a small shim on top of node:test that adds describe / beforeEach / afterEach semantics with sequential scheduling so the existing cleanup-heavy test files keep working.
  • Add src/test/cleanup.ts: the withCleanup() helper used by the new tests.
  • package.json: add @std/assert and @std/expect as devDependencies (via the @jsr/std__assert / @jsr/std__expect bridge), add the check / fix / test scripts. The test script splits the fast Bun suite from the heavy runtime-matrix suite using the same --timeout 30000 --max-concurrency 1 knobs CI already uses.
  • deno.jsonc: add @std/assert and @std/expect to the imports map, drop the stale *.bun.test.ts / *.bun.ts exclude + check.exclude blocks, and add publish.exclude with src/test and **/*.test.ts so no test sources ship to JSR.
  • .github/workflows/ci.yml: update both Bun test steps to reference the renamed examples/runtime-matrix.test.ts.

What's out of scope

This PR is intentionally narrow. It unblocks the wait-for rebuild (PRs 2-4), but does not touch:

  • Anything under src/wait/.
  • src/utils/groupArgs.ts / groupArgs.demo.ts — those move to @axhxrx/args in PR 2.
  • claude-summarize.demo.* — can come in a later PR if wanted.
  • wait-for.ts / wait-for.test.ts / wait-for.spec.md — those move to @axhxrx/wait-for in PR 4.

Verification

Verified in a fresh off-tree directory (outside the megarepo workspace) to avoid this session's worktree-specific Deno workspace and Bun hoisting quirks:

  • bun run test — 207 / 207 pass (Bun + Deno + Node, run sequentially).
  • bun run checkdeno check && deno lint && bun tsc --noEmit && dprint check all clean. 61 files checked.
  • deno publish --dry-run --allow-dirty — no *.test.ts files and no src/test/ files ship to JSR.

Code review (via bun review/main.ts run) round 2 returned no actionable findings after the three round-1 issues (CI workflow paths, default Bun test script, Deno publish excludes) were fixed.

Rename *.bun.test.ts to *.test.ts across the test suite and replace
bun:test imports with node:test plus @std/expect. Add src/test/testlib.ts
and src/test/cleanup.ts as a small shim on top of node:test so tests with
afterEach / beforeEach still compose correctly. Update package.json with
the cross-runtime check/test scripts, and wire @std/assert / @std/expect
into both the npm devDependencies and the deno.jsonc imports map.

Mechanical migration only. No behavior changes, no feature work.
Unblocks the wait-for rebuild (PRs 2-4).

---
Agent: axhxrx-engineer agent
Model: claude-opus-4-7[1m]
P1: update .github/workflows/ci.yml to reference the renamed
examples/runtime-matrix.test.ts (was examples/runtime-matrix.bun.test.ts)
in both the path-ignore-patterns and the dedicated matrix step.

P2: split the package.json "test" script so the fast Bun suite ignores
the runtime matrix and the heavy matrix runs separately with the same
--timeout/--max-concurrency knobs CI already uses. Avoids flakiness.

P2: rework deno.jsonc excludes. Drop the stale *.bun.test.ts / *.bun.ts
patterns and add a publish.exclude that filters src/test/ and
**/*.test.ts so no test sources leak into the JSR distributable.
Verified with deno publish --dry-run.

---
Agent: axhxrx-engineer agent
Model: claude-opus-4-7[1m]
---
Agent: axhxrx-engineer agent
Model: claude-opus-4-7[1m]
@masonmark
Copy link
Copy Markdown
Contributor

This one looks like the 🤖🤖🤖 went off the rails a little bit, so I don't want to bother reviewing this. I'm just gonna close it.

I'll take a look myself later; might let them take another crack at it after giving them a couple clean examples.

@masonmark masonmark closed this Apr 19, 2026
@masonmark masonmark deleted the test/node-test-cross-runtime branch April 20, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants