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-6/

Test Utilities Manager

A utility module that provides test helper functions for managing and cleaning up mock states in test suites. The module should help developers properly reset test mocks between test cases to prevent test pollution.

Capabilities

Mock State Cleanup

  • Clears all call history from a provided mock function without removing its implementation @test
  • Completely resets a mock function by clearing its history and removing any custom implementation @test
  • Restores a spy to its original implementation while keeping the spy functional @test

Batch Mock Management

  • Clears call history from multiple mock functions at once @test
  • Resets multiple mock functions at once, removing all implementations @test

Implementation

@generates

API

/**
 * Clears the call history of a mock function without affecting its implementation.
 *
 * @param {Function} mockFn - A Jest mock function whose call history should be cleared.
 */
function clearMockHistory(mockFn) {
  // IMPLEMENTATION HERE
}

/**
 * Completely resets a mock function, clearing its call history and removing
 * any custom implementation or return values.
 *
 * @param {Function} mockFn - A Jest mock function to reset completely.
 */
function resetMock(mockFn) {
  // IMPLEMENTATION HERE
}

/**
 * Restores a spy to its original implementation.
 *
 * @param {Function} spyFn - A Jest spy function to restore.
 */
function restoreSpy(spyFn) {
  // IMPLEMENTATION HERE
}

/**
 * Clears call history from multiple mock functions.
 *
 * @param {Function[]} mockFns - Array of Jest mock functions.
 */
function clearMultipleMocks(mockFns) {
  // IMPLEMENTATION HERE
}

/**
 * Resets multiple mock functions completely.
 *
 * @param {Function[]} mockFns - Array of Jest mock functions.
 */
function resetMultipleMocks(mockFns) {
  // IMPLEMENTATION HERE
}

module.exports = {
  clearMockHistory,
  resetMock,
  restoreSpy,
  clearMultipleMocks,
  resetMultipleMocks,
};

Dependencies { .dependencies }

jest-circus { .dependency }

Provides test framework globals and mock functionality.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-jest-circus

tile.json