Skip to content

Commit 6dbf5b3

Browse files
committed
Fix node 18
1 parent 5f18419 commit 6dbf5b3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/test/cache-github-fake.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as pathlib from 'path';
99
import * as assert from 'uvu/assert';
1010
import * as crypto from 'crypto';
1111
import * as selfsigned from 'selfsigned';
12+
import * as x509 from '@peculiar/x509';
1213
import {suite} from 'uvu';
1314
import {fileURLToPath} from 'url';
1415
import {ExitResult, WireitTestRig} from './util/test-rig.js';
@@ -23,6 +24,13 @@ const __filename = fileURLToPath(import.meta.url);
2324
const __dirname = pathlib.dirname(__filename);
2425
const repoRoot = pathlib.resolve(__dirname, '..', '..');
2526

27+
if (x509.cryptoProvider.size === 0) {
28+
// On Node 18, the x509 library which selfsigned uses fails to find a crypto
29+
// provider (not sure why). This forces the Node-native one in there.
30+
// TODO(aomarks) Do we really need to use TLS for this test?
31+
x509.cryptoProvider.set(crypto.webcrypto);
32+
}
33+
2634
const SELF_SIGNED_CERT = await selfsigned.generate(
2735
[{name: 'commonName', value: 'localhost'}],
2836
// More recent versions of TLS require a larger minimum key size than the

0 commit comments

Comments
 (0)