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

Mocha test runner doesn't clear test filter #2032

Closed
nicojs opened this issue Feb 13, 2020 · 2 comments · Fixed by #2037
Closed

Mocha test runner doesn't clear test filter #2032

nicojs opened this issue Feb 13, 2020 · 2 comments · Fixed by #2037
Assignees
Labels
🐛 Bug Something isn't working
Milestone

Comments

@nicojs
Copy link
Member

nicojs commented Feb 13, 2020

Summary

The @stryker-mutator/mocha-runner test runner plugin doesn't clear the test filter after a run with a test filter. The consequence is an incorrect result. This can be seen in the report of Stryker itself in a number of places. For example:

https://dashboard.stryker-mutator.io/reports/github.com/stryker-mutator/stryker/master#core/initializer/presets/ReactPreset.ts

image

This file should be almost entirely green, since it is well tested 😇. However, you can see it isn't a.t.m. 👿

Current workaround: Don't use coverage analysis 'perTest' in conjunction with the mocha test runner.

Stryker config

module.exports = function(config){
  config.set({
    testRunner: 'mocha',
    coverageAnalysis: 'perTest'
  });
}

I'll be working on a fix.

@nicojs nicojs added the 🐛 Bug Something isn't working label Feb 13, 2020
@nicojs nicojs added this to the 3.0 milestone Feb 13, 2020
@nicojs nicojs self-assigned this Feb 13, 2020
@simondel
Copy link
Member

Oh no...

@nicojs
Copy link
Member Author

nicojs commented Feb 13, 2020

This simple test reproduces the problem:

it('should be able to clear the filter after a filtered run', async () => {
    const testHooks = wrapInClosure(testFramework.filter([test0, test3]));
    await sut.proxy.run({ testHooks });
    const actualResult = await sut.proxy.run({ testHooks: undefined });
    expect(actualResult.tests).lengthOf(5);
});

F.y.i. @MrFix93 this is the bug we've spotted together.

nicojs added a commit that referenced this issue Feb 14, 2020
Allow the test filter to be cleared when the next test run requires mocha to run all tests.

Fixes #2032
nicojs added a commit that referenced this issue Feb 14, 2020
Allow the test filter to be cleared when the next test run requires mocha to run all tests.

Fixes #2032
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants