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
(function (sut) {
'use strict';
var testVar = 'Hello from original';
sut.testMe = function(){
return testvar;
}
}(module.exports));
trying to test this gives me a failure:
(function () {
'use strict';
var rewire = require("rewire");
var sut = rewire('../../lib/sut');
sut.__set__('testVar', 'hello from mock');
describe('Rewire', function(){
it('fails', function(){
expect(sut.testMe()).to.equal('Hello from mock');
})
}
)
The mock is not respected and the source has the original value for the testVar.
But if I remove my src from the IIFE then everything works. Am I doing something wrong?
The text was updated successfully, but these errors were encountered:
My source looks like:
trying to test this gives me a failure:
The mock is not respected and the source has the original value for the testVar.
But if I remove my src from the IIFE then everything works. Am I doing something wrong?
The text was updated successfully, but these errors were encountered: