Agent Skillsxinity-ai/xinity-ai › run-tests

run-tests

GitHub

本地全量运行测试套件,验证依赖变更或重构后的运行时行为。分三阶段:包级并行测试、系统测试及仪表盘测试,确保所有测试通过。

.claude/skills/run-tests/SKILL.md xinity-ai/xinity-ai

Trigger Scenarios

验证依赖变更 代码重构后验证 检查运行时行为影响

Install

npx skills add xinity-ai/xinity-ai --skill run-tests -g -y
More Options

Non-standard path

npx skills add https://github.com/xinity-ai/xinity-ai/tree/main/.claude/skills/run-tests -g -y

Use without installing

npx skills use xinity-ai/xinity-ai@run-tests

指定 Agent (Claude Code)

npx skills add xinity-ai/xinity-ai --skill run-tests -a claude-code -g -y

安装 repo 全部 skill

npx skills add xinity-ai/xinity-ai --all -g -y

预览 repo 内 skill

npx skills add xinity-ai/xinity-ai --list

SKILL.md

Frontmatter
{
    "name": "run-tests",
    "description": "End-to-end verification that every test suite in the workspace runs green locally. Use when validating dependency changes, refactors, or anything else that could plausibly affect runtime behavior across packages."
}

Run Tests

End-to-end procedure for verifying every test suite in the workspace runs green locally. Use when validating dependency changes, refactors, or anything else that could plausibly affect runtime behavior across packages. Runs in three sequential phases: non-dashboard package tests, system tests, then dashboard tests.

Phase 0: kick off the dashboard build in the background

Phase 3 needs the dashboard's production build before its preview server can start. The build takes a couple of minutes, so kick it off as a background task right at the beginning so it overlaps with phases 1 and 2:

cd packages/xinity-ai-dashboard && bun run build

Use the Bash tool with run_in_background: true. Save the resulting shell ID. By the time phases 1 and 2 finish, the build is usually done; if not, wait on it before phase 3.

Prerequisites you bring up yourself

Bring these up as needed; don't ask the user to do it.

Phase needs What must be running How to start it
Phase 1 nothing extra (none)
Phase 2 docker compose stack (Postgres, Mailhog, etc.) docker compose up -d from repo root
Phase 3 dashboard preview, infoserver dev, plus the docker stack from phase 2 After phase 0's build finishes: NODE_ENV=test LOG_LEVEL=info bun run preview in packages/xinity-ai-dashboard (run in background); bun run dev in packages/xinity-infoserver (run in background)

LOG_LEVEL=info on the dashboard preview is important: the default log level is much noisier, and the volume of log output blows up Claude's context for no benefit.

Phase 1: non-dashboard package tests

Discover packages dynamically rather than hardcoding the list (workspace membership changes over time):

for pkg_dir in packages/*/; do
  name=$(jq -r .name "$pkg_dir/package.json")
  has_test=$(jq -r '.scripts.test // empty' "$pkg_dir/package.json")
  if [ "$name" != "xinity-ai-dashboard" ] && [ -n "$has_test" ]; then
    echo "$name"
  fi
done

Run the discovered packages' bun run test scripts in parallel via separate Bash tool calls in a single message. They are independent: no shared state, no services. Every package must report 0 fails.

Report counts back as a small table. If any package fails, surface the failure and stop. Do not modify test code without instruction.

Phase 2: system tests

bun run test:system   # from repo root

Reads from tests/system/. Hits the real Postgres in the docker stack, plus other services that get spun up per-test. SeaweedFS-dependent tests self-skip if SeaweedFS isn't reachable; that's expected and not a failure.

Phase 3: dashboard tests

By now the phase 0 background build should be finished. Start the dashboard preview (with LOG_LEVEL=info) and infoserver dev yourself in the background, give them a few seconds to come up, then:

cd packages/xinity-ai-dashboard && bun run test

This runs both the small in-package unit tests and the full e2e/ suite, which hits the running preview server + infoserver. Expect roughly 90 seconds of wall time. If the count of test files in the output looks low compared to what find packages/xinity-ai-dashboard -name '*.test.ts' -not -path '*/node_modules/*' | wc -l reports, the e2e suite is being skipped: check that the preview server is actually reachable.

Phase 4: tear down what you brought up

After phase 3 finishes (pass or fail), shut down everything this skill started so nothing keeps running in the background:

  • TaskStop the dashboard preview and infoserver background tasks (use the IDs you saved when starting them).
  • docker compose down from the repo root to stop the docker stack.

The phase 0 build task exits on its own and does not need to be stopped. Do not skip teardown on failure: leftover servers and containers will block the next run.

Reporting back

After each phase, report a one-line summary per package:

xinity-ai-daemon: 80 pass, 3 skip
xinity-ai-gateway: 235 pass
...

After all three phases pass, summarize as a single table. If anything failed, surface the failure clearly and stop. Do not attempt to repair test code without instruction.

Common issues

  • Cannot find module 'X' from a test: the package likely imports a dep it does not declare in its own package.json (was relying on bun hoisting). Add it as a direct devDep on the package that imports it.
  • Dashboard e2e timeouts: preview server probably is not running, or LOG_LEVEL=info was forgotten and stdout is overflowing. Check both before retrying.
  • System tests cannot reach Postgres: docker stack is not up. Run docker compose up -d yourself.

Version History

  • 9817b2f Current 2026-07-25 05:51

Same Skill Collection

.claude/skills/add-dashboard-orpc-procedure/SKILL.md
.claude/skills/add-env-variable/SKILL.md
.claude/skills/code-quality-control/SKILL.md
.claude/skills/integrate-model/SKILL.md

Metadata

Files
0
Version
7684ed0
Hash
379f92f0
Indexed
2026-07-25 05:51

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 14:53
浙ICP备14020137号-1 $Гость$