Commit 3a3e34603ba for nodejs

commit 3a3e34603baa67d94a50358d42a74c134a373bb7
Author: James M Snell <jasnell@gmail.com>
Date:   Fri Nov 27 23:01:32 2026 +0000

    test: run dtls tests under DTLS 1.2 and 1.3

    Pin both versions explicitly in every test that completes a handshake,
    so coverage does not depend on the default.

    Assisted-by: Claude Opus 5.5
    Signed-off-by: James M Snell <jasnell@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/67837
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>

diff --git a/test/parallel/test-dtls-accessors.mjs b/test/parallel/test-dtls-accessors.mjs
index 654c0833a3d..7eb3e70897c 100644
--- a/test/parallel/test-dtls-accessors.mjs
+++ b/test/parallel/test-dtls-accessors.mjs
@@ -30,103 +30,112 @@ 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();
-
-const server = listen(mustCall((session) => {
-  gotServerSession.resolve(session);
-}), { cert, key, port: 0, host: '127.0.0.1' });
-
-// --- Endpoint state after listen(): bound and listening. ---
-const es = getDTLSEndpointState(server);
-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.
-assert.strictEqual(server.busy, false);
-assert.strictEqual(es.busy, false);
-server.busy = true;
-assert.strictEqual(server.busy, true);
-assert.strictEqual(es.busy, true);
-server.busy = false;
-assert.strictEqual(es.busy, false);
-
-// --- Endpoint onerror accessor. ---
-assert.strictEqual(server.onerror, undefined);
-const onEndpointError = mustNotCall();
-server.onerror = onEndpointError;
-assert.strictEqual(server.onerror, onEndpointError);
-
-const client = connect('127.0.0.1', server.address.port, {
-  ca: [ca],
-  rejectUnauthorized: false,
-});
-
-// --- Session state during the handshake. ---
-const cs = getDTLSSessionState(client);
-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. ---
-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, which is recorded on a
-// symbol rather than a property: it decides whether closing the session takes
-// the endpoint with it, and a server session told the same thing would take
-// down the listener.
-assert.strictEqual(client[kOwnsEndpoint], true);
-assert.strictEqual(client.ownsEndpoint, undefined);
-
-client.onmessage = mustNotCall();
-assert.strictEqual(typeof client.onmessage, 'function');
-// Attaching a message listener flips the shared flag.
-assert.strictEqual(cs.hasMessageListener, true);
-
-client.onerror = mustNotCall();
-assert.strictEqual(typeof client.onerror, 'function');
-
-client.onhandshake = mustCall();
-assert.strictEqual(typeof client.onhandshake, 'function');
-
-client.onkeylog = mustCallAtLeast();
-assert.strictEqual(typeof client.onkeylog, 'function');
-
-await client.opened;
-
-// --- Session state after the handshake completes. ---
-assert.strictEqual(cs.handshaking, false);
-assert.strictEqual(cs.open, true);
-
-const serverSession = await gotServerSession.promise;
-await serverSession.opened;
-assert.strictEqual(es.sessionCount, 1);
-
-await client.close();
-await server.close();
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  const gotServerSession = Promise.withResolvers();
+
+  const server = listen(mustCall((session) => {
+    gotServerSession.resolve(session);
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });
+
+  // --- Endpoint state after listen(): bound and listening. ---
+  const es = getDTLSEndpointState(server);
+  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.
+  assert.strictEqual(server.busy, false);
+  assert.strictEqual(es.busy, false);
+  server.busy = true;
+  assert.strictEqual(server.busy, true);
+  assert.strictEqual(es.busy, true);
+  server.busy = false;
+  assert.strictEqual(es.busy, false);
+
+  // --- Endpoint onerror accessor. ---
+  assert.strictEqual(server.onerror, undefined);
+  const onEndpointError = mustNotCall();
+  server.onerror = onEndpointError;
+  assert.strictEqual(server.onerror, onEndpointError);
+
+  const client = connect('127.0.0.1', server.address.port, {
+    ca: [ca],
+    rejectUnauthorized: false,
+    ...versions,
+  });
+
+  // --- Session state during the handshake. ---
+  const cs = getDTLSSessionState(client);
+  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. ---
+  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, which is recorded on a
+  // symbol rather than a property: it decides whether closing the session takes
+  // the endpoint with it, and a server session told the same thing would take
+  // down the listener.
+  assert.strictEqual(client[kOwnsEndpoint], true);
+  assert.strictEqual(client.ownsEndpoint, undefined);
+
+  client.onmessage = mustNotCall();
+  assert.strictEqual(typeof client.onmessage, 'function');
+  // Attaching a message listener flips the shared flag.
+  assert.strictEqual(cs.hasMessageListener, true);
+
+  client.onerror = mustNotCall();
+  assert.strictEqual(typeof client.onerror, 'function');
+
+  client.onhandshake = mustCall();
+  assert.strictEqual(typeof client.onhandshake, 'function');
+
+  client.onkeylog = mustCallAtLeast();
+  assert.strictEqual(typeof client.onkeylog, 'function');
+
+  await client.opened;
+
+  // --- Session state after the handshake completes. ---
+  assert.strictEqual(cs.handshaking, false);
+  assert.strictEqual(cs.open, true);
+
+  const serverSession = await gotServerSession.promise;
+  await serverSession.opened;
+  assert.strictEqual(es.sessionCount, 1);
+
+  await client.close();
+  await server.close();
+}

 // ownsEndpoint is not public. It says whether closing a session should take
 // its endpoint with it, which is true only for the single-session endpoint
 // connect() creates. Exposed as a settable property, it let a server session
 // be told it owned the listener: closing that one session then tore down the
 // endpoint and every other session on it.
-{
+for (const versions of [V12, V13]) {
   const arrived = Promise.withResolvers();
   let serverSession;

   const server = listen((session) => {
     serverSession ??= session;
     arrived.resolve();
-  }, { cert, key, host: '127.0.0.1', port: 0 });
+  }, { cert, key, host: '127.0.0.1', port: 0, ...versions });
   const port = server.address.port;

-  const first = connect('127.0.0.1', port, { rejectUnauthorized: false });
+  const first = connect('127.0.0.1', port, {
+    rejectUnauthorized: false, ...versions,
+  });
   await first.opened;
   await arrived.promise;

@@ -145,6 +154,7 @@ await server.close();
   const second = connect('127.0.0.1', port, {
     rejectUnauthorized: false,
     handshakeTimeout: 5000,
+    ...versions,
   });
   await second.opened;

diff --git a/test/parallel/test-dtls-alpn-validation.mjs b/test/parallel/test-dtls-alpn-validation.mjs
index 053a16ef675..4e95d92a1db 100644
--- a/test/parallel/test-dtls-alpn-validation.mjs
+++ b/test/parallel/test-dtls-alpn-validation.mjs
@@ -30,6 +30,9 @@ const ca = fixtures.readKey('ca1-cert.pem');

 const base = { cert, key, host: '127.0.0.1', port: 0 };

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // A name that does not fit in the length byte.
 assert.throws(
   () => listen(() => {}, { ...base, alpn: ['a'.repeat(256)] }),
@@ -46,11 +49,11 @@ assert.throws(
   { code: 'ERR_OUT_OF_RANGE', message: /alpn\[1\]/ });

 // 255 is the largest representable name and must still be accepted.
-{
+for (const versions of [V12, V13]) {
   const name = 'b'.repeat(255);
-  const endpoint = listen(() => {}, { ...base, alpn: [name] });
+  const endpoint = listen(() => {}, { ...base, alpn: [name], ...versions });
   const client = connect('127.0.0.1', endpoint.address.port, {
-    servername: 'agent1', ca: [ca], alpn: [name],
+    servername: 'agent1', ca: [ca], alpn: [name], ...versions,
   });
   await client.opened;
   assert.strictEqual(client.alpnProtocol, name);
@@ -68,12 +71,12 @@ assert.throws(
   { code: 'ERR_INVALID_ARG_VALUE', message: /past the end/ });

 // A well-formed buffer still works, so the walk is not rejecting everything.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
-    ...base, alpn: Buffer.from([2, 0x68, 0x32]),
+    ...base, alpn: Buffer.from([2, 0x68, 0x32]), ...versions,
   });
   const client = connect('127.0.0.1', endpoint.address.port, {
-    servername: 'agent1', ca: [ca], alpn: ['h2'],
+    servername: 'agent1', ca: [ca], alpn: ['h2'], ...versions,
   });
   await client.opened;
   assert.strictEqual(client.alpnProtocol, 'h2');
diff --git a/test/parallel/test-dtls-alpn.mjs b/test/parallel/test-dtls-alpn.mjs
index 28a0cb3e453..e9d5eb2ee44 100644
--- a/test/parallel/test-dtls-alpn.mjs
+++ b/test/parallel/test-dtls-alpn.mjs
@@ -20,36 +20,43 @@ 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.
-  assert.strictEqual(session.alpnProtocol, 'coap');
-  serverAlpnChecked.resolve();
-}), {
-  cert: serverCert.toString(),
-  key: serverKey.toString(),
-  port: 0,
-  host: '127.0.0.1',
-  alpn: ['coap', 'h2'],
-});
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  const serverAlpnChecked = Promise.withResolvers();
+
+  const endpoint = listen(mustCall(async (session) => {
+    await session.opened;
+    // Server should see the negotiated ALPN protocol.
+    assert.strictEqual(session.alpnProtocol, 'coap');
+    serverAlpnChecked.resolve();
+  }), {
+    cert: serverCert.toString(),
+    key: serverKey.toString(),
+    port: 0,
+    host: '127.0.0.1',
+    ...versions,
+    alpn: ['coap', 'h2'],
+  });

-const session = connect('127.0.0.1', endpoint.address.port, {
-  ca: [ca.toString()],
-  rejectUnauthorized: false,
-  alpn: ['coap'],
-});
+  const session = connect('127.0.0.1', endpoint.address.port, {
+    ca: [ca.toString()],
+    rejectUnauthorized: false,
+    ...versions,
+    alpn: ['coap'],
+  });

-await session.opened;
+  await session.opened;

-// Client should see the negotiated protocol.
-assert.strictEqual(session.alpnProtocol, 'coap');
+  // Client should see the negotiated protocol.
+  assert.strictEqual(session.alpnProtocol, 'coap');

-await serverAlpnChecked.promise;
+  await serverAlpnChecked.promise;

-await session.close();
-await endpoint.close();
+  await session.close();
+  await endpoint.close();
+}

 // ALPN with no protocol in common: RFC 7301 section 3.2 requires the server to
 // send a fatal no_application_protocol alert, so the handshake must fail.
@@ -58,18 +65,20 @@ await endpoint.close();
 // neither peer reporting a protocol -- which left both ends connected with no
 // agreement on what to speak. The callback returned SSL_TLSEXT_ERR_NOACK; it
 // now returns SSL_TLSEXT_ERR_ALERT_FATAL, matching node:tls.
-{
+for (const versions of [V12, V13]) {
   const server = listen(() => {}, {
     cert: serverCert.toString(),
     key: serverKey.toString(),
     port: 0,
     host: '127.0.0.1',
+    ...versions,
     alpn: ['bar'],
   });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca.toString()],
     rejectUnauthorized: false,
+    ...versions,
     alpn: ['foo'],
   });

@@ -87,7 +96,7 @@ await endpoint.close();
 // A server with no ALPN configured must not reject a client that offers
 // protocols. The alert above applies only where the server does ALPN and
 // finds no overlap; declining the extension entirely is not a failure.
-{
+for (const versions of [V12, V13]) {
   const gotServerSession = Promise.withResolvers();

   const server = listen(mustCall((s) => gotServerSession.resolve(s)), {
@@ -95,11 +104,13 @@ await endpoint.close();
     key: serverKey.toString(),
     port: 0,
     host: '127.0.0.1',
+    ...versions,
   });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca.toString()],
     rejectUnauthorized: false,
+    ...versions,
     alpn: ['foo'],
   });

@@ -116,7 +127,7 @@ await endpoint.close();

 // A server that does ALPN must still accept a client that offers none: the
 // selection callback only runs when the client sent the extension.
-{
+for (const versions of [V12, V13]) {
   const gotServerSession = Promise.withResolvers();

   const server = listen(mustCall((s) => gotServerSession.resolve(s)), {
@@ -124,12 +135,14 @@ await endpoint.close();
     key: serverKey.toString(),
     port: 0,
     host: '127.0.0.1',
+    ...versions,
     alpn: ['bar'],
   });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca.toString()],
     rejectUnauthorized: false,
+    ...versions,
   });

   await client.opened;
diff --git a/test/parallel/test-dtls-async-dispose.mjs b/test/parallel/test-dtls-async-dispose.mjs
index 7fdf43445cc..8afa5db4a6e 100644
--- a/test/parallel/test-dtls-async-dispose.mjs
+++ b/test/parallel/test-dtls-async-dispose.mjs
@@ -20,28 +20,35 @@ 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();
-}), {
-  cert: serverCert.toString(),
-  key: serverKey.toString(),
-  port: 0,
-  host: '127.0.0.1',
-});
-
-const session = connect('127.0.0.1', endpoint.address.port, {
-  ca: [ca.toString()],
-  rejectUnauthorized: false,
-});
-
-await session.opened;
-
-// Test that Symbol.asyncDispose exists.
-assert.strictEqual(typeof session[Symbol.asyncDispose], 'function');
-assert.strictEqual(typeof endpoint[Symbol.asyncDispose], 'function');
-
-// Dispose the session.
-await session[Symbol.asyncDispose]();
-
-// Dispose the endpoint.
-await endpoint[Symbol.asyncDispose]();
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  const endpoint = listen(mustCall((session) => {
+    session.onmessage = mustNotCall();
+  }), {
+    cert: serverCert.toString(),
+    key: serverKey.toString(),
+    port: 0,
+    host: '127.0.0.1',
+    ...versions,
+  });
+
+  const session = connect('127.0.0.1', endpoint.address.port, {
+    ca: [ca.toString()],
+    rejectUnauthorized: false,
+    ...versions,
+  });
+
+  await session.opened;
+
+  // Test that Symbol.asyncDispose exists.
+  assert.strictEqual(typeof session[Symbol.asyncDispose], 'function');
+  assert.strictEqual(typeof endpoint[Symbol.asyncDispose], 'function');
+
+  // Dispose the session.
+  await session[Symbol.asyncDispose]();
+
+  // Dispose the endpoint.
+  await endpoint[Symbol.asyncDispose]();
+}
diff --git a/test/parallel/test-dtls-authorized-before-handshake.mjs b/test/parallel/test-dtls-authorized-before-handshake.mjs
index 91613813402..738fb0b63b4 100644
--- a/test/parallel/test-dtls-authorized-before-handshake.mjs
+++ b/test/parallel/test-dtls-authorized-before-handshake.mjs
@@ -31,8 +31,11 @@ const cert = key('agent1-cert.pem');
 const privateKey = key('agent1-key.pem');
 const ca = key('ca1-cert.pem');

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // Server side: read both accessors at the earliest moment they exist.
-{
+for (const versions of [V12, V13]) {
   const checked = Promise.withResolvers();

   const endpoint = listen(mustCall((session) => {
@@ -42,10 +45,11 @@ const ca = key('ca1-cert.pem');
     assert.strictEqual(session.authorized, false);
     assert.strictEqual(session.authorizationError, 'HANDSHAKE_INCOMPLETE');
     checked.resolve();
-  }), { cert, key: privateKey, host: HOST, port: 0 });
+  }), { cert, key: privateKey, host: HOST, port: 0, ...versions });

   const client = connect(HOST, endpoint.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });
   await client.opened;
   await checked.promise;
@@ -55,13 +59,15 @@ const ca = key('ca1-cert.pem');
 }

 // Client side: readable between connect() and the handshake completing.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
     cert, key: privateKey, host: HOST, port: 0,
+    ...versions,
   });

   const client = connect(HOST, endpoint.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });

   assert.strictEqual(client.authorized, false);
@@ -75,14 +81,16 @@ const ca = key('ca1-cert.pem');

 // After the handshake the accessors report the real result, so the guard has
 // not simply pinned them to a constant.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
     cert, key: privateKey, host: HOST, port: 0,
+    ...versions,
   });

   // Trusting the issuer: authorized, with no error.
   const trusting = connect(HOST, endpoint.address.port, {
     ca: [ca], servername: 'agent1',
+    ...versions,
   });
   await trusting.opened;
   assert.strictEqual(trusting.authorized, true);
@@ -92,6 +100,7 @@ const ca = key('ca1-cert.pem');
   // Not trusting it: a real verification error, not the placeholder.
   const untrusting = connect(HOST, endpoint.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });
   await untrusting.opened;
   assert.strictEqual(untrusting.authorized, false);
@@ -103,13 +112,15 @@ const ca = key('ca1-cert.pem');
 }

 // And after close, when the handle is gone.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
     cert, key: privateKey, host: HOST, port: 0,
+    ...versions,
   });

   const client = connect(HOST, endpoint.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });
   await client.opened;
   await client.close();
diff --git a/test/parallel/test-dtls-authorized.mjs b/test/parallel/test-dtls-authorized.mjs
index f0329a19c2a..765b281453e 100644
--- a/test/parallel/test-dtls-authorized.mjs
+++ b/test/parallel/test-dtls-authorized.mjs
@@ -26,46 +26,51 @@ const key = fixtures.readKey('agent1-key.pem');
 const ca1 = fixtures.readKey('ca1-cert.pem');
 const ca2 = fixtures.readKey('ca2-cert.pem');

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // --- Client side ---------------------------------------------------------

