Skip to content

Instantly share code, notes, and snippets.

@sdepold
Created July 30, 2012 10:06
Show Gist options
  • Save sdepold/3205975 to your computer and use it in GitHub Desktop.
Save sdepold/3205975 to your computer and use it in GitHub Desktop.
missing context in nested describe's tests when using beforeAll
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)
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment