-
-
Notifications
You must be signed in to change notification settings - Fork 706
Open
Description
We should add async support to the core. This means chai-as-promised
will no longer be needed in most cases (but will still be useful if you prefer the style it uses).
This kind of API:
expect(val).resolves.to.equal(303);
expect(val).rejects.to.throw("error");
This is very similar to vitest's existing chai extension. So it is also possible we can remove a lot of code from vitest once this becomes stable in core.
A few notes of things we'd need to do:
- All assertions would need to return a
Promise<void>
if the special flag is set- We can likely do this by wrapping all
addMethod
andaddChainableMethod
in something which conditionally awaits based on the special flag
- We can likely do this by wrapping all
- The special flag would be something like
flag(this, 'promise')
orflag(this, 'isAsync')
- A new
resolves
property would need to be added which sets the special flag- It would also need to set
object
to a new promise which, when resolved, setsobject
again to the resolved value
- It would also need to set
- A new
rejects
property would need to be added which sets the special flag
koddsson and brettdh
Metadata
Metadata
Assignees
Labels
No labels