storybook-addon-specifications icon indicating copy to clipboard operation
storybook-addon-specifications copied to clipboard

Promise-based async interface

Open mikeapr4 opened this issue 6 years ago • 1 comments

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.

mikeapr4 avatar Sep 10 '18 18:09 mikeapr4

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.

mikeapr4 avatar Sep 14 '18 11:09 mikeapr4