-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for async await? #31
Comments
Hi, good job discovering my fork :) it's not quite as robust as I would
like and not tested with node 7 or async await. If you want to try and get
to the bottom of this, I would look at the very brittle code that actually
runs a Babel transform before compiling the doctest. Maybe if your
`.babelrc` is not in scope then the transform will not pick it up.
On 24 May 2017 23:20, "Matthias Seemann" <notifications@github.com> wrote:
@jmatsushita <https://github.com/jmatsushita> How can I test ES7 *async*
(i.e. Promise returning) functions?
/** * @example * resolvesAPromise(); * // ~> 11 */async function
resolvesAPromise() {
return 11;
}
Under *Node v.7.6.0* using the iilab's jsdoctest project fork
<https://github.com/iilab/jsdoctest> I get
0 passing
Although async await is supported in *Node* I tried requiring these babel
plugins, but no luck: syntax-async-functions and transform-regenerator.
Best regards
Semmel
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#31>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAVvAdKGvY6GqoTW__O3k9DvjrOIarsXks5r9J8kgaJpZM4NlryZ>
.
|
|
The error is caused by tj/dox So I upgraded dox to mocha --include test/helpers/helper-promises.js --timeout 3000 --require . test/files/returns-complex-es7-promise.js
This being my ES7 source file: /**
* @example
* resolvesAPromise();
* // ~> 10
*/
async function resolvesAPromise() {
await new Promise( resolve => setTimeout(resolve, 2000) );
return 10;
} Hopefully both @jmatsushita's and @cjy37 forks will sometime eventually be merged back with their parent projects so that I can upgrade my tooling better in the future. |
Hm... I see... The recommended way would be to use babel, maybe even to preserve your code base compatible with versions of Node that don't yet support async/await. RE dox fork; if there's some PR it'll likely be merged soon, otherwise I wouldn't mind depending on a patched version temporarily. I'll add tests to async syntax with babel soon. Closing as |
@jmatsushita How can I test ES7 async (i.e. Promise returning) functions?
Under Node v.7.6.0 using the iilab's jsdoctest project fork I get
Although async await is supported in Node I tried requiring these babel plugins, but no luck:
syntax-async-functions
andtransform-regenerator
.Best regards
Semmel
The text was updated successfully, but these errors were encountered: