rushstack
rushstack copied to clipboard
[heft] Increase Jest default timeout from 5s to 15s
Summary
Some builds were failing randomly because the VM was under heavy load.
I'm not a fan of doing this globally for all consumers of heft-jest-plugin.
I'm not a fan of doing this globally for all consumers of heft-jest-plugin.
Why not?
I'm not a fan of doing this globally for all consumers of heft-jest-plugin.
Why not?
A test taking longer than 5 seconds, even if the VM is under load still indicates a bad test. Alternatively it indicates that you VM's scheduler is running too many processes relative to the number of CPUs, which is a configuration bug.
A test taking longer than 5 seconds, even if the VM is under load still indicates a bad test. Alternatively it indicates that you VM's scheduler is running too many processes relative to the number of CPUs, which is a configuration bug.
@IanC and @elliot-nelson felt the same way.
After some discussion, we think this error may be revealing an actually incorrect practice for the tests that were timing out:
https://github.com/microsoft/rushstack/blob/638079610e4d963e89f81ce729a53ef44ac704bc/libraries/node-core-library/src/test/Async.test.ts#L168-L175
This file contains numerous calls to Async.sleep(1) that although sleeping for "only" 1ms may actually be accumulating into nontrivial delays. Possible improvements:
- Change them all to
Sleep(0) - Mock the timers
- Increase the test limit for just this one file... but how much?
Option 1 seems like the least effort. @dmichon-msft any opinions?