技能 编程开发 自动跨栈测试运行器

自动跨栈测试运行器

v20260730
ci-tests
这是一个统一的接口,用于在CI/CD流程中为多种编程语言(Python、Node.js、Rust)运行测试套件。它能自动检测项目环境,并调用相应的测试框架,确保无论底层语言如何,都能进行一致的代码质量检查。适用于代码提交或持续集成环境。
获取技能
242 次下载
概览

/ci:tests: Run tests

Detects the stack and runs tests with the right command.

Stack detection

if [ -f "uv.lock" ]; then
  STACK="python"
elif [ -f "pnpm-lock.yaml" ] || [ -f "package.json" ]; then
  STACK="node"
elif [ -f "Cargo.toml" ]; then
  STACK="rust"
else
  STACK="unknown"
fi

Commands by stack

Python (uv + pytest)

# All tests
uv run pytest --tb=short -q $ARGUMENTS

# With coverage
uv run pytest --cov=src --cov-report=term-missing -q

# Specific file or folder
uv run pytest $ARGUMENTS -v

Node (pnpm + vitest)

# All tests
pnpm vitest run $ARGUMENTS

# With coverage
pnpm vitest run --coverage

# Watch mode (dev)
pnpm vitest

Node (npm + jest)

npm test -- --passWithNoTests $ARGUMENTS

Rust (cargo)

cargo test --quiet $ARGUMENTS 2>&1

Expected output

Tests: my-api (Python/pytest)
───────────────────────────────

uv run pytest --tb=short -q

[pytest output]

✅ 42 passed in 3.1s  →  Ready to push

On failure:

❌ 2 failed

FAILED tests/test_billing.py::TestInvoice::test_promo_expired
AssertionError: expected discount=0, got discount=10

→ Fix before pushing.

Usage

/ci:tests
/ci:tests tests/test_orders.py
/ci:tests src/components/Button.test.tsx

Target: $ARGUMENTS

信息
Category 编程开发
Name ci-tests
版本 v20260730
大小 1.61KB
更新时间 2026-08-04
语言