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.
After doing a fresh
git clone
andnpm install
(without apackage-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: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:hubot
dependency to v3.0.0, and now requireshubot/es2015
instead ofhubot
(https://github.com/mtsmfm/hubot-test-helper/commit/6a621be0863f5c762b9072804ed1566c6f70102b).es2015.js
was added in Hubot v3.0.0 as part of a rewrite from CoffeeScript to ES2015, and the originalindex.js
was refactored to exportCoffeeScriptCompatibleClass
instances (https://github.com/hubotio/hubot/commit/7939b8f08a0a4fbbb685cfd67c706ca2d2594002).The problem is that
hubot-slack
now adds thereact
method to the CoffeeScript-compatible wrapper function exported by the originalhubot/index.js
, while the originalRobot
implementation exported byhubot/es2015.js
remains unchanged. Consequently, theMockRobot
fromhubot-test-helper/src/index.js
did not have access to thereact
function, leading to the test failures.Upgrading this repository's
hubot
dependency to^3.0.0
1 and adding the following snippet tohubot/slack-github-issues.js
resolves the issue for now (coming in a pull request immediately after I file this issue):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 runningnpm install
again, so thathubot-test-helper
wasn't still working with its local copy ofhubot
v3.0.1. Debugging that issue produced another moment of enlightenment.