跳到正文
cccskills
免费在 GitHub 公开

terminal-emulator

Create and run tests for interactive command-line tools and terminal interfaces using @microsoft/tui-test. Simulate keyboard input, check visible text, and compare screen snapshots in a separate terminal environment for each test.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Test interactive CLI/TUI applications using @microsoft/tui-test. Use when you need to test CLI tools with interactive prompts, TUI rendering, arrow key navigation, or any command that requires a TTY. Triggers include "test CLI", "test TUI", "run interactively", "automate terminal input", "simulate user input in terminal".

查看安装方法

适用场景

  • Testing selection prompts with arrow keys and Enter
  • Checking terminal screen snapshots
  • Automating text entry and keyboard navigation
  • Testing commands that require a terminal connection

包含的文件(1)

  • SKILL.md2.4 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Testing Interactive CLI / TUI with @microsoft/tui-test

Playwright-like API for terminals. Real PTY per test. Made by Microsoft.

Install

yarn add -D @microsoft/tui-test

Usage

import { test, expect } from '@microsoft/tui-test';

test.use({ program: { file: 'node', args: ['./my-cli.js'] } });

test('selects option and proceeds', async ({ terminal }) => {
    await expect(terminal.getByText('Select an option')).toBeVisible();
    await terminal.write('\x1B[B');  // Arrow Down
    await terminal.submit();          // Enter
    await expect(terminal.getByText('Option 2 selected')).toBeVisible();
});

test('matches snapshot', async ({ terminal }) => {
    await expect(terminal).toMatchSnapshot();
});

API

// Navigation
await terminal.write('\x1B[A');    // Arrow Up
await terminal.write('\x1B[B');    // Arrow Down
await terminal.write('\x1B[C');    // Arrow Right
await terminal.write('\x1B[D');    // Arrow Left
await terminal.submit();           // Enter
await terminal.write('\t');        // Tab
await terminal.write('\x03');      // Ctrl+C
await terminal.write('\x1B');      // Escape
await terminal.write('\x7F');      // Backspace
await terminal.write('hello');     // Type text

// Assertions
await expect(terminal.getByText('pattern')).toBeVisible();
await expect(terminal.getByText('pattern', { full: true })).toBeVisible();
await expect(terminal).toMatchSnapshot();

// Reading
const content = terminal.content;  // Full terminal content as string

Running

npx tui-test                       # Run all tests
npx tui-test --update-snapshots    # Update snapshots
npx tui-test my-test.ts            # Run specific test

Reference

  • Used by VS Code terminal team
  • Real PTY isolation per test (no mocking)
  • Auto-waits for terminal renders
  • Cross-platform (macOS, Linux, Windows)
  • Snapshot testing built-in

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Automate real browser tasks to test websites, complete forms, and collect page information. The skill guides agents through identifying clickable elements, interacting with pages, comparing page states, and saving screenshots or PDFs.

中文简介正在准备中。当前显示英语简介。

  • Testing form submissions and page navigation
  • Comparing page appearance before and after changes
  • Extracting page text and saving PDFs
slopus/happy2.4万2026年10月19日 更新

Trace application behavior and explain data structures using compact text tree diagrams. The diagrams connect user actions to real functions, data types, state changes, and the components that render again as a result.

中文简介正在准备中。当前显示英语简介。

  • Tracing what happens after a user action
  • Investigating why a component renders again
  • Mapping data structures and their consumers
slopus/happy2.4万2026年10月19日 更新

dev

免费

Set up and run Happy components locally, including its CLI, server, mobile app, and desktop app. The guide covers building, testing, checking logs, and separating development data using pnpm, the project's package management tool.

中文简介正在准备中。当前显示英语简介。

  • Setting up a local Happy development environment
  • Rebuilding the CLI and checking its daemon
  • Running the server and app locally
slopus/happy2.4万2026年10月19日 更新

maintain

免费

Organize Happy's GitHub issues, find duplicates, and check whether reported bugs are fixed on main, the primary development branch. Prepare replies and proposed actions for maintainer review, with explicit approval required before changes affecting contributors.

中文简介正在准备中。当前显示英语简介。

  • Grouping open issues and identifying duplicates
  • Checking whether reported bugs are fixed on main
  • Drafting replies and issue closure comments
slopus/happy2.4万2026年10月19日 更新

Query Prometheus metrics through Grafana and manage dashboards as JSON files. Use it to investigate current values and trends, add or adjust panels, and preview dashboard updates before applying them.

中文简介正在准备中。当前显示英语简介。

  • Investigating error rates and response times
  • Adding panels to a Grafana dashboard
  • Managing dashboard configuration as JSON
slopus/happy2.4万2026年10月19日 更新

Develop a product or side-project idea through guided questions and premise checks. Startup discussions examine evidence of demand, while builder discussions explore possibilities and scope, producing a design document before implementation begins.

中文简介正在准备中。当前显示英语简介。

  • Examining demand for a startup idea
  • Defining the smallest useful internal project
  • Shaping a hackathon or side-project idea
slopus/happy2.4万2026年10月19日 更新

查看 slopus 的全部技能

报告此技能的问题