layout | title | excerpt | groups | redirect_from | version_added | ||||
---|---|---|---|---|---|---|---|---|---|
page-api |
QUnit.test.skip() |
Add a test that will be skipped. |
|
|
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.
| 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.
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());
});
});