Skip to content

test: skip the mouse-safety suite when the addon does not load - #39

Merged
ThomasK33 merged 1 commit into
mainfrom
test/mouse-safety-skip-without-addon
Oct 29, 2026
Merged

ThomasK33 merged 1 commit into
mainfrom
test/mouse-safety-skip-without-addon

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Why

The goal is to fix four small leftovers from the mouse-encoding PR (#12). This PR fixes one of them. npm test without a built addon fails, because test/mouse-safety.test.ts has no skip gate. test/terminal.test.ts and test/workers.test.ts skip their native suites when the addon does not load.

What changed

  • test/mouse-safety.test.ts gates its describe.each with nativeSupport(), the same way the other two native test files gate their suites.
  • native/README.md and src/README.md now say the file skips like the other native suites. src/README.md adds it to the list of suites that skip.

Scope

Only the gate and the two README notes change. The 12 tests are unchanged.

Blast Radius

Tests and docs only. No package code changes. With the addon built, the suite runs as before.

Verification

Without an addon (no build/), on main at bf41459, npx vitest run exits 1:

 ↓ test/workers.test.ts (3 tests | 3 skipped)
 ✓ test/load.test.ts (1 test) 4ms
 ✓ test/terminal.test.ts (27 tests | 25 skipped) 3ms
 ✓ test/scripts.test.ts (24 tests) 1211ms
 FAIL  test/mouse-safety.test.ts > public mouse safety > rejects unsafe UTF-8 codepoints without terminating the process
 ... (all 12 mouse-safety tests fail)
 Test Files  1 failed | 3 passed | 1 skipped (5)
      Tests  12 failed | 27 passed | 28 skipped (67)

On this branch, with build/ moved out of the checkout, npx vitest run exits 0:

 ↓ test/mouse-safety.test.ts (12 tests | 12 skipped)
 ✓ test/load.test.ts (1 test) 4ms
 ✓ test/terminal.test.ts (27 tests | 25 skipped) 3ms
 ↓ test/workers.test.ts (3 tests | 3 skipped)
 ✓ test/scripts.test.ts (24 tests) 1248ms
 Test Files  3 passed | 2 skipped (5)
      Tests  27 passed | 40 skipped (67)

With the addon built, every gate exits 0. Each one runs the 12 mouse-safety tests (✓ test/mouse-safety.test.ts (12 tests)) and passes 67 of 67 tests:

  1. npm ci && npm run build:native && npm run build && npm run verify against a ReleaseFast libghostty-vt.
  2. The same against a ReleaseSafe libghostty-vt.
  3. UBSan: rm -rf dist, then npm run build:native with -fsanitize=undefined,float-cast-overflow -fno-sanitize-recover=all, then npm test && npm run smoke.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: medium

Gate it with nativeSupport() like test/terminal.test.ts and
test/workers.test.ts, so npm test without a built addon exits 0.
Update the README notes that said the suite fails without the addon.

Signed-off-by: Thomas Kosiewski <tk@coder.com>

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `medium`_

Change-Id: I4f0c73de4ee08eea111ef47e10792334768a301d
@ThomasK33

Copy link
Copy Markdown
Member Author

Verdict: PASS+NOTES
Head: 5accada

Parent is bf414593fa85a87f417f6efa76be9969410ffaee (merge-base with main). Every run below used Node v26.12.1 (npm exec -c 'node -v' printed v26.12.1, and the load error printed node=26.12.1).

Scenario: npx vitest run with no build/ (I moved build/ out of the checkout. The checkout has no prebuilds/.)

  • Parent: exit 1. test/mouse-safety.test.ts (12 tests | 12 failed), Tests 12 failed | 27 passed | 28 skipped (67). Each failure is the missing-addon load error.
  • Head: exit 0. test/mouse-safety.test.ts (12 tests | 12 skipped), Tests 27 passed | 40 skipped (67).
  • Head with the addon built: exit 0. test/mouse-safety.test.ts (12 tests), Tests 67 passed (67).

Revert test. At the head I changed only describeIfNative.each([ back to describe.each([. The no-addon run then failed again: exit 1, 12 failed | 27 passed | 28 skipped (67).

Gate at the head (all exit 0, each with test/mouse-safety.test.ts (12 tests) and Tests 67 passed (67)):

  • ReleaseFast: npm ci && LIBGHOSTTY_VT_PREFIX=<ReleaseFast prefix> npm run build:native && npm run build && npm run verify.
  • ReleaseSafe: the same against a ReleaseSafe libghostty-vt.
  • UBSan: rm -rf dist, then npm run build:native with -fsanitize=undefined,float-cast-overflow -fno-sanitize-recover=all, then npm test && npm run smoke. The addon objects addon.o, terminal.o and libghostty_vt_shim.o hold 16 undefined __ubsan references, so the flags reached g++.

Diff. It changes three files. test/mouse-safety.test.ts adds the same nativeSupport() gate as test/terminal.test.ts:7-8 and test/workers.test.ts:7-8. The 12 tests are unchanged (6 it blocks times 2 describe.each rows). The new sentences in native/README.md and src/README.md match what I saw. With this change, the existing line "Every native test skips when the addon does not load" in native/README.md is now true. No other doc still says the file does not skip.

Notes

  • With this change, a missing addon no longer fails npm test. CI still fails in that case, because npm run smoke exits 1 with the load error (I ran it without build/). Both verify and the UBSan gate run smoke after the tests.
  • Toolchain finding, not a defect in this PR. On this host the shell exports both Path and PATH. npm merges them with Path first, so npm run and npx use Node 22.23.4 even when Node 26.12.1 is first on PATH. I ran everything with unset Path. The PR body does not name its Node version.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

@ThomasK33
ThomasK33 merged commit 34ef422 into main Oct 29, 2026
5 checks passed
@ThomasK33
ThomasK33 deleted the test/mouse-safety-skip-without-addon branch October 29, 2026 23:26
@ThomasK33 ThomasK33 mentioned this pull request Oct 30, 2026
ThomasK33 added a commit that referenced this pull request Oct 30, 2026
cursorVisible first ships in this release, so it was never optional in
a published version. The #39 bullet only changed a test.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_

Change-Id: I9407e114ee961f9392f37b4afecafe2a774a0c4c
Signed-off-by: Thomas Kosiewski <tk@coder.com>
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.

1 participant