Created
July 30, 2012 10:06
-
-
Save sdepold/3205975 to your computer and use it in GitHub Desktop.
missing context in nested describe's tests when using beforeAll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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