Skip to content
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

QUnit.module.only including surprising tests #1610

Closed
smcclure15 opened this issue May 7, 2021 · 0 comments · Fixed by #1611
Closed

QUnit.module.only including surprising tests #1610

smcclure15 opened this issue May 7, 2021 · 0 comments · Fixed by #1611
Labels
Component: Core For module, test, hooks, and reporters. Type: Regression

Comments

@smcclure15
Copy link
Member

Using latest QUnit 2.15.0 via CLI.

Repro:

QUnit.module.only('Module A', () => {
    QUnit.test('Test A', assert => {
        assert.ok(1);
    });
});

QUnit.module('Module B', () => {
    QUnit.test('Test B', assert => {
        assert.ok(0);
    });
});

QUnit.module('Module C', () => {
    QUnit.test('Test C', assert => {
        assert.ok(0);
    });
    QUnit.module('Module D', () => {
        QUnit.test('Test D', assert => {
            assert.ok(0);
        });
    });
});

I expect that only Test A is executed, but in fact Test D is also run (demonstrated by the failing verification):

TAP version 13
ok 1 Module A > Test A
not ok 2 Module C > Module D > Test D
  ---
  message: failed, expected argument to be truthy, was: 0
  severity: failed
  actual  : 0
  expected: true
  stack: |
        at Object.<anonymous> (/SNIP/demo.js:22:11)
  ...
1..2
# pass 1
# skip 0
# todo 0
# fail 1

I verified that this does not reproduce in release 2.13.0, introduced in 2.14.0, and could very well be related to #1527.

@Krinkle Krinkle added Component: Core For module, test, hooks, and reporters. Type: Regression labels May 7, 2021
Krinkle pushed a commit that referenced this issue May 8, 2021
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core For module, test, hooks, and reporters. Type: Regression
Development

Successfully merging a pull request may close this issue.

2 participants