-
-
Save zcmgyu/d21f6e5fbba0a2e1e6b0750fb97fdcdb to your computer and use it in GitHub Desktop.
Pass data between beforeEach, afterEach and it in mocha tests.
This file contains 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 expect = require('expect'); | |
describe.only('Sample', function () { | |
beforeEach(function () { | |
this.currentTest.value = 'Winning!'; | |
}); | |
it('Uses current test data', function () { | |
expect(this.test.value).to.equal('Winning!'); | |
this.test.value = 'Win Later'; | |
}); | |
afterEach(function () { | |
expect(this.currentTest.value).to.equal('Win Later'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment