-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assert: Improve detection of bad calls to assert.async()
callbacks
#1642
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e122217
Assert: Improve detection of bad calls to `assert.async()` callbacks
Krinkle 759840b
Update src/test.js
Krinkle 3fb2b5c
Update src/cli/run.js
Krinkle 5aae48b
Add drooling-extra-done-outside.js
Krinkle b97a9e3
Rename pause.killed to pause.cancelled
Krinkle 5bc42c2
Use pause IDs as map keys, move hash to formatted string
Krinkle 0969fb2
Move pause housekeeping up in timeoutHandler()
Krinkle 6f9ffea
Call test.pushFailure() directly in timeoutHandler()
Krinkle f754296
Move timeoutDuration inline comment back
Krinkle fbb9e92
Rename internal test.asyncNextPauseId to test.nextPauseId
Krinkle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just fix it now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That won't work, it'll still be hosted just the same, right? It's a pretty tough situation. I set it up such that it is included by rollup as
intro
(within the file closure, so as to not leak and be seen by end-user source code), and thus the variable will be seen by fuzzysort.js and other code we use naturally as if it was a global.Without pulling in
globalThis
into here, I'm not sure how to do this because as soon as you declare anything asMap
you inherently also deprive your ability to see the outer scope's value for that same reference.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. What's needed is something like the following, which can't be fixed at this level (and is out of scope for this PR).