nicolo-ribaudo / jest-light-runner

A Jest runner that runs tests directly in bare Node.js, without virtualizing the environment.
MIT License
232 stars 24 forks source link

incompatibility: wrong nested beforeEach execution order #39

Closed mpareja closed 2 years ago

mpareja commented 2 years ago

The following test passes with jest but not jest-light-runner. The beforeAll behaviour appears to be correct, though.

describe('beforeEach execution order', () => {
  const calls = []
  beforeEach(() => {
    calls.push('outer')
  })

  describe('nested', () => {
    beforeEach(() => {
      calls.push('inner')
    })

    it('expect outer beforeEach before inner', () => {
      expect(calls).toEqual(['outer', 'inner'])
    })
  })
})
nicolo-ribaudo commented 2 years ago

Thanks! I'll fix this in the next few days, unless you want to open a pull request 🙂

nicolo-ribaudo commented 2 years ago

Fixed by #44