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
Since updating hubot-test-helper from 1.7.0 to 1.8.1 or 1.9.0, my project has been experiencing an odd issue with the sinon stubs we're creating for our hubot scripts. Essentially, we're creating an instance of aws's elasticbeanstalk and verifying a method was called a certain number of times
For example
beforeEach(() => {
describeEnvironmentsStub = sinon.stub(Object.getPrototypeOf(new aws.ElasticBeanstalk()),
'describeEnvironments').returns('some environment');
});
it('asks for environment information from various elastic beanstalks', async () => {
await room.user.say('someUser', '@hubot list versions');
expect(describeEnvironmentsStub.callCount).to.equal(1);
});
Where the elasticbeanstalk instance is created in the script file outside the module.exports
let devElasticbeanstalk = new aws.ElasticBeanstalk();
module.exports = (robot) => {
robot.respond(/list versions/, msg => {
...where we eventually call devElasticbeanstalk.describeEnvironments.
});
}
In 1.8.1+, the stub fails to be created and the describeEnvironments function is undefined on the devElasticbeanstalk instance. This isn't the case in 1.7.0.
Any clue into what could be breaking it would be super helpful. Thanks!
The text was updated successfully, but these errors were encountered:
After further investigation, it seems upgrading to 1.8.1 or above executes hubot's respond listener after the test cases have been run, so my stubs will never capture the callCount in the script files. Downgrading to 1.7.0 reverses this order and calls my implementation code before my test cases.
I'm looking through the 1.8.1 commits and it's hard to pinpoint where exactly this implementation changed since the Helper class was simply converted from coffee to regular javascript.
I tried following the examples on the README using the co package and I'm getting the same results :\
Since updating hubot-test-helper from 1.7.0 to 1.8.1 or 1.9.0, my project has been experiencing an odd issue with the sinon stubs we're creating for our hubot scripts. Essentially, we're creating an instance of aws's elasticbeanstalk and verifying a method was called a certain number of times
For example
Where the elasticbeanstalk instance is created in the script file outside the module.exports
In 1.8.1+, the stub fails to be created and the describeEnvironments function is undefined on the
devElasticbeanstalk
instance. This isn't the case in 1.7.0.Any clue into what could be breaking it would be super helpful. Thanks!
The text was updated successfully, but these errors were encountered: