Agent Skillsmx-space/core › run-test

run-test

GitHub

用于执行项目测试的 Skill,支持全量、单文件、模式匹配及 Watch 模式运行测试,涵盖单元测试与 E2E 测试场景。

.claude/skills/run-test/SKILL.md mx-space/core

Trigger Scenarios

需要运行所有测试时 指定特定文件或测试用例名称运行时 进入测试监听模式时

Install

npx skills add mx-space/core --skill run-test -g -y
More Options

Non-standard path

npx skills add https://github.com/mx-space/core/tree/master/.claude/skills/run-test -g -y

Use without installing

npx skills use mx-space/core@run-test

指定 Agent (Claude Code)

npx skills add mx-space/core --skill run-test -a claude-code -g -y

安装 repo 全部 skill

npx skills add mx-space/core --all -g -y

预览 repo 内 skill

npx skills add mx-space/core --list

SKILL.md

Frontmatter
{
    "name": "run-test",
    "description": "Run tests. Supports running all tests, single file, or pattern-matched tests.",
    "allowed-tools": "Bash(pnpm test*), Bash(cd *), Read, Glob",
    "argument-hint": [
        "file-path|pattern"
    ],
    "disable-model-invocation": true
}

Run Tests

Run project tests. Arguments: $ARGUMENTS

Test Commands

Run All Tests

pnpm test

Run Single Test File

# Using relative path (from apps/core directory)
pnpm test -- test/src/modules/post/post.controller.e2e-spec.ts

# Using filename pattern
pnpm test -- --testNamePattern="PostController"

Watch Mode

pnpm -C apps/core run test:watch

Run Specific Test Case

# Match test name
pnpm test -- --testNamePattern="should create post"

Test Directory Structure

apps/core/test/
├── src/
│   ├── modules/           # Module tests
│   │   ├── post/
│   │   │   ├── post.controller.e2e-spec.ts
│   │   │   └── post.e2e-mock.db.ts
│   │   ├── user/
│   │   │   ├── user.controller.spec.ts
│   │   │   ├── user.controller.e2e-spec.ts
│   │   │   └── user.service.spec.ts
│   │   └── ...
│   ├── utils/             # Utility tests
│   ├── processors/        # Processor tests
│   └── transformers/      # Transformer tests
├── helper/                # Test helpers
├── mock/                  # Mock implementations
└── setup-global.ts        # Global setup

Test Types

Suffix Type Description
.spec.ts Unit test Test single function or class
.e2e-spec.ts E2E test Test complete HTTP request flow

Execution Steps

  1. Analyze arguments to determine which tests to run
  2. If file path specified, verify file exists first
  3. Execute appropriate test command
  4. Report test results

Common Issues

Test Timeout

Increase timeout:

pnpm test -- --testTimeout=30000

Memory Issues

Tests use in-memory database. If memory issues occur:

NODE_OPTIONS="--max-old-space-size=4096" pnpm test

Run Only Failed Tests

pnpm test -- --reporter=verbose

Version History

  • a28bdf5 Current 2026-07-25 05:38

Same Skill Collection

.claude/skills/api-conventions/SKILL.md
.claude/skills/create-e2e-test/SKILL.md
.claude/skills/create-module/SKILL.md
.claude/skills/mx-core-local-auth/SKILL.md
.claude/skills/mx-pg-controller-migration/SKILL.md
.claude/skills/mx-review/SKILL.md
.claude/skills/mxs-cli-ai-author/SKILL.md
.claude/skills/release-core/SKILL.md
.claude/skills/zod-patterns/SKILL.md
.claude/skills/mx-migration-author/SKILL.md

Metadata

Files
0
Version
c2ffb56
Hash
2eb0bfde
Indexed
2026-07-25 05:38

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