Closed yokomotod closed 8 years ago
I think I could find the cause of this error.
At 20 hours ago, yeoman-environment upgraded to use inquirer v1.0.0, https://github.com/yeoman/environment/releases/tag/v1.6.0 and inquirer v1.0.0 has changed some its interfaces.
According to the README: https://github.com/SBoudrias/Inquirer.js/compare/v0.12.0...v1.0.0#diff-04c6e90faac2675aa89e2176d2eec7d8R115
{
/* Preferred way: with promise */
filter: function () {
return new Promise(/* etc... */);
},
/* Legacy way: with this.async */
validate: function (input) {
// Declare function as asynchronous, and save the done callback
var done = this.async();
// Do async stuff
setTimeout(function () {
if (typeof input !== 'number') {
// Pass the return value in the done callback
done('You need to provide a number');
return;
}
// Pass the return value in the done callback
- done(true);
+ done(null, true);
}, 3000);
}
}
Thank you for digging into this! It's a pain that yeoman-environment changing it's inquirer dependency causes downstream breakage 😓 I'm not sure there's anything we can do for existing generator-hubot aside from releasing an update with this.
I'm going to review and test, and hopefully get this out soon.
I wonder if we could check the arity of done
, ie if (done.length == 2)
.
Tested and this works ✨ We can leave a potential backwards compat fix ie checking arity of done
, and get this out so new users don't have a bad times 😓
This is released in generator-hubot@0.4.0
. Anyone running into this should npm install -g generator-hubot
to get the latest.
This can fix issues #64.
It seems that first argument of
done()
expects error object, and second one expects return value.