-const endpoint = listen(() => {}, {
-  cert, key, host: '127.0.0.1', port: 0,
-});
-const { port } = endpoint.address;
-
-for (const [description, options, authorized, authorizationError] of [
-  ['a trusted chain and matching identity verifies',
-   { servername: 'agent1', ca: [ca1] },
-   true, undefined],
-  ['an untrusted chain reports the issuer failure',
-   { servername: 'agent1', ca: [ca2], rejectUnauthorized: false },
-   false, 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'],
-  ['a trusted chain with the wrong identity reports the name mismatch',
-   { servername: 'not-agent1', ca: [ca1], rejectUnauthorized: false },
-   false, 'HOSTNAME_MISMATCH'],
-]) {
-  const client = connect('127.0.0.1', port, options);
-  await client.opened;
-  assert.strictEqual(client.authorized, authorized, description);
-  assert.strictEqual(client.authorizationError, authorizationError,
-                     description);
-  await client.close();
+for (const versions of [V12, V13]) {
+  const endpoint = listen(() => {}, {
+    cert, key, host: '127.0.0.1', port: 0, ...versions,
+  });
+  const { port } = endpoint.address;
+
+  for (const [description, options, authorized, authorizationError] of [
+    ['a trusted chain and matching identity verifies',
+     { servername: 'agent1', ca: [ca1] },
+     true, undefined],
+    ['an untrusted chain reports the issuer failure',
+     { servername: 'agent1', ca: [ca2], rejectUnauthorized: false },
+     false, 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'],
+    ['a trusted chain with the wrong identity reports the name mismatch',
+     { servername: 'not-agent1', ca: [ca1], rejectUnauthorized: false },
+     false, 'HOSTNAME_MISMATCH'],
+  ]) {
+    const client = connect('127.0.0.1', port, { ...options, ...versions });
+    await client.opened;
+    assert.strictEqual(client.authorized, authorized, description);
+    assert.strictEqual(client.authorizationError, authorizationError,
+                       description);
+    await client.close();
+  }
+
+  await endpoint.close();
 }

-await endpoint.close();
-
 // --- Server side ---------------------------------------------------------

 // A peer that sent no certificate is reported as unverified rather than
 // authorized, even though OpenSSL has nothing to find fault with.
-{
+for (const versions of [V12, V13]) {
   const serverSession = Promise.withResolvers();
   const server = listen(mustCall((session) => {
     session.onhandshake = mustCall(() => serverSession.resolve(session));
-  }), { cert, key, host: '127.0.0.1', port: 0 });
+  }), { cert, key, host: '127.0.0.1', port: 0, ...versions });

   const client = connect('127.0.0.1', server.address.port, {
-    servername: 'agent1', ca: [ca1],
+    servername: 'agent1', ca: [ca1], ...versions,
   });
   await client.opened;

@@ -78,16 +83,17 @@ await endpoint.close();
 }

 // A peer that sent a chain the server trusts is authorized.
-{
+for (const versions of [V12, V13]) {
   const serverSession = Promise.withResolvers();
   const server = listen(mustCall((session) => {
     session.onhandshake = mustCall(() => serverSession.resolve(session));
   }), {
     cert, key, ca: [ca1], requestCert: true, host: '127.0.0.1', port: 0,
+    ...versions,
   });

   const client = connect('127.0.0.1', server.address.port, {
-    cert, key, servername: 'agent1', ca: [ca1],
+    cert, key, servername: 'agent1', ca: [ca1], ...versions,
   });
   await client.opened;

diff --git a/test/parallel/test-dtls-basic.mjs b/test/parallel/test-dtls-basic.mjs
index 9df0eff0dcc..e4d3f491313 100644
--- a/test/parallel/test-dtls-basic.mjs
+++ b/test/parallel/test-dtls-basic.mjs
@@ -20,68 +20,75 @@ 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();
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  const serverReceivedData = Promise.withResolvers();
+  const clientReceivedData = Promise.withResolvers();
+
+  let serverHandshakeDone = false;
+  let clientHandshakeDone = false;
+
+  // Start server.
+  const endpoint = listen(mustCall((session) => {
+    session.onmessage = mustCall((data) => {
+      assert.strictEqual(data.toString(), 'hello from client');
+      serverReceivedData.resolve();
+
+      // Send response back to client.
+      session.send('hello from server');
+    });
+
+    session.onhandshake = mustCall((protocol) => {
+      assert.ok(protocol);
+      assert.match(protocol, /DTLS/i);
+      serverHandshakeDone = true;
+    });
+  }), {
+    cert: serverCert.toString(),
+    key: serverKey.toString(),
+    port: 0,
+    host: '127.0.0.1',
+    ...versions,
+  });

-let serverHandshakeDone = false;
-let clientHandshakeDone = false;
+  const serverAddress = endpoint.address;
+  assert.ok(serverAddress);
+  assert.ok(serverAddress.port > 0);

-// Start server.
-const endpoint = listen(mustCall((session) => {
-  session.onmessage = mustCall((data) => {
-    assert.strictEqual(data.toString(), 'hello from client');
-    serverReceivedData.resolve();
+  // Connect client.
+  const clientSession = connect('127.0.0.1', serverAddress.port, {
+    ca: [ca.toString()],
+    rejectUnauthorized: false,
+    ...versions,
+  });

-    // Send response back to client.
-    session.send('hello from server');
+  clientSession.onmessage = mustCall((data) => {
+    assert.strictEqual(data.toString(), 'hello from server');
+    clientReceivedData.resolve();
   });

-  session.onhandshake = mustCall((protocol) => {
+  clientSession.onhandshake = mustCall((protocol) => {
     assert.ok(protocol);
-    assert.match(protocol, /DTLS/i);
-    serverHandshakeDone = true;
+    clientHandshakeDone = true;
   });
-}), {
-  cert: serverCert.toString(),
-  key: serverKey.toString(),
-  port: 0,
-  host: '127.0.0.1',
-});
-
-const serverAddress = endpoint.address;
-assert.ok(serverAddress);
-assert.ok(serverAddress.port > 0);
-
-// Connect client.
-const clientSession = connect('127.0.0.1', serverAddress.port, {
-  ca: [ca.toString()],
-  rejectUnauthorized: false,
-});
-
-clientSession.onmessage = mustCall((data) => {
-  assert.strictEqual(data.toString(), 'hello from server');
-  clientReceivedData.resolve();
-});
-
-clientSession.onhandshake = mustCall((protocol) => {
-  assert.ok(protocol);
-  clientHandshakeDone = true;
-});
-
-// Wait for handshake.
-const { protocol } = await clientSession.opened;
-assert.match(protocol, /DTLS/i);
-
-// Send data.
-clientSession.send('hello from client');
-
-// Wait for bidirectional exchange.
-await Promise.all([serverReceivedData.promise, clientReceivedData.promise]);
-
-// Verify handshakes completed.
-assert.ok(clientHandshakeDone);
-assert.ok(serverHandshakeDone);
-
-// Clean up.
-await clientSession.close();
-await endpoint.close();
+
+  // Wait for handshake.
+  const { protocol } = await clientSession.opened;
+  assert.match(protocol, /DTLS/i);
+
+  // Send data.
+  clientSession.send('hello from client');
+
+  // Wait for bidirectional exchange.
+  await Promise.all([serverReceivedData.promise, clientReceivedData.promise]);
+
+  // Verify handshakes completed.
+  assert.ok(clientHandshakeDone);
+  assert.ok(serverHandshakeDone);
+
+  // Clean up.
+  await clientSession.close();
+  await endpoint.close();
+}
diff --git a/test/parallel/test-dtls-ciphers.mjs b/test/parallel/test-dtls-ciphers.mjs
index 074c33f64b9..2c76842f066 100644
--- a/test/parallel/test-dtls-ciphers.mjs
+++ b/test/parallel/test-dtls-ciphers.mjs
@@ -20,20 +20,28 @@ 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';
-
-// Case 1: a specific cipher is negotiated and reported on both peers.
-{
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+// Case 1: a specific cipher is negotiated and reported on both peers. DTLS
+// 1.3 suites are named by their TLS_ names.
+for (const [versions, CIPHER] of [
+  [V12, 'ECDHE-RSA-AES128-GCM-SHA256'],
+  [V13, 'TLS_AES_128_GCM_SHA256'],
+]) {
   const gotServerSession = Promise.withResolvers();

   const server = listen(mustCall((session) => {
     gotServerSession.resolve(session);
-  }), { cert, key, port: 0, host: '127.0.0.1', ciphers: CIPHER });
+  }), {
+    cert, key, port: 0, host: '127.0.0.1', ciphers: CIPHER, ...versions,
+  });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
     ciphers: CIPHER,
+    ...versions,
   });

   await client.opened;
@@ -53,15 +61,16 @@ assert.throws(() => listen(mustNotCall(), {
 }), { code: 'ERR_CRYPTO_OPERATION_FAILED' });

 // Case 3: a valid ECDH curve completes a handshake.
-{
+for (const versions of [V12, V13]) {
   const server = listen(mustCall(), {
-    cert, key, port: 0, host: '127.0.0.1', ecdhCurve: 'P-256',
+    cert, key, port: 0, host: '127.0.0.1', ecdhCurve: 'P-256', ...versions,
   });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
     ecdhCurve: 'P-256',
+    ...versions,
   });

   await client.opened;
diff --git a/test/parallel/test-dtls-client-cert.mjs b/test/parallel/test-dtls-client-cert.mjs
index 271bd7e322a..e43571b3ebc 100644
--- a/test/parallel/test-dtls-client-cert.mjs
+++ b/test/parallel/test-dtls-client-cert.mjs
@@ -21,18 +21,22 @@ 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 V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // Case 1: the client presents a certificate the server can verify.
-{
+for (const versions of [V12, V13]) {
   const gotServerSession = Promise.withResolvers();

   const server = listen(mustCall((session) => {
     gotServerSession.resolve(session);
   }), {
     cert, key, ca: [ca], requestCert: true, port: 0, host: '127.0.0.1',
+    ...versions,
   });

   const client = connect('127.0.0.1', server.address.port, {
-    cert, key, ca: [ca], rejectUnauthorized: false,
+    cert, key, ca: [ca], rejectUnauthorized: false, ...versions,
   });

   await client.opened;
@@ -49,20 +53,21 @@ const ca = fixtures.readKey('ca1-cert.pem').toString();
 }

 // Case 2: the client presents no certificate; the server requires one and
-// rejects the handshake.
-{
+// rejects the handshake. DTLS 1.3 has an alert of its own for this.
+for (const [versions, message] of [
+  [V12, /handshake failure/],
+  [V13, /certificate required/],
+]) {
   const server = listen(mustCall(), {
     cert, key, ca: [ca], requestCert: true, port: 0, host: '127.0.0.1',
+    ...versions,
   });

   const client = connect('127.0.0.1', server.address.port, {
-    ca: [ca], rejectUnauthorized: false,
+    ca: [ca], rejectUnauthorized: false, ...versions,
   });

-  // The exact alert text varies, so assert only that the handshake is rejected.
-  await assert.rejects(client.opened, {
-    message: /handshake failure/
-  });
+  await assert.rejects(client.opened, { message });

   // The failed client tears down its internally-owned endpoint.
   await client.endpoint.closed;
diff --git a/test/parallel/test-dtls-close.mjs b/test/parallel/test-dtls-close.mjs
index a71e0938b7d..7ae3d342d18 100644
--- a/test/parallel/test-dtls-close.mjs
+++ b/test/parallel/test-dtls-close.mjs
@@ -20,8 +20,11 @@ const serverCert = fixtures.readKey('agent1-cert.pem');
 const serverKey = fixtures.readKey('agent1-key.pem');
 const ca = fixtures.readKey('ca1-cert.pem');

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // Test 1: Graceful close from client side.
-{
+for (const versions of [V12, V13]) {
   const serverSessionClosed = Promise.withResolvers();

   const endpoint = listen(mustCall((session) => {
@@ -34,11 +37,13 @@ const ca = fixtures.readKey('ca1-cert.pem');
     key: serverKey.toString(),
     port: 0,
     host: '127.0.0.1',
+    ...versions,
   });

   const session = connect('127.0.0.1', endpoint.address.port, {
     ca: [ca.toString()],
     rejectUnauthorized: false,
+    ...versions,
   });

   await session.opened;
@@ -56,7 +61,7 @@ const ca = fixtures.readKey('ca1-cert.pem');
 }

 // Test 2: Forced destroy.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(mustCall((session) => {
     session.onmessage = mustNotCall();
   }), {
@@ -64,11 +69,13 @@ const ca = fixtures.readKey('ca1-cert.pem');
     key: serverKey.toString(),
     port: 0,
     host: '127.0.0.1',
+    ...versions,
   });

   const session = connect('127.0.0.1', endpoint.address.port, {
     ca: [ca.toString()],
     rejectUnauthorized: false,
+    ...versions,
   });

   await session.opened;
@@ -85,7 +92,7 @@ const ca = fixtures.readKey('ca1-cert.pem');
 }

 // Test 3: Endpoint close closes all sessions.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(mustCall((session) => {
     session.onmessage = mustNotCall();
   }), {
@@ -93,11 +100,13 @@ const ca = fixtures.readKey('ca1-cert.pem');
     key: serverKey.toString(),
     port: 0,
     host: '127.0.0.1',
+    ...versions,
   });

   const session = connect('127.0.0.1', endpoint.address.port, {
     ca: [ca.toString()],
     rejectUnauthorized: false,
+    ...versions,
   });

   await session.opened;
diff --git a/test/parallel/test-dtls-connect-error-cleanup.mjs b/test/parallel/test-dtls-connect-error-cleanup.mjs
index 13dcf8da26b..b2df9782fd5 100644
--- a/test/parallel/test-dtls-connect-error-cleanup.mjs
+++ b/test/parallel/test-dtls-connect-error-cleanup.mjs
@@ -22,22 +22,30 @@ 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.
-const server = listen(mustCall(), { cert, key, port: 0, host: '127.0.0.1' });
-
-// A servername that does not match the certificate, under rejectUnauthorized,
-// makes the client's handshake fail during verification.
-const session = connect('127.0.0.1', server.address.port, {
-  ca: [ca],
-  rejectUnauthorized: true,
-  servername: 'wrong.example.com',
-});
-
-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.
-await session.endpoint.closed;
-
-await server.close();
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  // The client rejects the certificate mid-handshake, so this server session
+  // never opens; its opened rejection is handled internally by the library.
+  const server = listen(mustCall(), {
+    cert, key, port: 0, host: '127.0.0.1', ...versions,
+  });
+
+  // A servername that does not match the certificate, under rejectUnauthorized,
+  // makes the client's handshake fail during verification.
+  const session = connect('127.0.0.1', server.address.port, {
+    ca: [ca],
+    rejectUnauthorized: true,
+    servername: 'wrong.example.com',
+    ...versions,
+  });
+
+  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.
+  await session.endpoint.closed;
+
+  await server.close();
+}
diff --git a/test/parallel/test-dtls-default-ca.mjs b/test/parallel/test-dtls-default-ca.mjs
index 747d69edb05..64dbf815132 100644
--- a/test/parallel/test-dtls-default-ca.mjs
+++ b/test/parallel/test-dtls-default-ca.mjs
@@ -23,23 +23,30 @@ const ca = fixtures.readKey('ca1-cert.pem');

 setDefaultCACertificates([ca]);

-const endpoint = listen(mustCall(), {
-  // Also cover the shared certificate-chain loader adopted by DTLS.
-  cert: Buffer.concat([serverCert, ca]),
-  key: serverKey,
-  host: '127.0.0.1',
-  port: 0,
-});
-
-// `servername` is both the SNI value and the identity checked during
-// certificate verification. agent1-cert.pem has no subjectAltName, so the
-// identity has to be matched against its CN; connecting to the IP literal
-// alone would fail with X509_V_ERR_IP_ADDRESS_MISMATCH before the CA set is
-// ever exercised.
-const client = connect('127.0.0.1', endpoint.address.port, {
-  servername: 'agent1',
-});
-await client.opened;
-
-await client.close();
-await endpoint.close();
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  const endpoint = listen(mustCall(), {
+    // Also cover the shared certificate-chain loader adopted by DTLS.
+    cert: Buffer.concat([serverCert, ca]),
+    key: serverKey,
+    host: '127.0.0.1',
+    port: 0,
+    ...versions,
+  });
+
+  // `servername` is both the SNI value and the identity checked during
+  // certificate verification. agent1-cert.pem has no subjectAltName, so the
+  // identity has to be matched against its CN; connecting to the IP literal
+  // alone would fail with X509_V_ERR_IP_ADDRESS_MISMATCH before the CA set is
+  // ever exercised.
+  const client = connect('127.0.0.1', endpoint.address.port, {
+    servername: 'agent1',
+    ...versions,
+  });
+  await client.opened;
+
+  await client.close();
+  await endpoint.close();
+}
diff --git a/test/parallel/test-dtls-destroy-in-callback.mjs b/test/parallel/test-dtls-destroy-in-callback.mjs
index 7915742ca01..299d554947d 100644
--- a/test/parallel/test-dtls-destroy-in-callback.mjs
+++ b/test/parallel/test-dtls-destroy-in-callback.mjs
@@ -23,11 +23,14 @@ 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 V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // ---------------------------------------------------------------------------
 // Case 1: destroy the (server) session from inside onmessage. The datagram
 // carrying the message drives receive -> pump -> onmessage -> destroy(), which
 // frees the session's map entry while ClearOut() is still looping over ssl_.
-{
+for (const versions of [V12, V13]) {
   const destroyed = Promise.withResolvers();

   const server = listen(mustCall((session) => {
@@ -35,11 +38,12 @@ const ca = fixtures.readKey('ca1-cert.pem').toString();
       session.destroy();
       destroyed.resolve();
     });
-  }), { cert, key, port: 0, host: '127.0.0.1' });
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
+    ...versions,
   });

   await client.opened;
@@ -55,7 +59,7 @@ const ca = fixtures.readKey('ca1-cert.pem').toString();
 // Case 2: destroy the (server) session from inside onhandshake. Handshake
 // completion is emitted from the middle of the pump (Cycle), so destroying
 // there must not free the session before the pump finishes unwinding.
-{
+for (const versions of [V12, V13]) {
   const destroyed = Promise.withResolvers();

   const server = listen(mustCall((session) => {
@@ -63,11 +67,12 @@ const ca = fixtures.readKey('ca1-cert.pem').toString();
       session.destroy();
       destroyed.resolve();
     });
-  }), { cert, key, port: 0, host: '127.0.0.1' });
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
+    ...versions,
   });

   await destroyed.promise;
diff --git a/test/parallel/test-dtls-error-queue.mjs b/test/parallel/test-dtls-error-queue.mjs
index b056a2f3d00..63a84218de5 100644
--- a/test/parallel/test-dtls-error-queue.mjs
+++ b/test/parallel/test-dtls-error-queue.mjs
@@ -33,52 +33,58 @@ const key = fixtures.readKey('agent1-key.pem');
 const ca1 = fixtures.readKey('ca1-cert.pem');
 const ca2 = fixtures.readKey('ca2-cert.pem');

-// The server accepts each session (cookie exchange completes) and only the
-// client rejects, so sessions do arrive here; nothing needs doing with them.
-const endpoint = listen(() => {}, {
-  cert, key, ca: [ca1], host: '127.0.0.1', port: 0,
-});
-const { port } = endpoint.address;
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };

-// Provoke failures from both directions.
-
-// 1. Rejected handshakes: the server certificate does not chain to ca2.
-for (let i = 0; i < 3; i++) {
-  const client = connect('127.0.0.1', port, {
-    servername: 'agent1',
-    ca: [ca2],
-  });
-  await assert.rejects(client.opened, (err) => {
-    assert.match(err.message, /certificate verify failed/);
-    return true;
+for (const versions of [V12, V13]) {
+  // The server accepts each session (cookie exchange completes) and only the
+  // client rejects, so sessions do arrive here; nothing needs doing with them.
+  const endpoint = listen(() => {}, {
+    cert, key, ca: [ca1], host: '127.0.0.1', port: 0, ...versions,
   });
-}
+  const { port } = endpoint.address;

-// 2. Garbage datagrams: each one reaches DTLSv1_listen() and fails there.
-// The leading 22 makes them look enough like a DTLS handshake record to get
-// past a cheap length/type screen.
-const socket = dgram.createSocket('udp4');
-for (let i = 0; i < 32; i++) {
-  socket.send(Buffer.from([22, 254, 253, 0, 0, i & 0xff]), port, '127.0.0.1');
-}
-// Let the datagrams reach the endpoint and be processed before closing;
-// dgram.close() does not flush queued sends.
-await setTimeout(200);
-await new Promise((resolve) => socket.close(resolve));
+  // Provoke failures from both directions.

-// An unrelated crypto failure must report its own cause. Before the error
-// queue was drained this surfaced a stale "SSL routines::..." entry left by
-// the DTLS activity above, with the real DECODER error demoted into
-// opensslErrorStack.
-assert.throws(
-  () => crypto.createPrivateKey(
-    '-----BEGIN PRIVATE KEY-----\nZm9v\n-----END PRIVATE KEY-----\n'),
-  (err) => {
-    assert.doesNotMatch(
-      err.message, /SSL routines/,
-      `crypto error contaminated by a stale DTLS entry: ${err.message}`);
-    return true;
-  },
-);
+  // 1. Rejected handshakes: the server certificate does not chain to ca2.
+  for (let i = 0; i < 3; i++) {
+    const client = connect('127.0.0.1', port, {
+      servername: 'agent1',
+      ca: [ca2],
+      ...versions,
+    });
+    await assert.rejects(client.opened, (err) => {
+      assert.match(err.message, /certificate verify failed/);
+      return true;
+    });
+  }

-await endpoint.close();
+  // 2. Garbage datagrams: each one reaches DTLSv1_listen() and fails there.
+  // The leading 22 makes them look enough like a DTLS handshake record to get
+  // past a cheap length/type screen.
+  const socket = dgram.createSocket('udp4');
+  for (let i = 0; i < 32; i++) {
+    socket.send(Buffer.from([22, 254, 253, 0, 0, i & 0xff]), port, '127.0.0.1');
+  }
+  // Let the datagrams reach the endpoint and be processed before closing;
+  // dgram.close() does not flush queued sends.
+  await setTimeout(200);
+  await new Promise((resolve) => socket.close(resolve));
+
+  // An unrelated crypto failure must report its own cause. Before the error
+  // queue was drained this surfaced a stale "SSL routines::..." entry left by
+  // the DTLS activity above, with the real DECODER error demoted into
+  // opensslErrorStack.
+  assert.throws(
+    () => crypto.createPrivateKey(
+      '-----BEGIN PRIVATE KEY-----\nZm9v\n-----END PRIVATE KEY-----\n'),
+    (err) => {
+      assert.doesNotMatch(
+        err.message, /SSL routines/,
+        `crypto error contaminated by a stale DTLS entry: ${err.message}`);
+      return true;
+    },
+  );
+
+  await endpoint.close();
+}
diff --git a/test/parallel/test-dtls-export-keying-material-validation.mjs b/test/parallel/test-dtls-export-keying-material-validation.mjs
index 10b48f38fa6..f78976a82c8 100644
--- a/test/parallel/test-dtls-export-keying-material-validation.mjs
+++ b/test/parallel/test-dtls-export-keying-material-validation.mjs
@@ -29,62 +29,72 @@ const cert = fixtures.readKey('agent1-cert.pem');
 const key = fixtures.readKey('agent1-key.pem');
 const ca = fixtures.readKey('ca1-cert.pem');

-const endpoint = listen(() => {}, {
-  cert, key, host: '127.0.0.1', port: 0,
-});
-
-const client = connect('127.0.0.1', endpoint.address.port, {
-  servername: 'agent1', ca: [ca],
-});
-await client.opened;
-
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
 const label = 'EXPORTER-test';

-// Lengths that used to abort the process, plus the rest of the bad range.
-for (const length of [-1, 0, 4294967295, 1e12, NaN, Infinity, -Infinity, 1.5]) {
+for (const versions of [V12, V13]) {
+  const endpoint = listen(() => {}, {
+    cert, key, host: '127.0.0.1', port: 0, ...versions,
+  });
+
+  const client = connect('127.0.0.1', endpoint.address.port, {
+    servername: 'agent1', ca: [ca], ...versions,
+  });
+  await client.opened;
+
+  // Lengths that used to abort the process, plus the rest of the bad range.
+  for (const length of [
+    -1, 0, 4294967295, 1e12, NaN, Infinity, -Infinity, 1.5,
+  ]) {
+    assert.throws(
+      () => client.exportKeyingMaterial(length, label),
+      { code: 'ERR_OUT_OF_RANGE' },
+      `length ${length} should have been refused`);
+  }
+
+  for (const length of ['60', null, {}, [], true]) {
+    assert.throws(
+      () => client.exportKeyingMaterial(length, label),
+      { code: /^ERR_(INVALID_ARG_TYPE|OUT_OF_RANGE)$/ },
+      `length ${typeof length} should have been refused`);
+  }
+
+  // The upper bound is enforced, so a caller cannot request a huge allocation.
+  // Under DTLS 1.3 the exporter is HKDF-Expand-Label, which cannot produce more
+  // than 255 hash lengths.
+  const max = versions === V12 ? 65536 :
+    255 * (/SHA384$/.test(client.cipher.name) ? 48 : 32);
   assert.throws(
-    () => client.exportKeyingMaterial(length, label),
-    { code: 'ERR_OUT_OF_RANGE' },
-    `length ${length} should have been refused`);
-}
-
-for (const length of ['60', null, {}, [], true]) {
+    () => client.exportKeyingMaterial(max + 1, label),
+    { code: 'ERR_OUT_OF_RANGE' });
+  assert.strictEqual(client.exportKeyingMaterial(max, label).length, max);
+
+  // The label and context arguments are checked too.
+  for (const bad of [undefined, 42, null, {}]) {
+    assert.throws(
+      () => client.exportKeyingMaterial(32, bad),
+      { code: 'ERR_INVALID_ARG_TYPE' },
+      `label ${typeof bad} should have been refused`);
+  }
+
+  for (const bad of ['ctx', 42, {}]) {
+    assert.throws(
+      () => client.exportKeyingMaterial(32, label, bad),
+      { code: 'ERR_INVALID_ARG_TYPE' },
+      `context ${typeof bad} should have been refused`);
+  }
+
+  // A valid call still works, so none of the above is vacuous.
+  assert.strictEqual(client.exportKeyingMaterial(60, label).length, 60);
+  assert.strictEqual(
+    client.exportKeyingMaterial(32, label, Buffer.from('ctx')).length, 32);
+
+  // A destroyed session reports that, rather than reaching the binding.
+  await client.close();
   assert.throws(
-    () => client.exportKeyingMaterial(length, label),
-    { code: /^ERR_(INVALID_ARG_TYPE|OUT_OF_RANGE)$/ },
-    `length ${typeof length} should have been refused`);
-}
-
-// The upper bound is enforced, so a caller cannot request a huge allocation.
-assert.throws(
-  () => client.exportKeyingMaterial(65537, label),
-  { code: 'ERR_OUT_OF_RANGE' });
-assert.strictEqual(client.exportKeyingMaterial(65536, label).length, 65536);
+    () => client.exportKeyingMaterial(60, label),
+    { code: 'ERR_INVALID_STATE' });

-// The label and context arguments are checked too.
-for (const bad of [undefined, 42, null, {}]) {
-  assert.throws(
-    () => client.exportKeyingMaterial(32, bad),
-    { code: 'ERR_INVALID_ARG_TYPE' },
-    `label ${typeof bad} should have been refused`);
+  await endpoint.close();
 }
-
-for (const bad of ['ctx', 42, {}]) {
-  assert.throws(
-    () => client.exportKeyingMaterial(32, label, bad),
-    { code: 'ERR_INVALID_ARG_TYPE' },
-    `context ${typeof bad} should have been refused`);
-}
-
-// A valid call still works, so none of the above is vacuous.
-assert.strictEqual(client.exportKeyingMaterial(60, label).length, 60);
-assert.strictEqual(
-  client.exportKeyingMaterial(32, label, Buffer.from('ctx')).length, 32);
-
-// A destroyed session reports that, rather than reaching the binding.
-await client.close();
-assert.throws(
-  () => client.exportKeyingMaterial(60, label),
-  { code: 'ERR_INVALID_STATE' });
-
-await endpoint.close();
diff --git a/test/parallel/test-dtls-handshake-timeout.mjs b/test/parallel/test-dtls-handshake-timeout.mjs
index 547152e68aa..c8ff071f1a1 100644
--- a/test/parallel/test-dtls-handshake-timeout.mjs
+++ b/test/parallel/test-dtls-handshake-timeout.mjs
@@ -11,6 +11,7 @@

 import { hasCrypto, skip } from '../common/index.mjs';
 import { setTimeout } from 'node:timers/promises';
+import { once } from 'node:events';
 import assert from 'node:assert';

 if (!hasCrypto) {
@@ -21,6 +22,7 @@ if (!process.features.dtls) {
   skip('DTLS is not enabled');
 }

+const dgram = await import('node:dgram');
 const dtls = await import('node:dtls');

 // The state and sessions views are not public API; they are reached here the
@@ -33,31 +35,56 @@ const { connect, listen } = dtls;

 const HOST = '127.0.0.1';
 const KEY = Buffer.from('0123456789abcdef');
-const WRONG = Buffer.from('fedcba9876543210');
-
-// A wrong pre-shared key is the cheapest way to stall a handshake: the
-// identity only names the key, so both sides derive different secrets and
-// then discard each other's records without replying, as DTLS requires
-// (RFC 6347 section 4.1.2.1). Neither peer is ever told, and both retransmit.
-function stall(endpoint, options = {}) {
-  return connect(HOST, endpoint.address.port, {
-    psk: { identity: 'device', key: WRONG }, ...options,
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+// Stall a handshake after the server has a session for it. A proxy between
+// the two passes the server's first datagram -- the HelloVerifyRequest or
+// HelloRetryRequest that carries the cookie -- and nothing after it. The
+// client answers with the cookie, so the server validates the address and
+// announces the session, and from then on neither side hears from the other.
+// Both retransmit, and nothing but a deadline ends it.
+async function stall(endpoint, options = {}) {
+  const front = dgram.createSocket('udp4');
+  const back = dgram.createSocket('udp4');
+  let client;
+  let passed = false;
+  front.on('message', (msg, rinfo) => {
+    client = rinfo;
+    back.send(msg, endpoint.address.port, HOST);
   });
+  back.on('message', (msg) => {
+    if (passed) return;
+    passed = true;
+    front.send(msg, client.port, client.address);
+  });
+  front.bind(0, HOST);
+  back.bind(0, HOST);
+  await Promise.all([once(front, 'listening'), once(back, 'listening')]);
+
+  const session = connect(HOST, front.address().port, {
+    psk: { identity: 'device', key: KEY }, ...options,
+  });
+  session.closed.finally(() => {
+    front.close();
+    back.close();
+  }).catch(() => {});
+  return session;
 }

-function serve(options = {}) {
-  return listen(() => {}, {
+function serve(options = {}, onsession = () => {}) {
+  return listen(onsession, {
     psk: { 'device': KEY }, host: HOST, port: 0, ...options,
   });
 }

-// The deadline is honoured, and close to exactly.
-{
+for (const versions of [V12, V13]) {
+  // The deadline is honoured, and close to exactly.
   for (const handshakeTimeout of [300, 700]) {
-    const endpoint = serve({ handshakeTimeout });
+    const endpoint = serve({ handshakeTimeout, ...versions });
     const started = Date.now();

-    const client = stall(endpoint, { handshakeTimeout });
+    const client = await stall(endpoint, { handshakeTimeout, ...versions });
     await assert.rejects(client.opened, { message: /handshake timeout/ });

     const elapsed = Date.now() - started;
@@ -87,25 +114,34 @@ function serve(options = {}) {
 // The slot is given back. This is the point of the exercise: without it an
 // abandoned handshake occupies its place against maxSessions until the
 // endpoint closes.
-{
-  const endpoint = serve({ handshakeTimeout: 300, maxSessions: 3 });
+for (const versions of [V12, V13]) {
+  const announced = [];
+  const allAnnounced = Promise.withResolvers();
+  const endpoint = serve({ handshakeTimeout: 300, maxSessions: 3, ...versions },
+                         (session) => {
+                           announced.push(session);
+                           if (announced.length === 3) allAnnounced.resolve();
+                         });

   const stalled = [];
   for (let i = 0; i < 3; i++) {
-    const client = stall(endpoint, { handshakeTimeout: 60000 });
+    const client = await stall(endpoint, {
+      handshakeTimeout: 60000, ...versions,
+    });
     client.opened.catch(() => {});
     stalled.push(client);
   }

-  await setTimeout(150);
+  await allAnnounced.promise;
   assert.strictEqual(Number(getDTLSEndpointState(endpoint).sessionCount), 3);

-  await setTimeout(600);
+  // Each server session expires on its own deadline.
+  await Promise.allSettled(announced.map((session) => session.closed));
   assert.strictEqual(Number(getDTLSEndpointState(endpoint).sessionCount), 0);

   // And the endpoint is usable again.
   const good = connect(HOST, endpoint.address.port, {
-    psk: { identity: 'device', key: KEY },
+    psk: { identity: 'device', key: KEY }, ...versions,
   });
   await good.opened;
   await good.close();
@@ -116,11 +152,11 @@ function serve(options = {}) {

 // A handshake that completes is not affected, and the deadline does not
 // linger to fire at an established session.
-{
-  const endpoint = serve({ handshakeTimeout: 300 });
+for (const versions of [V12, V13]) {
+  const endpoint = serve({ handshakeTimeout: 300, ...versions });

   const client = connect(HOST, endpoint.address.port, {
-    psk: { identity: 'device', key: KEY }, handshakeTimeout: 300,
+    psk: { identity: 'device', key: KEY }, handshakeTimeout: 300, ...versions,
   });
   await client.opened;

@@ -131,7 +167,7 @@ function serve(options = {}) {
   const echoed = Promise.withResolvers();
   client.onmessage = (data) => echoed.resolve(data);
   const peer = connect(HOST, endpoint.address.port, {
-    psk: { identity: 'device', key: KEY },
+    psk: { identity: 'device', key: KEY }, ...versions,
   });
   await peer.opened;
   await peer.close();
@@ -142,10 +178,10 @@ function serve(options = {}) {

 // Zero disables it, leaving OpenSSL's own retransmit budget as the only
 // limit.
-{
-  const endpoint = serve({ handshakeTimeout: 0 });
+for (const versions of [V12, V13]) {
+  const endpoint = serve({ handshakeTimeout: 0, ...versions });

-  const client = stall(endpoint, { handshakeTimeout: 0 });
+  const client = await stall(endpoint, { handshakeTimeout: 0, ...versions });

   const pending = Symbol('pending');
   const outcome = await Promise.race([
@@ -160,10 +196,10 @@ function serve(options = {}) {

 // The default does not fire early. Checking the 60s default itself would
 // mean waiting 60s, so this only pins that it is not something small.
-{
-  const endpoint = serve();
+for (const versions of [V12, V13]) {
+  const endpoint = serve(versions);

-  const client = stall(endpoint);
+  const client = await stall(endpoint, versions);

   const pending = Symbol('pending');
   const outcome = await Promise.race([
@@ -177,25 +213,32 @@ function serve(options = {}) {
 }

 // It applies to a resumed handshake too, which is a different code path
-// through the state machine but the same session lifecycle.
-{
+// through the state machine but the same session lifecycle. A DTLS 1.3
+// server issues its ticket after the handshake, so it is taken from
+// onsessionticket rather than read when opened settles.
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
     psk: { 'device': KEY }, host: HOST, port: 0, handshakeTimeout: 5000,
+    ...versions,
   });

   const first = connect(HOST, endpoint.address.port, {
-    psk: { identity: 'device', key: KEY },
+    psk: { identity: 'device', key: KEY }, ...versions,
   });
+  const issued = Promise.withResolvers();
+  first.onsessionticket = (ticket) => issued.resolve(ticket);
   await first.opened;
-  const ticket = first.session;
+  const ticket = await issued.promise;
   await first.close();

   const resumed = connect(HOST, endpoint.address.port, {
     psk: { identity: 'device', key: KEY },
     session: ticket,
     handshakeTimeout: 5000,
+    ...versions,
   });
   await resumed.opened;
+  assert.strictEqual(resumed.reused, true);
   assert.strictEqual(getDTLSSessionState(resumed).destroyed, false);

   await resumed.close();
diff --git a/test/parallel/test-dtls-ipv6.mjs b/test/parallel/test-dtls-ipv6.mjs
index cb05765b7b1..e5f6a17105d 100644
--- a/test/parallel/test-dtls-ipv6.mjs
+++ b/test/parallel/test-dtls-ipv6.mjs
@@ -29,18 +29,21 @@ const cert = fixtures.readKey('agent1-cert.pem');
 const key = fixtures.readKey('agent1-key.pem');
 const ca = fixtures.readKey('ca1-cert.pem');

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // A full handshake and round trip over IPv6 loopback.
-{
+for (const versions of [V12, V13]) {
   const echoed = Promise.withResolvers();

   const endpoint = listen((session) => {
     session.onmessage = (data) => session.send(data);
-  }, { cert, key, host: '::1', port: 0 });
+  }, { cert, key, host: '::1', port: 0, ...versions });

   assert.strictEqual(endpoint.address.family, 'IPv6');

   const client = connect('::1', endpoint.address.port, {
-    servername: 'agent1', ca: [ca],
+    servername: 'agent1', ca: [ca], ...versions,
   });

   await client.opened;
@@ -55,11 +58,13 @@ const ca = fixtures.readKey('ca1-cert.pem');

 // The local socket picks the peer's family without being told. Binding the
 // IPv4 wildcard here is what used to break the send.
-{
-  const endpoint = listen(() => {}, { cert, key, host: '::1', port: 0 });
+for (const versions of [V12, V13]) {
+  const endpoint = listen(() => {}, {
+    cert, key, host: '::1', port: 0, ...versions,
+  });

   const client = connect('::1', endpoint.address.port, {
-    servername: 'agent1', ca: [ca],
+    servername: 'agent1', ca: [ca], ...versions,
   });
   await client.opened;

@@ -68,11 +73,13 @@ const ca = fixtures.readKey('ca1-cert.pem');
 }

 // An explicit bindHost is still honoured.
-{
-  const endpoint = listen(() => {}, { cert, key, host: '::1', port: 0 });
+for (const versions of [V12, V13]) {
+  const endpoint = listen(() => {}, {
+    cert, key, host: '::1', port: 0, ...versions,
+  });

   const client = connect('::1', endpoint.address.port, {
-    servername: 'agent1', ca: [ca], bindHost: '::',
+    servername: 'agent1', ca: [ca], bindHost: '::', ...versions,
   });
   await client.opened;

@@ -81,15 +88,15 @@ const ca = fixtures.readKey('ca1-cert.pem');
 }

 // IPv4 is unaffected: the default must not become IPv6 for v4 peers.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
-    cert, key, host: '127.0.0.1', port: 0,
+    cert, key, host: '127.0.0.1', port: 0, ...versions,
   });

   assert.strictEqual(endpoint.address.family, 'IPv4');

   const client = connect('127.0.0.1', endpoint.address.port, {
-    servername: 'agent1', ca: [ca],
+    servername: 'agent1', ca: [ca], ...versions,
   });
   await client.opened;

diff --git a/test/parallel/test-dtls-ipv6only.mjs b/test/parallel/test-dtls-ipv6only.mjs
index ad3b7ac4579..d685ee14b9b 100644
--- a/test/parallel/test-dtls-ipv6only.mjs
+++ b/test/parallel/test-dtls-ipv6only.mjs
@@ -23,20 +23,24 @@ const { connect, listen } = await import('node:dtls');
 const cert = fixtures.readKey('agent1-cert.pem').toString();
 const key = fixtures.readKey('agent1-key.pem').toString();

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // An IPv6 wildcard endpoint accepts IPv4 peers, which is the default
 // everywhere else in Node.js.
-{
+for (const versions of [V12, V13]) {
   const arrived = Promise.withResolvers();
   let serverSession;

   const server = listen((session) => {
     serverSession ??= session;
     arrived.resolve();
-  }, { cert, key, host: '::', port: 0 });
+  }, { cert, key, host: '::', port: 0, ...versions });

   const client = connect('127.0.0.1', server.address.port, {
     rejectUnauthorized: false,
     handshakeTimeout: 5000,
+    ...versions,
   });

   await client.opened;
diff --git a/test/parallel/test-dtls-keylog.mjs b/test/parallel/test-dtls-keylog.mjs
index 21d1c50866f..e7a592901ec 100644
--- a/test/parallel/test-dtls-keylog.mjs
+++ b/test/parallel/test-dtls-keylog.mjs
@@ -28,51 +28,58 @@ 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();
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };

-const server = listen(mustCall(), {
-  cert, key, port: 0, host: '127.0.0.1',
-});
+for (const versions of [V12, V13]) {
+  const gotKeylog = Promise.withResolvers();

-const client = connect('127.0.0.1', server.address.port, {
-  ca: [ca],
-  rejectUnauthorized: false,
-});
+  const server = listen(mustCall(), {
+    cert, key, port: 0, host: '127.0.0.1', ...versions,
+  });

-// state.hasKeylogListener is the flag the native keylog callback reads to
-// decide whether to extract key material at all. Without a listener the
-// secrets stay inside OpenSSL and are never turned into JS strings, where
-// they would be reachable from heap snapshots and core dumps.
-assert.strictEqual(getDTLSSessionState(client).hasKeylogListener, false);
+  const client = connect('127.0.0.1', server.address.port, {
+    ca: [ca],
+    rejectUnauthorized: false,
+    ...versions,
+  });

-// A keylog line is "<LABEL> <hex> <hex>" (e.g. "CLIENT_RANDOM ...").
-client.onkeylog = mustCallAtLeast((line) => {
-  assert.strictEqual(typeof line, 'string');
-  assert.match(line, /^\S+ [0-9a-f]+ [0-9a-f]+$/i);
-  gotKeylog.resolve();
-});
+  // state.hasKeylogListener is the flag the native keylog callback reads to
+  // decide whether to extract key material at all. Without a listener the
+  // secrets stay inside OpenSSL and are never turned into JS strings, where
+  // they would be reachable from heap snapshots and core dumps.
+  assert.strictEqual(getDTLSSessionState(client).hasKeylogListener, false);
+
+  // A keylog line is "<LABEL> <hex> <hex>" (e.g. "CLIENT_RANDOM ...").
+  client.onkeylog = mustCallAtLeast((line) => {
+    assert.strictEqual(typeof line, 'string');
+    assert.match(line, /^\S+ [0-9a-f]+ [0-9a-f]+$/i);
+    gotKeylog.resolve();
+  });

-assert.strictEqual(getDTLSSessionState(client).hasKeylogListener, true);
+  assert.strictEqual(getDTLSSessionState(client).hasKeylogListener, true);

-await client.opened;
-await gotKeylog.promise;
+  await client.opened;
+  await gotKeylog.promise;

-// Clearing the listener puts the gate back.
-client.onkeylog = null;
-assert.strictEqual(getDTLSSessionState(client).hasKeylogListener, false);
+  // Clearing the listener puts the gate back.
+  client.onkeylog = null;
+  assert.strictEqual(getDTLSSessionState(client).hasKeylogListener, false);

-await client.close();
-await server.close();
+  await client.close();
+  await server.close();
+}

 // A session that never gets a listener never reports one, and handshakes
 // normally regardless.
-{
+for (const versions of [V12, V13]) {
   const quietServer = listen(mustCall(), {
-    cert, key, port: 0, host: '127.0.0.1',
+    cert, key, port: 0, host: '127.0.0.1', ...versions,
   });
   const quietClient = connect('127.0.0.1', quietServer.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
+    ...versions,
   });

   assert.strictEqual(quietClient.onkeylog, undefined);
@@ -94,13 +101,16 @@ await server.close();
 // report an exception from there, and it used to reach the process as an
 // uncaught exception instead. It is parked and emitted once the handshake
 // returns.
-{
+for (const versions of [V12, V13]) {
   process.on('uncaughtException', mustNotCall('reached uncaughtException'));

-  const server = listen(mustCall(), { cert, key, port: 0, host: '127.0.0.1' });
+  const server = listen(mustCall(), {
+    cert, key, port: 0, host: '127.0.0.1', ...versions,
+  });
   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
+    ...versions,
   });

   const reported = Promise.withResolvers();
diff --git a/test/parallel/test-dtls-max-sessions.mjs b/test/parallel/test-dtls-max-sessions.mjs
index 9359b2dd0fb..73b12acd760 100644
--- a/test/parallel/test-dtls-max-sessions.mjs
+++ b/test/parallel/test-dtls-max-sessions.mjs
@@ -30,12 +30,17 @@ const cert = fixtures.readKey('agent1-cert.pem');
 const key = fixtures.readKey('agent1-key.pem');
 const ca = fixtures.readKey('ca1-cert.pem');

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // Connects and resolves true if the handshake got through. A refused peer is
 // answered with silence rather than an alert, so it retransmits and then
 // fails; keep the wait short so the test does not sit through the full DTLS
 // retransmit schedule.
-async function tryConnect(port, timeout = 1500) {
-  const client = connect('127.0.0.1', port, { servername: 'agent1', ca: [ca] });
+async function tryConnect(port, versions, timeout = 1500) {
+  const client = connect('127.0.0.1', port, {
+    servername: 'agent1', ca: [ca], ...versions,
+  });
   const timer = setTimeout(timeout, undefined, { ref: false });
   const opened = await Promise.race([
     client.opened.then(() => true, () => false),
@@ -56,20 +61,20 @@ async function waitForSessionCount(server, expected) {

 // --- maxSessions ---------------------------------------------------------

-{
+for (const versions of [V12, V13]) {
   const server = listen(() => {}, {
-    cert, key, host: '127.0.0.1', port: 0, maxSessions: 2,
+    cert, key, host: '127.0.0.1', port: 0, maxSessions: 2, ...versions,
   });
   const { port } = server.address;

-  const first = await tryConnect(port);
-  const second = await tryConnect(port);
+  const first = await tryConnect(port, versions);
+  const second = await tryConnect(port, versions);
   assert.strictEqual(first.opened, true);
   assert.strictEqual(second.opened, true);
   assert.strictEqual(getDTLSEndpointState(server).sessionCount, 2);

   // The table is full, so the third is refused before anything is allocated.
-  const third = await tryConnect(port);
+  const third = await tryConnect(port, versions);
   assert.strictEqual(third.opened, false);
   assert.strictEqual(getDTLSEndpointState(server).sessionCount, 2);
   assert.ok(server.stats.serverRefusedCount > 0n,
@@ -80,7 +85,7 @@ async function waitForSessionCount(server, expected) {
   await first.client.close();
   await waitForSessionCount(server, 1);

-  const fourth = await tryConnect(port);
+  const fourth = await tryConnect(port, versions);
   assert.strictEqual(fourth.opened, true);

   await fourth.client.close();
@@ -97,24 +102,24 @@ async function waitForSessionCount(server, expected) {

 // Every client here is on 127.0.0.1, so the per-host cap binds first even
 // though the overall cap is far higher.
-{
+for (const versions of [V12, V13]) {
   const server = listen(() => {}, {
     cert, key, host: '127.0.0.1', port: 0,
-    maxSessions: 100, maxSessionsPerHost: 1,
+    maxSessions: 100, maxSessionsPerHost: 1, ...versions,
   });
   const { port } = server.address;

-  const first = await tryConnect(port);
+  const first = await tryConnect(port, versions);
   assert.strictEqual(first.opened, true);

-  const second = await tryConnect(port);
+  const second = await tryConnect(port, versions);
   assert.strictEqual(second.opened, false);
   assert.strictEqual(getDTLSEndpointState(server).sessionCount, 1);

   // The per-host count is released along with the session.
   await first.client.close();
   await waitForSessionCount(server, 0);
-  const third = await tryConnect(port);
+  const third = await tryConnect(port, versions);
   assert.strictEqual(third.opened, true);

   await third.client.close();
diff --git a/test/parallel/test-dtls-message-listener-gate.mjs b/test/parallel/test-dtls-message-listener-gate.mjs
index 56b7b8d06fe..4ec027e8b1e 100644
--- a/test/parallel/test-dtls-message-listener-gate.mjs
+++ b/test/parallel/test-dtls-message-listener-gate.mjs
@@ -32,53 +32,59 @@ const cert = fixtures.readKey('agent1-cert.pem');
 const key = fixtures.readKey('agent1-key.pem');
 const ca = fixtures.readKey('ca1-cert.pem');

-const gotSession = Promise.withResolvers();
-const endpoint = listen((session) => gotSession.resolve(session),
-                        { cert, key, host: '127.0.0.1', port: 0 });
-
-const client = connect('127.0.0.1', endpoint.address.port, {
-  servername: 'agent1', ca: [ca],
-});
-
-await client.opened;
-const session = await gotSession.promise;
-await session.opened;
-
-// Wait for a stat to reach an expected value, so the test does not depend on
-// a fixed sleep. dgram send callbacks fire when the kernel takes the
-// datagram, not when the peer has processed it.
-async function waitForMessages(count) {
-  for (let i = 0; i < 100; i++) {
-    if (session.stats.messagesReceived >= count) return;
-    await setTimeout(20);
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  const gotSession = Promise.withResolvers();
+  const endpoint = listen((session) => gotSession.resolve(session), {
+    cert, key, host: '127.0.0.1', port: 0, ...versions,
+  });
+
+  const client = connect('127.0.0.1', endpoint.address.port, {
+    servername: 'agent1', ca: [ca], ...versions,
+  });
+
+  await client.opened;
+  const session = await gotSession.promise;
+  await session.opened;
+
+  // Wait for a stat to reach an expected value, so the test does not depend on
+  // a fixed sleep. dgram send callbacks fire when the kernel takes the
+  // datagram, not when the peer has processed it.
+  async function waitForMessages(count) {
+    for (let i = 0; i < 100; i++) {
+      if (session.stats.messagesReceived >= count) return;
+      await setTimeout(20);
+    }
+    assert.fail(`only ${session.stats.messagesReceived} of ${count} messages ` +
+                'were read; data is not being drained');
   }
-  assert.fail(`only ${session.stats.messagesReceived} of ${count} messages ` +
-              'were read; data is not being drained');
-}

-// No listener: the data must still be read out of OpenSSL and counted.
-for (let i = 0; i < 5; i++) client.send(`unheard-${i}`);
-await waitForMessages(5);
-assert.strictEqual(session.stats.messagesReceived, 5n);
-assert.ok(session.stats.bytesReceived > 0n);
+  // No listener: the data must still be read out of OpenSSL and counted.
+  for (let i = 0; i < 5; i++) client.send(`unheard-${i}`);
+  await waitForMessages(5);
+  assert.strictEqual(session.stats.messagesReceived, 5n);
+  assert.ok(session.stats.bytesReceived > 0n);

-// Attaching a listener starts delivery.
-const delivered = [];
-session.onmessage = (data) => delivered.push(data.toString());
+  // Attaching a listener starts delivery.
+  const delivered = [];
+  session.onmessage = (data) => delivered.push(data.toString());

-for (let i = 0; i < 3; i++) client.send(`heard-${i}`);
-await waitForMessages(8);
+  for (let i = 0; i < 3; i++) client.send(`heard-${i}`);
+  await waitForMessages(8);

-// Nothing sent before the listener was attached should be replayed.
-assert.deepStrictEqual(delivered, ['heard-0', 'heard-1', 'heard-2']);
+  // Nothing sent before the listener was attached should be replayed.
+  assert.deepStrictEqual(delivered, ['heard-0', 'heard-1', 'heard-2']);

-// Removing it stops delivery but must not stop reading.
-session.onmessage = null;
-for (let i = 0; i < 4; i++) client.send(`unheard-again-${i}`);
-await waitForMessages(12);
+  // Removing it stops delivery but must not stop reading.
+  session.onmessage = null;
+  for (let i = 0; i < 4; i++) client.send(`unheard-again-${i}`);
+  await waitForMessages(12);

-assert.strictEqual(session.stats.messagesReceived, 12n);
-assert.strictEqual(delivered.length, 3);
+  assert.strictEqual(session.stats.messagesReceived, 12n);
+  assert.strictEqual(delivered.length, 3);

-await client.close();
-await endpoint.close();
+  await client.close();
+  await endpoint.close();
+}
diff --git a/test/parallel/test-dtls-mtu-record-framing.mjs b/test/parallel/test-dtls-mtu-record-framing.mjs
index 610d86c4e3a..6ef7e85652f 100644
--- a/test/parallel/test-dtls-mtu-record-framing.mjs
+++ b/test/parallel/test-dtls-mtu-record-framing.mjs
@@ -31,59 +31,67 @@ const cert = fixtures.readKey('agent1-cert.pem');
 const key = fixtures.readKey('agent1-key.pem');
 const ca = fixtures.readKey('ca1-cert.pem');

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 const MTU = 512;

-// Send the CA alongside the leaf so the server's flight is several times the
-// MTU and has to be split across records.
-const endpoint = listen(() => {}, {
-  cert: Buffer.concat([cert, ca]),
-  key,
-  host: '127.0.0.1',
-  port: 0,
-  mtu: MTU,
-});
-const serverPort = endpoint.address.port;
-
-const serverToClientSizes = [];
-const clientSide = dgram.createSocket('udp4');
-const serverSide = dgram.createSocket('udp4');
-let clientAddr = null;
-
-clientSide.on('message', (msg, rinfo) => {
-  clientAddr = rinfo;
-  serverSide.send(msg, serverPort, '127.0.0.1');
-});
-serverSide.on('message', (msg) => {
-  serverToClientSizes.push(msg.length);
-  if (clientAddr !== null) {
-    clientSide.send(msg, clientAddr.port, clientAddr.address);
-  }
-});
-
-await new Promise((resolve) => clientSide.bind(0, '127.0.0.1', resolve));
-await new Promise((resolve) => serverSide.bind(0, '127.0.0.1', resolve));
-
-const client = connect('127.0.0.1', clientSide.address().port, {
-  servername: 'agent1',
-  ca: [ca],
-  mtu: MTU,
-});
-
-await client.opened;
-
-const oversized = serverToClientSizes.filter((size) => size > MTU);
-assert.deepStrictEqual(
-  oversized, [],
-  `server sent datagram(s) larger than the ${MTU} byte MTU: ` +
-  `[${oversized}] (all: [${serverToClientSizes}])`);
-
-// Sanity check that the flight really did exceed one MTU, so the assertion
-// above is meaningful rather than vacuous.
-const total = serverToClientSizes.reduce((a, b) => a + b, 0);
-assert.ok(total > MTU,
-          `handshake was too small to exercise fragmentation: ${total} bytes`);
-
-await client.close();
-await endpoint.close();
-clientSide.close();
-serverSide.close();
+for (const versions of [V12, V13]) {
+  // Send the CA alongside the leaf so the server's flight is several times the
+  // MTU and has to be split across records.
+  const endpoint = listen(() => {}, {
+    cert: Buffer.concat([cert, ca]),
+    key,
+    host: '127.0.0.1',
+    port: 0,
+    mtu: MTU,
+    ...versions,
+  });
+  const serverPort = endpoint.address.port;
+
+  const serverToClientSizes = [];
+  const clientSide = dgram.createSocket('udp4');
+  const serverSide = dgram.createSocket('udp4');
+  let clientAddr = null;
+
+  clientSide.on('message', (msg, rinfo) => {
+    clientAddr = rinfo;
+    serverSide.send(msg, serverPort, '127.0.0.1');
+  });
+  serverSide.on('message', (msg) => {
+    serverToClientSizes.push(msg.length);
+    if (clientAddr !== null) {
+      clientSide.send(msg, clientAddr.port, clientAddr.address);
+    }
+  });
+
+  await new Promise((resolve) => clientSide.bind(0, '127.0.0.1', resolve));
+  await new Promise((resolve) => serverSide.bind(0, '127.0.0.1', resolve));
+
+  const client = connect('127.0.0.1', clientSide.address().port, {
+    servername: 'agent1',
+    ca: [ca],
+    mtu: MTU,
+    ...versions,
+  });
+
+  await client.opened;
+
+  const oversized = serverToClientSizes.filter((size) => size > MTU);
+  assert.deepStrictEqual(
+    oversized, [],
+    `server sent datagram(s) larger than the ${MTU} byte MTU: ` +
+    `[${oversized}] (all: [${serverToClientSizes}])`);
+
+  // Sanity check that the flight really did exceed one MTU, so the assertion
+  // above is meaningful rather than vacuous.
+  const total = serverToClientSizes.reduce((a, b) => a + b, 0);
+  assert.ok(total > MTU,
+            'handshake was too small to exercise fragmentation: ' +
+            `${total} bytes`);
+
+  await client.close();
+  await endpoint.close();
+  clientSide.close();
+  serverSide.close();
+}
diff --git a/test/parallel/test-dtls-mtu.mjs b/test/parallel/test-dtls-mtu.mjs
index 58bf9098d00..dceb0118a0f 100644
--- a/test/parallel/test-dtls-mtu.mjs
+++ b/test/parallel/test-dtls-mtu.mjs
@@ -21,6 +21,9 @@ 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 V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // MTU must be within [256, 65535].
 assert.throws(() => new DTLSEndpoint({ mtu: 255 }), { code: 'ERR_OUT_OF_RANGE' });
 assert.throws(() => new DTLSEndpoint({ mtu: 65536 }), { code: 'ERR_OUT_OF_RANGE' });
@@ -33,7 +36,7 @@ assert.throws(() => new DTLSEndpoint({ mtu: 65536 }), { code: 'ERR_OUT_OF_RANGE'

 // A small valid MTU forces the handshake flights (e.g. the certificate) to be
 // fragmented across records, and the exchange still succeeds.
-{
+for (const versions of [V12, V13]) {
   const received = Promise.withResolvers();

   const server = listen(mustCall((session) => {
@@ -42,13 +45,14 @@ assert.throws(() => new DTLSEndpoint({ mtu: 65536 }), { code: 'ERR_OUT_OF_RANGE'
       session.send('world');
     });
   }), {
-    cert, key, port: 0, host: '127.0.0.1', mtu: 256,
+    cert, key, port: 0, host: '127.0.0.1', mtu: 256, ...versions,
   });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
     mtu: 256,
+    ...versions,
   });

   client.onmessage = mustCall((data) => {
diff --git a/test/parallel/test-dtls-multiple-clients.mjs b/test/parallel/test-dtls-multiple-clients.mjs
index 6ef5435295d..eb53c9cdb30 100644
--- a/test/parallel/test-dtls-multiple-clients.mjs
+++ b/test/parallel/test-dtls-multiple-clients.mjs
@@ -20,59 +20,67 @@ const serverCert = fixtures.readKey('agent1-cert.pem');
 const serverKey = fixtures.readKey('agent1-key.pem');
 const ca = fixtures.readKey('ca1-cert.pem');

-const NUM_CLIENTS = 3;
-let sessionsAccepted = 0;
-const allClientsConnected = Promise.withResolvers();
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };

-const endpoint = listen(mustCall((session) => {
-  session.onmessage = (data) => {
-    // Echo back with session identifier.
-    session.send(`echo:${data.toString()}`);
-  };
+const NUM_CLIENTS = 3;

-  if (++sessionsAccepted === NUM_CLIENTS) {
-    allClientsConnected.resolve();
-  }
-}, NUM_CLIENTS), {
-  cert: serverCert.toString(),
-  key: serverKey.toString(),
-  port: 0,
-  host: '127.0.0.1',
-});
-
-const serverAddress = endpoint.address;
-const clients = [];
-const clientResponses = [];
-
-for (let i = 0; i < NUM_CLIENTS; i++) {
-  const received = Promise.withResolvers();
-  clientResponses.push(received);
-
-  const session = connect('127.0.0.1', serverAddress.port, {
-    ca: [ca.toString()],
-    rejectUnauthorized: false,
+for (const versions of [V12, V13]) {
+  let sessionsAccepted = 0;
+  const allClientsConnected = Promise.withResolvers();
+
+  const endpoint = listen(mustCall((session) => {
+    session.onmessage = (data) => {
+      // Echo back with session identifier.
+      session.send(`echo:${data.toString()}`);
+    };
+
+    if (++sessionsAccepted === NUM_CLIENTS) {
+      allClientsConnected.resolve();
+    }
+  }, NUM_CLIENTS), {
+    cert: serverCert.toString(),
+    key: serverKey.toString(),
+    port: 0,
+    host: '127.0.0.1',
+    ...versions,
   });

-  session.onmessage = mustCall((data) => {
-    assert.strictEqual(data.toString(), `echo:client${i}`);
-    received.resolve();
-  });
+  const serverAddress = endpoint.address;
+  const clients = [];
+  const clientResponses = [];

-  clients.push(session);
-}
+  for (let i = 0; i < NUM_CLIENTS; i++) {
+    const received = Promise.withResolvers();
+    clientResponses.push(received);

-// Wait for all handshakes.
-await Promise.all(clients.map((c) => c.opened));
+    const session = connect('127.0.0.1', serverAddress.port, {
+      ca: [ca.toString()],
+      rejectUnauthorized: false,
+      ...versions,
+    });

-// Send data from each client.
-for (let i = 0; i < NUM_CLIENTS; i++) {
-  clients[i].send(`client${i}`);
-}
+    session.onmessage = mustCall((data) => {
+      assert.strictEqual(data.toString(), `echo:client${i}`);
+      received.resolve();
+    });

-// Wait for all echoes.
-await Promise.all(clientResponses.map((r) => r.promise));
+    clients.push(session);
+  }
+
+  // Wait for all handshakes.
+  await Promise.all(clients.map((c) => c.opened));
+
+  // Send data from each client.
+  for (let i = 0; i < NUM_CLIENTS; i++) {
+    clients[i].send(`client${i}`);
+  }
+
+  // Wait for all echoes.
+  await Promise.all(clientResponses.map((r) => r.promise));

-// Clean up.
-await Promise.all(clients.map((c) => c.close()));
+  // Clean up.
+  await Promise.all(clients.map((c) => c.close()));

-await endpoint.close();
+  await endpoint.close();
+}
diff --git a/test/parallel/test-dtls-opened-settles.mjs b/test/parallel/test-dtls-opened-settles.mjs
index c70d05f6f6b..91a4af86ec6 100644
--- a/test/parallel/test-dtls-opened-settles.mjs
+++ b/test/parallel/test-dtls-opened-settles.mjs
@@ -25,6 +25,9 @@ const cert = fixtures.readKey('agent1-cert.pem');
 const key = fixtures.readKey('agent1-key.pem');
 const ca = fixtures.readKey('ca1-cert.pem');

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 async function sleep(n) {
   await setTimeout(1000);
   return 'pending';
@@ -40,12 +43,12 @@ function outcome(promise) {
   ]);
 }

-function newClient() {
+function newClient(versions) {
   const endpoint = listen(() => {}, {
-    cert, key, host: '127.0.0.1', port: 0,
+    cert, key, host: '127.0.0.1', port: 0, ...versions,
   });
   const client = connect('127.0.0.1', endpoint.address.port, {
-    servername: 'agent1', ca: [ca],
+    servername: 'agent1', ca: [ca], ...versions,
   });
   return { endpoint, client };
 }
@@ -90,8 +93,8 @@ function newClient() {

 // A completed handshake still resolves, and a later close must not overwrite
 // that with a rejection.
-{
-  const { endpoint, client } = newClient();
+for (const versions of [V12, V13]) {
+  const { endpoint, client } = newClient(versions);
   await client.opened;

   await client.close();
@@ -102,13 +105,13 @@ function newClient() {

 // A handshake that fails on its own reports the real reason; teardown must
 // not replace it with the generic teardown error.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
-    cert, key, host: '127.0.0.1', port: 0,
+    cert, key, host: '127.0.0.1', port: 0, ...versions,
   });
   // No CA for this server, so verification fails during the handshake.
   const client = connect('127.0.0.1', endpoint.address.port, {
-    servername: 'agent1', rejectUnauthorized: true,
+    servername: 'agent1', rejectUnauthorized: true, ...versions,
   });

   const result = await outcome(client.opened);
@@ -125,17 +128,17 @@ function newClient() {
 // The binding destroys those sessions but emits no callback for them, so
 // anything awaiting one waited for a session that no longer existed. The
 // documentation says the promise always settles and awaiting it cannot hang.
-{
+for (const versions of [V12, V13]) {
   const arrived = Promise.withResolvers();
   let serverSession;

   const endpoint = listen((session) => {
     serverSession = session;
     arrived.resolve();
-  }, { cert, key, host: '127.0.0.1', port: 0 });
+  }, { cert, key, host: '127.0.0.1', port: 0, ...versions });

   const client = connect('127.0.0.1', endpoint.address.port, {
-    rejectUnauthorized: false,
+    rejectUnauthorized: false, ...versions,
   });
   await client.opened;
   await arrived.promise;
@@ -150,17 +153,17 @@ function newClient() {

 // The endpoint's error reaches them, rather than being reported only on the
 // endpoint while the sessions resolve as though nothing went wrong.
-{
+for (const versions of [V12, V13]) {
   const arrived = Promise.withResolvers();
   let serverSession;

   const endpoint = listen((session) => {
     serverSession = session;
     arrived.resolve();
-  }, { cert, key, host: '127.0.0.1', port: 0 });
+  }, { cert, key, host: '127.0.0.1', port: 0, ...versions });

   const client = connect('127.0.0.1', endpoint.address.port, {
-    rejectUnauthorized: false,
+    rejectUnauthorized: false, ...versions,
   });
   await client.opened;
   await arrived.promise;
@@ -176,11 +179,14 @@ function newClient() {

 // A session torn down mid-handshake settles both of its promises, not just
 // the one the peer's departure would settle.
-{
-  const endpoint = listen(() => {}, { cert, key, host: '127.0.0.1', port: 0 });
+for (const versions of [V12, V13]) {
+  const endpoint = listen(() => {}, {
+    cert, key, host: '127.0.0.1', port: 0, ...versions,
+  });
   const client = connect('127.0.0.1', endpoint.address.port, {
     handshakeTimeout: 500,
     rejectUnauthorized: false,
+    ...versions,
   });

   // Before the handshake can finish.
diff --git a/test/parallel/test-dtls-passphrase.mjs b/test/parallel/test-dtls-passphrase.mjs
index d1687a162dc..f176289ffe3 100644
--- a/test/parallel/test-dtls-passphrase.mjs
+++ b/test/parallel/test-dtls-passphrase.mjs
@@ -29,6 +29,9 @@ const { connect, listen } = await import('node:dtls');

 const PASSPHRASE = 'correct horse battery staple';

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // Generate an encrypted key and a matching self-signed certificate rather
 // than checking a fixture in, so the passphrase is visible in the test.
 const dir = mkdtempSync(tmpdir.resolve('dtls-passphrase-'));
@@ -56,7 +59,7 @@ rmSync(dir, { recursive: true, force: true });
 assert.match(encryptedKey, /^-----BEGIN ENCRYPTED PRIVATE KEY-----/);

 // The correct passphrase decrypts the key, and the endpoint serves with it.
-{
+for (const versions of [V12, V13]) {
   const echoed = Promise.withResolvers();

   const endpoint = listen((session) => {
@@ -67,12 +70,14 @@ assert.match(encryptedKey, /^-----BEGIN ENCRYPTED PRIVATE KEY-----/);
     passphrase: PASSPHRASE,
     host: '127.0.0.1',
     port: 0,
+    ...versions,
   });

   // Self-signed and not in any CA store, so verification is off here; the
   // point of the test is that the encrypted key loaded and can sign.
   const client = connect('127.0.0.1', endpoint.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });

   await client.opened;
diff --git a/test/parallel/test-dtls-peer-x509-certificate.mjs b/test/parallel/test-dtls-peer-x509-certificate.mjs
index 4a4032b0eda..cd7286d20e1 100644
--- a/test/parallel/test-dtls-peer-x509-certificate.mjs
+++ b/test/parallel/test-dtls-peer-x509-certificate.mjs
@@ -33,6 +33,9 @@ const chain = leafCert + intermediate;
 const agentCert = fixtures.readKey('agent1-cert.pem').toString();
 const agentKey = fixtures.readKey('agent1-key.pem').toString();

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 function commonNames(cert) {
   const names = [];
   for (let x = cert, i = 0; x && i < 8; i++) {
@@ -46,13 +49,15 @@ function commonNames(cert) {
 }

 // The client sees the chain the server presented.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
     cert: chain, key: leafKey, host: '127.0.0.1', port: 0,
+    ...versions,
   });

   const client = connect('127.0.0.1', endpoint.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });
   await client.opened;

@@ -83,7 +88,7 @@ function commonNames(cert) {
 // The server sees the chain the client presented. This is the other branch
 // of GetPeerCertificateFlag: SSL_get_peer_cert_chain() omits the peer's leaf
 // on the server, so the wrong flag here silently drops or repeats it.
-{
+for (const versions of [V12, V13]) {
   const gotSession = Promise.withResolvers();

   const endpoint = listen((session) => gotSession.resolve(session), {
@@ -93,10 +98,12 @@ function commonNames(cert) {
     rejectUnauthorized: false,
     host: '127.0.0.1',
     port: 0,
+    ...versions,
   });

   const client = connect('127.0.0.1', endpoint.address.port, {
     cert: chain, key: leafKey, rejectUnauthorized: false,
+    ...versions,
   });

   await client.opened;
@@ -117,13 +124,15 @@ function commonNames(cert) {
 // lifts the leaf out of the SSL's chain with sk_X509_delete(), so calling it
 // twice returns a shorter chain and then nothing. The accessor must call it
 // once and keep the result.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
     cert: chain, key: leafKey, host: '127.0.0.1', port: 0,
+    ...versions,
   });

   const client = connect('127.0.0.1', endpoint.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });
   await client.opened;

@@ -140,15 +149,17 @@ function commonNames(cert) {
 }

 // A peer that sent no certificate reports undefined rather than an empty one.
-{
+for (const versions of [V12, V13]) {
   const gotSession = Promise.withResolvers();

   const endpoint = listen((session) => gotSession.resolve(session), {
     cert: agentCert, key: agentKey, host: '127.0.0.1', port: 0,
+    ...versions,
   });

   const client = connect('127.0.0.1', endpoint.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });

   await client.opened;
diff --git a/test/parallel/test-dtls-psk.mjs b/test/parallel/test-dtls-psk.mjs
index e1671bc725e..c1e10b215fb 100644
--- a/test/parallel/test-dtls-psk.mjs
+++ b/test/parallel/test-dtls-psk.mjs
@@ -26,6 +26,9 @@ const KEY = Buffer.from('0123456789abcdef');
 const OTHER = Buffer.from('fedcba9876543210');
 const HOST = '127.0.0.1';
 const PSK_CIPHER = 'PSK-AES128-CCM8@SECLEVEL=0';
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+const VERSIONS = [V12, V13];

 const readKey = (name) => fixtures.readKey(name).toString();

@@ -34,17 +37,26 @@ function open(endpoint, options) {
 }

 // A map on the server, an identity on the client. No certificate anywhere.
-{
+for (const versions of VERSIONS) {
   const endpoint = listen(mustCall(), {
-    psk: { 'device-42': KEY }, host: HOST, port: 0,
+    psk: { 'device-42': KEY }, host: HOST, port: 0, ...versions,
   });

-  const client = open(endpoint, { psk: { identity: 'device-42', key: KEY } });
+  const client = open(endpoint, {
+    psk: { identity: 'device-42', key: KEY }, ...versions,
+  });
   await client.opened;

-  // A PSK suite must actually have been negotiated -- the default cipher
-  // list excludes PSK, so this also pins the implicit enabling below.
-  assert.match(client.cipher.standardName, /_PSK_/);
+  if (versions === V12) {
+    // A PSK suite must actually have been negotiated -- the default cipher
+    // list excludes PSK, so this also pins the implicit enabling below.
+    assert.match(client.cipher.standardName, /_PSK_/);
+  } else {
+    // DTLS 1.3 suite names do not say how the peer authenticated; the
+    // absence of a certificate does, and the key is bound to SHA-256.
+    assert.strictEqual(client.peerCertificate, undefined);
+    assert.match(client.cipher.standardName, /_SHA256$/);
+  }
   assert.strictEqual(client.authorized, true);

   await client.close();
@@ -52,21 +64,30 @@ function open(endpoint, options) {
 }

 // A callback on either side, for keys that are looked up or derived rather
-// than known up front.
-{
+// than known up front. Under DTLS 1.3 the client offers its key in each
+// ClientHello, and the server is asked about each, so both are called twice:
+// once for the first ClientHello and once for the one answering the
+// HelloRetryRequest.
+for (const versions of VERSIONS) {
+  const calls = versions === V13 ? 2 : 1;
   const endpoint = listen(() => {}, {
     psk: mustCall((identity) => {
       assert.strictEqual(identity, 'device-42');
       return KEY;
-    }),
-    host: HOST, port: 0,
+    }, calls),
+    host: HOST, port: 0, ...versions,
   });

   const client = open(endpoint, {
-    psk: mustCall(() => ({ identity: 'device-42', key: KEY })),
+    psk: mustCall(() => ({ identity: 'device-42', key: KEY }), calls),
+    ...versions,
   });
   await client.opened;
-  assert.match(client.cipher.standardName, /_PSK_/);
+  if (versions === V12) {
+    assert.match(client.cipher.standardName, /_PSK_/);
+  } else {
+    assert.strictEqual(client.peerCertificate, undefined);
+  }

   await client.close();
   await endpoint.close();
@@ -75,11 +96,13 @@ function open(endpoint, options) {
 // The map answers first; the callback is only reached on a miss. This is what
 // keeps a map-only configuration from running JavaScript inside the
 // handshake at all.
-{
+for (const versions of VERSIONS) {
   const endpoint = listen(() => {}, {
-    psk: { 'in-map': KEY }, host: HOST, port: 0,
+    psk: { 'in-map': KEY }, host: HOST, port: 0, ...versions,
+  });
+  const client = open(endpoint, {
+    psk: { identity: 'in-map', key: KEY }, ...versions,
   });
-  const client = open(endpoint, { psk: { identity: 'in-map', key: KEY } });
   await client.opened;
   await client.close();
   await endpoint.close();
@@ -87,18 +110,21 @@ function open(endpoint, options) {

 // An identity the server does not know fails closed rather than negotiating
 // with an empty key.
-{
+for (const versions of VERSIONS) {
   const endpoint = listen(() => {}, {
-    psk: { 'known': KEY }, host: HOST, port: 0,
+    psk: { 'known': KEY }, host: HOST, port: 0, ...versions,
   });

-  const client = open(endpoint, { psk: { identity: 'unknown', key: KEY } });
+  const client = open(endpoint, {
+    psk: { identity: 'unknown', key: KEY }, ...versions,
+  });
   await assert.rejects(client.opened, { name: 'Error' });

   await endpoint.close();
 }

-// The right identity with the wrong key does not fail -- it stalls.
+// Under DTLS 1.2, the right identity with the wrong key does not fail -- it
+// stalls.
 //
 // The identity only names the key, so the handshake proceeds and the two
 // sides derive different secrets. The first record that fails authentication
@@ -112,10 +138,12 @@ function open(endpoint, options) {
 // wait below is only to observe the stall, not to wait one out.
 {
   const endpoint = listen(() => {}, {
-    psk: { 'device-42': KEY }, host: HOST, port: 0,
+    psk: { 'device-42': KEY }, host: HOST, port: 0, ...V12,
   });

-  const client = open(endpoint, { psk: { identity: 'device-42', key: OTHER } });
+  const client = open(endpoint, {
+    psk: { identity: 'device-42', key: OTHER }, ...V12,
+  });

   const stalled = Symbol('stalled');
   const outcome = await Promise.race([
@@ -128,13 +156,30 @@ function open(endpoint, options) {
   await endpoint.close();
 }

-// A callback returning nothing is a refusal, not an error.
+// Under DTLS 1.3 it fails at once: the client's ClientHello carries a binder
+// computed with its key, which the server checks before going further.
 {
   const endpoint = listen(() => {}, {
-    psk: mustCall(() => undefined), host: HOST, port: 0,
+    psk: { 'device-42': KEY }, host: HOST, port: 0, ...V13,
   });

-  const client = open(endpoint, { psk: { identity: 'anyone', key: KEY } });
+  const client = open(endpoint, {
+    psk: { identity: 'device-42', key: OTHER }, ...V13,
+  });
+  await assert.rejects(client.opened, /decrypt error/);
+
+  await endpoint.close();
+}
+
+// A callback returning nothing is a refusal, not an error.
+for (const versions of VERSIONS) {
+  const endpoint = listen(() => {}, {
+    psk: mustCall(() => undefined), host: HOST, port: 0, ...versions,
+  });
+
+  const client = open(endpoint, {
+    psk: { identity: 'anyone', key: KEY }, ...versions,
+  });
   await assert.rejects(client.opened, { name: 'Error' });

   await endpoint.close();
@@ -142,13 +187,15 @@ function open(endpoint, options) {

 // The cookie exchange still runs, so PSK is not a way around the address
 // validation the endpoint's DoS protection depends on.
-{
+for (const versions of VERSIONS) {
   const endpoint = listen(() => {}, {
-    psk: { 'device-42': KEY }, host: HOST, port: 0,
+    psk: { 'device-42': KEY }, host: HOST, port: 0, ...versions,
   });

   const before = Number(endpoint.stats.packetsReceived);
-  const client = open(endpoint, { psk: { identity: 'device-42', key: KEY } });
+  const client = open(endpoint, {
+    psk: { identity: 'device-42', key: KEY }, ...versions,
+  });
   await client.opened;
   const received = Number(endpoint.stats.packetsReceived) - before;

@@ -167,15 +214,16 @@ function open(endpoint, options) {
 // Asking for it therefore needs @SECLEVEL=0, and asking without one does not
 // report anything: the handshake stalls, because a DTLS peer with nothing to
 // select discards rather than replies. Anyone implementing CoAP will meet
-// this, so it is pinned here.
+// this, so it is pinned here. It is a DTLS 1.2 suite, and the list has no
+// DTLS 1.3 suite in it, so it only applies to DTLS 1.2.
 {
   const ciphers = 'PSK-AES128-CCM8@SECLEVEL=0';
   const endpoint = listen(() => {}, {
-    psk: { 'device-42': KEY }, ciphers, host: HOST, port: 0,
+    psk: { 'device-42': KEY }, ciphers, host: HOST, port: 0, ...V12,
   });

   const client = open(endpoint, {
-    psk: { identity: 'device-42', key: KEY }, ciphers,
+    psk: { identity: 'device-42', key: KEY }, ciphers, ...V12,
   });
   await client.opened;
   assert.strictEqual(client.cipher.standardName,
@@ -187,13 +235,16 @@ function open(endpoint, options) {

 // Without an explicit list a forward-secret suite is chosen. Plain PSK
 // derives its keys from the shared secret alone, so anyone who later learns
-// the key can decrypt recorded traffic.
+// the key can decrypt recorded traffic. A DTLS 1.3 suite name does not say
+// how the key was exchanged, so this is checked under DTLS 1.2.
 {
   const endpoint = listen(() => {}, {
-    psk: { 'device-42': KEY }, host: HOST, port: 0,
+    psk: { 'device-42': KEY }, host: HOST, port: 0, ...V12,
   });

-  const client = open(endpoint, { psk: { identity: 'device-42', key: KEY } });
+  const client = open(endpoint, {
+    psk: { identity: 'device-42', key: KEY }, ...V12,
+  });
   await client.opened;
   assert.match(client.cipher.standardName, /_(EC)?DHE_PSK_/);

@@ -202,42 +253,58 @@ function open(endpoint, options) {
 }

 // A certificate still works alongside PSK, because DEFAULT stays on the end
-// of the implicit cipher list.
-{
+// of the implicit cipher list. Under DTLS 1.3 a server holding a certificate
+// does not prefer the SHA-256 suites a PSK is bound to, so this also pins
+// that a PSK client offers only those.
+for (const versions of VERSIONS) {
   const endpoint = listen(() => {}, {
     cert: readKey('agent1-cert.pem'),
     key: readKey('agent1-key.pem'),
     psk: { 'device-42': KEY },
-    host: HOST, port: 0,
+    host: HOST, port: 0, ...versions,
   });

-  const psk = open(endpoint, { psk: { identity: 'device-42', key: KEY } });
+  const psk = open(endpoint, {
+    psk: { identity: 'device-42', key: KEY }, ...versions,
+  });
   await psk.opened;
-  assert.match(psk.cipher.standardName, /_PSK_/);
+  if (versions === V12) {
+    assert.match(psk.cipher.standardName, /_PSK_/);
+  }
+  assert.strictEqual(psk.peerCertificate, undefined);
   await psk.close();

-  const cert = open(endpoint, { rejectUnauthorized: false });
+  const cert = open(endpoint, { rejectUnauthorized: false, ...versions });
   await cert.opened;
-  assert.doesNotMatch(cert.cipher.standardName, /_PSK_/);
+  if (versions === V12) {
+    assert.doesNotMatch(cert.cipher.standardName, /_PSK_/);
+  }
+  assert.ok(cert.peerCertificate);
   await cert.close();

   await endpoint.close();
 }

 // The identity hint is a server-side courtesy (RFC 4279 section 5.2) and
-// reaches the client's callback.
-{
+// reaches the client's callback. DTLS 1.3 has no identity hint: the client
+// offers its key before the server has sent anything, so the callback is
+// called without one, for each ClientHello.
+for (const [versions, hint, calls] of [
+  [V12, 'example.com', 1],
+  [V13, undefined, 2],
+]) {
   const endpoint = listen(() => {}, {
     psk: { 'device-42': KEY },
     pskIdentityHint: 'example.com',
-    host: HOST, port: 0,
+    host: HOST, port: 0, ...versions,
   });

   const client = open(endpoint, {
-    psk: mustCall((hint) => {
-      assert.strictEqual(hint, 'example.com');
+    psk: mustCall((received) => {
+      assert.strictEqual(received, hint);
       return { identity: 'device-42', key: KEY };
-    }),
+    }, calls),
+    ...versions,
   });
   await client.opened;

@@ -249,6 +316,7 @@ function open(endpoint, options) {
 // session. It must not reach the process as an uncaughtException: one bad
 // callback should not take a server down.
 {
+  const versions = V12;
   process.on('uncaughtException', mustNotCall());

   const thrown = new Error('from the psk callback');
@@ -258,10 +326,12 @@ function open(endpoint, options) {
     session.onerror = (err) => seen.resolve(err);
   }, {
     psk: () => { throw thrown; },
-    host: HOST, port: 0,
+    host: HOST, port: 0, ...versions,
   });

-  const client = open(endpoint, { psk: { identity: 'device-42', key: KEY } });
+  const client = open(endpoint, {
+    psk: { identity: 'device-42', key: KEY }, ...versions,
+  });
   await assert.rejects(client.opened, { name: 'Error' });

   // The user's own error, not something wrapped around it.
@@ -271,6 +341,36 @@ function open(endpoint, options) {
   process.removeAllListeners('uncaughtException');
 }

+// Under DTLS 1.3 the server's callback is first asked about the ClientHello
+// that precedes the cookie exchange, and a throw there fails a handshake
+// that has no session yet. The client is refused, the process is not taken
+// down, and the endpoint goes on serving.
+{
+  process.on('uncaughtException', mustNotCall());
+
+  const endpoint = listen(() => {}, {
+    psk: (identity) => {
+      if (identity === 'throws') throw new Error('from the psk callback');
+      return KEY;
+    },
+    host: HOST, port: 0, ...V13,
+  });
+
+  const failing = open(endpoint, {
+    psk: { identity: 'throws', key: KEY }, ...V13,
+  });
+  await assert.rejects(failing.opened, { name: 'Error' });
+
+  const working = open(endpoint, {
+    psk: { identity: 'device-42', key: KEY }, ...V13,
+  });
+  await working.opened;
+  await working.close();
+
+  await endpoint.close();
+  process.removeAllListeners('uncaughtException');
+}
+
 // Validation.
 {
   const port = 0;
@@ -322,9 +422,9 @@ function open(endpoint, options) {
 // without reporting it, so the caller saw an opaque SSL error instead of what
 // it threw, and the TryCatch was left to unwind with the exception still
 // caught on the way back into OpenSSL.
-{
+for (const versions of VERSIONS) {
   const server = listen(() => {}, {
-    host: HOST, port: 0, psk: { 'id-1': KEY },
+    host: HOST, port: 0, psk: { 'id-1': KEY }, ...versions,
   });

   for (const build of [
@@ -345,13 +445,22 @@ function open(endpoint, options) {
       }
     })();

-    const client = connect(HOST, server.address.port, { psk: build });
-    const seen = Promise.withResolvers();
-    client.onerror = (error) => seen.resolve(error);
+    const client = connect(HOST, server.address.port, {
+      psk: build, ...versions,
+    });
+
+    // A DTLS 1.2 client is asked for its key once the server's first flight
+    // arrives, so onerror is attached in time to hear about it. A DTLS 1.3
+    // client offers its key in its first ClientHello, which connect() builds
+    // before returning, so there only opened can carry the error.
+    if (versions === V12) {
+      const seen = Promise.withResolvers();
+      client.onerror = (error) => seen.resolve(error);

-    const error = await seen.promise;
-    // The caller's own error, not "error:0A0000DF:SSL routines".
-    assert.strictEqual(error.message, expected);
+      const error = await seen.promise;
+      // The caller's own error, not "error:0A0000DF:SSL routines".
+      assert.strictEqual(error.message, expected);
+    }

     await assert.rejects(client.opened, { message: expected });
   }
@@ -366,7 +475,7 @@ function open(endpoint, options) {
 // SSL_get_SSL_CTX(), which SNI reassigns: selecting any identity -- including
 // the '*' fallback, so this needed no servername at all -- pointed the lookup
 // at a context with no PSK configuration and every PSK handshake failed.
-{
+for (const versions of VERSIONS) {
   const cert = fixtures.readKey('agent1-cert.pem').toString();
   const key = fixtures.readKey('agent1-key.pem').toString();
   const identity = { cert, key };
@@ -378,12 +487,14 @@ function open(endpoint, options) {
     key,
     psk: { 'id-1': KEY },
     sni: { 'a.example': identity, '*': identity },
+    ...versions,
   });

   for (const servername of [undefined, 'a.example', 'unmatched.example']) {
     const client = connect(HOST, server.address.port, {
       psk: { identity: 'id-1', key: KEY },
       servername,
+      ...versions,
     });
     await client.opened;
     await client.close();
@@ -396,7 +507,7 @@ function open(endpoint, options) {
 // callbacks are installed on the connection by SSL_new(), before any name is
 // known, and SSL_set_SSL_CTX() does not replace them -- so they stay the
 // endpoint's, and a PSK configured on an SNI identity is never consulted.
-{
+for (const versions of VERSIONS) {
   const cert = fixtures.readKey('agent1-cert.pem').toString();
   const key = fixtures.readKey('agent1-key.pem').toString();
   const other = Buffer.from('fedcba9876543210');
@@ -408,11 +519,13 @@ function open(endpoint, options) {
     key,
     psk: { 'endpoint-id': KEY },
     sni: { 'a.example': { cert, key, psk: { 'sni-id': other } } },
+    ...versions,
   });

   const accepted = connect(HOST, server.address.port, {
     psk: { identity: 'endpoint-id', key: KEY },
     servername: 'a.example',
+    ...versions,
   });
   await accepted.opened;
   await accepted.close();
@@ -420,6 +533,7 @@ function open(endpoint, options) {
   const refused = connect(HOST, server.address.port, {
     psk: { identity: 'sni-id', key: other },
     servername: 'a.example',
+    ...versions,
   });
   await assert.rejects(refused.opened, { name: 'Error' });

@@ -432,13 +546,14 @@ function open(endpoint, options) {
 // every one of these took, so a mistake in the callback arrived as
 // "error:0A0000DF:SSL routines::psk identity not found" -- the same string
 // for all of them, naming nothing the caller had done.
-{
+for (const [versions, ciphers] of [[V12, PSK_CIPHER], [V13, undefined]]) {
   const server = listen(() => {}, {
     psk: () => ({ key: KEY }),
     pskIdentityHint: 'hint',
     host: HOST,
     port: 0,
-    ciphers: PSK_CIPHER,
+    ciphers,
+    ...versions,
   });

   const cases = [
@@ -453,8 +568,9 @@ function open(endpoint, options) {
   for (const [psk, expected] of cases) {
     const session = connect(HOST, server.address.port, {
       psk,
-      ciphers: PSK_CIPHER,
+      ciphers,
       handshakeTimeout: 5000,
+      ...versions,
     });
     const error = await session.opened.then(() => null, (e) => e);
     assert.ok(error, 'the handshake should not have completed');
diff --git a/test/parallel/test-dtls-reject-unauthorized.mjs b/test/parallel/test-dtls-reject-unauthorized.mjs
index 3ed625de30c..e444a6e3fc9 100644
--- a/test/parallel/test-dtls-reject-unauthorized.mjs
+++ b/test/parallel/test-dtls-reject-unauthorized.mjs
@@ -21,19 +21,23 @@ const { listen, connect } = await import('node:dtls');
 const cert = fixtures.readKey('agent1-cert.pem').toString();
 const key = fixtures.readKey('agent1-key.pem').toString();

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // Case 1: with rejectUnauthorized, a certificate that does not chain to a
 // trusted CA fails verification. The servername matches the certificate, so
 // the failure is the untrusted chain and not an identity mismatch. No `ca` is
 // supplied, so only the system-default CAs are trusted (which do not include
 // this test's CA).
-{
+for (const versions of [V12, V13]) {
   const server = listen(mustCall(), {
-    cert, key, port: 0, host: '127.0.0.1',
+    cert, key, port: 0, host: '127.0.0.1', ...versions,
   });

   const client = connect('127.0.0.1', server.address.port, {
     rejectUnauthorized: true,
     servername: 'agent1',
+    ...versions,
   });

   await assert.rejects(client.opened, /certificate verify failed/i);
@@ -43,13 +47,14 @@ const key = fixtures.readKey('agent1-key.pem').toString();
 }

 // Case 2: the same untrusted certificate is accepted when verification is off.
-{
+for (const versions of [V12, V13]) {
   const server = listen(mustCall(), {
-    cert, key, port: 0, host: '127.0.0.1',
+    cert, key, port: 0, host: '127.0.0.1', ...versions,
   });

   const client = connect('127.0.0.1', server.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });

   const { protocol } = await client.opened;
diff --git a/test/parallel/test-dtls-request-cert.mjs b/test/parallel/test-dtls-request-cert.mjs
index b5e581c44eb..ba2aab532f2 100644
--- a/test/parallel/test-dtls-request-cert.mjs
+++ b/test/parallel/test-dtls-request-cert.mjs
@@ -33,15 +33,18 @@ const key = fixtures.readKey('agent1-key.pem');
 const ca1 = fixtures.readKey('ca1-cert.pem');
 const ca2 = fixtures.readKey('ca2-cert.pem');

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // Runs one handshake and reports what the server made of the client.
-async function handshake(serverOptions, clientOptions) {
+async function handshake(versions, serverOptions, clientOptions) {
   const gotSession = Promise.withResolvers();
   const server = listen((session) => {
     session.onhandshake = () => gotSession.resolve(session);
-  }, { cert, key, host: '127.0.0.1', port: 0, ...serverOptions });
+  }, { cert, key, host: '127.0.0.1', port: 0, ...serverOptions, ...versions });

   const client = connect('127.0.0.1', server.address.port, {
-    servername: 'agent1', ca: [ca1], ...clientOptions,
+    servername: 'agent1', ca: [ca1], ...clientOptions, ...versions,
   });

   let result;
@@ -67,71 +70,79 @@ async function handshake(serverOptions, clientOptions) {
   return result;
 }

-// --- requestCert with rejectUnauthorized disabled ------------------------
+for (const versions of [V12, V13]) {
+  const run = (server, client) => handshake(versions, server, client);

-// A trusted client certificate is actually requested and received. This is
-// the case that silently produced no certificate at all before.
-assert.deepStrictEqual(
-  await handshake({ requestCert: true, rejectUnauthorized: false, ca: [ca1] },
-                  { cert, key }),
-  {
-    rejected: false,
-    sawPeerCertificate: true,
-    authorized: true,
-    authorizationError: undefined,
-  });
+  // --- requestCert with rejectUnauthorized disabled ------------------------

-// An untrusted client certificate is received, and the handshake completes so
-// the application can decide.
-assert.deepStrictEqual(
-  await handshake({ requestCert: true, rejectUnauthorized: false, ca: [ca2] },
-                  { cert, key }),
-  {
-    rejected: false,
-    sawPeerCertificate: true,
-    authorized: false,
-    authorizationError: 'SELF_SIGNED_CERT_IN_CHAIN',
-  });
+  // A trusted client certificate is actually requested and received. This is
+  // the case that silently produced no certificate at all before.
+  assert.deepStrictEqual(
+    await run({ requestCert: true, rejectUnauthorized: false, ca: [ca1] },
+              { cert, key }),
+    {
+      rejected: false,
+      sawPeerCertificate: true,
+      authorized: true,
+      authorizationError: undefined,
+    });
+
+  // An untrusted client certificate is received, and the handshake completes so
+  // the application can decide.
+  assert.deepStrictEqual(
+    await run({ requestCert: true, rejectUnauthorized: false, ca: [ca2] },
+              { cert, key }),
+    {
+      rejected: false,
+      sawPeerCertificate: true,
+      authorized: false,
+      authorizationError: 'SELF_SIGNED_CERT_IN_CHAIN',
+    });
+
+  // A client that declines to send one is tolerated rather than rejected.
+  assert.deepStrictEqual(
+    await run({ requestCert: true, rejectUnauthorized: false, ca: [ca1] },
+              {}),
+    {
+      rejected: false,
+      sawPeerCertificate: false,
+      authorized: false,
+      authorizationError: 'UNABLE_TO_GET_ISSUER_CERT',
+    });

-// A client that declines to send one is tolerated rather than rejected.
-assert.deepStrictEqual(
-  await handshake({ requestCert: true, rejectUnauthorized: false, ca: [ca1] },
-                  {}),
-  {
-    rejected: false,
-    sawPeerCertificate: false,
-    authorized: false,
-    authorizationError: 'UNABLE_TO_GET_ISSUER_CERT',
-  });
+  // --- requestCert, enforced -----------------------------------------------

-// --- requestCert, enforced -----------------------------------------------
+  // OpenSSL rejects these, so the peer receives a real alert rather than having
+  // the session quietly dropped after the handshake.
+  {
+    const noCert = await run({ requestCert: true, ca: [ca1] }, {});
+    assert.strictEqual(noCert.rejected, true);
+    // A DTLS 1.3 server rejects after the client's final flight, with the
+    // alert TLS 1.3 defined for it. The client is still waiting for that flight
+    // to be acknowledged, so the rejection reaches its opened all the same.
+    assert.match(noCert.message, versions === V12 ?
+      /handshake failure/ : /certificate required/);
+
+    const untrusted = await run({ requestCert: true, ca: [ca2] },
+                                { cert, key });
+    assert.strictEqual(untrusted.rejected, true);
+    assert.match(untrusted.message, /unknown ca/);
+  }

-// OpenSSL rejects these, so the peer receives a real alert rather than having
-// the session quietly dropped after the handshake.
-{
-  const noCert = await handshake({ requestCert: true, ca: [ca1] }, {});
-  assert.strictEqual(noCert.rejected, true);
-  assert.match(noCert.message, /handshake failure/);
+  // --- no requestCert ------------------------------------------------------

-  const untrusted = await handshake({ requestCert: true, ca: [ca2] },
-                                    { cert, key });
-  assert.strictEqual(untrusted.rejected, true);
-  assert.match(untrusted.message, /unknown ca/);
+  // rejectUnauthorized alone must not turn a server into one that demands
+  // client certificates.
+  assert.deepStrictEqual(
+    await run({ rejectUnauthorized: true, ca: [ca1] }, { cert, key }),
+    {
+      rejected: false,
+      sawPeerCertificate: false,
+      authorized: false,
+      authorizationError: 'UNABLE_TO_GET_ISSUER_CERT',
+    });
 }

-// --- no requestCert ------------------------------------------------------
-
-// rejectUnauthorized alone must not turn a server into one that demands
-// client certificates.
-assert.deepStrictEqual(
-  await handshake({ rejectUnauthorized: true, ca: [ca1] }, { cert, key }),
-  {
-    rejected: false,
-    sawPeerCertificate: false,
-    authorized: false,
-    authorizationError: 'UNABLE_TO_GET_ISSUER_CERT',
-  });
-
 // --- validation ----------------------------------------------------------

 assert.throws(
diff --git a/test/parallel/test-dtls-resumption-reject-unauthorized.mjs b/test/parallel/test-dtls-resumption-reject-unauthorized.mjs
index 70ffaa497f8..5a2ff2bdf8c 100644
--- a/test/parallel/test-dtls-resumption-reject-unauthorized.mjs
+++ b/test/parallel/test-dtls-resumption-reject-unauthorized.mjs
@@ -37,29 +37,41 @@ const ca = fixtures.readKey('ca1-cert.pem').toString();

 const serverOptions = { cert, key, host: '127.0.0.1', port: 0 };

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+// Connects, and returns the session with a ticket to resume it from. A DTLS
+// 1.3 server sends its tickets after the handshake, so there the first is
+// taken from onsessionticket rather than read from session.session.
+async function ticketed(port, versions, options) {
+  const session = connect('127.0.0.1', port, { ...options, ...versions });
+  const issued = Promise.withResolvers();
+  session.onsessionticket = (ticket) => issued.resolve(ticket);
+  await session.opened;
+  const ticket = versions === V12 ? session.session : await issued.promise;
+  return { session, ticket };
+}
+
 // A ticket earned without verification cannot be spent with it. The chain
 // does not verify here -- no `ca` is supplied, so only the system-default CAs
 // are trusted -- and rejectUnauthorized: false is what let the first
 // connection through.
-{
-  const server = listen(mustCall(2), serverOptions);
+for (const versions of [V12, V13]) {
+  const server = listen(mustCall(2), { ...serverOptions, ...versions });

-  const first = connect('127.0.0.1', server.address.port, {
-    rejectUnauthorized: false,
-  });
-  await first.opened;
+  const { session: first, ticket } = await ticketed(
+    server.address.port, versions, { rejectUnauthorized: false });

   // The failure that the blob is about to carry with it.
   assert.strictEqual(first.authorized, false);
   assert.ok(first.authorizationError);
-  const ticket = first.session;
   assert.ok(Buffer.isBuffer(ticket));
   await first.close();

   // Same host, so the identity binding permits the blob; the difference is
   // that this caller asked for a verified peer.
   const second = connect('127.0.0.1', server.address.port, {
-    rejectUnauthorized: true, session: ticket,
+    rejectUnauthorized: true, session: ticket, ...versions,
   });

   await assert.rejects(second.opened, {
@@ -75,20 +87,19 @@ const serverOptions = { cert, key, host: '127.0.0.1', port: 0 };
 // for real. With the CA trusted and the identity matching the certificate,
 // the first handshake verifies, the recorded result is X509_V_OK, and the
 // resumed handshake inherits it.
-{
-  const server = listen(mustCall(2), serverOptions);
+for (const versions of [V12, V13]) {
+  const server = listen(mustCall(2), { ...serverOptions, ...versions });

-  const first = connect('127.0.0.1', server.address.port, {
-    ca, servername: 'agent1', rejectUnauthorized: true,
-  });
-  await first.opened;
+  const { session: first, ticket } = await ticketed(
+    server.address.port, versions,
+    { ca, servername: 'agent1', rejectUnauthorized: true });
   assert.strictEqual(first.authorized, true);
   assert.strictEqual(first.authorizationError, undefined);
-  const ticket = first.session;
   await first.close();

   const second = connect('127.0.0.1', server.address.port, {
     ca, servername: 'agent1', rejectUnauthorized: true, session: ticket,
+    ...versions,
   });
   await second.opened;

@@ -103,19 +114,16 @@ const serverOptions = { cert, key, host: '127.0.0.1', port: 0 };
 // A caller that did not ask for verification still gets the connection, and
 // still gets told the peer never verified. Resumption does not change that
 // either way.
-{
-  const server = listen(mustCall(2), serverOptions);
+for (const versions of [V12, V13]) {
+  const server = listen(mustCall(2), { ...serverOptions, ...versions });

-  const first = connect('127.0.0.1', server.address.port, {
-    rejectUnauthorized: false,
-  });
-  await first.opened;
-  const ticket = first.session;
+  const { session: first, ticket } = await ticketed(
+    server.address.port, versions, { rejectUnauthorized: false });
   const firstError = first.authorizationError;
   await first.close();

   const second = connect('127.0.0.1', server.address.port, {
-    rejectUnauthorized: false, session: ticket,
+    rejectUnauthorized: false, session: ticket, ...versions,
   });
   await second.opened;

diff --git a/test/parallel/test-dtls-robustness.mjs b/test/parallel/test-dtls-robustness.mjs
index a19a63537b3..62a4fdfe62e 100644
--- a/test/parallel/test-dtls-robustness.mjs
+++ b/test/parallel/test-dtls-robustness.mjs
@@ -28,51 +28,57 @@ 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 server = listen(mustCall((session) => {
-  session.onhandshake = mustCall();
-}), { cert, key, port: 0, host: '127.0.0.1' });
-
-const { port } = server.address;
-
-// Fire datagrams that are not a ClientHello at the server. The empty one is
-// legal UDP but can never carry a DTLS record; it must be dropped before it
-// reaches the accept path or a session BIO.
-const junk = [
-  Buffer.from('this is not a DTLS ClientHello'),
-  Buffer.alloc(0),
-  Buffer.from([22]),
-  Buffer.from([22, 254, 253, 0, 0]),
-];
-
-const raw = dgram.createSocket('udp4');
-for (const datagram of junk) {
-  await new Promise((resolve, reject) => {
-    raw.send(datagram, port, '127.0.0.1',
-             (err) => (err ? reject(err) : resolve()));
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  const server = listen(mustCall((session) => {
+    session.onhandshake = mustCall();
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });
+
+  const { port } = server.address;
+
+  // Fire datagrams that are not a ClientHello at the server. The empty one is
+  // legal UDP but can never carry a DTLS record; it must be dropped before it
+  // reaches the accept path or a session BIO.
+  const junk = [
+    Buffer.from('this is not a DTLS ClientHello'),
+    Buffer.alloc(0),
+    Buffer.from([22]),
+    Buffer.from([22, 254, 253, 0, 0]),
+  ];
+
+  const raw = dgram.createSocket('udp4');
+  for (const datagram of junk) {
+    await new Promise((resolve, reject) => {
+      raw.send(datagram, port, '127.0.0.1',
+               (err) => (err ? reject(err) : resolve()));
+    });
+  }
+  await new Promise((resolve) => raw.close(resolve));
+
+  // A real client still completes a handshake against the same server.
+  const client = connect('127.0.0.1', port, {
+    ca: [ca],
+    rejectUnauthorized: false,
+    ...versions,
   });
-}
-await new Promise((resolve) => raw.close(resolve));
-
-// A real client still completes a handshake against the same server.
-const client = connect('127.0.0.1', port, {
-  ca: [ca],
-  rejectUnauthorized: false,
-});

-await client.opened;
+  await client.opened;

-// The junk was delivered and processed well before this handshake finished,
-// so the counters are settled by now.
+  // The junk was delivered and processed well before this handshake finished,
+  // so the counters are settled by now.

-// Exactly one session, from the real client. None of the junk made one.
-assert.strictEqual(getDTLSEndpointSessions(server).size, 1);
-assert.strictEqual(server.stats.serverSessions, 1n);
+  // Exactly one session, from the real client. None of the junk made one.
+  assert.strictEqual(getDTLSEndpointSessions(server).size, 1);
+  assert.strictEqual(server.stats.serverSessions, 1n);

-// Three of the four junk datagrams were turned away by the structural screen
-// before anything was allocated for them. The empty one was dropped earlier
-// still, and the real ClientHello passed the screen rather than being counted
-// by it.
-assert.strictEqual(server.stats.serverRejectedCount, 3n);
+  // Three of the four junk datagrams were turned away by the structural screen
+  // before anything was allocated for them. The empty one was dropped earlier
+  // still, and the real ClientHello passed the screen rather than being counted
+  // by it.
+  assert.strictEqual(server.stats.serverRejectedCount, 3n);

-await client.close();
-await server.close();
+  await client.close();
+  await server.close();
+}
diff --git a/test/parallel/test-dtls-secure-context.mjs b/test/parallel/test-dtls-secure-context.mjs
index ffc764b4101..ad5cb7d7b7c 100644
--- a/test/parallel/test-dtls-secure-context.mjs
+++ b/test/parallel/test-dtls-secure-context.mjs
@@ -26,6 +26,9 @@ 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 V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // The context reports which side it was built for.
 {
   const server = createSecureContext({ cert, key, isServer: true });
@@ -42,9 +45,11 @@ assert.throws(() => new DTLSSecureContext(),

 // One server context serves several endpoints, and one client context
 // serves connections to all of them.
-{
-  const serverContext = createSecureContext({ cert, key, isServer: true });
-  const clientContext = createSecureContext({ ca: [ca] });
+for (const versions of [V12, V13]) {
+  const serverContext = createSecureContext({
+    cert, key, isServer: true, ...versions,
+  });
+  const clientContext = createSecureContext({ ca: [ca], ...versions });

   const endpoints = [];
   for (let i = 0; i < 3; i++) {
@@ -78,9 +83,11 @@ assert.throws(() => new DTLSSecureContext(),
 // The verified identity stays per connection. It is bound to the session
 // with SSL_set1_host(), not to the context, so one context can be used
 // against different peer names -- and still rejects the wrong one.
-{
-  const serverContext = createSecureContext({ cert, key, isServer: true });
-  const clientContext = createSecureContext({ ca: [ca] });
+for (const versions of [V12, V13]) {
+  const serverContext = createSecureContext({
+    cert, key, isServer: true, ...versions,
+  });
+  const clientContext = createSecureContext({ ca: [ca], ...versions });

   const endpoint = listen(() => {}, {
     secureContext: serverContext, host: '127.0.0.1', port: 0,
@@ -135,9 +142,11 @@ assert.throws(() => new DTLSSecureContext(),

 // Options that belong to the context are refused alongside one, rather than
 // being silently ignored.
-{
-  const serverContext = createSecureContext({ cert, key, isServer: true });
-  const clientContext = createSecureContext({ ca: [ca] });
+for (const versions of [V12, V13]) {
+  const serverContext = createSecureContext({
+    cert, key, isServer: true, ...versions,
+  });
+  const clientContext = createSecureContext({ ca: [ca], ...versions });

   for (const [name, value] of [
     ['cert', cert],
@@ -157,7 +166,7 @@ assert.throws(() => new DTLSSecureContext(),

   // This one does accept a connection below, so it gets a real handler.
   const endpoint = listen(() => {}, {
-    cert, key, host: '127.0.0.1', port: 0,
+    cert, key, host: '127.0.0.1', port: 0, ...versions,
   });

   assert.throws(() => connect('127.0.0.1', endpoint.address.port, {
diff --git a/test/parallel/test-dtls-send-error.mjs b/test/parallel/test-dtls-send-error.mjs
index d6ab61b2afa..2bbcbe5d0d6 100644
--- a/test/parallel/test-dtls-send-error.mjs
+++ b/test/parallel/test-dtls-send-error.mjs
@@ -31,6 +31,9 @@ if (!process.features.dtls) {
 const { connect } = await import('node:dtls');
 const dgram = await import('node:dgram');

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // Whether this kernel refuses a broadcast send from an unconfigured socket is
 // not something the test controls, so establish it with a plain UDP socket
 // first. If it does refuse, DTLS has to report that -- deciding from the DTLS
@@ -50,13 +53,14 @@ if (!refusesBroadcast) {

 // Sending to the broadcast address without SO_BROADCAST is refused by the
 // kernel with EACCES, on the first flight, synchronously.
-{
+for (const versions of [V12, V13]) {
   const timeout = 5000;
   const started = Date.now();

   const session = connect('255.255.255.255', 4433, {
     rejectUnauthorized: false,
     handshakeTimeout: timeout,
+    ...versions,
   });

   // Reported from the first flight, which connect() runs before it returns:
diff --git a/test/parallel/test-dtls-send.mjs b/test/parallel/test-dtls-send.mjs
index dda250e817f..a511086a014 100644
--- a/test/parallel/test-dtls-send.mjs
+++ b/test/parallel/test-dtls-send.mjs
@@ -27,21 +27,27 @@ 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 largest application payload that fits in a single DTLS record (2^14).
-const MAX_RECORD = 16384;
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+// The largest application payload send() accepts in a single DTLS record:
+// 2^14, or one byte less under DTLS 1.3, where OpenSSL mis-measures a
+// full-length record on receipt and ends the association.
+const LIMITS = [[V12, 16384], [V13, 16383]];

 // Case 1: send() before the handshake is a state error; afterwards it returns
 // the number of bytes written and the message is delivered whole.
-{
+for (const [versions, MAX_RECORD] of LIMITS) {
   const received = Promise.withResolvers();

   const server = listen(mustCall((session) => {
     session.onmessage = mustCall((data) => received.resolve(data.length));
-  }), { cert, key, port: 0, host: '127.0.0.1' });
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
+    ...versions,
   });

   assert.throws(
@@ -59,14 +65,15 @@ const MAX_RECORD = 16384;

 // Case 2: a payload larger than a single record is refused, and the error
 // names both the size given and the limit rather than just failing.
-{
+for (const [versions, MAX_RECORD] of LIMITS) {
   const server = listen(mustCall((session) => {
     session.onmessage = mustNotCall();
-  }), { cert, key, port: 0, host: '127.0.0.1' });
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
+    ...versions,
   });

   await client.opened;
@@ -88,17 +95,18 @@ const MAX_RECORD = 16384;
 // Case 3: the record limit is what bounds send(), not the MTU. A record
 // larger than the configured MTU is still sent and still arrives; IP
 // fragments it. Getting this wrong would make send() reject valid payloads.
-{
+for (const [versions] of LIMITS) {
   const received = Promise.withResolvers();

   const server = listen(mustCall((session) => {
     session.onmessage = mustCall((data) => received.resolve(data.length));
-  }), { cert, key, port: 0, host: '127.0.0.1' });
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
     mtu: 1200,
+    ...versions,
   });

   await client.opened;
@@ -111,13 +119,14 @@ const MAX_RECORD = 16384;

 // Case 4: a closed session reports that, and is not confused with the size
 // or handshake errors above.
-{
+for (const [versions] of LIMITS) {
   const server = listen(mustCall(),
-                        { cert, key, port: 0, host: '127.0.0.1' });
+                        { cert, key, port: 0, host: '127.0.0.1', ...versions });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
+    ...versions,
   });

   await client.opened;
@@ -136,7 +145,7 @@ const MAX_RECORD = 16384;
 // exportKeyingMaterial() on the same object accepted one. Views with an
 // offset and views whose elements are wider than a byte have to send the
 // bytes they cover, not the bytes of the buffer behind them.
-{
+for (const [versions] of LIMITS) {
   const received = [];
   const done = Promise.withResolvers();
   let expected = 0;
@@ -146,10 +155,10 @@ const MAX_RECORD = 16384;
       received.push(Buffer.from(data).toString('hex'));
       if (received.length === expected) done.resolve();
     };
-  }, { cert, key, host: HOST, port: 0 });
+  }, { cert, key, host: HOST, port: 0, ...versions });

   const client = connect(HOST, server.address.port, {
-    rejectUnauthorized: false,
+    rejectUnauthorized: false, ...versions,
   });
   await client.opened;

diff --git a/test/parallel/test-dtls-server-handshake-error.mjs b/test/parallel/test-dtls-server-handshake-error.mjs
index dcfed3cccae..0ebf88a9d14 100644
--- a/test/parallel/test-dtls-server-handshake-error.mjs
+++ b/test/parallel/test-dtls-server-handshake-error.mjs
@@ -7,7 +7,7 @@
 // nobody had been given yet and was lost. A server saw a client fail to
 // connect and heard nothing at all.

-import { hasCrypto, mustCall, skip } from '../common/index.mjs';
+import { hasCrypto, mustCall, mustNotCall, skip } from '../common/index.mjs';
 import { setTimeout } from 'node:timers/promises';
 import * as fixtures from '../common/fixtures.mjs';
 import assert from 'node:assert';
@@ -45,10 +45,33 @@ async function within(promise, what, ms = 5000) {
 const key = (name) => fixtures.readKey(name).toString();
 const cert = key('agent1-cert.pem');
 const privateKey = key('agent1-key.pem');
+const ca = key('ca1-cert.pem');
+
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+// For each version, a handshake the server fails after it has validated the
+// client's address and announced the session. Under DTLS 1.2 a cipher
+// mismatch does; under DTLS 1.3 the cipher is chosen before the address is
+// validated (see below), so a missing client certificate stands in.
+const FAILURES = [
+  {
+    versions: V12,
+    server: { ciphers: 'ECDHE-RSA-AES256-GCM-SHA384' },
+    client: { ciphers: 'ECDHE-RSA-AES128-GCM-SHA256' },
+    message: /no shared cipher/,
+  },
+  {
+    versions: V13,
+    server: { ca: [ca], requestCert: true },
+    client: {},
+    message: /peer did not return a certificate/,
+  },
+];

 // A handshake that fails on the server's own terms is reported to the
 // session, and the session is handed over in time for a listener to see it.
-{
+for (const { versions, server, client: clientOptions, message } of FAILURES) {
   const reported = Promise.withResolvers();

   const endpoint = listen(mustCall((session) => {
@@ -56,21 +79,22 @@ const privateKey = key('agent1-key.pem');
   }), {
     cert,
     key: privateKey,
-    // Nothing the client below offers.
-    ciphers: 'ECDHE-RSA-AES256-GCM-SHA384',
     host: HOST,
     port: 0,
+    ...server,
+    ...versions,
   });

   const client = connect(HOST, endpoint.address.port, {
     rejectUnauthorized: false,
-    ciphers: 'ECDHE-RSA-AES128-GCM-SHA256',
+    ...clientOptions,
+    ...versions,
   });
   await assert.rejects(client.opened, { name: 'Error' });

   const err = await within(reported.promise,
                            'the server session error');
-  assert.match(err.message, /no shared cipher/);
+  assert.match(err.message, message);

   await endpoint.close();
 }
@@ -79,7 +103,7 @@ const privateKey = key('agent1-key.pem');
 // in place for it. This is what makes the above work, and is worth pinning on
 // its own: a listener attached there must not miss the handshake it belongs
 // to.
-{
+for (const { versions, server, client: clientOptions } of FAILURES) {
   const order = [];
   const settled = Promise.withResolvers();

@@ -92,14 +116,16 @@ const privateKey = key('agent1-key.pem');
   }), {
     cert,
     key: privateKey,
-    ciphers: 'ECDHE-RSA-AES256-GCM-SHA384',
     host: HOST,
     port: 0,
+    ...server,
+    ...versions,
   });

   const client = connect(HOST, endpoint.address.port, {
     rejectUnauthorized: false,
-    ciphers: 'ECDHE-RSA-AES128-GCM-SHA256',
+    ...clientOptions,
+    ...versions,
   });
   await assert.rejects(client.opened, { name: 'Error' });
   await within(settled.promise, 'the server session error');
@@ -109,9 +135,35 @@ const privateKey = key('agent1-key.pem');
   await endpoint.close();
 }

+// Under DTLS 1.3 the cipher suite is chosen from the first ClientHello,
+// because the HelloRetryRequest that carries the cookie commits to it. A
+// client with nothing in common is therefore refused before its address has
+// been validated, and no session is created for it: the client is told by
+// alert, and the server has nothing to report the failure on.
+{
+  const endpoint = listen(mustNotCall(), {
+    cert,
+    key: privateKey,
+    host: HOST,
+    port: 0,
+    ciphers: 'TLS_AES_256_GCM_SHA384',
+    ...V13,
+  });
+
+  const client = connect(HOST, endpoint.address.port, {
+    rejectUnauthorized: false,
+    ciphers: 'TLS_AES_128_GCM_SHA256',
+    ...V13,
+  });
+  await assert.rejects(client.opened, /handshake failure/);
+  assert.strictEqual(endpoint.stats.serverSessions, 0n);
+
+  await endpoint.close();
+}
+
 // Destroying a session from onsession, now that it runs first, must not let
 // the handshake proceed on a session that is already gone.
-{
+for (const versions of [V12, V13]) {
   let first = true;
   const endpoint = listen(mustCall((session) => {
     // Only the first: the probe below has to be left alone.
@@ -119,10 +171,10 @@ const privateKey = key('agent1-key.pem');
       first = false;
       session.destroy();
     }
-  }, 2), { cert, key: privateKey, host: HOST, port: 0 });
+  }, 2), { cert, key: privateKey, host: HOST, port: 0, ...versions });

   const client = connect(HOST, endpoint.address.port, {
-    rejectUnauthorized: false,
+    rejectUnauthorized: false, ...versions,
   });

   // The client gets nothing back and gives up; what matters is that the
@@ -137,7 +189,7 @@ const privateKey = key('agent1-key.pem');

   // Still serving.
   const good = connect(HOST, endpoint.address.port, {
-    rejectUnauthorized: false,
+    rejectUnauthorized: false, ...versions,
   });
   const outcome = await Promise.race([
     good.opened.then(() => 'opened', () => 'failed'),
@@ -151,13 +203,13 @@ const privateKey = key('agent1-key.pem');
 }

 // A handshake that succeeds is unaffected.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(mustCall((session) => {
     session.onerror = () => assert.fail('handshake should have succeeded');
-  }), { cert, key: privateKey, host: HOST, port: 0 });
+  }), { cert, key: privateKey, host: HOST, port: 0, ...versions });

   const client = connect(HOST, endpoint.address.port, {
-    rejectUnauthorized: false,
+    rejectUnauthorized: false, ...versions,
   });
   await client.opened;

diff --git a/test/parallel/test-dtls-servername-validation.mjs b/test/parallel/test-dtls-servername-validation.mjs
index 4daf5af0da9..e121d606c0a 100644
--- a/test/parallel/test-dtls-servername-validation.mjs
+++ b/test/parallel/test-dtls-servername-validation.mjs
@@ -27,57 +27,71 @@ const HOST = '127.0.0.1';
 const key = (name) => fixtures.readKey(name).toString();
 const ca = key('ca1-cert.pem');

-// agent1's certificate is issued for "agent1" by ca1.
-const endpoint = listen(() => {}, {
-  cert: key('agent1-cert.pem'),
-  key: key('agent1-key.pem'),
-  host: HOST,
-  port: 0,
-});
-const port = endpoint.address.port;
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };

-// A name the certificate is not for is rejected. This is the check that a
-// non-string used to skip.
-{
-  const session = connect(HOST, port, { ca: [ca], servername: 'wrong.example' });
-  await assert.rejects(session.opened, { name: 'Error' });
-}
+for (const versions of [V12, V13]) {
+  // agent1's certificate is issued for "agent1" by ca1.
+  const endpoint = listen(() => {}, {
+    cert: key('agent1-cert.pem'),
+    key: key('agent1-key.pem'),
+    host: HOST,
+    port: 0,
+    ...versions,
+  });
+  const port = endpoint.address.port;

-// The right name is accepted, so the check is not simply refusing everything.
-{
-  const session = connect(HOST, port, { ca: [ca], servername: 'agent1' });
-  await session.opened;
-  assert.strictEqual(session.authorized, true);
-  await session.close();
-}
+  // A name the certificate is not for is rejected. This is the check that a
+  // non-string used to skip.
+  {
+    const session = connect(HOST, port, {
+      ca: [ca], servername: 'wrong.example', ...versions,
+    });
+    await assert.rejects(session.opened, { name: 'Error' });
+  }

-// Anything that is not a string is refused up front rather than quietly
-// disabling the check.
-for (const servername of [{}, [], 42, true, null, Symbol('x'), () => {}]) {
-  assert.throws(() => connect(HOST, port, { ca: [ca], servername }), {
-    code: 'ERR_INVALID_ARG_TYPE',
-  }, `servername: ${inspect(servername)}`);
-}
+  // The right name is accepted, so the check is not simply refusing everything.
+  {
+    const session = connect(HOST, port, {
+      ca: [ca], servername: 'agent1', ...versions,
+    });
+    await session.opened;
+    assert.strictEqual(session.authorized, true);
+    await session.close();
+  }

-// An object whose toString() would produce a valid name is still refused;
-// coercing it would make the identity depend on user-controlled coercion.
-assert.throws(() => connect(HOST, port, {
-  ca: [ca],
-  servername: { toString: mustNotCall() },
-}), { code: 'ERR_INVALID_ARG_TYPE' });
+  // Anything that is not a string is refused up front rather than quietly
+  // disabling the check.
+  for (const servername of [{}, [], 42, true, null, Symbol('x'), () => {}]) {
+    assert.throws(() => connect(HOST, port, { ca: [ca], servername }), {
+      code: 'ERR_INVALID_ARG_TYPE',
+    }, `servername: ${inspect(servername)}`);
+  }

-// The empty string keeps its documented meaning: no SNI is sent, and the
-// identity falls back to the host.
-{
-  const session = connect(HOST, port, { ca: [ca], servername: '' });
-  // Verifying 127.0.0.1 against a certificate for "agent1" must fail.
-  await assert.rejects(session.opened, { name: 'Error' });
-}
+  // An object whose toString() would produce a valid name is still refused;
+  // coercing it would make the identity depend on user-controlled coercion.
+  assert.throws(() => connect(HOST, port, {
+    ca: [ca],
+    servername: { toString: mustNotCall() },
+  }), { code: 'ERR_INVALID_ARG_TYPE' });

-// Omitting it entirely also falls back to the host.
-{
-  const session = connect(HOST, port, { ca: [ca], servername: undefined });
-  await assert.rejects(session.opened, { name: 'Error' });
-}
+  // The empty string keeps its documented meaning: no SNI is sent, and the
+  // identity falls back to the host.
+  {
+    const session = connect(HOST, port, {
+      ca: [ca], servername: '', ...versions,
+    });
+    // Verifying 127.0.0.1 against a certificate for "agent1" must fail.
+    await assert.rejects(session.opened, { name: 'Error' });
+  }
+
+  // Omitting it entirely also falls back to the host.
+  {
+    const session = connect(HOST, port, {
+      ca: [ca], servername: undefined, ...versions,
+    });
+    await assert.rejects(session.opened, { name: 'Error' });
+  }

-await endpoint.close();
+  await endpoint.close();
+}
diff --git a/test/parallel/test-dtls-session-id-context.mjs b/test/parallel/test-dtls-session-id-context.mjs
index 4f41d32ef08..1ddabdfe630 100644
--- a/test/parallel/test-dtls-session-id-context.mjs
+++ b/test/parallel/test-dtls-session-id-context.mjs
@@ -25,15 +25,18 @@ const cert = fixtures.readKey('agent1-cert.pem');
 const key = fixtures.readKey('agent1-key.pem');
 const ca = fixtures.readKey('ca1-cert.pem');

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // An explicit context is accepted and does not disturb the handshake.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
     cert, key, host: '127.0.0.1', port: 0,
-    sessionIdContext: 'a'.repeat(32),
+    sessionIdContext: 'a'.repeat(32), ...versions,
   });

   const client = connect('127.0.0.1', endpoint.address.port, {
-    servername: 'agent1', ca: [ca],
+    servername: 'agent1', ca: [ca], ...versions,
   });
   await client.opened;
   assert.strictEqual(endpoint.stats.serverSessions, 1n);
@@ -43,13 +46,13 @@ const ca = fixtures.readKey('ca1-cert.pem');
 }

 // The default is applied when none is given, and handshakes still work.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
-    cert, key, host: '127.0.0.1', port: 0,
+    cert, key, host: '127.0.0.1', port: 0, ...versions,
   });

   const client = connect('127.0.0.1', endpoint.address.port, {
-    servername: 'agent1', ca: [ca],
+    servername: 'agent1', ca: [ca], ...versions,
   });
   await client.opened;
   assert.strictEqual(endpoint.stats.serverSessions, 1n);
diff --git a/test/parallel/test-dtls-session-properties.mjs b/test/parallel/test-dtls-session-properties.mjs
index 6a59ecabc92..ee4bb1a025d 100644
--- a/test/parallel/test-dtls-session-properties.mjs
+++ b/test/parallel/test-dtls-session-properties.mjs
@@ -20,42 +20,50 @@ 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();
-}), {
-  cert: serverCert.toString(),
-  key: serverKey.toString(),
-  port: 0,
-  host: '127.0.0.1',
-});
-
-const session = connect('127.0.0.1', endpoint.address.port, {
-  ca: [ca.toString()],
-  rejectUnauthorized: false,
-});
-
-await session.opened;
-
-// Protocol should be DTLSv1.2.
-assert.match(session.protocol, /DTLS/i);
-
-// Cipher should be an object with name, standardName, version.
-const cipher = session.cipher;
-assert.strictEqual(typeof cipher?.name, 'string');
-assert.strictEqual(typeof cipher?.standardName, 'string');
-assert.strictEqual(typeof cipher?.version, 'string');
-
-// Remote address should be defined.
-const addr = session.remoteAddress;
-assert.ok(addr);
-
-// Peer certificate should be available (PEM string).
-const peerCert = session.peerCertificate;
-assert.ok(peerCert);
-assert.ok(peerCert.includes('BEGIN CERTIFICATE'));
-
-// State should reflect open connection.
-assert.strictEqual(session.destroyed, false);
-
-await session.close();
-await endpoint.close();
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  const endpoint = listen(mustCall((session) => {
+    session.onmessage = mustNotCall();
+  }), {
+    cert: serverCert.toString(),
+    key: serverKey.toString(),
+    port: 0,
+    host: '127.0.0.1',
+    ...versions,
+  });
+
+  const session = connect('127.0.0.1', endpoint.address.port, {
+    ca: [ca.toString()],
+    rejectUnauthorized: false,
+    ...versions,
+  });
+
+  await session.opened;
+
+  // Protocol should be the pinned version.
+  assert.match(session.protocol, /DTLS/i);
+  assert.strictEqual(session.protocol, versions.maxVersion);
+
+  // Cipher should be an object with name, standardName, version.
+  const cipher = session.cipher;
+  assert.strictEqual(typeof cipher?.name, 'string');
+  assert.strictEqual(typeof cipher?.standardName, 'string');
+  assert.strictEqual(typeof cipher?.version, 'string');
+
+  // Remote address should be defined.
+  const addr = session.remoteAddress;
+  assert.ok(addr);
+
+  // Peer certificate should be available (PEM string).
+  const peerCert = session.peerCertificate;
+  assert.ok(peerCert);
+  assert.ok(peerCert.includes('BEGIN CERTIFICATE'));
+
+  // State should reflect open connection.
+  assert.strictEqual(session.destroyed, false);
+
+  await session.close();
+  await endpoint.close();
+}
diff --git a/test/parallel/test-dtls-session-resumption.mjs b/test/parallel/test-dtls-session-resumption.mjs
index 892deadced1..da67cef5830 100644
--- a/test/parallel/test-dtls-session-resumption.mjs
+++ b/test/parallel/test-dtls-session-resumption.mjs
@@ -22,7 +22,7 @@ if (!process.features.dtls) {
   skip('DTLS is not enabled');
 }

-const { randomBytes } = await import('node:crypto');
+const { randomBytes, X509Certificate } = await import('node:crypto');
 const { connect, createSecureContext, listen } = await import('node:dtls');

 const key = (name) => fixtures.readKey(name).toString();
@@ -33,51 +33,66 @@ const serverOptions = {
   cert, key: privateKey, host: '127.0.0.1', port: 0,
 };

-// A session can be carried from one connection to the next.
-{
-  const endpoint = listen(() => {}, serverOptions);
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };

-  const first = connect('127.0.0.1', endpoint.address.port, {
-    rejectUnauthorized: false,
+// Connects, and returns the session with a ticket to resume it from. A DTLS
+// 1.2 server issues its ticket during the handshake, so session.session has
+// it once opened settles. A DTLS 1.3 server sends tickets after the
+// handshake, and the first is taken from onsessionticket.
+async function ticketed(port, versions, options = {}) {
+  const session = connect('127.0.0.1', port, {
+    rejectUnauthorized: false, ...options, ...versions,
   });
-  await first.opened;
+  const issued = Promise.withResolvers();
+  session.onsessionticket = (ticket) => issued.resolve(ticket);
+  await session.opened;
+  const ticket = versions === V12 ? session.session : await issued.promise;
+  return { session, ticket };
+}
+
+// A session can be carried from one connection to the next.
+for (const versions of [V12, V13]) {
+  const endpoint = listen(() => {}, { ...serverOptions, ...versions });
+
+  const { session: first, ticket } =
+    await ticketed(endpoint.address.port, versions);

   assert.strictEqual(first.reused, false);
-  const ticket = first.session;
   assert.ok(Buffer.isBuffer(ticket));
   assert.ok(ticket.length > 0);
   await first.close();

-  const second = connect('127.0.0.1', endpoint.address.port, {
-    rejectUnauthorized: false, session: ticket,
-  });
-  await second.opened;
+  const { session: second, ticket: next } =
+    await ticketed(endpoint.address.port, versions, { session: ticket });
   assert.strictEqual(second.reused, true);

   // A resumed connection can itself be resumed from.
-  assert.ok(Buffer.isBuffer(second.session));
+  assert.ok(Buffer.isBuffer(next));
   await second.close();

   await endpoint.close();
 }

 // Resumption skips the Certificate flight, which is the point of it.
-{
-  const endpoint = listen(() => {}, serverOptions);
+for (const versions of [V12, V13]) {
+  const endpoint = listen(() => {}, { ...serverOptions, ...versions });
   const sent = () => Number(endpoint.stats.bytesSent);

   const beforeFull = sent();
   const full = connect('127.0.0.1', endpoint.address.port, {
-    rejectUnauthorized: false,
+    rejectUnauthorized: false, ...versions,
   });
+  const issued = Promise.withResolvers();
+  full.onsessionticket = (ticket) => issued.resolve(ticket);
   await full.opened;
   const fullBytes = sent() - beforeFull;
-  const ticket = full.session;
+  const ticket = await issued.promise;
   await full.close();

   const beforeResumed = sent();
   const resumed = connect('127.0.0.1', endpoint.address.port, {
-    rejectUnauthorized: false, session: ticket,
+    rejectUnauthorized: false, session: ticket, ...versions,
   });
   await resumed.opened;
   const resumedBytes = sent() - beforeResumed;
@@ -87,9 +102,20 @@ const serverOptions = {
   assert.strictEqual(resumed.reused, true);
   await resumed.close();

-  assert.ok(resumedBytes < fullBytes / 2,
-            `resumed handshake sent ${resumedBytes} bytes, ` +
-            `full sent ${fullBytes}; expected well under half`);
+  if (versions === V12) {
+    assert.ok(resumedBytes < fullBytes / 2,
+              `resumed handshake sent ${resumedBytes} bytes, ` +
+              `full sent ${fullBytes}; expected well under half`);
+  } else {
+    // A DTLS 1.3 server sends its key share either way, and the default
+    // post-quantum hybrid group's is over a kilobyte, so the saving is the
+    // certificate rather than half.
+    const certBytes = new X509Certificate(cert).raw.length;
+    assert.ok(fullBytes - resumedBytes > certBytes,
+              `resumed handshake sent ${resumedBytes} bytes, ` +
+              `full sent ${fullBytes}; expected at least the ` +
+              `${certBytes} byte certificate less`);
+  }

   await endpoint.close();
 }
@@ -97,26 +123,23 @@ const serverOptions = {
 // The cookie exchange still runs for a resumed handshake. Resumption must not
 // become a way around the address validation that the endpoint's DoS
 // protection depends on.
-{
-  const endpoint = listen(() => {}, serverOptions);
+for (const versions of [V12, V13]) {
+  const endpoint = listen(() => {}, { ...serverOptions, ...versions });

-  const first = connect('127.0.0.1', endpoint.address.port, {
-    rejectUnauthorized: false,
-  });
-  await first.opened;
-  const ticket = first.session;
+  const { session: first, ticket } =
+    await ticketed(endpoint.address.port, versions);
   await first.close();

   const before = Number(endpoint.stats.packetsReceived);
   const second = connect('127.0.0.1', endpoint.address.port, {
-    rejectUnauthorized: false, session: ticket,
+    rejectUnauthorized: false, session: ticket, ...versions,
   });
   await second.opened;
   const received = Number(endpoint.stats.packetsReceived) - before;

   // At least two: the first ClientHello is answered with a
-  // HelloVerifyRequest and the client has to send another carrying the
-  // cookie. One would mean DTLSv1_listen() had been bypassed.
+  // HelloVerifyRequest or HelloRetryRequest and the client has to send
+  // another carrying the cookie. One would mean it had been bypassed.
   assert.ok(received >= 2,
             `resumed handshake cost the server ${received} packets; ` +
             'fewer than 2 means the cookie exchange was skipped');
@@ -132,19 +155,17 @@ const serverOptions = {
 // verification while appearing to succeed. This is CVE-2026-48934, fixed in
 // node:tls; the same hazard applies to any API that lets a session travel
 // between connections.
-{
-  const endpoint = listen(() => {}, serverOptions);
+for (const versions of [V12, V13]) {
+  const endpoint = listen(() => {}, { ...serverOptions, ...versions });

-  const first = connect('127.0.0.1', endpoint.address.port, {
-    rejectUnauthorized: false, servername: 'host-a',
-  });
-  await first.opened;
-  const ticket = first.session;
+  const { session: first, ticket } = await ticketed(
+    endpoint.address.port, versions, { servername: 'host-a' });
   await first.close();

   // The identity it was issued for: allowed.
   const same = connect('127.0.0.1', endpoint.address.port, {
     rejectUnauthorized: false, servername: 'host-a', session: ticket,
+    ...versions,
   });
   await same.opened;
   assert.strictEqual(same.reused, true);
@@ -153,6 +174,7 @@ const serverOptions = {
   // Any other: refused before OpenSSL sees it.
   assert.throws(() => connect('127.0.0.1', endpoint.address.port, {
     rejectUnauthorized: false, servername: 'host-b', session: ticket,
+    ...versions,
   }), {
     code: 'ERR_INVALID_ARG_VALUE',
     message: /authenticated for 'host-a'.*cannot be reused for 'host-b'/,
@@ -168,21 +190,18 @@ const serverOptions = {
 }

 // An unusable session falls back to a full handshake rather than failing.
-{
-  const first = listen(() => {}, serverOptions);
-  const client = connect('127.0.0.1', first.address.port, {
-    rejectUnauthorized: false,
-  });
-  await client.opened;
-  const ticket = client.session;
+for (const versions of [V12, V13]) {
+  const first = listen(() => {}, { ...serverOptions, ...versions });
+  const { session: client, ticket } =
+    await ticketed(first.address.port, versions);
   await client.close();
   await first.close();

   // A different endpoint has a different, randomly generated ticket key, so
   // it cannot decrypt the ticket.
-  const second = listen(() => {}, serverOptions);
+  const second = listen(() => {}, { ...serverOptions, ...versions });
   const stale = connect('127.0.0.1', second.address.port, {
-    rejectUnauthorized: false, session: ticket,
+    rejectUnauthorized: false, session: ticket, ...versions,
   });
   await stale.opened;
   assert.strictEqual(stale.reused, false);
@@ -192,21 +211,17 @@ const serverOptions = {

 // ticketKeys makes tickets portable between endpoints, which is what makes
 // them survive a restart or work across a cluster.
-{
+for (const versions of [V12, V13]) {
   const ticketKeys = randomBytes(80);

-  const a = listen(() => {}, { ...serverOptions, ticketKeys });
-  const b = listen(() => {}, { ...serverOptions, ticketKeys });
+  const a = listen(() => {}, { ...serverOptions, ticketKeys, ...versions });
+  const b = listen(() => {}, { ...serverOptions, ticketKeys, ...versions });

-  const first = connect('127.0.0.1', a.address.port, {
-    rejectUnauthorized: false,
-  });
-  await first.opened;
-  const ticket = first.session;
+  const { session: first, ticket } = await ticketed(a.address.port, versions);
   await first.close();

   const second = connect('127.0.0.1', b.address.port, {
-    rejectUnauthorized: false, session: ticket,
+    rejectUnauthorized: false, session: ticket, ...versions,
   });
   await second.opened;
   assert.strictEqual(second.reused, true);
@@ -240,12 +255,13 @@ const serverOptions = {
 }

 // A server session has no identity to bind a blob to, so it offers none.
-{
+for (const versions of [V12, V13]) {
   const gotSession = Promise.withResolvers();
-  const endpoint = listen((s) => gotSession.resolve(s), serverOptions);
+  const endpoint = listen((s) => gotSession.resolve(s),
+                          { ...serverOptions, ...versions });

   const client = connect('127.0.0.1', endpoint.address.port, {
-    rejectUnauthorized: false,
+    rejectUnauthorized: false, ...versions,
   });
   await client.opened;
   const session = await gotSession.promise;
diff --git a/test/parallel/test-dtls-session-table-cleanup.mjs b/test/parallel/test-dtls-session-table-cleanup.mjs
index 9df3ff7a7f1..bb150a78829 100644
--- a/test/parallel/test-dtls-session-table-cleanup.mjs
+++ b/test/parallel/test-dtls-session-table-cleanup.mjs
@@ -28,18 +28,22 @@ 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 V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // ---------------------------------------------------------------------------
 // Case 1: the server closes its own session -> removed from the table.
-{
+for (const versions of [V12, V13]) {
   const gotSession = Promise.withResolvers();

   const server = listen(mustCall((session) => {
     gotSession.resolve(session);
-  }), { cert, key, port: 0, host: '127.0.0.1' });
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
+    ...versions,
   });

   await client.opened;
@@ -56,16 +60,17 @@ const ca = fixtures.readKey('ca1-cert.pem').toString();
 // ---------------------------------------------------------------------------
 // Case 2: the client closes -> the server sees the peer close_notify and
 // removes the session from the table.
-{
+for (const versions of [V12, V13]) {
   const gotSession = Promise.withResolvers();

   const server = listen(mustCall((session) => {
     gotSession.resolve(session);
-  }), { cert, key, port: 0, host: '127.0.0.1' });
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });

   const client = connect('127.0.0.1', server.address.port, {
     ca: [ca],
     rejectUnauthorized: false,
+    ...versions,
   });

   await client.opened;
diff --git a/test/parallel/test-dtls-sni-binding.mjs b/test/parallel/test-dtls-sni-binding.mjs
index 2a65edfc2fa..36db7ad80ee 100644
--- a/test/parallel/test-dtls-sni-binding.mjs
+++ b/test/parallel/test-dtls-sni-binding.mjs
@@ -28,8 +28,11 @@ const key = (name) => fixtures.readKey(name).toString();
 const cert = key('agent1-cert.pem');
 const privateKey = key('agent1-key.pem');

-const serverContext = () =>
-  createSecureContext({ cert, key: privateKey, isServer: true });
+const serverContext = (versions) =>
+  createSecureContext({ cert, key: privateKey, isServer: true, ...versions });
+
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };

 // The binding holds SNI contexts weakly, so a context naming itself does not
 // keep itself alive.
@@ -77,9 +80,9 @@ const serverContext = () =>
 // Only ever assigning it meant a context given a map after a callback kept
 // the callback, which for SNI is a fail-open: a map with no '*' entry means
 // only the names in it are served, and a leftover callback answers the rest.
-{
-  const context = serverContext();
-  const identity = serverContext();
+for (const versions of [V12, V13]) {
+  const context = serverContext(versions);
+  const identity = serverContext(versions);

   let calls = 0;
   context[kHandle].setSNIContexts([], () => { calls++; return identity; });
@@ -94,6 +97,7 @@ const serverContext = () =>
   const unmatched = connect('127.0.0.1', server.address.port, {
     servername: 'unknown.example',
     rejectUnauthorized: false,
+    ...versions,
   });
   await assert.rejects(unmatched.opened, { name: 'Error' });
   assert.strictEqual(calls, 0);
@@ -101,6 +105,7 @@ const serverContext = () =>
   const matched = connect('127.0.0.1', server.address.port, {
     servername: 'known.example',
     rejectUnauthorized: false,
+    ...versions,
   });
   await matched.opened;
   await matched.close();
diff --git a/test/parallel/test-dtls-sni.mjs b/test/parallel/test-dtls-sni.mjs
index 5762ed8ce2b..714efc7c33b 100644
--- a/test/parallel/test-dtls-sni.mjs
+++ b/test/parallel/test-dtls-sni.mjs
@@ -27,6 +27,9 @@ const { connect, createSecureContext, listen } = dtls;

 const key = (name) => fixtures.readKey(name).toString();

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // Bounded, so a regression fails with something readable rather than hanging
 // until the runner gives up.
 async function within(promise, what, ms = 5000) {
@@ -50,7 +53,7 @@ function servedCommonName(session) {

 // The name selects the certificate, and values may be either an options bag
 // or a DTLSSecureContext.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
     cert: agent1Cert,
     key: agent1Key,
@@ -63,6 +66,7 @@ function servedCommonName(session) {
       }),
       '*': { cert: agent1Cert, key: agent1Key },
     },
+    ...versions,
   });

   for (const [servername, expected] of [
@@ -72,6 +76,7 @@ function servedCommonName(session) {
   ]) {
     const client = connect('127.0.0.1', endpoint.address.port, {
       servername, rejectUnauthorized: false,
+      ...versions,
     });
     await client.opened;
     assert.strictEqual(servedCommonName(client), expected);
@@ -83,7 +88,7 @@ function servedCommonName(session) {

 // Without a wildcard, an unmatched name is refused rather than falling back
 // to the endpoint's own certificate.
-{
+for (const versions of [V12, V13]) {
   // The session reaches onsession before SNI selection runs -- the server
   // builds it once DTLSv1_listen() has validated the cookie, and only then
   // drives the handshake that consults the map. So a refused name still
@@ -95,10 +100,12 @@ function servedCommonName(session) {
     host: '127.0.0.1',
     port: 0,
     sni: { 'agent1': { cert: agent1Cert, key: agent1Key } },
+    ...versions,
   });

   const client = connect('127.0.0.1', endpoint.address.port, {
     servername: 'not.configured', rejectUnauthorized: false,
+    ...versions,
   });

   await assert.rejects(client.opened, (err) => {
@@ -111,15 +118,17 @@ function servedCommonName(session) {

 // A client that sends no SNI at all also lands on the wildcard, and is
 // refused when there is none.
-{
+for (const versions of [V12, V13]) {
   const withWildcard = listen(() => {}, {
     cert: agent1Cert, key: agent1Key, host: '127.0.0.1', port: 0,
     sni: { '*': { cert: agent1Cert, key: agent1Key } },
+    ...versions,
   });

   // servername: '' disables the extension entirely.
   const ok = connect('127.0.0.1', withWildcard.address.port, {
     servername: '', rejectUnauthorized: false,
+    ...versions,
   });
   await ok.opened;
   assert.strictEqual(servedCommonName(ok), 'CN=agent1');
@@ -129,10 +138,12 @@ function servedCommonName(session) {
   const withoutWildcard = listen(() => {}, {
     cert: agent1Cert, key: agent1Key, host: '127.0.0.1', port: 0,
     sni: { 'agent1': { cert: agent1Cert, key: agent1Key } },
+    ...versions,
   });

   const refused = connect('127.0.0.1', withoutWildcard.address.port, {
     servername: '', rejectUnauthorized: false,
+    ...versions,
   });
   await assert.rejects(refused.opened, { name: 'Error' });
   await withoutWildcard.close();
@@ -142,7 +153,7 @@ function servedCommonName(session) {
 // ssl->ctx and the verify store is read through it, so an identity that
 // trusts only ca2 rejects a client presenting a ca1 certificate even though
 // the endpoint itself trusts ca1.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
     cert: agent1Cert,
     key: agent1Key,
@@ -159,6 +170,7 @@ function servedCommonName(session) {
         cert: agent1Cert, key: agent1Key, ca: [key('ca2-cert.pem')],
       },
     },
+    ...versions,
   });

   // ca1 client against the ca1 identity: accepted.
@@ -166,6 +178,7 @@ function servedCommonName(session) {
     servername: 'anything',
     cert: agent1Cert, key: agent1Key,
     rejectUnauthorized: false,
+    ...versions,
   });
   await accepted.opened;
   await accepted.close();
@@ -175,6 +188,7 @@ function servedCommonName(session) {
     servername: 'ca2-only',
     cert: agent1Cert, key: agent1Key,
     rejectUnauthorized: false,
+    ...versions,
   });
   await assert.rejects(rejected.opened, { name: 'Error' });

@@ -183,6 +197,7 @@ function servedCommonName(session) {
     servername: 'ca2-only',
     cert: key('agent3-cert.pem'), key: key('agent3-key.pem'),
     rejectUnauthorized: false,
+    ...versions,
   });
   await other.opened;
   await other.close();
@@ -217,7 +232,7 @@ function servedCommonName(session) {

 // A callback may be given instead of a map, for identities that are chosen
 // rather than enumerated. It returns the same two things a map entry holds.
-{
+for (const versions of [V12, V13]) {
   const prepared = createSecureContext({
     cert: localhostCert, key: localhostKey, isServer: true,
   });
@@ -234,6 +249,7 @@ function servedCommonName(session) {
       if (servername === 'agent1') return { cert: agent1Cert, key: agent1Key };
       return undefined;
     },
+    ...versions,
   });

   for (const [servername, expected] of [
@@ -242,6 +258,7 @@ function servedCommonName(session) {
   ]) {
     const client = connect('127.0.0.1', endpoint.address.port, {
       rejectUnauthorized: false, servername,
+      ...versions,
     });
     await client.opened;
     assert.strictEqual(servedCommonName(client), expected);
@@ -253,6 +270,7 @@ function servedCommonName(session) {
   // falling back to the endpoint's own certificate.
   const refused = connect('127.0.0.1', endpoint.address.port, {
     rejectUnauthorized: false, servername: 'no.such.host',
+    ...versions,
   });
   await assert.rejects(refused.opened, { name: 'Error' });

@@ -264,7 +282,7 @@ function servedCommonName(session) {
 // A client that sends no SNI extension still reaches the callback, and is
 // told the name is absent rather than given an empty string it could not
 // tell apart from one.
-{
+for (const versions of [V12, V13]) {
   const seen = [];
   const endpoint = listen(() => {}, {
     cert: agent1Cert,
@@ -275,10 +293,12 @@ function servedCommonName(session) {
       seen.push(servername);
       return { cert: agent1Cert, key: agent1Key };
     },
+    ...versions,
   });

   const client = connect('127.0.0.1', endpoint.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });
   await client.opened;
   assert.deepStrictEqual(seen, [undefined]);
@@ -297,7 +317,7 @@ function servedCommonName(session) {
 // fail without the retaining reference -- whether the object is collected
 // inside the handshake is not something the test can force. It is here to
 // exercise callback-built contexts, not as proof of the retention.
-{
+for (const versions of [V12, V13]) {
   const endpoint = listen(() => {}, {
     cert: agent1Cert,
     key: agent1Key,
@@ -306,11 +326,13 @@ function servedCommonName(session) {
     // A fresh context every time, deliberately: none of them is reachable
     // from JavaScript once the callback returns.
     sni: () => ({ cert: localhostCert, key: localhostKey }),
+    ...versions,
   });

   for (let i = 0; i < 12; i++) {
     const client = connect('127.0.0.1', endpoint.address.port, {
       rejectUnauthorized: false, servername: `host-${i}.example`,
+      ...versions,
     });
     await client.opened;
     assert.strictEqual(servedCommonName(client), 'CN=localhost');
@@ -324,7 +346,7 @@ function servedCommonName(session) {
 // An exception from the callback fails that handshake and is reported to the
 // session, like any other handshake failure. It must not reach the process as
 // an uncaught exception.
-{
+for (const versions of [V12, V13]) {
   process.on('uncaughtException', mustNotCall());

   const thrown = new Error('from the sni callback');
@@ -338,10 +360,12 @@ function servedCommonName(session) {
     host: '127.0.0.1',
     port: 0,
     sni: () => { throw thrown; },
+    ...versions,
   });

   const client = connect('127.0.0.1', endpoint.address.port, {
     rejectUnauthorized: false, servername: 'anything',
+    ...versions,
   });
   await assert.rejects(client.opened, { name: 'Error' });

@@ -354,7 +378,7 @@ function servedCommonName(session) {

 // Validation of what a callback returns, which is checked the same way a map
 // entry is.
-{
+for (const versions of [V12, V13]) {
   const clientContext = createSecureContext({
     cert: agent1Cert, key: agent1Key,
   });
@@ -373,10 +397,12 @@ function servedCommonName(session) {
       host: '127.0.0.1',
       port: 0,
       sni: () => returned,
+      ...versions,
     });

     const client = connect('127.0.0.1', endpoint.address.port, {
       rejectUnauthorized: false, servername: 'anything',
+      ...versions,
     });
     await assert.rejects(client.opened, { name: 'Error' });
     assert.strictEqual(
@@ -390,7 +416,7 @@ function servedCommonName(session) {
 // for being an object. Unwrapping validates the internal field count with a
 // DCHECK only, so in a release build any other native wrapper would have been
 // reinterpreted as a context and its SSL_CTX read out of whatever was there.
-{
+for (const versions of [V12, V13]) {
   const { Gzip } = await import('node:zlib');
   const nativeButNotAContext = new Gzip();

@@ -401,11 +427,13 @@ function servedCommonName(session) {
     port: 0,
     // A different kind of native object, not a DTLSSecureContext.
     sni: () => nativeButNotAContext,
+    ...versions,
   });

   const client = connect('127.0.0.1', server.address.port, {
     servername: 'a.example',
     rejectUnauthorized: false,
+    ...versions,
   });
   await assert.rejects(client.opened, { name: 'Error' });

@@ -415,7 +443,7 @@ function servedCommonName(session) {
 // The sni option belongs to the context. It can be given to
 // createSecureContext(), and combining it with a prepared secureContext is
 // refused rather than silently reconfiguring a shared context.
-{
+for (const versions of [V12, V13]) {
   const identity = { cert: agent1Cert, key: agent1Key };

   const prepared = createSecureContext({
@@ -423,6 +451,7 @@ function servedCommonName(session) {
     key: agent1Key,
     isServer: true,
     sni: { 'named.example': identity },
+    ...versions,
   });

   const server = listen(() => {}, {
@@ -431,6 +460,7 @@ function servedCommonName(session) {

   const named = connect('127.0.0.1', server.address.port, {
     servername: 'named.example', rejectUnauthorized: false,
+    ...versions,
   });
   await named.opened;
   await named.close();
@@ -439,6 +469,7 @@ function servedCommonName(session) {
   // given to listen() directly.
   const other = connect('127.0.0.1', server.address.port, {
     servername: 'other.example', rejectUnauthorized: false,
+    ...versions,
   });
   await assert.rejects(other.opened, { name: 'Error' });

diff --git a/test/parallel/test-dtls-socket-options.mjs b/test/parallel/test-dtls-socket-options.mjs
index 1eecddd4ceb..9b3c7870d2a 100644
--- a/test/parallel/test-dtls-socket-options.mjs
+++ b/test/parallel/test-dtls-socket-options.mjs
@@ -24,6 +24,9 @@ const cert = fixtures.readKey('agent1-cert.pem').toString();
 const key = fixtures.readKey('agent1-key.pem').toString();
 const HOST = '127.0.0.1';

+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // reusePort lets a second endpoint take the same port, which is how a server
 // is spread over several processes.
 {
@@ -60,7 +63,7 @@ const HOST = '127.0.0.1';
 // rcvbuf 212992 and one asking for 1 MiB reported 425984, the kernel having
 // doubled and clamped it. Reading them back would need a getter this module
 // does not have.
-{
+for (const versions of [V12, V13]) {
   const server = listen(() => {}, {
     cert,
     key,
@@ -69,10 +72,12 @@ const HOST = '127.0.0.1';
     udpReceiveBufferSize: 1024 * 1024,
     udpSendBufferSize: 1024 * 1024,
     udpTTL: 64,
+    ...versions,
   });

   const client = connect(HOST, server.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });
   await client.opened;
   await client.close();
diff --git a/test/parallel/test-dtls-srtp.mjs b/test/parallel/test-dtls-srtp.mjs
index 602ad3552ff..fccf6edbf52 100644
--- a/test/parallel/test-dtls-srtp.mjs
+++ b/test/parallel/test-dtls-srtp.mjs
@@ -24,52 +24,59 @@ const ca = fixtures.readKey('ca1-cert.pem').toString();

 const SRTP_PROFILE = 'SRTP_AEAD_AES_128_GCM';

-const gotServerSession = Promise.withResolvers();
-
-const server = listen(mustCall((session) => {
-  gotServerSession.resolve(session);
-}), {
-  cert,
-  key,
-  port: 0,
-  host: '127.0.0.1',
-  srtp: SRTP_PROFILE,
-});
-
-const client = connect('127.0.0.1', server.address.port, {
-  ca: [ca],
-  rejectUnauthorized: false,
-  srtp: SRTP_PROFILE,
-});
-
-await client.opened;
-const serverSession = await gotServerSession.promise;
-await serverSession.opened;
-
-// Both peers negotiate the same SRTP profile.
-assert.strictEqual(client.srtpProfile, SRTP_PROFILE);
-assert.strictEqual(serverSession.srtpProfile, SRTP_PROFILE);
-
-// Both peers derive identical keying material for the same label and length.
-const label = 'EXTRACTOR-dtls_srtp';
-const clientKM = client.exportKeyingMaterial(60, label);
-const serverKM = serverSession.exportKeyingMaterial(60, label);
-assert.strictEqual(clientKM.length, 60);
-assert.deepStrictEqual(clientKM, serverKM);
-
-// The optional context is bound into the derivation: the same context yields
-// the same material on both peers, and a different context yields different
-// material.
-const contextA = Buffer.from('context-a');
-const contextB = Buffer.from('context-b');
-assert.deepStrictEqual(
-  client.exportKeyingMaterial(32, label, contextA),
-  serverSession.exportKeyingMaterial(32, label, contextA),
-);
-assert.notDeepStrictEqual(
-  client.exportKeyingMaterial(32, label, contextA),
-  client.exportKeyingMaterial(32, label, contextB),
-);
-
-await client.close();
-await server.close();
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  const gotServerSession = Promise.withResolvers();
+
+  const server = listen(mustCall((session) => {
+    gotServerSession.resolve(session);
+  }), {
+    cert,
+    key,
+    port: 0,
+    host: '127.0.0.1',
+    srtp: SRTP_PROFILE,
+    ...versions,
+  });
+
+  const client = connect('127.0.0.1', server.address.port, {
+    ca: [ca],
+    rejectUnauthorized: false,
+    srtp: SRTP_PROFILE,
+    ...versions,
+  });
+
+  await client.opened;
+  const serverSession = await gotServerSession.promise;
+  await serverSession.opened;
+
+  // Both peers negotiate the same SRTP profile.
+  assert.strictEqual(client.srtpProfile, SRTP_PROFILE);
+  assert.strictEqual(serverSession.srtpProfile, SRTP_PROFILE);
+
+  // Both peers derive identical keying material for the same label and length.
+  const label = 'EXTRACTOR-dtls_srtp';
+  const clientKM = client.exportKeyingMaterial(60, label);
+  const serverKM = serverSession.exportKeyingMaterial(60, label);
+  assert.strictEqual(clientKM.length, 60);
+  assert.deepStrictEqual(clientKM, serverKM);
+
+  // The optional context is bound into the derivation: the same context yields
+  // the same material on both peers, and a different context yields different
+  // material.
+  const contextA = Buffer.from('context-a');
+  const contextB = Buffer.from('context-b');
+  assert.deepStrictEqual(
+    client.exportKeyingMaterial(32, label, contextA),
+    serverSession.exportKeyingMaterial(32, label, contextA),
+  );
+  assert.notDeepStrictEqual(
+    client.exportKeyingMaterial(32, label, contextA),
+    client.exportKeyingMaterial(32, label, contextB),
+  );
+
+  await client.close();
+  await server.close();
+}
diff --git a/test/parallel/test-dtls-stats.mjs b/test/parallel/test-dtls-stats.mjs
index 50030d103e7..a563f95311e 100644
--- a/test/parallel/test-dtls-stats.mjs
+++ b/test/parallel/test-dtls-stats.mjs
@@ -20,135 +20,151 @@ 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();
+const V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
+for (const versions of [V12, V13]) {
+  const serverReceivedData = Promise.withResolvers();
+  const clientReceivedData = Promise.withResolvers();
+
+  let serverSession;
+
+  // Start server.
+  const endpoint = listen(mustCall((session) => {
+    serverSession = session;
+
+    session.onmessage = mustCall((data) => {
+      assert.strictEqual(data.toString(), 'hello from client');
+      session.send('hello from server');
+      serverReceivedData.resolve();
+    });
+
+    session.onhandshake = mustCall();
+  }), {
+    cert: serverCert.toString(),
+    key: serverKey.toString(),
+    port: 0,
+    host: '127.0.0.1',
+    ...versions,
+  });

-let serverSession;
+  // --- Endpoint stats should be available immediately ---

-// Start server.
-const endpoint = listen(mustCall((session) => {
-  serverSession = session;
+  const epStats = endpoint.stats;
+  assert.ok(epStats, 'endpoint.stats should be defined');
+  assert.ok(epStats.isConnected, 'stats should be connected');
+  assert.ok(epStats.createdAt > 0n, 'createdAt should be set');
+  assert.strictEqual(epStats.destroyedAt, 0n);
+  assert.strictEqual(epStats.clientSessions, 0n);
+  assert.strictEqual(epStats.serverSessions, 0n);
+  assert.strictEqual(epStats.serverBusyCount, 0n);

-  session.onmessage = mustCall((data) => {
-    assert.strictEqual(data.toString(), 'hello from client');
-    session.send('hello from server');
-    serverReceivedData.resolve();
+  // Connect client.
+  const clientSession = connect('127.0.0.1', endpoint.address.port, {
+    ca: [ca.toString()],
+    rejectUnauthorized: false,
+    ...versions,
   });

-  session.onhandshake = mustCall();
-}), {
-  cert: serverCert.toString(),
-  key: serverKey.toString(),
-  port: 0,
-  host: '127.0.0.1',
-});
-
-// --- Endpoint stats should be available immediately ---
-
-const epStats = endpoint.stats;
-assert.ok(epStats, 'endpoint.stats should be defined');
-assert.ok(epStats.isConnected, 'stats should be connected');
-assert.ok(epStats.createdAt > 0n, 'createdAt should be set');
-assert.strictEqual(epStats.destroyedAt, 0n);
-assert.strictEqual(epStats.clientSessions, 0n);
-assert.strictEqual(epStats.serverSessions, 0n);
-assert.strictEqual(epStats.serverBusyCount, 0n);
-
-// Connect client.
-const clientSession = connect('127.0.0.1', endpoint.address.port, {
-  ca: [ca.toString()],
-  rejectUnauthorized: false,
-});
-
-clientSession.onmessage = mustCall((data) => {
-  assert.strictEqual(data.toString(), 'hello from server');
-  clientReceivedData.resolve();
-});
-
-clientSession.onhandshake = mustCall();
-
-// Wait for handshake.
-await clientSession.opened;
-
-// --- Client session stats after handshake ---
-
-const csStats = clientSession.stats;
-assert.ok(csStats, 'session.stats should be defined');
-assert.ok(csStats.isConnected, 'session stats should be connected');
-assert.ok(csStats.createdAt > 0n, 'createdAt should be set');
-assert.ok(csStats.handshakeCompletedAt > 0n, 'handshake timestamp should be set');
-assert.ok(csStats.handshakeCompletedAt >= csStats.createdAt,
-          'handshake should complete after creation');
-assert.strictEqual(csStats.closingAt, 0n);
-assert.strictEqual(csStats.destroyedAt, 0n);
-
-// Record bytes before sending application data.
-const csBytesSentBefore = csStats.bytesSent;
-const csMessagesSentBefore = csStats.messagesSent;
-
-// Send data.
-clientSession.send('hello from client');
-
-// Wait for bidirectional exchange.
-await Promise.all([serverReceivedData.promise, clientReceivedData.promise]);
-
-// --- Client session stats after data exchange ---
-
-assert.ok(csStats.bytesSent > csBytesSentBefore,
-          'bytesSent should increase after send');
-assert.ok(csStats.messagesSent > csMessagesSentBefore,
-          'messagesSent should increase after send');
-assert.ok(csStats.bytesReceived > 0n, 'bytesReceived should be non-zero');
-assert.ok(csStats.messagesReceived > 0n, 'messagesReceived should be non-zero');
-
-// --- Server session stats after data exchange ---
-
-assert.ok(serverSession, 'server session should exist');
-const ssStats = serverSession.stats;
-assert.ok(ssStats.bytesReceived > 0n, 'server bytesReceived should be non-zero');
-assert.ok(ssStats.messagesReceived > 0n, 'server messagesReceived should be non-zero');
-assert.ok(ssStats.bytesSent > 0n, 'server bytesSent should be non-zero');
-assert.ok(ssStats.messagesSent > 0n, 'server messagesSent should be non-zero');
-assert.ok(ssStats.handshakeCompletedAt > 0n, 'server handshake timestamp should be set');
-
-// --- Endpoint stats after data exchange ---
-
-assert.ok(epStats.bytesReceived > 0n, 'endpoint bytesReceived should be non-zero');
-assert.ok(epStats.bytesSent > 0n, 'endpoint bytesSent should be non-zero');
-assert.ok(epStats.packetsReceived > 0n, 'endpoint packetsReceived should be non-zero');
-assert.ok(epStats.packetsSent > 0n, 'endpoint packetsSent should be non-zero');
-assert.strictEqual(epStats.serverSessions, 1n);
-
-// The client's own endpoint should track the client session.
-const clientEpStats = clientSession.endpoint.stats;
-assert.strictEqual(clientEpStats.clientSessions, 1n);
-assert.ok(clientEpStats.bytesSent > 0n);
-assert.ok(clientEpStats.bytesReceived > 0n);
-
-// --- toJSON / toString ---
-
-const epJson = epStats.toJSON();
-assert.ok(epJson);
-assert.strictEqual(typeof epJson.bytesReceived, 'string');
-assert.strictEqual(typeof epJson.bytesSent, 'string');
-assert.strictEqual(typeof epJson.connected, 'boolean');
-
-const ssJson = csStats.toJSON();
-assert.ok(ssJson);
-assert.strictEqual(typeof ssJson.handshakeCompletedAt, 'string');
-assert.strictEqual(typeof ssJson.messagesReceived, 'string');
-
-const epStr = epStats.toString();
-assert.ok(typeof epStr === 'string');
-assert.ok(epStr.includes('bytesReceived'));
-
-// Clean up.
-await clientSession.close();
-
-// After close, session closing timestamp should be set.
-assert.notStrictEqual(csStats.closingAt, 0n);
-
-await endpoint.close();
+  clientSession.onmessage = mustCall((data) => {
+    assert.strictEqual(data.toString(), 'hello from server');
+    clientReceivedData.resolve();
+  });
+
+  clientSession.onhandshake = mustCall();
+
+  // Wait for handshake.
+  await clientSession.opened;
+
+  // --- Client session stats after handshake ---
+
+  const csStats = clientSession.stats;
+  assert.ok(csStats, 'session.stats should be defined');
+  assert.ok(csStats.isConnected, 'session stats should be connected');
+  assert.ok(csStats.createdAt > 0n, 'createdAt should be set');
+  assert.ok(csStats.handshakeCompletedAt > 0n,
+            'handshake timestamp should be set');
+  assert.ok(csStats.handshakeCompletedAt >= csStats.createdAt,
+            'handshake should complete after creation');
+  assert.strictEqual(csStats.closingAt, 0n);
+  assert.strictEqual(csStats.destroyedAt, 0n);
+
+  // Record bytes before sending application data.
+  const csBytesSentBefore = csStats.bytesSent;
+  const csMessagesSentBefore = csStats.messagesSent;
+
+  // Send data.
+  clientSession.send('hello from client');
+
+  // Wait for bidirectional exchange.
+  await Promise.all([serverReceivedData.promise, clientReceivedData.promise]);
+
+  // --- Client session stats after data exchange ---
+
+  assert.ok(csStats.bytesSent > csBytesSentBefore,
+            'bytesSent should increase after send');
+  assert.ok(csStats.messagesSent > csMessagesSentBefore,
+            'messagesSent should increase after send');
+  assert.ok(csStats.bytesReceived > 0n, 'bytesReceived should be non-zero');
+  assert.ok(csStats.messagesReceived > 0n,
+            'messagesReceived should be non-zero');
+
+  // --- Server session stats after data exchange ---
+
+  assert.ok(serverSession, 'server session should exist');
+  const ssStats = serverSession.stats;
+  assert.ok(ssStats.bytesReceived > 0n,
+            'server bytesReceived should be non-zero');
+  assert.ok(ssStats.messagesReceived > 0n,
+            'server messagesReceived should be non-zero');
+  assert.ok(ssStats.bytesSent > 0n, 'server bytesSent should be non-zero');
+  assert.ok(ssStats.messagesSent > 0n,
+            'server messagesSent should be non-zero');
+  assert.ok(ssStats.handshakeCompletedAt > 0n,
+            'server handshake timestamp should be set');
+
+  // --- Endpoint stats after data exchange ---
+
+  assert.ok(epStats.bytesReceived > 0n,
+            'endpoint bytesReceived should be non-zero');
+  assert.ok(epStats.bytesSent > 0n, 'endpoint bytesSent should be non-zero');
+  assert.ok(epStats.packetsReceived > 0n,
+            'endpoint packetsReceived should be non-zero');
+  assert.ok(epStats.packetsSent > 0n,
+            'endpoint packetsSent should be non-zero');
+  assert.strictEqual(epStats.serverSessions, 1n);
+
+  // The client's own endpoint should track the client session.
+  const clientEpStats = clientSession.endpoint.stats;
+  assert.strictEqual(clientEpStats.clientSessions, 1n);
+  assert.ok(clientEpStats.bytesSent > 0n);
+  assert.ok(clientEpStats.bytesReceived > 0n);
+
+  // --- toJSON / toString ---
+
+  const epJson = epStats.toJSON();
+  assert.ok(epJson);
+  assert.strictEqual(typeof epJson.bytesReceived, 'string');
+  assert.strictEqual(typeof epJson.bytesSent, 'string');
+  assert.strictEqual(typeof epJson.connected, 'boolean');
+
+  const ssJson = csStats.toJSON();
+  assert.ok(ssJson);
+  assert.strictEqual(typeof ssJson.handshakeCompletedAt, 'string');
+  assert.strictEqual(typeof ssJson.messagesReceived, 'string');
+
+  const epStr = epStats.toString();
+  assert.ok(typeof epStr === 'string');
+  assert.ok(epStr.includes('bytesReceived'));
+
+  // Clean up.
+  await clientSession.close();
+
+  // After close, session closing timestamp should be set.
+  assert.notStrictEqual(csStats.closingAt, 0n);
+
+  await endpoint.close();
+}

 // Stats say when they have stopped tracking anything.
 //
@@ -156,12 +172,14 @@ await endpoint.close();
 // ever set it: kFinishClose was defined on both stats classes and imported,
 // and no caller in the module ever invoked it. The numbers stayed readable
 // and stopped moving, and isConnected went on saying they were live.
-{
+for (const versions of [V12, V13]) {
   const server = listen(() => {}, {
     cert: serverCert, key: serverKey, host: '127.0.0.1', port: 0,
+    ...versions,
   });
   const client = connect('127.0.0.1', server.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });
   await client.opened;

@@ -183,12 +201,14 @@ await endpoint.close();
 }

 // destroy() reaches them too, not only the graceful path.
-{
+for (const versions of [V12, V13]) {
   const server = listen(() => {}, {
     cert: serverCert, key: serverKey, host: '127.0.0.1', port: 0,
+    ...versions,
   });
   const client = connect('127.0.0.1', server.address.port, {
     rejectUnauthorized: false,
+    ...versions,
   });
   await client.opened;

diff --git a/test/parallel/test-dtls-verify-identity.mjs b/test/parallel/test-dtls-verify-identity.mjs
index 4940f5693a8..18c668eb8d9 100644
--- a/test/parallel/test-dtls-verify-identity.mjs
+++ b/test/parallel/test-dtls-verify-identity.mjs
@@ -25,17 +25,20 @@ 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 V12 = { minVersion: 'DTLSv1.2', maxVersion: 'DTLSv1.2' };
+const V13 = { minVersion: 'DTLSv1.3', maxVersion: 'DTLSv1.3' };
+
 // ---------------------------------------------------------------------------
 // Case 1: a matching servername with rejectUnauthorized succeeds, and the
 // server observes the SNI the client sent (proving it is in the ClientHello).
-{
+for (const versions of [V12, V13]) {
   const sawServername = Promise.withResolvers();

   const server = listen(mustCall((session) => {
     session.onhandshake = mustCall(() => {
       sawServername.resolve(session.servername);
     });
-  }), { cert, key, port: 0, host: '127.0.0.1' });
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });

   const { port } = server.address;

@@ -43,6 +46,7 @@ const ca = fixtures.readKey('ca1-cert.pem').toString();
     ca: [ca],
     rejectUnauthorized: true,
     servername: 'agent1',
+    ...versions,
   });

   const { protocol } = await session.opened;
@@ -57,12 +61,12 @@ const ca = fixtures.readKey('ca1-cert.pem').toString();
 // ---------------------------------------------------------------------------
 // Case 2: a servername that does not match the certificate is rejected during
 // the handshake, even though the certificate chain is otherwise valid.
-{
+for (const versions of [V12, V13]) {
   const server = listen(mustCall((session) => {
     // The client aborts after verifying the certificate, so the server-side
     // handshake never completes.
     session.onhandshake = mustNotCall();
-  }), { cert, key, port: 0, host: '127.0.0.1' });
+  }), { cert, key, port: 0, host: '127.0.0.1', ...versions });

   const { port } = server.address;

@@ -70,6 +74,7 @@ const ca = fixtures.readKey('ca1-cert.pem').toString();
     ca: [ca],
     rejectUnauthorized: true,
     servername: 'wrong.example.com',
+    ...versions,
   });

   await assert.rejects(session.opened, /certificate verify failed/i);