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

Allow async exec test to reject #4583

Open
hzoo opened this Issue Sep 27, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@hzoo
Member

hzoo commented Sep 27, 2016

Ref #4576 (comment) and commited in 5ea57d5

In an exec test, you can now return a promise. We use mochajs.org for tests and returning a promise will cause it to asynchronously call done.

return forEach(genAnswers(), function(val) { output += val.value })
.then(function () {
assert.equal(output, 42);
});

return forEach(genAnswers(), function(val) { output += val.value })
.then(function () {
  assert.equal(output, 42);
});

You need to add to options.json (to fix parser error)

{
  "parserOpts": {
      "allowReturnOutsideFunction": true
   }
}

The suggestion is to allow a rejection instead of just .then

@hzoo hzoo added the help wanted label Sep 27, 2016

@alxpy

This comment has been minimized.

Contributor

alxpy commented Feb 16, 2017

@hzoo hi, this issue is already possible to close)

@hzoo

This comment has been minimized.

Member

hzoo commented Feb 16, 2017

When did someone add it? I definetely don't remember adding it. There's no test with a return a().catch()

@alxpy

This comment has been minimized.

Contributor

alxpy commented Feb 16, 2017

@hzoo I can add this test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment