NEW in v1.0.10

Test Filtering

Run only the tests you need with powerful pattern matching. Focus on specific tests during development or skip flaky tests in CI.

Filter Options

--filter <pattern>

Run only tests matching the specified pattern. Supports wildcards.

--skip <pattern>

Exclude tests matching the pattern from running.

Examples

Run only search-related tests

mcp-jest node ./server.js --tools "search,email,weather" --filter search

Skip email tests during development

mcp-jest node ./server.js --tools "search,email,weather" --skip email

Use wildcards for flexible matching

# Match all user-related tests
mcp-jest node ./server.js --tools "getUser,getUserProfile,updateUser" --filter "user*"

# Match tests containing "search"
mcp-jest node ./server.js --filter "*search*"

Combine with other options

mcp-jest node ./server.js --filter search --timeout 5000 --update-snapshots

Pattern Syntax

PatternMatches
searchExact match: "search"
search*Starts with: "search", "searchUsers", "searchProducts"
*searchEnds with: "search", "quickSearch", "globalSearch"
*search*Contains: "search", "searchUsers", "quickSearchApi"

Use Cases

  • Fast iteration: Focus on the specific feature you're developing
  • Debugging: Run only the failing test to isolate issues
  • CI optimization: Skip slow integration tests for quick feedback
  • Flaky test management: Temporarily skip problematic tests while investigating

💡 Pro Tip

Combine --filter with--watch mode for a focused development workflow that only re-runs the tests you care about.