asyncError not caught causing failing tests to pass
Environment
-
vscode-jest version: 4.6.0 -
node -v: 16.16.0 -
npm -voryarn --version: npm 8.11.0 -
npm ls jestornpm ls react-scripts(if you haven’t ejected): [email protected] - your vscode-jest settings if customized:
- jest.jestCommandLine? npx jest
- jest.autoRun? false
- anything else that you think might be relevant? [fill]
- Operating system: osx 12.5
Prerequisite
- are you able to run jest test from the command line? yes (with npx)
- how do you run your tests from the command line? npx jest
Steps to Reproduce
https://github.com/marr/jest-async-fail
-
npm install -
npx jest - see failing test
- open in vs code with extension and run test
- see passing test
Relevant Debug Info

This is blocking us from fully adopting/trusting the plugin at the moment. Some screenshots are included to potentially point out that within the jest runner for this test, asyncError is set to an Error object, but as you can see below things are green in the ide.

Thanks for any help
@marr sorry for the late reply. Your repo helped us identify another bug (thanks), and we were able to address that, however not related to your actual issue.
Now that is out of the way, I played with your sample repo again today: the original repo (after uncommented the xdescribe), showed ERR_UNHANDLED_REJECTION:
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Error: expect(received).resolves.toContain(expected) // indexOf
Expected value: 2
Received array: [1]".] {
code: 'ERR_UNHANDLED_REJECTION'
}
So I modified your tests then all is well:

The green check mark you saw in the TestExplorer is a cached status since the async error interfered with the proper update. It should do better, fortunately, this is addressed in the next release:
Thanks for bringing this to our attention, hopefully after fixing your test code you are good to go.