Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ C++ declarations:
- Run (after `npm ci`): `npm run build:libghostty && npm run build:native && npm test`
- Every native test skips when the addon does not load (`test/native-support.ts:nativeSupport`), so check the test output for skips.
- `mise run ci-ubsan` builds the addon with UBSan (Linux, GCC), then runs the tests and smoke. Undefined behavior aborts the run. The task also fails when the addon's object files contain no UBSan checks, which means the flags did not reach g++ (`mise.toml:tasks.ci-ubsan`).
- `test/workers.test.ts` checks the per-environment state in child processes with `worker_threads`. `test/terminal.test.ts` covers `feed`, `snapshot`, `resize`, `dispose`, the `RangeError` cases of the `createTerminal` checks in the addon, the `encodeMouse` bytes of each mouse format, `cursorVisible`, and the cell style fields. `test/mouse-safety.test.ts` runs the `encodeMouse` limits and the getter re-entry cases against both the package API and the raw addon object. It does not skip when the addon is missing. Its child-process cases load `src/` through `tsx`, so they need no `dist/` build. No vitest test covers `formatPlain`, `formatHtml`, `includeScrollback`, or the typed-array errors.
- `test/workers.test.ts` checks the per-environment state in child processes with `worker_threads`. `test/terminal.test.ts` covers `feed`, `snapshot`, `resize`, `dispose`, the `RangeError` cases of the `createTerminal` checks in the addon, the `encodeMouse` bytes of each mouse format, `cursorVisible`, and the cell style fields. `test/mouse-safety.test.ts` runs the `encodeMouse` limits and the getter re-entry cases against both the package API and the raw addon object. It skips when the addon is missing, like the other native suites. Its child-process cases load `src/` through `tsx`, so they need no `dist/` build. No vitest test covers `formatPlain`, `formatHtml`, `includeScrollback`, or the typed-array errors.
- For changes to `TerminalWrap` or `InitAll`, also run the TLA+ lifecycle model: [`.agents/skills/verify-native-lifecycle/SKILL.md`](https://github.com/coder/libghostty-vt-node/blob/main/.agents/skills/verify-native-lifecycle/SKILL.md).
2 changes: 1 addition & 1 deletion src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ Internal (not exported by the package):
## Verification

- Run (after `npm ci`): `npm run typecheck && npm test`
- Without a built addon, only the `createTerminal validation` suite in `test/terminal.test.ts` runs, and `test/load.test.ts` accepts the load error instead. The native suite in `test/terminal.test.ts` and all of `test/workers.test.ts` skip (`test/native-support.ts:nativeSupport`). `test/mouse-safety.test.ts` does not skip: it fails without a built addon. Its child-process cases load `src/` through `tsx`, so they need no `dist/` build. `test/workers.test.ts` loads the addon directly, so it tests `native/`, not `src/`. To run the native suite, build the addon first: `npm run build:libghostty && npm run build:native`.
- Without a built addon, only the `createTerminal validation` suite in `test/terminal.test.ts` runs, and `test/load.test.ts` accepts the load error instead. The native suite in `test/terminal.test.ts`, all of `test/workers.test.ts`, and all of `test/mouse-safety.test.ts` skip (`test/native-support.ts:nativeSupport`). The child-process cases in `test/mouse-safety.test.ts` load `src/` through `tsx`, so they need no `dist/` build. `test/workers.test.ts` loads the addon directly, so it tests `native/`, not `src/`. To run the native suite, build the addon first: `npm run build:libghostty && npm run build:native`.
6 changes: 5 additions & 1 deletion test/mouse-safety.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { describe, expect, it } from "vitest";
import { spawnSync } from "node:child_process";
import { createTerminal } from "../src/index.js";
import { loadNative } from "../src/loader.js";
import { nativeSupport } from "./native-support.js";

const support = nativeSupport();
const describeIfNative = support.available ? describe : describe.skip;

const geometry = {
screenWidth: 80, screenHeight: 24, cellWidth: 1, cellHeight: 1,
Expand All @@ -12,7 +16,7 @@ const geometry = {
const childArgs = ["--import", "tsx", "--input-type=module", "-e"];

// Exercise the C++ boundary independently of the public TypeScript normalizer.
describe.each([
describeIfNative.each([
["public", createTerminal],
["native", (options: { cols: number; rows: number }) => loadNative().createTerminal(options)],
] as const)("%s mouse safety", (_name, create) => {
Expand Down
Loading