Skip to content

Possible async problem #21

@jamestalmage

Description

@jamestalmage

Now that we support async functions, is the fact that this is in a closure going to be a problem?

I am near certain the answer is yes!

Look at this code:

test('a', t => {
  t.is(await promiseA1(), await promiseA2());
});

test('b', t => {
  t.is(await promiseB1(), await promiseB2());
});

Now, assume both following sequence of events:

  1. test a starts
  2. test a halts as it awaits the resolution of promiseA1()
  3. test b starts
  4. test b halts as it awaits the resolution of promiseB1()
  5. promiseA1() resolves, and test a resumes.
  6. test a halts as it awaits the resolution of promiseA2()
  7. promiseB1() resolves, and test b resumes.
  8. test b halts as it awaits the resolution of promiseB2()
  9. promiseB2() resolves, and test b resumes.
  10. test b ends
  11. promiseA2() resolves, and test a resumes.

It seems like events is going to be corrupted by step 12.

I think AVA is going to need to create a new enhanced assert object for each run.

@twada - thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions