Central control for starting and configuring the QUnit test runner with Ember-specific options. The start() function is the main entry point that orchestrates test environment setup.
Main entry point to start the test runner with configurable options.
/**
* Configures and starts the QUnit test runner with Ember-specific setup
* @param options - Configuration options for test runner behavior
*/
function start(options?: QUnitStartOptions): void;
interface QUnitStartOptions {
/** If false, test container will not be setup based on URL params, defaults to true */
setupTestContainer?: boolean;
/** If false, tests will not be automatically started, defaults to true */
startTests?: boolean;
/** If false, default Ember.Test adapter will not be updated, defaults to true */
setupTestAdapter?: boolean;
/** If false, opts out of setting Ember.testing during tests, defaults to true */
setupEmberTesting?: boolean;
/** If false, test isolation validation will be disabled */
setupTestIsolationValidation?: boolean;
/** Max time in milliseconds allowed after test completion for async to settle, defaults to 50 */
testIsolationValidationDelay?: number;
}Usage Example:
// tests/test-helper.js - Standard setup
import Application from '../app';
import config from '../config/environment';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';
setApplication(Application.create(config.APP));
start();// Custom configuration
start({
setupTestContainer: true,
startTests: true,
setupTestAdapter: true,
setupEmberTesting: true,
setupTestIsolationValidation: true,
testIsolationValidationDelay: 100
});The start() function internally calls these individual setup functions. They can be used separately for custom test runner configuration.
Configures the test container based on URL parameters.
/**
* Configures test container display based on URL parameters:
* - ?nocontainer - hides the test container
* - ?devmode or ?fullscreencontainer - makes container full screen
*/
function setupTestContainer(): void;Sets up the Ember.Test adapter for QUnit 2.x usage.
/**
* Configures the custom QUnit adapter for Ember's async testing needs
*/
function setupTestAdapter(): void;Ensures Ember.testing is properly set during test execution.
/**
* Sets Ember.testing to true before each test and false after each test
* This is critical for proper Ember test behavior
*/
function setupEmberTesting(): void;Validates that Ember.onerror properly re-throws errors during testing.
/**
* Creates a validation test to ensure Ember.onerror handler
* properly re-throws exceptions when Ember.testing is true
*/
function setupEmberOnerrorValidation(): void;Resets Ember.onerror after each test to prevent cross-test contamination.
/**
* Resets Ember.onerror after each test completion
* Called automatically by start() to prevent error handlers from affecting other tests
*/
function setupResetOnerror(): void;Enables test isolation validation to catch leaky tests.
/**
* Enables detection of tests that aren't properly isolated
* (have pending timers, runloops, AJAX requests, or waiters)
* @param delay - Maximum time in milliseconds to wait for settlement, defaults to 50
*/
function setupTestIsolationValidation(delay?: number): void;Instructs QUnit to start running tests.
/**
* Calls QUnit.start() to begin test execution
*/
function startTests(): void;Custom test adapter that handles Ember's async testing requirements.
/**
* Custom QUnit adapter for Ember.js applications
* Handles async test coordination between Ember and QUnit
*/
class QUnitAdapter extends EmberTestAdapter {
/** Initialize adapter with QUnit reference and done callback tracking */
init(): void;
/** Handle start of async operation in tests */
asyncStart(): void;
/** Handle end of async operation in tests */
asyncEnd(): void;
}
/**
* Empty callback function used when no test is currently running
*/
function nonTestDoneCallback(): void;Usage Example:
// Manual adapter setup (normally done by start())
import { QUnitAdapter, setupTestAdapter } from 'ember-qunit';
import { setAdapter } from 'ember-testing/lib/test/adapter';
// Option 1: Use convenience function
setupTestAdapter();
// Option 2: Manual setup
setAdapter(QUnitAdapter.create());QUnit is automatically configured with URL parameters for test control:
?nocontainer - Hide the test container?devmode - Enable development mode (no test timeout, full screen container)?fullscreencontainer - Make test container full screenTest timeout is set to 60 seconds by default, or null in devmode.