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
Jest has a --detectLeaks flag, which causes tests to fail if there is a memory leak. Importing @testing-library/jest-dom causes a memory leak in NodeJS v20. However, in NodeJS v18 the memory leak does not occur.
When commenting out require('aria-query');var matchers = require('./matchers-5ae87d41.js'); and expect.extend(matchers.extensions); from ./node_modules/@testing-library/jest-dom/dist/index.js memory leak disappears. Both var matchers and require('aria-query') cause a memory leak.
Actually, when running npm run test -- --detectLeaks in the @testing-library/jest-dom repo all tests fail when using NodeJS v20.
The text was updated successfully, but these errors were encountered:
@testing-library/jest-dom
version: 6.4.2node
version: 20.11.1jest
version: 29.7.0npm
version: 10.2.4What happened:
Jest fails with a memory leak error when importing @testing-library/jest-dom into jest setup file
Your test suite is leaking memory. Please ensure all references are cleaned.
Reproduction:
Here is the minimal reproduction repository
Problem description:
Jest has a --detectLeaks flag, which causes tests to fail if there is a memory leak. Importing @testing-library/jest-dom causes a memory leak in NodeJS v20. However, in NodeJS v18 the memory leak does not occur.
When commenting out
require('aria-query');
var matchers = require('./matchers-5ae87d41.js');
andexpect.extend(matchers.extensions);
from./node_modules/@testing-library/jest-dom/dist/index.js
memory leak disappears. Bothvar matchers
andrequire('aria-query')
cause a memory leak.Actually, when running
npm run test -- --detectLeaks
in the@testing-library/jest-dom
repo all tests fail when using NodeJS v20.The text was updated successfully, but these errors were encountered: