QUnit.test.skip()

version added: 1.16.0.

Description

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

Add a test that will be skipped during the run.

parameter description
name (string) Title of unit
callback (function) Optional, function that would perform 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.

See also

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 tests, or to temporarily skip a broken test.

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());
  });

  // TODO: Implement this later!
  QUnit.test.skip('jump');
});