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

Latest commit

 

History

History
55 lines (42 loc) · 1.66 KB

test.skip.md

File metadata and controls

55 lines (42 loc) · 1.66 KB
layout title excerpt groups redirect_from version_added
page-api
QUnit.test.skip()
Add a test that will be skipped.
main
/QUnit.skip/
/QUnit/skip/
/QUnit/test.skip/
1.16.0

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

Add a test that will be skipped during the run.

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

Use this method to disable a QUnit.test(), as alternative to commenting out the test.

This test will be listed in the results as a "skipped" test. The callback and the respective module's hooks will not run.

As a codebase becomes bigger, you may sometimes want to temporarily disable an entire group of tests at once. You can use QUnit.module.skip() to recursively skip all tests in the same module.

Changelog

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

Examples

How to use skip as a placeholder for future or temporarily broken tests.

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

  QUnit.test('say', assert => {
    assert.strictEqual(robot.say(), 'Exterminate!');
  });

  // Robot does not yet have a laser() method yet, skip this test for now
  QUnit.test.skip('laser', assert => {
    assert.true(robot.laser());
  });
});