hubotio / hubot

A customizable life embetterment robot.
https://hubotio.github.io/hubot/
MIT License
16.64k stars 3.75k forks source link

hubot-test-helper broke due to change to Robot constructor #1652

Closed vpeltola closed 1 year ago

vpeltola commented 1 year ago

Hi! I use hubot-test-helper for unit testing, which broke due the following recent commit:

https://github.com/hubotio/hubot/commit/d1cabd580e7091fb395042c0e2b249f7312eac21

This removed "adapterPath" from the argument list:

- constructor (adapterPath, adapter, httpd, name, alias) {
+ constructor (adapter, httpd, name, alias) {

hubot-test-helper creates a mock Robot instance by calling super(null, null, httpd, 'hubot'); but this is now wrong as the httpd argument should be the 2nd argument. See https://github.com/mtsmfm/hubot-test-helper/blob/37b5e99faa2023c95d88c420b2b3bb1f09dd07b1/src/index.js#L20C5-L20C39

I created a PR for hubot-test-helper: https://github.com/mtsmfm/hubot-test-helper/pull/62/files However, hubot-test-helper hasn't been receiving updates in a long time, and I don't know if anyone is maintaining it.

Also, the "es2015.js" file which is used by hubot-test-helper, hasn't been updated to call Robot() with the new 4 arguments, so that needs to be updated as well. https://github.com/hubotio/hubot/blob/v5.0.7/es2015.js

  loadBot (adapterPath, adapterName, enableHttpd, botName, botAlias) {
    return new module.exports.Robot(adapterPath, adapterName, enableHttpd, botName, botAlias)
  }
github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 6.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

joeyguerra commented 1 year ago

Do you think you can move away from hubot-test-helper? https://github.com/hubotio/hubot/tree/main/test/fixtures has some example Mock Adapters.

vpeltola commented 1 year ago

Thanks for the quick update! I will review the Mock Adapters as well,

askreet commented 9 months ago

@joeyguerra The main Hubot docs still recommend hubot-test-helper -- I take it that's no longer a good suggestion?

joeyguerra commented 9 months ago

@askreet thanks for letting me know. I need to go update it.