Skip to content

Commit

Permalink
Core: Correctly ignore late tests after a nested QUnit.module.only() …
Browse files Browse the repository at this point in the history
…closure

Fixes #1645.
Closes #1658.
  • Loading branch information
smcclure15 committed Sep 18, 2021
1 parent f30d5de commit e0aa69a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ module.only = function( ...args ) {
if ( !focused ) {
config.modules.length = 0;
config.queue.length = 0;
}

processModule( ...args );
// aggressively ignore any direct tests in "outer" nested modules
config.currentModule.ignored = true;
}

focused = true;
processModule( ...args );
};

module.skip = function( name, options, executeNow ) {
Expand Down
4 changes: 4 additions & 0 deletions test/cli/fixtures/only/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ QUnit.module( "module B", function() {
} );
} );

QUnit.test( "test with the only-module as its peer", function( assert ) {
assert.true( false, "this test should not run" );
} );

QUnit.module( "This also should not run", function() {
QUnit.test( "normal test", function( assert ) {
assert.true( false, "this test should not run" );
Expand Down

0 comments on commit e0aa69a

Please sign in to comment.