Skip to content

Commit

Permalink
Core: Fix QUnit.module.only() regression where some unrelated modules…
Browse files Browse the repository at this point in the history
… also executed

This fixes a regression introduced in 2.14.0, restoring the behaviour from 2.13 and earlier.

When `QUnit.module.only()` is used, and there is a later sibling module (implicitly disabled
by the "only" filter), with the later module having a nested module inside it, then since
2.14 that nested module would execute as if it was part of the "only" filter.

Fixes #1610.
  • Loading branch information
smcclure15 authored May 8, 2021
1 parent bb95acf commit 134c59b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import { globalSuite } from "./core";
const moduleStack = [];

function isParentModuleInQueue() {
const modulesInQueue = config.modules.map( module => module.moduleId );
const modulesInQueue = config.modules
.filter( module => !module.ignored )
.map( module => module.moduleId );
return moduleStack.some( module => modulesInQueue.includes( module.moduleId ) );
}

Expand Down
8 changes: 8 additions & 0 deletions test/cli/fixtures/only/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ QUnit.module.only( "module D", function() {
} );
} );

QUnit.module( "module D1", function() {
QUnit.module( "module D2", function() {
QUnit.test( "test D3", function( assert ) {
assert.true( false, "this test should not run" );
} );
} );
} );

QUnit.module.only( "module E", function() {
QUnit.module( "module F", function() {
QUnit.test( "test F", function( assert ) {
Expand Down

0 comments on commit 134c59b

Please sign in to comment.