-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow user to require the Hubot script themselves #46
Comments
You can do something like this: Helper = require('hubot-test-helper')
helper = new Helper sctiptPath
room = helper.createRoom name: 'bob'
room.robot.Response = class extends Helper.Response
# Generated using a fair dice!
random: -> 4 |
strugee
added a commit
to strugee/hubot-botsnack
that referenced
this issue
Sep 29, 2017
Thank you! That worked perfectly 👍 Maybe that should be documented somewhere? Unless I just missed it... |
No, its not documented. Feel free to open a pull request to update the readme to have this trick :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a script which is using
res.random
. Obviously that's hard to test for, so I want to use proxyquire to override the require that gets the possible responses, such that there's only one possible response. However I can't do this because hubot-test-helper is callingrequire()
for me.It'd be nice if I could just pass in a function and have that interpreted by hubot-test-helper as the plugin itself, pre-
require()
'd.The text was updated successfully, but these errors were encountered: