-
Notifications
You must be signed in to change notification settings - Fork 781
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
Core: fix module.only logic for "flat" structures #1527
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
76252b1
Core: fixing module.only logic for "flat" structures
smcclure15 eb56280
Tests: move "only" tests to CLI suite to verify TAP output
smcclure15 8036dcd
Tests: delete sandbox test and add node tests
smcclure15 7fb993b
Tests: restoring sandboxed-iframe test
smcclure15 5a75285
Tests: remove trailing whitespace
smcclure15 881d010
Merge branch 'master' into module-only-flat
smcclure15 3ee0efd
Core: prefer "ignore" over "closed"
smcclure15 2a22bd3
Merge branch 'master' into module-only-flat
smcclure15 ea8a5f5
Merge branch 'master' into module-only-flat
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
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,27 @@ | ||
|
||
QUnit.module( "module A" ); | ||
QUnit.test( "test A", function( assert ) { | ||
assert.true( false, "this test should not run" ); | ||
} ); | ||
|
||
QUnit.module.only( "module B" ); | ||
QUnit.todo( "test B", function( assert ) { | ||
assert.true( false, "not implemented yet" ); | ||
} ); | ||
QUnit.skip( "test C", function( assert ) { | ||
assert.true( false, "test should be skipped" ); | ||
} ); | ||
QUnit.test( "test D", function( assert ) { | ||
assert.true( true, "this test should run" ); | ||
} ); | ||
|
||
QUnit.module( "module C" ); | ||
QUnit.todo( "test E", function( assert ) { | ||
assert.true( false, "not implemented yet" ); | ||
} ); | ||
QUnit.skip( "test F", function( assert ) { | ||
assert.true( false, "test should be skipped" ); | ||
} ); | ||
QUnit.test( "test G", function( assert ) { | ||
assert.true( false, "this test should not run" ); | ||
} ); |
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,15 @@ | ||
QUnit.test( "implicitly skipped test", function( assert ) { | ||
assert.true( false, "test should be skipped" ); | ||
} ); | ||
|
||
QUnit.only( "run this test", function( assert ) { | ||
assert.true( true, "only this test should run" ); | ||
} ); | ||
|
||
QUnit.test( "another implicitly skipped test", function( assert ) { | ||
assert.true( false, "test should be skipped" ); | ||
} ); | ||
|
||
QUnit.only( "all tests with only run", function( assert ) { | ||
assert.true( true, "this test should run as well" ); | ||
} ); |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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.
It took me a while to realize that this is actually mutating the "previous" module. The one we are processing now, never makes it into the registry. This feels a bit fragile as it means
test()
calls are thus interacting with a closed module and I can see that leading to some confusing failures in the future.On the other hand, given the way that
only
is meant to act like afilter
, the module isn't meant to be visible in any way. Perhaps, though, it would be best to still let it enter the registry, but as an empty module that (if all goes well) will never start or stop, because it is empty. Afaik that is how empty modules are treated.If empty modules are exposed to reporters or callbacks in some way, then we'd need some additional logic to make sure e.g. empty modules with
currentModule.ignored
get bypassed in our events/callback layer.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.
Let me know if you like that direction. I haven't thought it through fully, so it's not a strong suggestion, just an idea.
For now my only suggestion would be to add an inline comment indicating what we have done, which is to keep the previous module on the stack and that "closed" means it was implicitly closed by a subsequent
module()
call.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.
I'm certainly intrigued by that suggestion, and the notion of
currentModule.ignored
has a much more natural feel and intuition.I think it's inside
module.only
where we setconfig.modules.length = 0;
to effectively wipe out the others that were registered before. I'm trying to make that work with something likebut I'm definitely wrestling with the unittests - I don't have everything quite right.
I'll keep this open and continue noodling. I agree we should document the exposed property, and
ignored
is just so much easier to digest thanclosed
(or alternative).