-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update "noglobals" from
QUnit.log
to QUnit.on('testEnd')
event
- Loading branch information
Showing
1 changed file
with
13 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
var failures = []; | ||
QUnit.log(function(details) { | ||
if (details.result === false) { | ||
failures.push(details.message); | ||
QUnit.config.reorder = false; | ||
|
||
var failures; | ||
QUnit.on('testEnd', function(test) { | ||
if (!failures) { | ||
failures = test.errors; | ||
} | ||
}); | ||
|
||
QUnit.todo('global pollution', function(assert) { | ||
window.pollute = true; | ||
assert.ok(pollute, 'nasty pollution'); | ||
window.myPollution = true; | ||
assert.true(myPollution, 'nasty pollution'); | ||
// We expect QUnit to add an error to the end of this test | ||
}); | ||
|
||
QUnit.test('actually check for global pollution', function(assert) { | ||
QUnit.test('check result of previous test', function(assert) { | ||
assert.expect(1); | ||
assert.deepEqual(failures, ['Introduced global variable(s): pollute']); | ||
assert.propContains(failures, [ | ||
{ message: 'Introduced global variable(s): myPollution' } | ||
]); | ||
}); |