You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a test file has several describe() contexts, and one of them if focused using describe.only(), beforeAll() methods in all other contexts are still fired, even if no tests of those contexts are actually run.
This seems similar to #8379, but this time regarding .only() and not .skip().
To Reproduce
The following test file exhibits the issue:
describe('context',()=>{describe.only('foo',()=>{it('should work',()=>{expect(true).toEqual(true);});});describe('bar',()=>{beforeAll(()=>{console.info("[beforeAll]: this should not appear");});beforeEach(()=>{console.info("[beforeEach]: this should not appear");});it('should not be run',()=>{expect(true).toEqual(true);});});});
Output:
Expected behavior
None of the console.log should be called. The correct behavior of the beforeEach should also be applied to beforeAll.
pixelastic
changed the title
beforeAll is fired even not in the current describe.only context
beforeAll is fired even when not in the current describe.only context
Jun 27, 2019
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
🐛 Bug Report
When a test file has several
describe()
contexts, and one of them if focused usingdescribe.only()
,beforeAll()
methods in all other contexts are still fired, even if no tests of those contexts are actually run.This seems similar to #8379, but this time regarding
.only()
and not.skip()
.To Reproduce
The following test file exhibits the issue:
Output:
![image](https://user-images.githubusercontent.com/283419/60256635-36b69400-98d2-11e9-960f-4894e92f8d4c.png)
Expected behavior
None of the
console.log
should be called. The correct behavior of thebeforeEach
should also be applied tobeforeAll
.Link to repl or repo (highly encouraged)
Live demo or repo to clone.
Run
npx envinfo --preset jest
The text was updated successfully, but these errors were encountered: