-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix(expect): handle async errors in expect.soft #8145
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
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good, thank you! Just one little thing
packages/expect/src/utils.ts
Outdated
return fn.apply(this, args) | ||
const result = fn.apply(this, args) | ||
|
||
if (result && typeof result === 'object' && result instanceof Promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I already fixed that, but maybe I forgot. Can you change the check from instanceof Promise
to typeof result.then === 'function'
here and in jest-extend.ts
?
And use then(noop, (err) => { /* ... */ })
here instead
This is needed to support PromiseLike
(we already do this in all other places except here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updates have been submitted. Thank you for your suggestion!
LGTM! Thank you! |
Description
Fixes #8092
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.