You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 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 and addChainableMethod in something which conditionally awaits based on the special flag
The special flag would be something like flag(this, 'promise') or flag(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, sets object again to the resolved value
A new rejects property would need to be added which sets the special flag
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:
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:
Promise<void>
if the special flag is setaddMethod
andaddChainableMethod
in something which conditionally awaits based on the special flagflag(this, 'promise')
orflag(this, 'isAsync')
resolves
property would need to be added which sets the special flagobject
to a new promise which, when resolved, setsobject
again to the resolved valuerejects
property would need to be added which sets the special flagcc @koddsson @keithamus
The text was updated successfully, but these errors were encountered: