From e5bd74f3e52ceb1c000c58dc07f98c1308c85923 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Thu, 8 Apr 2021 09:12:57 +0200 Subject: [PATCH] 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); +});