testingterm 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT-DOCS.md +77 -0
- package/LICENSE +21 -0
- package/dist/ai.d.ts +24 -0
- package/dist/attach.d.ts +6 -0
- package/dist/capabilities.d.ts +6 -0
- package/dist/chunks/ai-MISD5ZKB.js +260 -0
- package/dist/chunks/args-FJPX5SKE.js +8 -0
- package/dist/chunks/attach-STVPRW4U.js +30 -0
- package/dist/chunks/chunk-66N3P624.js +44 -0
- package/dist/chunks/chunk-IJ5VA4HN.js +41 -0
- package/dist/chunks/chunk-INTJPVJZ.js +191 -0
- package/dist/chunks/chunk-NM755IGG.js +658 -0
- package/dist/chunks/chunk-PA67Y4XN.js +65 -0
- package/dist/chunks/chunk-U52LFC23.js +68 -0
- package/dist/chunks/chunk-YFGNBX2I.js +229 -0
- package/dist/chunks/chunk-YHQYNBAN.js +801 -0
- package/dist/chunks/commands-IWTFRW33.js +540 -0
- package/dist/chunks/context-QML5TP36.js +14 -0
- package/dist/chunks/help-I5WIJHZM.js +359 -0
- package/dist/chunks/paths-X3C4P67K.js +18 -0
- package/dist/chunks/run-RNFQMMXD.js +95 -0
- package/dist/chunks/setup-WIZULKES.js +106 -0
- package/dist/chunks/themes.gen-E3CTYIQE.js +8 -0
- package/dist/chunks/upgrade-43JWCQ63.js +143 -0
- package/dist/chunks/verify-55DFXJOY.js +37 -0
- package/dist/cli/args.d.ts +13 -0
- package/dist/cli/commands.d.ts +5 -0
- package/dist/cli/help.d.ts +2 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +83 -0
- package/dist/cli/run.d.ts +2 -0
- package/dist/cli/setup.d.ts +6 -0
- package/dist/cli/upgrade.d.ts +19 -0
- package/dist/cli/verify.d.ts +2 -0
- package/dist/context.d.ts +33 -0
- package/dist/engine.d.ts +56 -0
- package/dist/errors.d.ts +4 -0
- package/dist/expect.d.ts +62 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +205 -0
- package/dist/install.d.ts +13 -0
- package/dist/instances.d.ts +23 -0
- package/dist/locator.d.ts +49 -0
- package/dist/paths.d.ts +7 -0
- package/dist/runner.d.ts +56 -0
- package/dist/sync.d.ts +8 -0
- package/dist/terminal.d.ts +146 -0
- package/dist/themes.gen.d.ts +4 -0
- package/dist/types.d.ts +214 -0
- package/package.json +41 -4
- package/skill/testingterm/SKILL.md +138 -0
- package/README.md +0 -3
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import type { GhosttyTheme, RexTheme } from "./themes.gen.ts";
|
|
2
|
+
export type { GhosttyTheme, RexTheme };
|
|
3
|
+
/**
|
|
4
|
+
* testingterm's own "dark" and "light", any Ghostty or Rex theme by name (case and spaces don't matter),
|
|
5
|
+
* or "ghostty" / "rex" to use the theme your Ghostty config or Rex settings pick (add ":light" or ":dark" to choose one side).
|
|
6
|
+
*/
|
|
7
|
+
export type ThemeName = "dark" | "light" | "ghostty" | "ghostty:light" | "ghostty:dark" | "rex" | "rex:light" | "rex:dark" | GhosttyTheme | RexTheme | (string & {});
|
|
8
|
+
/** Colors for the terminal as #rrggbb. Anything left out comes from `base`. */
|
|
9
|
+
export interface ThemeColors {
|
|
10
|
+
/** The theme to start from. Default: dark. */
|
|
11
|
+
base?: ThemeName;
|
|
12
|
+
background?: string;
|
|
13
|
+
foreground?: string;
|
|
14
|
+
cursor?: string;
|
|
15
|
+
/** Color of the character under a block cursor. */
|
|
16
|
+
cursorText?: string;
|
|
17
|
+
/** ANSI colors: an array for 0, 1, 2, ... or an object like `{ 1: "#ff0000", 208: "#ff8700" }` for any of the 256. */
|
|
18
|
+
palette?: string[] | Record<number, string>;
|
|
19
|
+
}
|
|
20
|
+
export type Theme = ThemeName | ThemeColors;
|
|
21
|
+
/**
|
|
22
|
+
* Terminals to imitate:
|
|
23
|
+
* - full: everything testingterm supports (default)
|
|
24
|
+
* - xterm: no kitty keyboard or graphics, no synchronized output
|
|
25
|
+
* - apple-terminal: 256 colors, no kitty protocols, clipboard, hyperlinks or synchronized output
|
|
26
|
+
* - tmux: TERM=tmux-256color, no kitty protocols
|
|
27
|
+
* - basic: TERM=xterm, 16 colors, few extras
|
|
28
|
+
* - dumb: TERM=dumb, no colors, no mouse, no alternate screen
|
|
29
|
+
*/
|
|
30
|
+
export type CapabilityPreset = "full" | "xterm" | "apple-terminal" | "tmux" | "basic" | "dumb";
|
|
31
|
+
/**
|
|
32
|
+
* What the terminal supports, to test how a program behaves in other terminals. A disabled feature behaves
|
|
33
|
+
* like a terminal without it: requests to turn it on are ignored and queries say it isn't supported.
|
|
34
|
+
*/
|
|
35
|
+
export interface Capabilities {
|
|
36
|
+
/** Start from a preset, then apply the other fields. Default: full. */
|
|
37
|
+
preset?: CapabilityPreset;
|
|
38
|
+
/** The TERM the program sees. Default depends on colors: xterm-256color, xterm, or dumb. */
|
|
39
|
+
term?: string;
|
|
40
|
+
/** Colors the terminal can show. Fewer colors are approximated, like a real terminal would; COLORTERM is set only for truecolor. */
|
|
41
|
+
colors?: "truecolor" | 256 | 16 | 8 | "none";
|
|
42
|
+
mouse?: boolean;
|
|
43
|
+
bracketedPaste?: boolean;
|
|
44
|
+
focusEvents?: boolean;
|
|
45
|
+
synchronizedOutput?: boolean;
|
|
46
|
+
alternateScreen?: boolean;
|
|
47
|
+
kittyKeyboard?: boolean;
|
|
48
|
+
kittyGraphics?: boolean;
|
|
49
|
+
/** OSC 52 clipboard writes. */
|
|
50
|
+
clipboard?: boolean;
|
|
51
|
+
/** OSC 8 links. */
|
|
52
|
+
hyperlinks?: boolean;
|
|
53
|
+
/** Setting the window title. */
|
|
54
|
+
title?: boolean;
|
|
55
|
+
/** Grapheme clustering (mode 2027), which decides how wide emoji and combined characters are. */
|
|
56
|
+
graphemes?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export type CapabilitiesOption = CapabilityPreset | Capabilities;
|
|
59
|
+
/** When to keep a video of the terminal. */
|
|
60
|
+
export type VideoMode = "on" | "off" | "retain-on-failure";
|
|
61
|
+
export interface LaunchOptions {
|
|
62
|
+
/** The program to run. A string runs through `sh -c`; an array runs the program directly. Default: your shell. */
|
|
63
|
+
command?: string | string[];
|
|
64
|
+
/** Working directory for the program. Default: the current directory. */
|
|
65
|
+
cwd?: string;
|
|
66
|
+
/** Extra environment variables. `undefined` removes a variable. */
|
|
67
|
+
env?: Record<string, string | undefined>;
|
|
68
|
+
/** Columns in the terminal grid. Default: 100. */
|
|
69
|
+
cols?: number;
|
|
70
|
+
/** Rows in the terminal grid. Default: 30. */
|
|
71
|
+
rows?: number;
|
|
72
|
+
/** Font size in points. Default: 13. */
|
|
73
|
+
fontSize?: number;
|
|
74
|
+
/** Pixel density of screenshots and videos (2 is retina). Default: 2. */
|
|
75
|
+
scale?: number;
|
|
76
|
+
/** Space around the grid in points. Default: 8. */
|
|
77
|
+
padding?: number;
|
|
78
|
+
/** A theme name like "Dracula" or "Catppuccin Mocha" (see `themes`), or custom colors. Default: dark. */
|
|
79
|
+
theme?: Theme;
|
|
80
|
+
/** What the terminal supports: a preset like "apple-terminal" or "dumb", or individual features like `{ mouse: false, colors: 256 }`. Default: full. */
|
|
81
|
+
capabilities?: CapabilitiesOption;
|
|
82
|
+
/** Show the terminal in a window so a person can watch. Default: false, or true under `testingterm run --headed`. */
|
|
83
|
+
headed?: boolean;
|
|
84
|
+
/** Wait this many milliseconds after every action, to make headed runs and videos easier to follow. */
|
|
85
|
+
slowMo?: number;
|
|
86
|
+
/** Record a video from launch. `true` saves it in the artifacts folder; a string is the file path. */
|
|
87
|
+
record?: boolean | string;
|
|
88
|
+
/** Frames per second for videos. Default: 30. */
|
|
89
|
+
fps?: number;
|
|
90
|
+
/** Draw the mouse pointer, clicks and key presses into videos and the headed window. Default: true. */
|
|
91
|
+
overlay?: boolean;
|
|
92
|
+
/** Record a performance profile from launch. `true` saves it in the artifacts folder; a string is the file path. */
|
|
93
|
+
profile?: boolean | string;
|
|
94
|
+
/** Default timeout in milliseconds for waits, locators and assertions. Default: 5000. */
|
|
95
|
+
timeout?: number;
|
|
96
|
+
/** Folder for screenshots, videos and profiles. Default: the run's artifacts folder. */
|
|
97
|
+
artifacts?: string;
|
|
98
|
+
/** Name used in artifact file names and `testingterm ls`. */
|
|
99
|
+
name?: string;
|
|
100
|
+
/** Run the program with a fresh, empty HOME so user config can't change the result. Default: false. */
|
|
101
|
+
isolate?: boolean;
|
|
102
|
+
/** Draw the cursor in screenshots. Default: true. */
|
|
103
|
+
cursor?: boolean;
|
|
104
|
+
}
|
|
105
|
+
export interface Cursor {
|
|
106
|
+
col: number;
|
|
107
|
+
row: number;
|
|
108
|
+
visible: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface Screen {
|
|
111
|
+
/** The visible screen as text, trailing blank lines removed. */
|
|
112
|
+
text: string;
|
|
113
|
+
/** One string per row, trailing spaces removed. */
|
|
114
|
+
lines: string[];
|
|
115
|
+
cols: number;
|
|
116
|
+
rows: number;
|
|
117
|
+
cursor: Cursor | null;
|
|
118
|
+
title: string;
|
|
119
|
+
/** Whether the program switched to the alternate screen (full screen apps do). */
|
|
120
|
+
altScreen: boolean;
|
|
121
|
+
/** Whether the program asked for mouse events. Clicks do nothing when it didn't. */
|
|
122
|
+
mouseTracking: boolean;
|
|
123
|
+
bracketedPaste: boolean;
|
|
124
|
+
/** Kitty keyboard protocol flags the program enabled (0 when off). */
|
|
125
|
+
kittyKeyboard: number;
|
|
126
|
+
exited: boolean;
|
|
127
|
+
exitCode: number | null;
|
|
128
|
+
signal: string | null;
|
|
129
|
+
}
|
|
130
|
+
export interface StyledSpan {
|
|
131
|
+
text: string;
|
|
132
|
+
col: number;
|
|
133
|
+
fg?: string;
|
|
134
|
+
bg?: string;
|
|
135
|
+
bold?: boolean;
|
|
136
|
+
italic?: boolean;
|
|
137
|
+
faint?: boolean;
|
|
138
|
+
underline?: boolean;
|
|
139
|
+
strikethrough?: boolean;
|
|
140
|
+
inverse?: boolean;
|
|
141
|
+
}
|
|
142
|
+
export interface Box {
|
|
143
|
+
/** Pixel rectangle in screenshot coordinates. */
|
|
144
|
+
x: number;
|
|
145
|
+
y: number;
|
|
146
|
+
w: number;
|
|
147
|
+
h: number;
|
|
148
|
+
center: {
|
|
149
|
+
x: number;
|
|
150
|
+
y: number;
|
|
151
|
+
};
|
|
152
|
+
row: number;
|
|
153
|
+
col: number;
|
|
154
|
+
/** Width in cells. */
|
|
155
|
+
width: number;
|
|
156
|
+
text: string;
|
|
157
|
+
}
|
|
158
|
+
export interface Shot {
|
|
159
|
+
path: string;
|
|
160
|
+
width: number;
|
|
161
|
+
height: number;
|
|
162
|
+
}
|
|
163
|
+
export interface ExitStatus {
|
|
164
|
+
exitCode: number | null;
|
|
165
|
+
signal: string | null;
|
|
166
|
+
}
|
|
167
|
+
export interface ClickOptions {
|
|
168
|
+
button?: "left" | "right" | "middle";
|
|
169
|
+
/** Click this many times. Default: 1. */
|
|
170
|
+
count?: number;
|
|
171
|
+
modifiers?: Array<"shift" | "ctrl" | "alt" | "cmd">;
|
|
172
|
+
}
|
|
173
|
+
/** A point in screenshot pixels, or a cell with `{ col, row }`. */
|
|
174
|
+
export type Point = {
|
|
175
|
+
x: number;
|
|
176
|
+
y: number;
|
|
177
|
+
} | {
|
|
178
|
+
col: number;
|
|
179
|
+
row: number;
|
|
180
|
+
};
|
|
181
|
+
export interface WaitOptions {
|
|
182
|
+
/** Milliseconds before giving up. Default: the terminal's timeout. */
|
|
183
|
+
timeout?: number;
|
|
184
|
+
/** Search the whole history instead of only the visible screen. */
|
|
185
|
+
scrollback?: boolean;
|
|
186
|
+
}
|
|
187
|
+
export type AgentChoice = "claude" | "codex" | {
|
|
188
|
+
command: string;
|
|
189
|
+
args?: string[];
|
|
190
|
+
env?: Record<string, string>;
|
|
191
|
+
};
|
|
192
|
+
export interface VerifyOptions {
|
|
193
|
+
/** Which coding agent checks the terminal. Default: claude if it's installed, otherwise codex. Any ACP agent works through `{ command, args }`. */
|
|
194
|
+
agent?: AgentChoice;
|
|
195
|
+
model?: string;
|
|
196
|
+
effort?: string;
|
|
197
|
+
/** Milliseconds the agent gets. Default: 180000. */
|
|
198
|
+
timeout?: number;
|
|
199
|
+
/** Save a screenshot, the screen text and the agent's notes when the check fails. Default: true. */
|
|
200
|
+
artifacts?: boolean;
|
|
201
|
+
/** Let the agent type, press keys and click while checking. Default: false (it only looks). */
|
|
202
|
+
interact?: boolean;
|
|
203
|
+
/** Return the result instead of throwing when the check fails. */
|
|
204
|
+
soft?: boolean;
|
|
205
|
+
}
|
|
206
|
+
export interface VerifyResult {
|
|
207
|
+
pass: boolean;
|
|
208
|
+
reason: string;
|
|
209
|
+
agent: string;
|
|
210
|
+
durationMs: number;
|
|
211
|
+
artifacts: string[];
|
|
212
|
+
/** Set when the agent could not run or never reported a result; `pass` is false and `reason` says why. */
|
|
213
|
+
error?: string;
|
|
214
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testingterm",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Test terminal apps: drive a real terminal, read its state, and capture screenshots, videos and profiles",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/zenbu-labs/testingterm.git",
|
|
10
|
+
"directory": "packages/testingterm"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://testingterm.com",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22.15"
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"testingterm": "./dist/cli/main.js"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"skill",
|
|
31
|
+
"AGENT-DOCS.md"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@agentclientprotocol/sdk": "2.12.1",
|
|
35
|
+
"zod": "^4.6.7"
|
|
36
|
+
},
|
|
37
|
+
"optionalDependencies": {
|
|
38
|
+
"@zenbu-labs/testingterm-darwin-arm64": "0.0.1",
|
|
39
|
+
"@zenbu-labs/testingterm-darwin-x64": "0.0.1",
|
|
40
|
+
"@zenbu-labs/testingterm-linux-x64": "0.0.1",
|
|
41
|
+
"@zenbu-labs/testingterm-linux-arm64": "0.0.1"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testingterm
|
|
3
|
+
description: Test terminal apps (CLIs, TUIs, REPLs, anything that runs in a terminal) by running them in a real headless terminal. Read the screen, press keys, type, click pixel coordinates, wait for text, and capture screenshots, MP4 videos and performance profiles as evidence. Use it to check that a terminal program works, reproduce a bug with a video, verify a UI change visually, or write automated end to end tests for a CLI or TUI.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- fixme: placeholder copy -->
|
|
7
|
+
|
|
8
|
+
`testingterm` runs a program inside a real terminal emulator (libghostty) that
|
|
9
|
+
you control. Nothing opens on the human's screen unless you pass `--headed`.
|
|
10
|
+
Everything is fast: a launch, a wait and a screenshot take tens of milliseconds.
|
|
11
|
+
|
|
12
|
+
There are two ways to use it. Pick the scripted one whenever you can.
|
|
13
|
+
|
|
14
|
+
## 1. Scripts: one call, all the results
|
|
15
|
+
|
|
16
|
+
Write a script with the `testingterm` library and run it with `testingterm run`.
|
|
17
|
+
The import resolves automatically; nothing needs installing.
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
// check-menu.mjs
|
|
21
|
+
import { launch, expect } from "testingterm";
|
|
22
|
+
|
|
23
|
+
const term = launch("node menu.js", { cols: 100, rows: 30 });
|
|
24
|
+
await expect(term).toHaveText("Main menu");
|
|
25
|
+
await term.press("Down");
|
|
26
|
+
await term.press("Enter");
|
|
27
|
+
await expect(term).toHaveText("You picked Run tests");
|
|
28
|
+
await term.getByText("Quit").click();
|
|
29
|
+
await expect(term).toHaveExited({ code: 0 });
|
|
30
|
+
await term.screenshot();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
testingterm run check-menu.mjs
|
|
35
|
+
testingterm run check-menu.mjs --video on # keep an MP4 of the whole run
|
|
36
|
+
testingterm run -e 'const t = launch("ls -la"); await expect(t).toHaveText("package.json"); await t.screenshot()'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The output lists what passed and failed, the screen at the moment of failure,
|
|
40
|
+
and the paths of every screenshot, video and profile. On failure it saves a
|
|
41
|
+
screenshot and the full scrollback automatically. Read the PNGs to see the
|
|
42
|
+
result.
|
|
43
|
+
|
|
44
|
+
Several cases go in one file with `test()`; each gets fresh terminals:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import { test, expect } from "testingterm";
|
|
48
|
+
|
|
49
|
+
test("shows help", async ({ launch }) => {
|
|
50
|
+
const term = launch(["mycli", "--help"]);
|
|
51
|
+
await expect(term).toHaveText("Usage:");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("rejects bad input", async ({ launch }) => {
|
|
55
|
+
const term = launch("mycli frobnicate");
|
|
56
|
+
await expect(term).toHaveExited({ code: 2 });
|
|
57
|
+
await expect(term).toHaveText(/unknown command/i, { scrollback: true });
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 2. Step by step: drive a terminal across commands
|
|
62
|
+
|
|
63
|
+
When you don't know the steps up front, start a terminal and act one command
|
|
64
|
+
at a time, reading the screen after each step, like a person would.
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
testingterm new --name app -- npm run dev # prints the terminal id
|
|
68
|
+
testingterm wait --text "ready"
|
|
69
|
+
testingterm screen # text, cursor, title, modes
|
|
70
|
+
testingterm press Down Down Enter
|
|
71
|
+
testingterm type "hello\n"
|
|
72
|
+
testingterm click --text "Save" # waits for the text, clicks its center
|
|
73
|
+
testingterm click 412 230 # pixels, as measured on a screenshot
|
|
74
|
+
testingterm screenshot # prints the PNG path; read it to look
|
|
75
|
+
testingterm record start ... testingterm record stop
|
|
76
|
+
testingterm close
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
With one terminal running, commands use it; with several, pass `--id <id>`
|
|
80
|
+
(`testingterm ls` lists them). Always `testingterm close` when done.
|
|
81
|
+
|
|
82
|
+
## Rules that keep tests reliable
|
|
83
|
+
|
|
84
|
+
- Never sleep. Wait for what you expect: `waitForText` / `--text`, `--gone`,
|
|
85
|
+
`waitForStable(ms)` / `--stable` after animations and spinners, `--idle` for
|
|
86
|
+
output to stop, `waitForExit` / `--exit`.
|
|
87
|
+
- `expect(term)` assertions retry until they pass or time out (default 5s), so
|
|
88
|
+
they never race the program.
|
|
89
|
+
- `getByText()` is strict: if the text appears more than once it errors; pick
|
|
90
|
+
one with `.first()`, `.last()` or `.nth(i)`.
|
|
91
|
+
- Clicks only reach programs that turned on mouse reporting; `testingterm
|
|
92
|
+
screen` shows `mouse on` when they did, and click output says when a click
|
|
93
|
+
went nowhere. Use keys otherwise.
|
|
94
|
+
- Pixel coordinates are screenshot pixels (default scale 2). `{ col, row }`
|
|
95
|
+
or `--cell` address cells instead.
|
|
96
|
+
- `launch("a string")` runs through `sh -c` when it has shell syntax; pass an
|
|
97
|
+
array to run a program directly. Use `{ isolate: true }` / `--isolate` to
|
|
98
|
+
give the program an empty HOME so local config can't change results.
|
|
99
|
+
- Themes: `theme: "Dracula"` (or any of Ghostty's ~600 themes by name, plus
|
|
100
|
+
`dark`/`light`), custom colors with `theme: { base: "Nord", background:
|
|
101
|
+
"#000000", palette: { 1: "#ff5555" } }`, and `term.setTheme(...)` to switch
|
|
102
|
+
while it runs. CLI: `--theme <name>` on `new` and `run`, `testingterm theme
|
|
103
|
+
<name>`, `testingterm themes [filter]`.
|
|
104
|
+
- `theme: "ghostty"` / `"rex"` (or `:light` / `:dark`) use the human's own
|
|
105
|
+
Ghostty config or Rex settings, so screenshots look like their terminal.
|
|
106
|
+
- Capabilities: test how a program behaves in other terminals with
|
|
107
|
+
`capabilities: "apple-terminal"` (or `xterm`, `tmux`, `basic`, `dumb`) or
|
|
108
|
+
individual features like `{ mouse: false, colors: 256, kittyKeyboard: false }`.
|
|
109
|
+
Disabled features act like a terminal without them: requests to enable them
|
|
110
|
+
are ignored and queries report them unsupported. CLI: `--capabilities`,
|
|
111
|
+
`--disable mouse,kitty-keyboard`, `--colors 16`, `--term xterm`.
|
|
112
|
+
- Keys: `Enter`, `Tab`, `Escape`, `Backspace`, `Up`, `Down`, `Left`, `Right`,
|
|
113
|
+
`Home`, `End`, `PageUp`, `PageDown`, `F1`-`F12`, `space`, characters, and
|
|
114
|
+
modifiers: `ctrl+c`, `shift+Tab`, `alt+x`, `cmd+s`.
|
|
115
|
+
|
|
116
|
+
## Evidence for the human
|
|
117
|
+
|
|
118
|
+
- Screenshots: `term.screenshot()` / `testingterm screenshot`.
|
|
119
|
+
- Videos: `launch(cmd, { record: true })`, `--video on` on `run`, or `testingterm
|
|
120
|
+
record start|stop`. Videos show the pointer, clicks and keys pressed.
|
|
121
|
+
- Let the human watch live: `--headed` on `run` or `new` opens a window, and
|
|
122
|
+
`--slow-mo 300` makes it easy to follow.
|
|
123
|
+
- Profiles: `{ profile: true }`, `--profile`, or `testingterm profile
|
|
124
|
+
start|stop` record output timing, CPU and memory, frames and every action.
|
|
125
|
+
Open them at https://ui.perfetto.dev.
|
|
126
|
+
|
|
127
|
+
## Checks that are hard to write in code (experimental)
|
|
128
|
+
|
|
129
|
+
`await term.verify("the table is aligned and the header is bold")` or
|
|
130
|
+
`testingterm verify "<statement>"` asks Claude Code or Codex (whichever is
|
|
131
|
+
installed, with its own sign-in) to inspect the terminal and decide. It fails
|
|
132
|
+
the test with the agent's reason and saves a screenshot and notes. Prefer
|
|
133
|
+
plain assertions; use this for visual or fuzzy checks.
|
|
134
|
+
|
|
135
|
+
## Reference
|
|
136
|
+
|
|
137
|
+
`testingterm --help` and `testingterm <command> --help` list every command and
|
|
138
|
+
option. The library is typed: every method has documentation in its `.d.ts`.
|
package/README.md
DELETED