* Set `node-fetch` to `^2.7.0`
* Update package-lock.json
```
# root
bin/npm update node-fetch
bin/npm update cross-fetch
# in other path in docker
npm update node-fetch
```
* Update node-fetch patch
* [fetch-utils] Skip the test: destroys the request body if it doesn't get consumed
```
1) fetch-utils
fetchJson
destroys the request body if it doesn't get consumed:
FetchError: Invalid response body while trying to fetch http://example.com:30001/json/ignore-request: write EPIPE
at PassThrough.<anonymous> (/overleaf/node_modules/node-fetch/lib/index.js:400:12)
at PassThrough.emit (node:events:529:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
```
* [fetch-utils] Delete the test: destroys the request body if it doesn't get consumed
* Remove the `setTimeout` in the node-fetch patch
Fixes a test and doesn't break filestore acceptance tests
* Update node-fetch patch again: bring changes from https://github.com/node-fetch/node-fetch/blob/e87b093/src/index.js
* Update node-fetch patch again: bring changes from https://github.com/node-fetch/node-fetch/blob/e87b093/src/index.js
* Update node-fetch patches back to single lines
Per https://github.com/overleaf/internal/pull/20165#discussion_r1739035513
GitOrigin-RevId: 945e5a12e838673b7bc87b588b7aca1bcd9109e2
* [fetch-utils] Fix FetchUtilsTests.js tests
* Cleanup between tests
* Define `AbortError`
* [fetch-utils] Add `expectConnectionCount` showcasing that the connection stays on when the stream is destroyed
* Revert "[fetch-utils] Add `expectConnectionCount` showcasing that the connection stays on when the stream is destroyed"
This reverts commit b10da7b3fc06a7345df8fd70f27fad70a478bbb4.
* [fetch-utils] Fix `supports abort signals` test
* [fetch-utils] Add tests "aborts the request when the request body is destroyed during transfer"
* [fetch-utils] Add extra waiting step before `expectRequestAborted`
* [fetch-utils] Add `while (!req?.destroyed) await wait(10)`
Unfortunately I couldn't find a better event to await.
To try with this to test flakiness
```
for i in {1..100}; do npm run test:unit || break; echo "Run $i completed"; done
```
* [fetch-utils] Replace arbitrary `wait(10)` by `this.server.waitForEvent('request-received')`
* [fetch-utils] Improve tests per PR comments
See https://github.com/overleaf/internal/pull/20210
1. Replace `waitForEvent` with `once`
2. Replace `waitForRequestAborted` by `expectRequestAborted`
3. Add comment in `expectRequestAborted` empty catch block
Non-flakiness rechecked with `for i in {1..100}; do npm run test:unit || break; echo "Run $i completed"; done`
* [fetch-utils] Add small wait before checking `lastReq === undefined`
Per https://github.com/overleaf/internal/pull/20210#discussion_r1743329462
GitOrigin-RevId: 5fe542e0a8e6011307e03237e2f81404d9a0e674