or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-5/

Test Runner Controller

Build a test runner controller that manages test execution timing and provides control over when tests start. The controller should work with asynchronous test loading scenarios and provide both automatic and manual start modes.

Requirements

Create a test runner controller that:

  1. Supports automatic and manual test start modes via configuration
  2. Implements a configurable delay before test execution begins
  3. Tracks the running state of the test suite
  4. Provides a manual start method for deferred execution scenarios

Functional Requirements

Configuration

The controller accepts a configuration object:

{
  autostart: boolean,  // If true, tests start automatically; if false, manual start required
  delay: number        // Milliseconds to wait before starting (applies after initialization)
}

Default values: autostart: true, delay: 0

Execution Control

When autostart is true: Tests begin automatically after the configured delay When autostart is false: Tests wait indefinitely until start() is called manually

The delay period begins counting after the controller is initialized.

State Management

The controller maintains a running state that can be queried to determine if tests have started.

API

/**
 * Creates a test runner controller
 * @param {Object} config - Configuration object
 * @param {boolean} [config.autostart=true] - Whether to start tests automatically
 * @param {number} [config.delay=0] - Delay in milliseconds before starting
 * @returns {Object} Controller instance
 */
function createController(config);

/**
 * Manually starts the test runner
 * Should only be called when autostart is false
 */
controller.start();

/**
 * Returns whether tests are currently running
 * @returns {boolean} True if tests have started
 */
controller.isRunning();

/**
 * Returns a promise that resolves when tests start
 * @returns {Promise<void>} Resolves when test execution begins
 */
controller.onStart();

@generates

Test Cases

  • When autostart is true and delay is 0, tests start immediately after initialization @test
  • When autostart is false, tests do not start until start() is called manually @test
  • When autostart is true with delay of 100ms, tests start 100ms after initialization @test

Dependencies { .dependencies }

karma-qunit { .dependency }

Provides test framework integration with configuration options for controlling test execution timing and manual start capabilities.