Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression after doesn't execute if tests skipped in beforeEach #2286

Closed
dasilvacontin opened this issue May 29, 2016 · 3 comments
Closed

Regression after doesn't execute if tests skipped in beforeEach #2286

dasilvacontin opened this issue May 29, 2016 · 3 comments
Labels
type: bug a defect, confirmed by a maintainer

Comments

@dasilvacontin
Copy link
Contributor

dasilvacontin commented May 29, 2016

after(function () {
  console.log('after outside suite')
})

describe('suite', function () {
  var count = 0

  beforeEach(function () {
    if (count > 2) this.skip()
  })

  after(function () {
    console.log('after in suite')
  })

  it('test 1', function () { ++count })
  it('test 2', function () { ++count })
  it('test 3', function () { ++count })
  it('test 4', function () { ++count })
  it('test 5', function () { ++count })
  it('test 6', function () { ++count })
})

will not output the after in suite since v2.5.0 due to PR #2081 (found via git bisect)

reported by @blueice349, confirmed by myself

@dasilvacontin dasilvacontin added the type: bug a defect, confirmed by a maintainer label May 29, 2016
@dasilvacontin
Copy link
Contributor Author

It doesn't happen if the skip happens inside the it.

Simplified case:

after(function () { console.log('after outside suite') })

describe('suite', function () {
  beforeEach(function () { this.skip() })
  after(function () { console.log('after in suite') })
  it('test', function () {})
})

@boneskull
Copy link
Member

See PR #2571

@laughinghan
Copy link

@dasilvacontin Hey, we're discussing in #2571 what the right behavior is when you call this.skip() inside beforeEach(), care to weigh in there and explain your use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants