CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-jest-circus

The next-gen flux-based test runner for Jest that provides test framework globals and event-driven test execution

82

1.90x
Overview
Eval results
Files

task.mdevals/scenario-5/

Custom Matchers for Range Validation

Build a custom Jest matcher library that provides intuitive assertions for testing numeric ranges and boundary conditions.

Capabilities

Range validation matcher

Provides a matcher to check if a number falls within a specified range (inclusive).

  • Given the number 5, checking if it's in range [1, 10] returns true @test
  • Given the number 0, checking if it's in range [1, 10] returns false @test
  • Given the number 10, checking if it's in range [1, 10] returns true (inclusive upper bound) @test

Matcher provides helpful error messages

The custom matcher should provide clear, descriptive error messages when assertions fail.

  • When a value is outside the expected range, the error message includes the received value and the expected range @test

Implementation

@generates

API

/**
 * Extends Jest's expect with custom matchers for range validation.
 * Must be called before using the custom matchers in tests.
 */
function setupCustomMatchers() {
  // Implementation registers custom matcher(s) with expect
}

module.exports = { setupCustomMatchers };

Dependencies { .dependencies }

jest { .dependency }

Provides the testing framework and expect.extend functionality for creating custom matchers.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-jest-circus

tile.json