-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: Add
QUnit.test.if()
and QUnit.module.if()
Cherry-picked from a165ab8 (3.0.0-dev): > Closes #1772. Co-authored-by: Steve McClure <[email protected]>
- Loading branch information
1 parent
a136726
commit e61f4cc
Showing
9 changed files
with
89 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
QUnit.test.if('skip me', false, function (assert) { | ||
assert.true(false); | ||
}); | ||
|
||
QUnit.test.if('keep me', true, function (assert) { | ||
assert.true(true); | ||
}); | ||
|
||
QUnit.test('regular', function (assert) { | ||
assert.true(true); | ||
}); | ||
|
||
QUnit.test.if.each('skip dataset', false, ['a', 'b'], function (assert, _data) { | ||
assert.true(false); | ||
}); | ||
|
||
QUnit.test.if.each('keep dataset', true, ['a', 'b'], function (assert, data) { | ||
assert.true(true); | ||
assert.equal(typeof data, 'string'); | ||
}); | ||
|
||
QUnit.module.if('skip group', false, function () { | ||
QUnit.test('skipper', function (assert) { | ||
assert.true(false); | ||
}); | ||
}); | ||
|
||
QUnit.module.if('keep group', true, function (hooks) { | ||
let list = []; | ||
hooks.beforeEach(function () { | ||
list.push('x'); | ||
}); | ||
QUnit.test('keeper', function (assert) { | ||
assert.true(true); | ||
assert.deepEqual(list, ['x']); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# name: no tests | ||
# command: ["qunit", "test-if.js"] | ||
|
||
TAP version 13 | ||
ok 1 # SKIP skip me | ||
ok 2 keep me | ||
ok 3 regular | ||
ok 4 # SKIP skip dataset [0] | ||
ok 5 # SKIP skip dataset [1] | ||
ok 6 keep dataset [0] | ||
ok 7 keep dataset [1] | ||
ok 8 # SKIP skip group > skipper | ||
ok 9 keep group > keeper | ||
1..9 | ||
# pass 5 | ||
# skip 4 | ||
# todo 0 | ||
# fail 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters