You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to debug remaining open handles in Jest tests reviewing this PR, I was unable to run jest tests serially via --runInBand/--detectOpenHandles because they were running out of memory due to a number of possible memory leaks.
There is an experimental jest argument: --detectLeaks that will fail a test if it detects that it is leaking memory:
max ~/interledger/rafiki/packages/backend [main] $ node ../../node_modules/jest/bin/jest.js --runInBand --detectLeaks --detectOpenHandles
{"level":30,"time":1707131063083,"pid":12851,"hostname":"max.local","msg":"creating knex"}
FAIL backend src/open_payments/payment/outgoing/service.test.ts
● Test suite failed to run
EXPERIMENTAL FEATURE!
Your test suite is leaking memory. Please ensure all references are cleaned.
There is a number of things that can leak memory:
- Async operations that have not finished (e.g. fs.readFile).
- Timers not properly mocked (e.g. setInterval, setTimeout).
- Keeping references to the global scope.
at onResult (node_modules/.pnpm/@jest+core@29.7.0/node_modules/@jest/core/build/TestScheduler.js:150:18)
at node_modules/.pnpm/@jest+core@29.7.0/node_modules/@jest/core/build/TestScheduler.js:254:19
at node_modules/.pnpm/emittery@0.13.1/node_modules/emittery/index.js:363:13
at Array.map (<anonymous>)
at Emittery.emit (node_modules/.pnpm/emittery@0.13.1/node_modules/emittery/index.js:361:23)
FAIL backend src/open_payments/payment/combined/service.test.ts
● Test suite failed to run
EXPERIMENTAL FEATURE!
Your test suite is leaking memory. Please ensure all references are cleaned.
There is a number of things that can leak memory:
- Async operations that have not finished (e.g. fs.readFile).
- Timers not properly mocked (e.g. setInterval, setTimeout).
- Keeping references to the global scope.
at onResult (node_modules/.pnpm/@jest+core@29.7.0/node_modules/@jest/core/build/TestScheduler.js:150:18)
at node_modules/.pnpm/@jest+core@29.7.0/node_modules/@jest/core/build/TestScheduler.js:254:19
at node_modules/.pnpm/emittery@0.13.1/node_modules/emittery/index.js:363:13
at Array.map (<anonymous>)
at Emittery.emit (node_modules/.pnpm/emittery@0.13.1/node_modules/emittery/index.js:361:23)
.... and so on
This fails most of our tests due to several reasons.
It looks like the main culprit is the nock library:
Context
When trying to debug remaining open handles in Jest tests reviewing this PR, I was unable to run jest tests serially via
--runInBand
/--detectOpenHandles
because they were running out of memory due to a number of possible memory leaks.There is an experimental jest argument:
--detectLeaks
that will fail a test if it detects that it is leaking memory:This fails most of our tests due to several reasons.
It looks like the main culprit is the
nock
library:Some other culprits are the
The text was updated successfully, but these errors were encountered: