You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.
When adding data to mocha's context, the data disappears, or the context is reset. For example, I commonly use this pattern when testing node.js code, but it doesn't work in meteor:
beforeEach(function() {
this.sinon = sinon.sandbox.create();
});
afterEach(function() {
this.sinon.restore(); // here this.sinon is undefined
});
it('does something with sinon', function() {
this.sinon.mock(obj).expct("foo"); // here this.sinon is undefined
});
The text was updated successfully, but these errors were encountered:
Hello @PeteProgrammer I was able to reproduce the problem only in the server, but something interesting happen when I used the arrow function ( () =>{} ) instead of the normal function, It works as expected, so as a workaround you can try use the arrow function (even so the official mocha documentation says no).
This is working for me:
beforeEach(() => {
this.sinon = sinon.sandbox.create();
});
afterEach(() => {
this.sinon.restore(); // here this.sinon is undefined
});
it('does something with sinon', =>() {
this.sinon.mock(obj).expect("foo"); // here this.sinon is undefined
});
Maybe the next release is going to be fixed.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When adding data to mocha's context, the data disappears, or the context is reset. For example, I commonly use this pattern when testing node.js code, but it doesn't work in meteor:
The text was updated successfully, but these errors were encountered: