-
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.
Assert: Improve detection of bad calls to
assert.async()
callbacks
- Loading branch information
Showing
13 changed files
with
273 additions
and
182 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 |
---|---|---|
@@ -1,14 +1,35 @@ | ||
// Support IE 9-10, PhantomJS: Fallback for fuzzysort.js used by ./html.js | ||
// Support IE 9-10, Safari 7, PhantomJS: Partial Map fallback. | ||
// Used by html.js (via fuzzysort.js), and test.js. | ||
// | ||
// FIXME: This check is broken. This file is embedded in the qunit.js closure, | ||
// thus the Map var is hoisted in that scope, and starts undefined (not a function). | ||
var Map = typeof Map === "function" ? Map : function StringMap() { | ||
var store = Object.create( null ); | ||
var hasOwn = Object.prototype.hasOwnProperty; | ||
this.get = function( strKey ) { | ||
return store[ strKey ]; | ||
}; | ||
this.set = function( strKey, val ) { | ||
if ( !hasOwn.call( store, strKey ) ) { | ||
this.size++; | ||
} | ||
store[ strKey ] = val; | ||
return this; | ||
}; | ||
this.delete = function( strKey ) { | ||
if ( hasOwn.call( store, strKey ) ) { | ||
delete store[ strKey ]; | ||
this.size--; | ||
} | ||
}; | ||
this.forEach = function( callback ) { | ||
for ( var strKey in store ) { | ||
callback( store[ strKey ], strKey ); | ||
} | ||
}; | ||
this.clear = function() { | ||
store = Object.create( null ); | ||
this.size = 0; | ||
}; | ||
this.size = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
QUnit.test( "extra done scheduled outside any test", assert => { | ||
assert.timeout( 10 ); | ||
const done = assert.async(); | ||
assert.true( true ); | ||
|
||
// Later, boom! | ||
setTimeout( done, 100 ); | ||
|
||
// Passing, end of test | ||
done(); | ||
} ); |
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 @@ | ||
QUnit.config.reorder = false; | ||
|
||
let done; | ||
|
||
QUnit.test( "Test A", assert => { | ||
assert.ok( true ); | ||
done = assert.async(); | ||
|
||
// Passing. | ||
done(); | ||
} ); | ||
|
||
QUnit.test( "Test B", assert => { | ||
assert.ok( true ); | ||
|
||
// Boom | ||
done(); | ||
} ); |
Oops, something went wrong.