Skip to content
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

marco doesn't support async function #2306

Closed
lili21 opened this issue Dec 5, 2019 · 2 comments
Closed

marco doesn't support async function #2306

lili21 opened this issue Dec 5, 2019 · 2 comments

Comments

@lili21
Copy link

lili21 commented Dec 5, 2019

Test Source

function testMacro(t, cb) {
  cb(t);
}

test.only('test async', testMacro, async t => {
  t.is(1, 1);
  await Promise.resolve();
  t.is(3, 2); // will be ignored
});

Environment

Tell us which operating system you are using, as well as which versions of Node.js, npm, and AVA. Run the following to get it quickly:

Node.js v13.2.0
darwin 18.6.0
ava 2.4.0
npm 6.13.1

@tymfear
Copy link
Contributor

tymfear commented Dec 5, 2019

Try this one

async function testMacro(t) {
  await  cb(t);
}

test.only('test async', testMacro, async t => {
  t.is(1, 1);
  await Promise.resolve();
  t.is(3, 2); // will be ignored
});

But why you don want to normally ?

async function testMacro(t) {
  t.is(1, 1);
  await Promise.resolve();
  t.is(3, 2);
}

test.only('test async', testMacro);

@lili21
Copy link
Author

lili21 commented Dec 5, 2019

it works. Thanks.

@lili21 lili21 closed this as completed Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants