From 041611729a32f9c0ffbeb3a71238bde127c4c1dd Mon Sep 17 00:00:00 2001 From: Rob Brackett Date: Wed, 19 May 2021 21:48:57 -0700 Subject: [PATCH 1/8] Don't detect async handles already queued to close Some types of async resources in Node.js are not destroyed until *after* their `close` or `end` or similar callbacks and events run, leading to a situation where the `--detectOpenHandles` option can falsely flag resources that have been cleaned up in user code and are already scheduled for destruction. For example, if a test ends from the callback to `TCPServer.close()` and no other tests or lifecycle functions impose additional delays, `--detectOpenHandles` will flag the server even though it has been closed. This is the main cause of issues people encounter with Supertest (see #8554). This addresses the issue by adding a short delay before collecting open handles. Depends on #11382. --- .../__snapshots__/detectOpenHandles.ts.snap | 2 + e2e/__tests__/detectOpenHandles.ts | 12 ++++++ .../__tests__/recently-closed.js | 20 ++++++++++ .../src/__tests__/collectHandles.test.js | 38 +++++++++++++------ packages/jest-core/src/collectHandles.ts | 14 ++++++- packages/jest-core/src/runJest.ts | 6 +-- 6 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 e2e/detect-open-handles/__tests__/recently-closed.js diff --git a/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap index f679a6e076f5..f4823ed102dd 100644 --- a/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap +++ b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap @@ -1,5 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`does not print info about open handlers for a server that is already closed 1`] = ``; + exports[`prints message about flag on forceExit 1`] = `Force exiting Jest: Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?`; exports[`prints message about flag on slow tests 1`] = ` diff --git a/e2e/__tests__/detectOpenHandles.ts b/e2e/__tests__/detectOpenHandles.ts index f070f4b9e25b..3cd9396f9b26 100644 --- a/e2e/__tests__/detectOpenHandles.ts +++ b/e2e/__tests__/detectOpenHandles.ts @@ -155,3 +155,15 @@ it('prints out info about open handlers from lifecycle functions with a `done` c expect(wrap(textAfterTest)).toMatchSnapshot(); }); + +it('does not print info about open handlers for a server that is already closed', async () => { + const run = runContinuous('detect-open-handles', [ + 'recently-closed', + '--detectOpenHandles', + ]); + await run.waitUntil(({stderr}) => stderr.includes('Ran all test suites')); + const {stderr} = await run.end(); + const textAfterTest = getTextAfterTest(stderr); + + expect(wrap(textAfterTest)).toMatchSnapshot(); +}); diff --git a/e2e/detect-open-handles/__tests__/recently-closed.js b/e2e/detect-open-handles/__tests__/recently-closed.js new file mode 100644 index 000000000000..3ce6b0cfc9ca --- /dev/null +++ b/e2e/detect-open-handles/__tests__/recently-closed.js @@ -0,0 +1,20 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import {createServer} from 'http'; + +test('a recently closed server should not be detected by --detectOpenHandles', done => { + const server = createServer((_, response) => response.end('ok')); + server.listen(0, () => { + expect(true).toBe(true); + + // Close server and return immediately on callback. During the "close" + // callback, async hooks usually have not yet been called, but we want to + // make sure Jest can figure out that this server is closed. + server.close(done); + }); +}); diff --git a/packages/jest-core/src/__tests__/collectHandles.test.js b/packages/jest-core/src/__tests__/collectHandles.test.js index 7192709d9350..0970030a5859 100644 --- a/packages/jest-core/src/__tests__/collectHandles.test.js +++ b/packages/jest-core/src/__tests__/collectHandles.test.js @@ -11,12 +11,12 @@ import {PerformanceObserver} from 'perf_hooks'; import collectHandles from '../collectHandles'; describe('collectHandles', () => { - it('should collect Timeout', () => { + it('should collect Timeout', async () => { const handleCollector = collectHandles(); const interval = setInterval(() => {}, 100); - const openHandles = handleCollector(); + const openHandles = await handleCollector(); expect(openHandles).toHaveLength(1); expect(openHandles[0].message).toContain('Timeout'); @@ -24,12 +24,12 @@ describe('collectHandles', () => { clearInterval(interval); }); - it('should not collect the PerformanceObserver open handle', () => { + it('should not collect the PerformanceObserver open handle', async () => { const handleCollector = collectHandles(); const obs = new PerformanceObserver((list, observer) => {}); obs.observe({entryTypes: ['mark']}); - const openHandles = handleCollector(); + const openHandles = await handleCollector(); expect(openHandles).toHaveLength(0); obs.disconnect(); @@ -40,14 +40,28 @@ describe('collectHandles', () => { const server = http.createServer((_, response) => response.end('ok')); server.listen(0, () => { // Collect results while server is still open. - const openHandles = handleCollector(); - - server.close(() => { - expect(openHandles).toContainEqual( - expect.objectContaining({message: 'TCPSERVERWRAP'}), - ); - done(); - }); + handleCollector() + .then(openHandles => { + server.close(() => { + expect(openHandles).toContainEqual( + expect.objectContaining({message: 'TCPSERVERWRAP'}), + ); + done(); + }); + }) + .catch(done); }); }); + + it('should not collect handles that have been queued to close', async () => { + const handleCollector = collectHandles(); + const server = http.createServer((_, response) => response.end('ok')); + + // Start and stop server. + await new Promise(r => server.listen(0, r)); + await new Promise(r => server.close(r)); + + const openHandles = await handleCollector(); + expect(openHandles).toHaveLength(0); + }); }); diff --git a/packages/jest-core/src/collectHandles.ts b/packages/jest-core/src/collectHandles.ts index bb617a3c60bc..6365e2cc0153 100644 --- a/packages/jest-core/src/collectHandles.ts +++ b/packages/jest-core/src/collectHandles.ts @@ -8,12 +8,13 @@ /* eslint-disable local/ban-types-eventually */ import * as asyncHooks from 'async_hooks'; +import {promisify} from 'util'; import stripAnsi = require('strip-ansi'); import type {Config} from '@jest/types'; import {formatExecError} from 'jest-message-util'; import {ErrorWithStack} from 'jest-util'; -export type HandleCollectionResult = () => Array; +export type HandleCollectionResult = () => Promise>; function stackIsFromUser(stack: string) { // Either the test file, or something required by it @@ -42,6 +43,8 @@ const alwaysActive = () => true; // @ts-expect-error: doesn't exist in v10 typings const hasWeakRef = typeof WeakRef === 'function'; +const nextTask = promisify(setImmediate); + // Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js // Extracted as we want to format the result ourselves export default function collectHandles(): HandleCollectionResult { @@ -101,7 +104,14 @@ export default function collectHandles(): HandleCollectionResult { hook.enable(); - return () => { + return async () => { + // Wait until the next JS task for any async resources that have been queued + // for destruction to actually be destroyed. + // For example, Node.js TCP Servers are not destroyed until *after* their + // `close` callback runs. If someone finishes a test from the `close` + // callback, we will not yet have seen the resource be destroyed here. + await nextTask(); + hook.disable(); // Get errors for every async resource still referenced at this moment diff --git a/packages/jest-core/src/runJest.ts b/packages/jest-core/src/runJest.ts index 90d68275ed8c..b6088007235a 100644 --- a/packages/jest-core/src/runJest.ts +++ b/packages/jest-core/src/runJest.ts @@ -75,7 +75,7 @@ type ProcessResultOptions = Pick< outputStream: NodeJS.WriteStream; }; -const processResults = ( +const processResults = async ( runResults: AggregatedResult, options: ProcessResultOptions, ) => { @@ -89,7 +89,7 @@ const processResults = ( } = options; if (collectHandles) { - runResults.openHandles = collectHandles(); + runResults.openHandles = await collectHandles(); } else { runResults.openHandles = []; } @@ -282,7 +282,7 @@ export default async function runJest({ await runGlobalHook({allTests, globalConfig, moduleName: 'globalTeardown'}); } - processResults(results, { + await processResults(results, { collectHandles, json: globalConfig.json, onComplete, From 09504178ee311de3ef6dbf47097b6a8059d293b7 Mon Sep 17 00:00:00 2001 From: Rob Brackett Date: Wed, 19 May 2021 23:51:17 -0700 Subject: [PATCH 2/8] Track indirectly created async resources This fixes a test that the previous commit broke. Some commands (for example, starting a TCP/HTTP server with the `host` option) can cause other async resources to be created indire ctly (so their stack traces don't have any user code in them). Since these are still triggered by things in a user's code, we now track and show them when `--detectOpenHandles` is used. This also increases the size of stack traces in `ErrorWithStack` because some of the Node internals in these async stack traces are deep enough that the test wrapper functions we lo ok for fall off the bottom of the stack trace! --- .../__snapshots__/detectOpenHandles.ts.snap | 2 +- .../src/__tests__/collectHandles.test.js | 21 +++++++++++++++++++ packages/jest-core/src/collectHandles.ts | 16 ++++++++++++-- packages/jest-util/src/ErrorWithStack.ts | 6 ++++++ 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap index f4823ed102dd..40aeef9d4529 100644 --- a/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap +++ b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap @@ -13,7 +13,7 @@ This usually means that there are asynchronous operations that weren't stopped i exports[`prints out info about open handlers 1`] = ` Jest has detected the following 1 open handle potentially keeping Jest from exiting: - ● GETADDRINFOREQWRAP + ● DNSCHANNEL 12 | const app = new Server(); 13 | diff --git a/packages/jest-core/src/__tests__/collectHandles.test.js b/packages/jest-core/src/__tests__/collectHandles.test.js index 0970030a5859..bab13996417a 100644 --- a/packages/jest-core/src/__tests__/collectHandles.test.js +++ b/packages/jest-core/src/__tests__/collectHandles.test.js @@ -64,4 +64,25 @@ describe('collectHandles', () => { const openHandles = await handleCollector(); expect(openHandles).toHaveLength(0); }); + + it('should collect handles indirectly triggered by user code', async () => { + const handleCollector = collectHandles(); + + // Calling `server.listen` with just a port (e.g. `server.listen(0)`) + // creates a `TCPSERVERWRAP` async resource. However, including a `host` + // option instead creates a `GETADDRINFOREQWRAP` resource that only + // lasts for the lifetime of the `listen()` call, but which *indirectly* + // creates a long-lived `TCPSERVERWRAP` resource. We want to make sure we + // capture that long-lived resource. + const server = new http.Server(); + await new Promise(r => server.listen({host: 'localhost', port: 0}, r)); + + const openHandles = await handleCollector(); + + await new Promise(r => server.close(r)); + + expect(openHandles).toContainEqual( + expect.objectContaining({message: 'TCPSERVERWRAP'}), + ); + }); }); diff --git a/packages/jest-core/src/collectHandles.ts b/packages/jest-core/src/collectHandles.ts index 6365e2cc0153..d8614674512f 100644 --- a/packages/jest-core/src/collectHandles.ts +++ b/packages/jest-core/src/collectHandles.ts @@ -59,7 +59,7 @@ export default function collectHandles(): HandleCollectionResult { init: function initHook( asyncId, type, - _triggerAsyncId, + triggerAsyncId, resource: {} | NodeJS.Timeout, ) { if ( @@ -71,8 +71,20 @@ export default function collectHandles(): HandleCollectionResult { return; } const error = new ErrorWithStack(type, initHook); + let fromUser = stackIsFromUser(error.stack || ''); + + // If the async resource was not directly created by user code, but was + // triggered by another async resource from user code, track it and use + // the original triggering resource's stack. + if (!fromUser) { + const triggeringHandle = activeHandles.get(triggerAsyncId); + if (triggeringHandle) { + fromUser = true; + error.stack = triggeringHandle.error.stack; + } + } - if (stackIsFromUser(error.stack || '')) { + if (fromUser) { let isActive: () => boolean; if (type === 'Timeout' || type === 'Immediate') { diff --git a/packages/jest-util/src/ErrorWithStack.ts b/packages/jest-util/src/ErrorWithStack.ts index cbdcf7fa8058..8caf43bdd0d5 100644 --- a/packages/jest-util/src/ErrorWithStack.ts +++ b/packages/jest-util/src/ErrorWithStack.ts @@ -10,9 +10,15 @@ export default class ErrorWithStack extends Error { message: string | undefined, callsite: (...args: Array) => unknown, ) { + // Ensure we have a large stack length so we get full details. + const stackLimit = Error.stackTraceLimit; + Error.stackTraceLimit = Math.max(100, stackLimit || 10); + super(message); if (Error.captureStackTrace) { Error.captureStackTrace(this, callsite); } + + Error.stackTraceLimit = stackLimit; } } From 1d650bf867c47ccc1e187851bec746edbee99177 Mon Sep 17 00:00:00 2001 From: Rob Brackett Date: Thu, 20 May 2021 09:01:25 -0700 Subject: [PATCH 3/8] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe1a0477439e..4b8e15569a4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ - `[jest-core]` Don't report PerformanceObserver as open handle ([#11123](https://github.com/facebook/jest/pull/11123)) - `[jest-core]` Use `WeakRef` to hold timers when detecting open handles ([#11277](https://github.com/facebook/jest/pull/11277)) - `[jest-core]` Correctly detect open handles that were created in test functions using `done` callbacks ([#11382](https://github.com/facebook/jest/pull/11382)) +- `[jest-core]` Wait briefly for open handles to close before flagging them when using `--detectOpenHandles` ([#11429](https://github.com/facebook/jest/pull/11429)) - `[jest-diff]` [**BREAKING**] Use only named exports ([#11371](https://github.com/facebook/jest/pull/11371)) - `[jest-each]` [**BREAKING**] Ignore excess words in headings ([#8766](https://github.com/facebook/jest/pull/8766)) - `[jest-each]` Support array index with template strings ([#10763](https://github.com/facebook/jest/pull/10763)) From 609aa6266d37c501ec12fa02a02f47d5f6c25491 Mon Sep 17 00:00:00 2001 From: Rob Brackett Date: Thu, 20 May 2021 09:32:43 -0700 Subject: [PATCH 4/8] Tweak tests to work better on Node 10. --- packages/jest-core/src/__tests__/collectHandles.test.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/jest-core/src/__tests__/collectHandles.test.js b/packages/jest-core/src/__tests__/collectHandles.test.js index bab13996417a..9e97b8c64498 100644 --- a/packages/jest-core/src/__tests__/collectHandles.test.js +++ b/packages/jest-core/src/__tests__/collectHandles.test.js @@ -18,8 +18,9 @@ describe('collectHandles', () => { const openHandles = await handleCollector(); - expect(openHandles).toHaveLength(1); - expect(openHandles[0].message).toContain('Timeout'); + expect(openHandles).toContainEqual( + expect.objectContaining({message: 'Timeout'}), + ); clearInterval(interval); }); @@ -31,7 +32,9 @@ describe('collectHandles', () => { const openHandles = await handleCollector(); - expect(openHandles).toHaveLength(0); + expect(openHandles).not.toContainEqual( + expect.objectContaining({message: 'PerformanceObserver'}), + ); obs.disconnect(); }); From 0fab1e4cd05e1e86a0597fd4a81999c56832f9ef Mon Sep 17 00:00:00 2001 From: Rob Brackett Date: Thu, 20 May 2021 09:58:42 -0700 Subject: [PATCH 5/8] Wait longer for Windows TCP servers to shut down --- packages/jest-core/src/collectHandles.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/jest-core/src/collectHandles.ts b/packages/jest-core/src/collectHandles.ts index d8614674512f..f5ccf4f9025e 100644 --- a/packages/jest-core/src/collectHandles.ts +++ b/packages/jest-core/src/collectHandles.ts @@ -8,7 +8,6 @@ /* eslint-disable local/ban-types-eventually */ import * as asyncHooks from 'async_hooks'; -import {promisify} from 'util'; import stripAnsi = require('strip-ansi'); import type {Config} from '@jest/types'; import {formatExecError} from 'jest-message-util'; @@ -43,7 +42,9 @@ const alwaysActive = () => true; // @ts-expect-error: doesn't exist in v10 typings const hasWeakRef = typeof WeakRef === 'function'; -const nextTask = promisify(setImmediate); +function asycSleep(milliseconds: number) { + return new Promise(resolve => setTimeout(resolve, milliseconds)); +} // Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js // Extracted as we want to format the result ourselves @@ -117,12 +118,12 @@ export default function collectHandles(): HandleCollectionResult { hook.enable(); return async () => { - // Wait until the next JS task for any async resources that have been queued - // for destruction to actually be destroyed. + // Wait briefly for any async resources that have been queued for + // destruction to actually be destroyed. // For example, Node.js TCP Servers are not destroyed until *after* their // `close` callback runs. If someone finishes a test from the `close` // callback, we will not yet have seen the resource be destroyed here. - await nextTask(); + await asycSleep(100); hook.disable(); From f499edccef0a0e8d27314068a7020cd305c3e593 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Thu, 20 May 2021 23:39:48 +0200 Subject: [PATCH 6/8] PR feedback --- packages/jest-core/src/collectHandles.ts | 9 ++++----- packages/jest-util/src/ErrorWithStack.ts | 9 ++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/jest-core/src/collectHandles.ts b/packages/jest-core/src/collectHandles.ts index f5ccf4f9025e..907ee970567e 100644 --- a/packages/jest-core/src/collectHandles.ts +++ b/packages/jest-core/src/collectHandles.ts @@ -8,6 +8,7 @@ /* eslint-disable local/ban-types-eventually */ import * as asyncHooks from 'async_hooks'; +import {promisify} from 'util'; import stripAnsi = require('strip-ansi'); import type {Config} from '@jest/types'; import {formatExecError} from 'jest-message-util'; @@ -42,9 +43,7 @@ const alwaysActive = () => true; // @ts-expect-error: doesn't exist in v10 typings const hasWeakRef = typeof WeakRef === 'function'; -function asycSleep(milliseconds: number) { - return new Promise(resolve => setTimeout(resolve, milliseconds)); -} +const asyncSleep = promisify(setTimeout); // Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js // Extracted as we want to format the result ourselves @@ -71,7 +70,7 @@ export default function collectHandles(): HandleCollectionResult { ) { return; } - const error = new ErrorWithStack(type, initHook); + const error = new ErrorWithStack(type, initHook, 100); let fromUser = stackIsFromUser(error.stack || ''); // If the async resource was not directly created by user code, but was @@ -123,7 +122,7 @@ export default function collectHandles(): HandleCollectionResult { // For example, Node.js TCP Servers are not destroyed until *after* their // `close` callback runs. If someone finishes a test from the `close` // callback, we will not yet have seen the resource be destroyed here. - await asycSleep(100); + await asyncSleep(100); hook.disable(); diff --git a/packages/jest-util/src/ErrorWithStack.ts b/packages/jest-util/src/ErrorWithStack.ts index 8caf43bdd0d5..9ccac1c8aa44 100644 --- a/packages/jest-util/src/ErrorWithStack.ts +++ b/packages/jest-util/src/ErrorWithStack.ts @@ -9,16 +9,19 @@ export default class ErrorWithStack extends Error { constructor( message: string | undefined, callsite: (...args: Array) => unknown, + stackLimit?: number, ) { // Ensure we have a large stack length so we get full details. - const stackLimit = Error.stackTraceLimit; - Error.stackTraceLimit = Math.max(100, stackLimit || 10); + const originalStackLimit = Error.stackTraceLimit; + if (stackLimit) { + Error.stackTraceLimit = Math.max(stackLimit, originalStackLimit || 10); + } super(message); if (Error.captureStackTrace) { Error.captureStackTrace(this, callsite); } - Error.stackTraceLimit = stackLimit; + Error.stackTraceLimit = originalStackLimit; } } From e5bd74f3e52ceb1c000c58dc07f98c1308c85923 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Thu, 8 Apr 2021 09:12:57 +0200 Subject: [PATCH 7/8] pull in test from #11278 --- e2e/__tests__/detectOpenHandles.ts | 11 +++++++++++ e2e/detect-open-handles/__tests__/crypto.js | 13 +++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 e2e/detect-open-handles/__tests__/crypto.js diff --git a/e2e/__tests__/detectOpenHandles.ts b/e2e/__tests__/detectOpenHandles.ts index 3cd9396f9b26..810c5761507b 100644 --- a/e2e/__tests__/detectOpenHandles.ts +++ b/e2e/__tests__/detectOpenHandles.ts @@ -167,3 +167,14 @@ it('does not print info about open handlers for a server that is already closed' expect(wrap(textAfterTest)).toMatchSnapshot(); }); + +it('does not report crypto random data', () => { + // The test here is basically that it exits cleanly without reporting anything (does not need `until`) + const {stderr} = runJest('detect-open-handles', [ + 'crypto', + '--detectOpenHandles', + ]); + const textAfterTest = getTextAfterTest(stderr); + + expect(textAfterTest).toBe(''); +}); diff --git a/e2e/detect-open-handles/__tests__/crypto.js b/e2e/detect-open-handles/__tests__/crypto.js new file mode 100644 index 000000000000..1a4284994d8e --- /dev/null +++ b/e2e/detect-open-handles/__tests__/crypto.js @@ -0,0 +1,13 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +const {randomFillSync} = require('crypto'); + +test('randomFillSync()', () => { + const buf = Buffer.alloc(10); + randomFillSync(buf); +}); From 2ab6387dd89aaca481b3f3d5abfba61b6ceebad3 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 21 May 2021 00:03:26 +0200 Subject: [PATCH 8/8] Revert "pull in test from #11278" This reverts commit e5bd74f3e52ceb1c000c58dc07f98c1308c85923. --- e2e/__tests__/detectOpenHandles.ts | 11 ----------- e2e/detect-open-handles/__tests__/crypto.js | 13 ------------- 2 files changed, 24 deletions(-) delete mode 100644 e2e/detect-open-handles/__tests__/crypto.js diff --git a/e2e/__tests__/detectOpenHandles.ts b/e2e/__tests__/detectOpenHandles.ts index 810c5761507b..3cd9396f9b26 100644 --- a/e2e/__tests__/detectOpenHandles.ts +++ b/e2e/__tests__/detectOpenHandles.ts @@ -167,14 +167,3 @@ it('does not print info about open handlers for a server that is already closed' expect(wrap(textAfterTest)).toMatchSnapshot(); }); - -it('does not report crypto random data', () => { - // The test here is basically that it exits cleanly without reporting anything (does not need `until`) - const {stderr} = runJest('detect-open-handles', [ - 'crypto', - '--detectOpenHandles', - ]); - const textAfterTest = getTextAfterTest(stderr); - - expect(textAfterTest).toBe(''); -}); diff --git a/e2e/detect-open-handles/__tests__/crypto.js b/e2e/detect-open-handles/__tests__/crypto.js deleted file mode 100644 index 1a4284994d8e..000000000000 --- a/e2e/detect-open-handles/__tests__/crypto.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const {randomFillSync} = require('crypto'); - -test('randomFillSync()', () => { - const buf = Buffer.alloc(10); - randomFillSync(buf); -});