storybook-addon-specifications
storybook-addon-specifications copied to clipboard
Promise-based async interface
Code to resolve https://github.com/mthuret/storybook-addon-specifications/issues/105
For the moment the change only applies to it
, though Jest/Mocha allows it on the before/after hooks too, so that might be some future work.
The check for a returned Promise matches what Mocha does: https://github.com/mochajs/mocha/blob/master/lib/runnable.js#L373
Nothing in this code actually requires the Promise
class be available, means the code is compatible with pre-v0.12.18 node, although hardly a requirement to go back that far.
I've updated some tests, though more for illustrative purposes, as those tests will not fail if async doesn't work. I've updated the docs too so users know they can use both the done
and Promise interfaces.
Can somebody take a look at this? @mthuret? @therealparmesh? I know this repo hasn't seen a lot of recent activity, but I think you'll find this PR is ready to merge.