-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Nested describes don't run if parent describe has .only (mocha 3) #2378
Comments
Hmm. Actually I'm not sure this particular case got coverage. |
This is a bit tricky, so I'm not going to finish it tonight; could use some assistance. Basically what needs to happen is if a suite is marked "only", then unless a test within that suite is marked "only", all child suites' tests should run as well. Or, that's what I'd expect, anyhow. describe.only('foo', function () {
describe('bar', function () {
it('should run', function () {});
});
}); // do we agree?
describe.only('foo', function () {
it.only('should run', function () {});
describe('bar', function () {
it('should not run', function () {});
});
}); // careful with the order...
describe.only('foo', function () {
describe('bar', function () {
it('should not run', function () {});
});
it.only('should run', function () {});
}); also deeply-nested suites may complicate matters, as you can't simply check the most immediate parent to see if it has tests marked "only"; when child suites are created, they should be given a |
cc @mochajs/core this will delay the final v3 release until it's resolved or we can agree that this is what should be happening, which is unlikely... |
- includes some more refactoring of interface code into `lib/interfaces/common.js` for DRY (still more work to be done here) - unfortunately said refactoring contains hellish logic which addresses this issue (someone should make a flowchart of this for lolz) - original PR did not address `exports` interface; this doesn't either - may need more coverage against `qunit` interface
@jhartikainen If you're feeling generous, I'd encourage you to pull down the |
@boneskull yep appears to function as expected on that branch |
- includes some more refactoring of interface code into `lib/interfaces/common.js` for DRY (still more work to be done here) - unfortunately said refactoring contains hellish logic which addresses this issue (someone should make a flowchart of this for lolz) - original PR did not address `exports` interface; this doesn't either - may need more coverage against `qunit` interface
closed by 9ea2011, but I'm not 100% convinced, so we'll see if this stays closed. |
- includes some more refactoring of interface code into `lib/interfaces/common.js` for DRY (still more work to be done here) - unfortunately said refactoring contains hellish logic which addresses this issue (someone should make a flowchart of this for lolz) - original PR did not address `exports` interface; this doesn't either - may need more coverage against `qunit` interface
* 'master' of github.com:mochajs/mocha: (79 commits) Release v3.0.1 update CHANGELOG.md; rebuild [ci skip] fix nested describe.only suites; closes mochajs#2406 update date in CHANGELOG.md [ci skip] Release v3.0.0 rebuild mocha.js fix bad merge of karma.conf.js add note about spec reporter to CHANGELOG.md [ci skip] fixed typo in mocha.css introduced by 185c0d9 [ci skip] Remove carriage return before each test line in spec reporter. Served no purpose add "logo" field to package.json [ci skip] fix incorrect executable name with new version of commander add bower.json to published package for npmcdn support [ci skip] fix broken/wrong URLs in CHANGELOG.md [ci skip] Release v3.0.0-2 rebuild mocha.js add browser-stdout to dependencies update CHANGELOG [ci skip] let child suites run if parent is exclusive; closes mochajs#2378 (mochajs#2387) Upgrade eslint package to 2.13 version (mochajs#2389) ...
Previously, if you had a nested describe and tests inside a parent describe with .only, the child-describe blocks would also run.
It seems #1481 may have broken this behavior. While I think the actual fix in 1481 makes sense, this side-effect of it seems counter-intuitive, and at least goes against my expectations of how this should work. It's also different from how this works in some other testing tools I've used in the past with similar features.
Steps to reproduce
Expected result
The tests inside the nested describe run
Actual result
Only tests immediately inside the parent describe block run, at least with mocha@3.0.0-1
Sample code
Output:
Expected output:
The text was updated successfully, but these errors were encountered: