用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/RtlZeroMemory/Rezi --skill rezi-write-tests命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Create a new screen/page for a Rezi TUI application. Use when adding views, pages, or screens to an app.
Profile and optimize Rezi app performance. Use when app feels slow, frames drop, or render phases take too long.
Add routing with guards and nested outlets to a Rezi app. Use when building multi-page/screen TUI applications.
基于 SOC 职业分类
正在显示 SKILL.md
| name | rezi-write-tests |
| description | Write tests for Rezi widgets, screens, or app logic using createTestRenderer and node:test. |
| user-invocable | true |
| allowed-tools | Read, Glob, Grep, Edit, Write, Bash(node scripts/run-tests.mjs*), Bash(node --test *) |
| argument-hint | [file-or-widget-to-test] |
| metadata | {"short-description":"Write tests"} |
Use this skill when:
packages/core/src/testing/ — test utilities (createTestRenderer, etc.)packages/core/src/widgets/__tests__/ — existing widget tests (use as examples)packages/core/src/widgets/__tests__/composition.animationHooks.test.ts — animation hook test patternspackages/core/src/app/__tests__/widgetRenderer.transition.test.ts — ui.box transition expectationsscripts/run-tests.mjs — test runnerpackages/core/src/testing/snapshot.ts — golden frame snapshot utilities (captureSnapshot, serializeSnapshot, diffSnapshots)scripts/rezi-snap.mjs — CLI for snapshot capture and verificationCreate test file in the appropriate __tests__/ directory
Use createTestRenderer() for widget/render tests:
import { describe, it } from "node:test";
import * as assert from "node:assert/strict";
import { createTestRenderer, ui } from "@rezi-ui/core";
describe("MyWidget", () => {
it("renders correctly", () => {
const r = createTestRenderer({ viewport: { cols: 80, rows: 24 } });
const result = r.render(ui.text("hello"));
assert.ok(result.findText("hello"));
});
});
Test state logic by testing reducer functions directly:
it("increments count", () => {
const state = reducer({ count: 0 }, { type: "increment" });
assert.strictEqual(state.count, 1);
});
Use for snapshot-style assertions
linear, quad, cubic) resolve as expectedloop: true) remain active and deterministic# Full suite
node scripts/run-tests.mjs
# Single file
node --test path/to/test.ts
result.toText()Use result.findById() to locate specific nodes in the render tree
Use golden frame snapshots for visual regression:
import { captureSnapshot, serializeSnapshot, diffSnapshots, parseSnapshot } from "@rezi-ui/core";
const snapshot = captureSnapshot("my-scene", myView(state), { viewport: { cols: 80, rows: 24 }, theme }, "dark");
const text = serializeSnapshot(snapshot);
// Compare with stored snapshot using diffSnapshots()
Run snapshot CLI for bulk capture/verify:
node scripts/rezi-snap.mjs --update # Capture new snapshots
node scripts/rezi-snap.mjs --verify # Verify against stored
For animation features, cover:
position / size / opacity) for ui.box transitionsFor extended routed actions, verify UiEvent payloads for widgets that emit non-press actions:
action: "toggle" with checkedaction: "select" with indexaction: "rowPress" with rowIndexaction: "change"For animation hook behavior, test: