Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.4 KB

File metadata and controls

52 lines (38 loc) · 1.4 KB
layout page-api
title QUnit.config.current
excerpt Internal object representing the currently running test.
groups
config
extension
redirect_from
/config/current/
version_added 1.0.0

Internal object representing the currently running test.

type `undefined` or `object` (read-only)

This object is not a configuration option, but is exposed under QUnit.config for use by plugins and other integrations. This offers access to QUnit's internal Test object at runtime.

Properties

name description
testName (string) Name of the currently-running test, as passed to QUnit.test.
testId (string) Internal ID, used by QUnit.config.testId to power "Rerun" links and the HTML API in the HTML Reporter.

Other properties may change without notice. When possible, use QUnit.on or event callbacks instead.

Changelog

| QUnit 1.16 | Added testId property.

Example

Access QUnit.config.current.testName to observe the currently running test's name.

function whatsUp () {
  console.log(QUnit.config.current.testName); // "example"
}

QUnit.test('example', function (assert) {
  whatsUp();

  assert.true(true);
});