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

Stricter .only for suites #1595

Closed
wants to merge 1 commit into from

Conversation

peterflynn
Copy link

Suites whose names are a superset of the .only suite shouldn't wind up also running.

Similar to PR #941, an earlier fix for .only on tests.

Unlike 941, this doesn't fully fix the bug for suite names -- because test names are concatenated to suite names, the grep can't be as strict. When the name of the .only suite + " " is a prefix of another suite's name, that other suite will still run even with this fix. But it's still an improvement, and fixes the specific unexpected behavior I was running into (when suites are named after the classes they test, and base classes / interfaces are often a prefix of the names of other classes).

…only

suite don't wind up also running.

Similar to 179ffd3, an earlier fix for .only on tests.

Limitation: because test names are concatenated to suite names, the grep
can't be AS strict as it is for .only on tests. When the name of the .only
suite + " " is a prefix of another suite's name, that other suite will
still run even with this fix.
@peterflynn
Copy link
Author

Ah, unfortunately just saw PR #1591 after submitting this -- it fixes the same issue more thoroughly via a more complex patch. If #1591 gets merged I'll close this one.

@travisjeffery
Copy link
Contributor

Yeah probably gonna go with #1481, thanks though!

@davidham
Copy link

Sorry if this was addressed elsewhere, but I was just able to reproduce this with two describe blocks in the same file. I have two describe blocks, where the name of one is a superset of the other, and 'only' on the first, but they both execute. Like so:

describe.only('Foo', function() {
            it('should be true', function() {
                expect(true).to.be.true;
            });
});

describe('Foo2', function() {
            it('should be true', function() {
                expect(true).to.be.true;
            });
});

I expected only the first to run.

Is this the desired behavior? If so, could a note about this be added to the documentation? Sorry if I am duplicating a known issue but I couldn't tell from the above referenced issues. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants