diff --git a/CHANGELOG.md b/CHANGELOG.md index 807fe18cbd6a..c4895d250a34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Fixes - `[@jest/expect-utils]` Fix deep equality of ImmutableJS Lists ([#12763](https://github.com/facebook/jest/pull/12763)) +- `[jest-core]` Do not collect `SIGNREQUEST` as open handles ([#12789](https://github.com/facebook/jest/pull/12789)) ### Chore & Maintenance diff --git a/packages/jest-core/src/__tests__/collectHandles.test.js b/packages/jest-core/src/__tests__/collectHandles.test.js index b0628157af00..9b79c5e6e280 100644 --- a/packages/jest-core/src/__tests__/collectHandles.test.js +++ b/packages/jest-core/src/__tests__/collectHandles.test.js @@ -6,6 +6,7 @@ * */ +import crypto from 'crypto'; import {promises as dns} from 'dns'; import http from 'http'; import {PerformanceObserver} from 'perf_hooks'; @@ -67,6 +68,22 @@ describe('collectHandles', () => { ); }); + it('should not collect the SIGNREQUEST open handle', async () => { + const handleCollector = collectHandles(); + + const key = + '-----BEGIN PRIVATE KEY-----\r\nMC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD' + + '/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r\n-----END PRIVATE KEY-----'; + const data = Buffer.from('a'); + crypto.sign(null, data, key); + + const openHandles = await handleCollector(); + + expect(openHandles).not.toContainEqual( + expect.objectContaining({message: 'SIGNREQUEST'}), + ); + }); + it('should collect handles opened in test functions with `done` callbacks', done => { const handleCollector = collectHandles(); const server = http.createServer((_, response) => response.end('ok')); diff --git a/packages/jest-core/src/collectHandles.ts b/packages/jest-core/src/collectHandles.ts index 61afcf7fd846..5e69fd920e71 100644 --- a/packages/jest-core/src/collectHandles.ts +++ b/packages/jest-core/src/collectHandles.ts @@ -72,7 +72,8 @@ export default function collectHandles(): HandleCollectionResult { type === 'PerformanceObserver' || type === 'RANDOMBYTESREQUEST' || type === 'DNSCHANNEL' || - type === 'ZLIB' + type === 'ZLIB' || + type === 'SIGNREQUEST' ) { return; }