If my there is at least one expectation in my unit test that is not fulfilled at test time, the entire test suite "hangs" instead of reporting a failed ("red") test.
(On contrary, If all my expectations are fulfilled at test time, the tests does not seem to hang.)
The following test code is an example.
describe(`Demo`, () => {
it(`Should Fail, not Hang`, () => {
expect(1).toEqual(2);
});
});
Run Jest from Git Bash/CMD, observe the following output:
$ yarn test
yarn run v1.6.0
(node:3316) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
$ jest -i
RUNS __tests__/3-1-single-array-multiple-stacks.spec.ts
Software/Package Versions:
jest: 22.4.3
ts-jest: 22.4.5
$ node --version
v10.0.0
$ npm --version
6.0.0
$ npm --version
6.0.0
$ tsc --version
Version 2.8.3
The test should be reported as failing.
npx envinfo --preset jest$ npx envinfo --preset jest
npx: installed 1 in 5.897s
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz
Binaries:
Yarn: 1.6.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.0.0 - ~\AppData\Roaming\npm\npm.CMD
This seems configuration specific, can you push a repo?
@rickhanlonii you can take a look at it here. (Please notice the branch -- repro).
Thanks for quick turnaround.
@another-guy hm, this did not hang for me:

@rickhanlonii thank you for looking into it. I should try to rollback from Node.js 10.0.0 to whatever I had day before yesterday and re-check. Things seemed to be working jest a few days ago.
It hangs when I use Node 10
It does _not_ hang on node 10.1.0, though. Maaaaybe related to https://github.com/nodejs/node/pull/20266?
@SimenB I confirm the upgrade resolved the issue. Thanks a ton!
$ node --version
v10.1.0
$ yarn test
yarn run v1.6.0
(node:2392) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use
the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
$ jest -i
(node:4552) ExperimentalWarning: The fs.promises API is experimental
(node:4552) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use
the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
FAIL __tests__\3-1-single-array-multiple-stacks.spec.ts
Demo
× Should Fail, not Hang (13ms)
● Demo › Should Fail, not Hang
expect(received).toEqual(expected)
Expected value to equal:
2
Received:
1
1 | describe(`Demo`, () => {
2 | it(`Should Fail, not Hang`, () => {
> 3 | expect(1).toEqual(2);
4 | });
5 | });
6 |
at Object.it (__tests__/3-1-single-array-multiple-stacks.spec.ts:3:15)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 2.523s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.