It seems that if you throw an object that is not an instance of Error, but includes a property named stack that is an object, the test will never complete.
No error is reported on my machine, but the repl.it environment prints the error TypeError: stack.replace is not a function, though the test still hangs regardless.
add this to a test file:
test("throw object with stack prop", () => {
throw { stack: [] };
});
Test fails, but remainder of test suite continues
https://repl.it/repls/GrossDarlingLocks
System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Binaries:
Node: 14.9.0 - ~/.nvm/versions/node/v14.9.0/bin/node
npm: 6.14.8 - ~/.nvm/versions/node/v14.9.0/bin/npm
npmPackages:
jest: ^26.4.2 => 26.4.2
Seems likely, yeah. Anybody up for a PR fixing this? Anything thrown, ever, should be unknown and we then narrow down the type afterwards. Assuming stack is a string is unsafe as can be seen by this issue.
Hello @SimenB, I was trying to work on this issue.
Do I have to run yarn run build every time I make changes in jest/packages/jest-jasmine2/src/reporter.ts to test the changes?
You can run yarn watch to build once and then set up a watcher 馃檪
This seems to also fail with jest-circus in a different way BTW
