Skip to content
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

Find permanent fix for integration, smoke test breakage with hubot-test-helper, hubot #15

Open
mbland opened this issue Nov 5, 2017 · 0 comments
Assignees
Milestone

Comments

@mbland
Copy link
Owner

mbland commented Nov 5, 2017

After doing a fresh git clone and npm install (without a package-lock.json file), I picked up hubot-test-helper v1.8.1. As a result, the integration and smoke tests started failing with the following message:

reaction_added listener registration failed: robot.react is not a function

This robot.react method should've been added to Hubot by the hubot-slack adapter (implemented in slackapi/hubot-slack#363, released in hubot-slack v4.2.0). After a bit of digging, I realized this was because:

The problem is that hubot-slack now adds the react method to the CoffeeScript-compatible wrapper function exported by the original hubot/index.js, while the original Robot implementation exported by hubot/es2015.js remains unchanged. Consequently, the MockRobot from hubot-test-helper/src/index.js did not have access to the react function, leading to the test failures.

Upgrading this repository's hubot dependency to ^3.0.01 and adding the following snippet to hubot/slack-github-issues.js resolves the issue for now (coming in a pull request immediately after I file this issue):

require('hubot-slack')
var CoffeeScriptCompatibleHubot = require('hubot')
var Hubot = require('hubot/es2015')
Hubot.Robot.prototype.react = CoffeeScriptCompatibleHubot.Robot.prototype.react

However, this is only a temporary solution. The proposed rewrite from CoffeeScript to ES2015 in slackapi/hubot-slack#429 should ideally rectify the problem and remove the need for the workaround.

1This also required blowing away node_modules and running npm install again, so that hubot-test-helper wasn't still working with its local copy of hubot v3.0.1. Debugging that issue produced another moment of enlightenment.

@mbland mbland added this to the v1.2.0 milestone Nov 5, 2017
@mbland mbland self-assigned this Nov 5, 2017
mbland pushed a commit that referenced this issue Nov 5, 2017
Addresses the issue described in #15. In short, hubot-test-helper v1.8.0
depends on hubot-v3.0.0, both are rewrites from CoffeeScript to ES2015,
and consequently hubot-slack adds Robot.react to a CoffeeScript-
compatible wrapper function, leading to smoke and integration test
failures.

The implementation of slackapi/hubot-slack#429 (CoffeeScript-to-ES2015
rewrite) should include a fix that will eliminate the need for this
workaround.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant