8000 Exception raised within BeforeEach will be append to all tests within same suite · Issue #228 · ryparker/jest-circus-allure-environment · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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.
Exception raised within BeforeEach will be append to all tests within same suite #228
Open
@xuanzhaopeng

Description

@xuanzhaopeng

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)
    })
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0