describe.only() does not work when string is the same as another describe() block
See original GitHub issueCurrent behavior:
If you have multiple describe
blocks with the same description string, marking one of them with describe.only
will run all describe
blocks with the same description instead of just the one with .only
:
Desired behavior:
Marking a describe
block with .only
should “only” run that describe
block, not others with the same description.
Steps to reproduce: (app code and test code)
Run the following spec:
describe('outer describe', () => {
describe('inner describe', () => {
it('works', () => {});
});
describe.only('inner describe', () => {
it('works again', () => {});
});
describe('unique name', () => {
it('still works', () => {});
});
describe('inner describe', () => {
it('works yet again', () => {});
});
});
Instead of just running one test with the description “works again”, three tests are executed, in all three describe('inner describe'...)
blocks.
Versions
Cypress 3.4.1 Ubuntu 18.04 Chrome 77
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
describe.only() does not work when string is the same as ...
With two describe() blocks that have identical strings, when one of them is a describe.only() , only that one's tests should run,
Read more >Why can't nested describe() blocks see vars defined in outer ...
The problem is that your var trees variable is trying to access orchard before it has been initialized. The body of a describe...
Read more >Mocha documentation — DevDocs
only() used string matching to decide which tests to execute; this is no longer the case. In v3.0.0 or newer, .only() can be...
Read more >Strict mode - JavaScript - MDN Web Docs
JavaScript's strict mode is a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode".
Read more >Globals · Jest - API Manual
If afterEach is inside a describe block, it only runs after the tests that are ... that our tests don't modify it. test('can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Cypress uses a Mocha version 2.5.3, this is fixed in later versions. Going to close this as a duplicate of https://github.com/cypress-io/cypress/issues/2528 - which will be released in Cypress 4.0.0 release.
Released in
4.0.0
.