Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Latest commit

 

History

History
58 lines (44 loc) · 1.86 KB

test.todo.md

File metadata and controls

58 lines (44 loc) · 1.86 KB
layout title excerpt groups redirect_from version_added
page-api
QUnit.test.todo()
Add a test which expects at least one failing assertion.
main
/QUnit.todo/
/QUnit/todo/
/QUnit/test.todo/
2.2.0

QUnit.test.todo( name, callback )
QUnit.todo( name, callback )

Add a test which expects at least one failing assertion or exception during its run.

parameter description
name (string) Title of unit being tested
callback (function) Function that performs the test

Callback parameters

parameter description
assert (object) A new instance object with the assertion methods

Use this method to test a unit of code that is still under development (in a "todo" state). The "todo" test will pass as long as there is at least one assertion still failing, or if an exception is thrown.

When all assertions are passing, the "todo" test will fail, thus signaling that QUnit.test.todo() should be changed to QUnit.test().

You can also use QUnit.module.todo() to manage the "todo" state for all tests within a module at once.

Changelog

| QUnit 2.12 | The QUnit.todo() method was renamed to QUnit.test.todo().
Use of QUnit.todo() remains supported as an alias. | QUnit 2.2 | The QUnit.todo() method was introduced.

Examples

How to use QUnit.test.todo to denote code that is still under development.

QUnit.module('Robot', hooks => {
  let robot;
  hooks.beforeEach(() => {
    robot = new Robot();
  });

  // Robot is not yet finished
  QUnit.test.todo('fireLazer', assert => {
    const result = robot.fireLazer();
    assert.equal(result, "I'm firing my lazer!");
  });
});