This repository has been archived by the owner. It is now read-only.

beforeAll is not working properly with nested descriptions #250

Closed
sdepold opened this Issue Jul 30, 2012 · 2 comments

Comments

Projects
None yet
3 participants
@sdepold

sdepold commented Jul 30, 2012

if you use beforeAll to setup a whole bunch of tests with nested contexts, assignments to the this variable are gone in inner it-clauses.

var buster  = require('buster')

buster.spec.expose()

describe('Outer', function() {
  beforeAll(function() {
    this.foo = 1
    console.log('outer beforeAll', this.foo)
  })

  before(function() {
    this.bar = 1
  })

  afterAll(function() {
    this.foo = 2
    console.log('outer afterAll', this.foo)
  })

  after(function() {
    this.bar = 2
  })

  describe('Inner', function() {
    it("does things", function() {
      console.log('in the test -> foo', this.foo) // this.foo is gone
      console.log('in the test -> bar', this.bar)
      expect(this.bar).toEqual(1)
      expect(this.foo).toEqual(1)
    })
  })
})

it's working properly for before. in the example, this.foo is not working as expected

@ghost ghost assigned cjohansen Aug 16, 2012

@cjohansen

This comment has been minimized.

Member

cjohansen commented Sep 9, 2013

Fixed in #321c57c

@cjohansen cjohansen closed this Sep 9, 2013

@sdepold

This comment has been minimized.

sdepold commented Sep 9, 2013

hooray!

@ghost ghost assigned dwittner and cjohansen Sep 10, 2013

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.