This repository was archived by the owner on Aug 28, 2022. It is now read-only.
This repository was archived by the owner on Aug 28, 2022. It is now read-only.
Open
Description
In a nutshell, the main problem is that hook is not linked to test, but hook link to suite.
For BeforeAll , it's correct because beforeAll is executed one time for whole suite
but for beforeEach, it's incorrect, it should link to test, instead of suite
Example code:
describe('my suite', () => {
let i = 0
beforeEach(() => {
if(i == 1) {
i++;
throw new Error('before each exception')
}
i++;
})
it('my test', () => {
expect(1+1).toBe(3)
})
it('my test2', () => {
expect(1+1).toBe(2)
})
it('my test3', () => {
expect(1+1).toBe(2)
})
})