CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-karma-qunit

A Karma plugin that provides an adapter for the QUnit testing framework, enabling seamless integration between Karma test runner and QUnit test suites.

92

0.97x
Quality

Pending

Does it follow best practices?

Impact

92%

0.97x

Average score across 10 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-8/

Test Event Monitor

Build a test event monitoring utility that tracks and logs QUnit test execution events in real-time. This utility should capture various stages of test execution and provide detailed reporting information.

Requirements

Create a monitoring system that:

  1. Tracks Test Suite Beginning: Captures when the entire test suite starts running and logs the total number of tests scheduled to execute.

  2. Monitors Individual Test Execution: For each test that runs, records:

    • When the test starts executing
    • The test name
    • The module/suite it belongs to
    • When the test completes
    • The execution duration (in milliseconds)
  3. Captures Test Results: For each completed test, logs whether it:

    • Passed successfully
    • Failed (with details of failures)
    • Was skipped
  4. Collects Detailed Failure Information: When tests fail, captures:

    • The failure message
    • Expected vs actual values (if applicable)
    • The source location of the failure (if available)
  5. Reports Suite Completion: When all tests finish, logs:

    • Total number of tests that ran
    • Number of passed tests
    • Number of failed tests
    • Total execution time for the entire suite

Implementation Files

@generates

API

/**
 * Initializes the test event monitor
 * Sets up event listeners for QUnit lifecycle hooks
 * @param {Object} qunit - The QUnit instance to monitor
 */
function initMonitor(qunit);

/**
 * Returns collected monitoring data
 * @returns {Object} Object containing arrays of events captured during test execution
 */
function getMonitorData();

/**
 * Clears all collected monitoring data
 */
function clearMonitorData();

module.exports = {
  initMonitor,
  getMonitorData,
  clearMonitorData
};

Test Cases

  • When the test suite begins, the monitor captures the total test count @test
  • When a test starts, the monitor records the test name and module @test
  • When a test completes successfully, the monitor records the pass status and duration @test
  • When a test fails, the monitor captures failure details including message and expected/actual values @test
  • When all tests complete, the monitor records total/passed/failed counts and total runtime @test

Dependencies { .dependencies }

qunit { .dependency }

Provides the QUnit testing framework with test lifecycle event hooks.

@satisfied-by

tile.json