From 9aa8489a01b128dbb5d1097cfccdb7a2293989a5 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Sat, 1 Aug 2026 09:02:34 +0200 Subject: [PATCH] test: fix lint in dtls tests a7d16a8cc6e introduced destructured uses of assert and fixtures, which the test lint rules forbid, plus bare strictEqual/throws calls that were never imported and threw ReferenceError at runtime. Use the assert and fixtures namespaces directly. Signed-off-by: Matteo Collina PR-URL: https://github.com/nodejs/node/pull/64902 Reviewed-By: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Reviewed-By: Filip Skokan Reviewed-By: James M Snell --- test/parallel/test-dtls-accessors.mjs | 69 ++++++------ test/parallel/test-dtls-alpn.mjs | 17 ++- test/parallel/test-dtls-async-dispose.mjs | 13 +-- test/parallel/test-dtls-basic.mjs | 29 +++-- test/parallel/test-dtls-ciphers.mjs | 17 ++- test/parallel/test-dtls-client-cert.mjs | 15 +-- test/parallel/test-dtls-close.mjs | 13 +-- .../test-dtls-connect-error-cleanup.mjs | 11 +- .../test-dtls-destroy-in-callback.mjs | 8 +- test/parallel/test-dtls-errors.mjs | 17 ++- test/parallel/test-dtls-keylog.mjs | 13 +-- test/parallel/test-dtls-mtu.mjs | 17 ++- test/parallel/test-dtls-multiple-clients.mjs | 11 +- test/parallel/test-dtls-options.mjs | 22 ++-- .../test-dtls-reject-unauthorized.mjs | 11 +- test/parallel/test-dtls-robustness.mjs | 8 +- test/parallel/test-dtls-send.mjs | 17 ++- .../parallel/test-dtls-session-properties.mjs | 25 ++--- .../test-dtls-session-table-cleanup.mjs | 17 ++- test/parallel/test-dtls-srtp.mjs | 21 ++-- test/parallel/test-dtls-stats.mjs | 103 +++++++++--------- .../test-dtls-unhandled-rejection.mjs | 8 +- test/parallel/test-dtls-verify-identity.mjs | 15 +-- 23 files changed, 216 insertions(+), 281 deletions(-) diff --git a/test/parallel/test-dtls-accessors.mjs b/test/parallel/test-dtls-accessors.mjs index 41c7ca7b238..bb93eeaebe6 100644 --- a/test/parallel/test-dtls-accessors.mjs +++ b/test/parallel/test-dtls-accessors.mjs @@ -9,9 +9,6 @@ import { import assert from 'node:assert'; import * as fixtures from '../common/fixtures.mjs'; -const { strictEqual } = assert; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -22,9 +19,9 @@ if (!process.features.dtls) { const { listen, connect } = await import('node:dtls'); -const cert = readKey('agent1-cert.pem').toString(); -const key = readKey('agent1-key.pem').toString(); -const ca = readKey('ca1-cert.pem').toString(); +const cert = fixtures.readKey('agent1-cert.pem').toString(); +const key = fixtures.readKey('agent1-key.pem').toString(); +const ca = fixtures.readKey('ca1-cert.pem').toString(); const gotServerSession = Promise.withResolvers(); @@ -34,26 +31,26 @@ const server = listen(mustCall((session) => { // --- Endpoint state after listen(): bound and listening. --- const es = server.state; -strictEqual(es.bound, true); -strictEqual(es.listening, true); -strictEqual(es.closing, false); -strictEqual(es.destroyed, false); -strictEqual(es.sessionCount, 0); +assert.strictEqual(es.bound, true); +assert.strictEqual(es.listening, true); +assert.strictEqual(es.closing, false); +assert.strictEqual(es.destroyed, false); +assert.strictEqual(es.sessionCount, 0); // The busy property is settable via the endpoint and reflected in the state view. -strictEqual(server.busy, false); -strictEqual(es.busy, false); +assert.strictEqual(server.busy, false); +assert.strictEqual(es.busy, false); server.busy = true; -strictEqual(server.busy, true); -strictEqual(es.busy, true); +assert.strictEqual(server.busy, true); +assert.strictEqual(es.busy, true); server.busy = false; -strictEqual(es.busy, false); +assert.strictEqual(es.busy, false); // --- Endpoint onerror accessor. --- -strictEqual(server.onerror, undefined); +assert.strictEqual(server.onerror, undefined); const onEndpointError = mustNotCall(); server.onerror = onEndpointError; -strictEqual(server.onerror, onEndpointError); +assert.strictEqual(server.onerror, onEndpointError); const client = connect('127.0.0.1', server.address.port, { ca: [ca], @@ -62,43 +59,43 @@ const client = connect('127.0.0.1', server.address.port, { // --- Session state during the handshake. --- const cs = client.state; -strictEqual(cs.handshaking, true); -strictEqual(cs.open, false); -strictEqual(cs.closing, false); -strictEqual(cs.destroyed, false); -strictEqual(cs.hasMessageListener, false); +assert.strictEqual(cs.handshaking, true); +assert.strictEqual(cs.open, false); +assert.strictEqual(cs.closing, false); +assert.strictEqual(cs.destroyed, false); +assert.strictEqual(cs.hasMessageListener, false); // --- Session callback accessors: unset, then set. --- -strictEqual(client.onmessage, undefined); -strictEqual(client.onerror, undefined); -strictEqual(client.onhandshake, undefined); -strictEqual(client.onkeylog, undefined); +assert.strictEqual(client.onmessage, undefined); +assert.strictEqual(client.onerror, undefined); +assert.strictEqual(client.onhandshake, undefined); +assert.strictEqual(client.onkeylog, undefined); // A connect() session owns its internal endpoint. -strictEqual(client.ownsEndpoint, true); +assert.strictEqual(client.ownsEndpoint, true); client.onmessage = mustNotCall(); -strictEqual(typeof client.onmessage, 'function'); +assert.strictEqual(typeof client.onmessage, 'function'); // Attaching a message listener flips the shared flag. -strictEqual(cs.hasMessageListener, true); +assert.strictEqual(cs.hasMessageListener, true); client.onerror = mustNotCall(); -strictEqual(typeof client.onerror, 'function'); +assert.strictEqual(typeof client.onerror, 'function'); client.onhandshake = mustCall(); -strictEqual(typeof client.onhandshake, 'function'); +assert.strictEqual(typeof client.onhandshake, 'function'); client.onkeylog = mustCallAtLeast(); -strictEqual(typeof client.onkeylog, 'function'); +assert.strictEqual(typeof client.onkeylog, 'function'); await client.opened; // --- Session state after the handshake completes. --- -strictEqual(cs.handshaking, false); -strictEqual(cs.open, true); +assert.strictEqual(cs.handshaking, false); +assert.strictEqual(cs.open, true); const serverSession = await gotServerSession.promise; await serverSession.opened; -strictEqual(es.sessionCount, 1); +assert.strictEqual(es.sessionCount, 1); await client.close(); await server.close(); diff --git a/test/parallel/test-dtls-alpn.mjs b/test/parallel/test-dtls-alpn.mjs index dd454fdf8be..01054dd6432 100644 --- a/test/parallel/test-dtls-alpn.mjs +++ b/test/parallel/test-dtls-alpn.mjs @@ -6,9 +6,6 @@ import { hasCrypto, skip, mustCall } from '../common/index.mjs'; import assert from 'node:assert'; import * as fixtures from '../common/fixtures.mjs'; -const { strictEqual } = assert; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -19,16 +16,16 @@ if (!process.features.dtls) { const { listen, connect } = await import('node:dtls'); -const serverCert = readKey('agent1-cert.pem'); -const serverKey = readKey('agent1-key.pem'); -const ca = readKey('ca1-cert.pem'); +const serverCert = fixtures.readKey('agent1-cert.pem'); +const serverKey = fixtures.readKey('agent1-key.pem'); +const ca = fixtures.readKey('ca1-cert.pem'); const serverAlpnChecked = Promise.withResolvers(); const endpoint = listen(mustCall(async (session) => { await session.opened; // Server should see the negotiated ALPN protocol. - strictEqual(session.alpnProtocol, 'coap'); + assert.strictEqual(session.alpnProtocol, 'coap'); serverAlpnChecked.resolve(); }), { cert: serverCert.toString(), @@ -47,7 +44,7 @@ const session = connect('127.0.0.1', endpoint.address.port, { await session.opened; // Client should see the negotiated protocol. -strictEqual(session.alpnProtocol, 'coap'); +assert.strictEqual(session.alpnProtocol, 'coap'); await serverAlpnChecked.promise; @@ -77,8 +74,8 @@ await endpoint.close(); const serverSession = await gotServerSession.promise; await serverSession.opened; - strictEqual(client.alpnProtocol, undefined); - strictEqual(serverSession.alpnProtocol, undefined); + assert.strictEqual(client.alpnProtocol, undefined); + assert.strictEqual(serverSession.alpnProtocol, undefined); await client.close(); await server.close(); diff --git a/test/parallel/test-dtls-async-dispose.mjs b/test/parallel/test-dtls-async-dispose.mjs index f6c46c6168b..7fdf43445cc 100644 --- a/test/parallel/test-dtls-async-dispose.mjs +++ b/test/parallel/test-dtls-async-dispose.mjs @@ -6,9 +6,6 @@ import { hasCrypto, skip, mustCall, mustNotCall } from '../common/index.mjs'; import assert from 'node:assert'; import * as fixtures from '../common/fixtures.mjs'; -const { strictEqual } = assert; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -19,9 +16,9 @@ if (!process.features.dtls) { const { listen, connect } = await import('node:dtls'); -const serverCert = readKey('agent1-cert.pem'); -const serverKey = readKey('agent1-key.pem'); -const ca = readKey('ca1-cert.pem'); +const serverCert = fixtures.readKey('agent1-cert.pem'); +const serverKey = fixtures.readKey('agent1-key.pem'); +const ca = fixtures.readKey('ca1-cert.pem'); const endpoint = listen(mustCall((session) => { session.onmessage = mustNotCall(); @@ -40,8 +37,8 @@ const session = connect('127.0.0.1', endpoint.address.port, { await session.opened; // Test that Symbol.asyncDispose exists. -strictEqual(typeof session[Symbol.asyncDispose], 'function'); -strictEqual(typeof endpoint[Symbol.asyncDispose], 'function'); +assert.strictEqual(typeof session[Symbol.asyncDispose], 'function'); +assert.strictEqual(typeof endpoint[Symbol.asyncDispose], 'function'); // Dispose the session. await session[Symbol.asyncDispose](); diff --git a/test/parallel/test-dtls-basic.mjs b/test/parallel/test-dtls-basic.mjs index 54f2c5b8e08..9df0eff0dcc 100644 --- a/test/parallel/test-dtls-basic.mjs +++ b/test/parallel/test-dtls-basic.mjs @@ -6,9 +6,6 @@ import { hasCrypto, skip, mustCall } from '../common/index.mjs'; import assert from 'node:assert'; import * as fixtures from '../common/fixtures.mjs'; -const { ok, strictEqual, match } = assert; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -19,9 +16,9 @@ if (!process.features.dtls) { const { listen, connect } = await import('node:dtls'); -const serverCert = readKey('agent1-cert.pem'); -const serverKey = readKey('agent1-key.pem'); -const ca = readKey('ca1-cert.pem'); +const serverCert = fixtures.readKey('agent1-cert.pem'); +const serverKey = fixtures.readKey('agent1-key.pem'); +const ca = fixtures.readKey('ca1-cert.pem'); const serverReceivedData = Promise.withResolvers(); const clientReceivedData = Promise.withResolvers(); @@ -32,7 +29,7 @@ let clientHandshakeDone = false; // Start server. const endpoint = listen(mustCall((session) => { session.onmessage = mustCall((data) => { - strictEqual(data.toString(), 'hello from client'); + assert.strictEqual(data.toString(), 'hello from client'); serverReceivedData.resolve(); // Send response back to client. @@ -40,8 +37,8 @@ const endpoint = listen(mustCall((session) => { }); session.onhandshake = mustCall((protocol) => { - ok(protocol); - match(protocol, /DTLS/i); + assert.ok(protocol); + assert.match(protocol, /DTLS/i); serverHandshakeDone = true; }); }), { @@ -52,8 +49,8 @@ const endpoint = listen(mustCall((session) => { }); const serverAddress = endpoint.address; -ok(serverAddress); -ok(serverAddress.port > 0); +assert.ok(serverAddress); +assert.ok(serverAddress.port > 0); // Connect client. const clientSession = connect('127.0.0.1', serverAddress.port, { @@ -62,18 +59,18 @@ const clientSession = connect('127.0.0.1', serverAddress.port, { }); clientSession.onmessage = mustCall((data) => { - strictEqual(data.toString(), 'hello from server'); + assert.strictEqual(data.toString(), 'hello from server'); clientReceivedData.resolve(); }); clientSession.onhandshake = mustCall((protocol) => { - ok(protocol); + assert.ok(protocol); clientHandshakeDone = true; }); // Wait for handshake. const { protocol } = await clientSession.opened; -match(protocol, /DTLS/i); +assert.match(protocol, /DTLS/i); // Send data. clientSession.send('hello from client'); @@ -82,8 +79,8 @@ clientSession.send('hello from client'); await Promise.all([serverReceivedData.promise, clientReceivedData.promise]); // Verify handshakes completed. -ok(clientHandshakeDone); -ok(serverHandshakeDone); +assert.ok(clientHandshakeDone); +assert.ok(serverHandshakeDone); // Clean up. await clientSession.close(); diff --git a/test/parallel/test-dtls-ciphers.mjs b/test/parallel/test-dtls-ciphers.mjs index e58a1443c9c..074c33f64b9 100644 --- a/test/parallel/test-dtls-ciphers.mjs +++ b/test/parallel/test-dtls-ciphers.mjs @@ -6,9 +6,6 @@ import { hasCrypto, skip, mustCall, mustNotCall } from '../common/index.mjs'; import assert from 'node:assert'; import * as fixtures from '../common/fixtures.mjs'; -const { strictEqual, throws } = assert; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -19,9 +16,9 @@ if (!process.features.dtls) { const { listen, connect } = await import('node:dtls'); -const cert = readKey('agent1-cert.pem').toString(); -const key = readKey('agent1-key.pem').toString(); -const ca = readKey('ca1-cert.pem').toString(); +const cert = fixtures.readKey('agent1-cert.pem').toString(); +const key = fixtures.readKey('agent1-key.pem').toString(); +const ca = fixtures.readKey('ca1-cert.pem').toString(); const CIPHER = 'ECDHE-RSA-AES128-GCM-SHA256'; @@ -43,15 +40,15 @@ const CIPHER = 'ECDHE-RSA-AES128-GCM-SHA256'; const serverSession = await gotServerSession.promise; await serverSession.opened; - strictEqual(client.cipher.name, CIPHER); - strictEqual(serverSession.cipher.name, CIPHER); + assert.strictEqual(client.cipher.name, CIPHER); + assert.strictEqual(serverSession.cipher.name, CIPHER); await client.close(); await server.close(); } // Case 2: an invalid cipher list is rejected. -throws(() => listen(mustNotCall(), { +assert.throws(() => listen(mustNotCall(), { cert, key, port: 0, host: '127.0.0.1', ciphers: 'THIS-IS-NOT-A-CIPHER', }), { code: 'ERR_CRYPTO_OPERATION_FAILED' }); @@ -74,6 +71,6 @@ throws(() => listen(mustNotCall(), { } // Case 4: an invalid ECDH curve is rejected. -throws(() => listen(mustNotCall(), { +assert.throws(() => listen(mustNotCall(), { cert, key, port: 0, host: '127.0.0.1', ecdhCurve: 'not-a-curve', }), { code: 'ERR_CRYPTO_OPERATION_FAILED' }); diff --git a/test/parallel/test-dtls-client-cert.mjs b/test/parallel/test-dtls-client-cert.mjs index 2505eb6ff7c..271bd7e322a 100644 --- a/test/parallel/test-dtls-client-cert.mjs +++ b/test/parallel/test-dtls-client-cert.mjs @@ -7,9 +7,6 @@ import { hasCrypto, skip, mustCall } from '../common/index.mjs'; import assert from 'node:assert'; import * as fixtures from '../common/fixtures.mjs'; -const { ok, rejects } = assert; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -20,9 +17,9 @@ if (!process.features.dtls) { const { listen, connect } = await import('node:dtls'); -const cert = readKey('agent1-cert.pem').toString(); -const key = readKey('agent1-key.pem').toString(); -const ca = readKey('ca1-cert.pem').toString(); +const cert = fixtures.readKey('agent1-cert.pem').toString(); +const key = fixtures.readKey('agent1-key.pem').toString(); +const ca = fixtures.readKey('ca1-cert.pem').toString(); // Case 1: the client presents a certificate the server can verify. { @@ -44,8 +41,8 @@ const ca = readKey('ca1-cert.pem').toString(); // The server received and verified the client's certificate. const clientCert = serverSession.peerCertificate; - ok(clientCert); - ok(clientCert.includes('BEGIN CERTIFICATE')); + assert.ok(clientCert); + assert.ok(clientCert.includes('BEGIN CERTIFICATE')); await client.close(); await server.close(); @@ -63,7 +60,7 @@ const ca = readKey('ca1-cert.pem').toString(); }); // The exact alert text varies, so assert only that the handshake is rejected. - await rejects(client.opened, { + await assert.rejects(client.opened, { message: /handshake failure/ }); diff --git a/test/parallel/test-dtls-close.mjs b/test/parallel/test-dtls-close.mjs index 0efc3b04348..a71e0938b7d 100644 --- a/test/parallel/test-dtls-close.mjs +++ b/test/parallel/test-dtls-close.mjs @@ -6,9 +6,6 @@ import { hasCrypto, skip, mustCall, mustNotCall } from '../common/index.mjs'; import assert from 'node:assert'; import * as fixtures from '../common/fixtures.mjs'; -const { ok, throws } = assert; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -19,9 +16,9 @@ if (!process.features.dtls) { const { listen, connect } = await import('node:dtls'); -const serverCert = readKey('agent1-cert.pem'); -const serverKey = readKey('agent1-key.pem'); -const ca = readKey('ca1-cert.pem'); +const serverCert = fixtures.readKey('agent1-cert.pem'); +const serverKey = fixtures.readKey('agent1-key.pem'); +const ca = fixtures.readKey('ca1-cert.pem'); // Test 1: Graceful close from client side. { @@ -48,7 +45,7 @@ const ca = readKey('ca1-cert.pem'); // Graceful close. const closedPromise = session.close(); - ok(closedPromise instanceof Promise); + assert.ok(closedPromise instanceof Promise); await closedPromise; // Wait for server to see the close. @@ -80,7 +77,7 @@ const ca = readKey('ca1-cert.pem'); session.destroy(); // After destroy, send should fail. - throws(() => { + assert.throws(() => { session.send('should fail'); }, /destroyed/i); diff --git a/test/parallel/test-dtls-connect-error-cleanup.mjs b/test/parallel/test-dtls-connect-error-cleanup.mjs index 049c2487900..13dcf8da26b 100644 --- a/test/parallel/test-dtls-connect-error-cleanup.mjs +++ b/test/parallel/test-dtls-connect-error-cleanup.mjs @@ -8,9 +8,6 @@ import { hasCrypto, skip, mustCall } from '../common/index.mjs'; import assert from 'node:assert'; import * as fixtures from '../common/fixtures.mjs'; -const { rejects } = assert; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -21,9 +18,9 @@ if (!process.features.dtls) { const { listen, connect } = await import('node:dtls'); -const cert = readKey('agent1-cert.pem').toString(); -const key = readKey('agent1-key.pem').toString(); -const ca = readKey('ca1-cert.pem').toString(); +const cert = fixtures.readKey('agent1-cert.pem').toString(); +const key = fixtures.readKey('agent1-key.pem').toString(); +const ca = fixtures.readKey('ca1-cert.pem').toString(); // The client rejects the certificate mid-handshake, so this server session // never opens; its opened rejection is handled internally by the library. @@ -37,7 +34,7 @@ const session = connect('127.0.0.1', server.address.port, { servername: 'wrong.example.com', }); -await rejects(session.opened, /certificate verify failed/i); +await assert.rejects(session.opened, /certificate verify failed/i); // The failed connect must have closed its internally-owned endpoint. Without // that, this await never settles and the test times out. diff --git a/test/parallel/test-dtls-destroy-in-callback.mjs b/test/parallel/test-dtls-destroy-in-callback.mjs index 97344bb7071..7915742ca01 100644 --- a/test/parallel/test-dtls-destroy-in-callback.mjs +++ b/test/parallel/test-dtls-destroy-in-callback.mjs @@ -9,8 +9,6 @@ import { hasCrypto, skip, mustCall } from '../common/index.mjs'; import * as fixtures from '../common/fixtures.mjs'; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -21,9 +19,9 @@ if (!process.features.dtls) { const { listen, connect } = await import('node:dtls'); -const cert = readKey('agent1-cert.pem').toString(); -const key = readKey('agent1-key.pem').toString(); -const ca = readKey('ca1-cert.pem').toString(); +const cert = fixtures.readKey('agent1-cert.pem').toString(); +const key = fixtures.readKey('agent1-key.pem').toString(); +const ca = fixtures.readKey('ca1-cert.pem').toString(); // --------------------------------------------------------------------------- // Case 1: destroy the (server) session from inside onmessage. The datagram diff --git a/test/parallel/test-dtls-errors.mjs b/test/parallel/test-dtls-errors.mjs index e17497fcac6..e65c90abd4e 100644 --- a/test/parallel/test-dtls-errors.mjs +++ b/test/parallel/test-dtls-errors.mjs @@ -7,9 +7,6 @@ import { hasCrypto, skip, mustNotCall } from '../common/index.mjs'; import assert from 'node:assert'; import * as fixtures from '../common/fixtures.mjs'; -const { throws } = assert; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -20,22 +17,22 @@ if (!process.features.dtls) { const { listen, DTLSEndpoint } = await import('node:dtls'); -const cert = readKey('agent1-cert.pem').toString(); -const key = readKey('agent1-key.pem').toString(); -const mismatchedKey = readKey('agent2-key.pem').toString(); +const cert = fixtures.readKey('agent1-cert.pem').toString(); +const key = fixtures.readKey('agent1-key.pem').toString(); +const mismatchedKey = fixtures.readKey('agent2-key.pem').toString(); // A malformed certificate PEM is rejected. -throws(() => listen(mustNotCall(), { +assert.throws(() => listen(mustNotCall(), { cert: 'not a certificate', key, port: 0, }), { code: 'ERR_CRYPTO_OPERATION_FAILED' }); // A malformed private key PEM is rejected. -throws(() => listen(mustNotCall(), { +assert.throws(() => listen(mustNotCall(), { cert, key: 'not a key', port: 0, }), { code: 'ERR_CRYPTO_OPERATION_FAILED' }); // A private key that does not match the certificate is rejected. -throws(() => listen(mustNotCall(), { +assert.throws(() => listen(mustNotCall(), { cert, key: mismatchedKey, port: 0, }), { code: 'ERR_CRYPTO_OPERATION_FAILED' }); @@ -43,6 +40,6 @@ throws(() => listen(mustNotCall(), { { const endpoint = new DTLSEndpoint(); endpoint.bind('127.0.0.1', 0); - throws(() => endpoint.bind('127.0.0.1', 0), { code: 'ERR_INVALID_STATE' }); + assert.throws(() => endpoint.bind('127.0.0.1', 0), { code: 'ERR_INVALID_STATE' }); await endpoint.close(); } diff --git a/test/parallel/test-dtls-keylog.mjs b/test/parallel/test-dtls-keylog.mjs index 49d70a4566f..f32c1142b4c 100644 --- a/test/parallel/test-dtls-keylog.mjs +++ b/test/parallel/test-dtls-keylog.mjs @@ -7,9 +7,6 @@ import { hasCrypto, skip, mustCall, mustCallAtLeast } from '../common/index.mjs' import assert from 'node:assert'; import * as fixtures from '../common/fixtures.mjs'; -const { strictEqual, match } = assert; -const { readKey } = fixtures; - if (!hasCrypto) { skip('missing crypto'); } @@ -20,9 +17,9 @@ if (!process.features.dtls) { const { listen, connect } = await import('node:dtls'); -const cert = readKey('agent1-cert.pem').toString(); -const key = readKey('agent1-key.pem').toString(); -const ca = readKey('ca1-cert.pem').toString(); +const cert = fixtures.readKey('agent1-cert.pem').toString(); +const key = fixtures.readKey('agent1-key.pem').toString(); +const ca = fixtures.readKey('ca1-cert.pem').toString(); const gotKeylog = Promise.withResolvers(); @@ -37,8 +34,8 @@ const client = connect('127.0.0.1', server.address.port, { // A keylog line is "