From 7a92eeeddf14ea637f5a6ab39c20bf18ab0e7ce0 Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Sat, 2 Mar 2024 13:27:29 +0100 Subject: [PATCH] tests: ignore catch block when requiring crypto module (#2901) --- lib/web/fetch/util.js | 4 ++-- lib/web/websocket/connection.js | 1 + lib/web/websocket/frame.js | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/web/fetch/util.js b/lib/web/fetch/util.js index 92bcb6cb202..6cf679b2ced 100644 --- a/lib/web/fetch/util.js +++ b/lib/web/fetch/util.js @@ -12,11 +12,11 @@ const { isUint8Array } = require('node:util/types') const { webidl } = require('./webidl') // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable -/** @type {import('crypto')|undefined} */ +/** @type {import('crypto')} */ let crypto - try { crypto = require('node:crypto') +/* c8 ignore next 3 */ } catch { } diff --git a/lib/web/websocket/connection.js b/lib/web/websocket/connection.js index 45f68e1de93..2869ebafb63 100644 --- a/lib/web/websocket/connection.js +++ b/lib/web/websocket/connection.js @@ -20,6 +20,7 @@ const { kHeadersList } = require('../../core/symbols') let crypto try { crypto = require('node:crypto') +/* c8 ignore next 3 */ } catch { } diff --git a/lib/web/websocket/frame.js b/lib/web/websocket/frame.js index ee3087bdf70..30c68c811cd 100644 --- a/lib/web/websocket/frame.js +++ b/lib/web/websocket/frame.js @@ -6,6 +6,7 @@ const { maxUnsigned16Bit } = require('./constants') let crypto try { crypto = require('node:crypto') +/* c8 ignore next 3 */ } catch { }