Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

cargo-nextest

БесплатноБез исполняемых скриптовНе проверен

cargo-nextest: fast Rust test runner with parallel execution and advanced filtering. Use when running tests, setting up CI, or diagnosing flaky/slow tests.

laurigatesот laurigates★ 61 звезда на GitHub

Об этом скилле

cargo-nextest - Next-Generation Test Runner

cargo-nextest is a faster, more reliable test runner for Rust that executes each test in its own process for better isolation and parallel performance.

When to Use This Skill

Use this skill when... Use sibling skill instead when...
Running tests in parallel with process isolation Measuring code coverage -- use cargo-llvm-cov
Filtering tests by package, name, or pattern Linting test code style -- use clippy-advanced
Setting up flaky-test retries in CI Auditing unused test deps -- use cargo-machete
Optimizing test runtime via partitioning Authoring tests / async patterns -- use rust-development

Installation

# Install cargo-nextest
cargo install cargo-nextest --locked

# Verify installation
cargo nextest --version

Basic Usage

# Run all tests with nextest
cargo nextest run

# Run specific test
cargo nextest run test_name

# Run tests in specific package
cargo nextest run -p package_name

# Run with verbose output
cargo nextest run --verbose

# Run ignored tests
cargo nextest run -- --ignored

# Run all tests including ignored
cargo nextest run -- --include-ignored

Configuration File

Create .config/nextest.toml in your project root:

[profile.default]
# Number of retries for flaky tests
retries = 0

# Test threads (default: number of logical CPUs)
test-threads = 8

# Fail fast - stop on first failure
fail-fast = false

# Show output for passing tests
success-output = "never"  # never, immediate, final, immediate-final

# Show output for failing tests
failure-output = "immediate"  # never, immediate, final, immediate-final

[profile.ci]
# CI-specific configuration
retries = 2
fail-fast = true
success-output = "never"
failure-output = "immediate-final"

# Slow test timeout
slow-timeout = { period = "60s", terminate-after = 2 }

[profile.ci.junit]
# JUnit XML output for CI
path = "target/nextest/ci/junit.xml"

Test Filtering with Expression Language

# Run tests matching pattern
cargo nextest run -E 'test(auth)'

# Run tests in specific binary
cargo nextest run -E 'binary(my_app)'

# Run tests in specific package
cargo nextest run -E 'package(my_crate)'

# Complex expressions with operators
cargo nextest run -E 'test(auth) and not test(slow)'

# Run all integration tests
cargo nextest run -E 'kind(test)'

# Run only unit tests in library
cargo nextest run -E 'kind(lib) and test(/)'

Expression Operators

  • test(pattern) - Match test name (regex)
  • binary(pattern) - Match binary name
  • package(pattern) - Match package name
  • kind(type) - Match test kind (lib, bin, test, bench, example)
  • platform(os) - Match target platform
  • not expr - Logical NOT
  • expr and expr - Logical AND
  • expr or expr - Logical OR

Parallel Execution

Nextest runs each test in its own process by default, providing:

  • Better isolation - Tests cannot interfere with each other
  • True parallelism - No global state conflicts
  • Fault isolation - One test crash doesn't affect others
  • Better resource management - Each test has clean environment
# Control parallelism
cargo nextest run --test-threads 4

# Single-threaded execution
cargo nextest run --test-threads 1

# Use all available cores
cargo nextest run --test-threads 0

Output Formats

# Human-readable output (default)
cargo nextest run

# JSON output for programmatic parsing
cargo nextest run --message-format json

# JSON with test output
cargo nextest run --message-format json-pretty

# Generate JUnit XML for CI
cargo nextest run --profile ci

# Combine with cargo-llvm-cov for coverage
cargo llvm-cov nextest --html

Flaky Test Management

# In .config/nextest.toml
[profile.default]
# Retry flaky tests automatically
retries = 3

# Detect tests that pass on retry
[profile.default.overrides]
filter = 'test(flaky_)'
retries = 5
# Run with retries
cargo nextest run --retries 3

# Show retry statistics
cargo nextest run --retries 3 --failure-output immediate-final

GitHub Actions Integration

name: Test

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]

      - name: Install the pinned toolchain
        run: rustup toolchain install --no-self-update

      - name: Install nextest
        uses: taiki-e/[email protected]
        with:
          tool: nextest

      - name: Run tests
        run: cargo nextest run --profile ci --all-features

      - name: Upload test results
        if: always()
        uses: actions/[email protected]
        with:
          name: test-results
          path: target/nextest/ci/junit.xml

      - name: Publish test results
        uses: EnricoMi/[email protected]
        if: always()
        with:
          files: target/nextest/ci/junit.xml

Advanced Configuration

# .config/nextest.
Полный SKILL.md на GitHub

Установить cargo-nextest в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(cargo nextest run *)
Bash(cargo test *)
Bash(cargo llvm-cov nextest *)
Read
Grep
Glob

FAQ

Что делает скилл cargo-nextest?

cargo-nextest: fast Rust test runner with parallel execution and advanced filtering. Use when running tests, setting up CI, or diagnosing flaky/slow tests.

Как установить скилл cargo-nextest?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл cargo-nextest запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить cargo-nextest с