diff --git a/docs/examples/ca-fingerprint/index.js b/docs/examples/ca-fingerprint/index.js index b4dfc41124c..d5075f8fec9 100644 --- a/docs/examples/ca-fingerprint/index.js +++ b/docs/examples/ca-fingerprint/index.js @@ -3,7 +3,7 @@ const crypto = require('node:crypto') const https = require('node:https') const { Client, buildConnector } = require('../../../') -const pem = require('https-pem') +const pem = require('../../../test/fixtures/https-pem.js') const caFingerprint = getFingerprint(pem.cert.toString() .split('\n') diff --git a/package.json b/package.json index 48948be80dd..c1cdeb8b2ae 100644 --- a/package.json +++ b/package.json @@ -64,12 +64,11 @@ "scripts": { "build:node": "esbuild index-fetch.js --bundle --platform=node --outfile=undici-fetch.js --define:esbuildDetection=1 --keep-names && node scripts/strip-comments.js", "build:wasm": "node build/wasm.js --docker", - "generate-pem": "node scripts/generate-pem.js", "lint": "eslint --cache", "lint:fix": "eslint --fix --cache", "test": "npm run test:javascript && cross-env NODE_V8_COVERAGE= npm run test:typescript", "test:javascript": "npm run test:javascript:no-jest && npm run test:jest", - "test:javascript:no-jest": "npm run generate-pem && npm run test:unit && npm run test:node-fetch && npm run test:cache && npm run test:cache-interceptor && npm run test:interceptors && npm run test:fetch && npm run test:cookies && npm run test:eventsource && npm run test:wpt && npm run test:websocket && npm run test:node-test && npm run test:cache-tests", + "test:javascript:no-jest": "npm run test:unit && npm run test:node-fetch && npm run test:cache && npm run test:cache-interceptor && npm run test:interceptors && npm run test:fetch && npm run test:cookies && npm run test:eventsource && npm run test:wpt && npm run test:websocket && npm run test:node-test && npm run test:cache-tests", "test:javascript:without-intl": "npm run test:javascript:no-jest", "test:busboy": "borp -p \"test/busboy/*.js\"", "test:cache": "borp -p \"test/cache/*.js\"", @@ -119,7 +118,6 @@ "esbuild": "^0.25.2", "eslint": "^9.9.0", "fast-check": "^4.1.1", - "https-pem": "^3.0.0", "husky": "^9.0.7", "jest": "^29.0.2", "neostandard": "^0.12.0", diff --git a/scripts/generate-pem.js b/scripts/generate-pem.js deleted file mode 100644 index 88ac5c8392f..00000000000 --- a/scripts/generate-pem.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict' -/* istanbul ignore file */ - -require('https-pem/install') diff --git a/test/connect-pre-shared-session.js b/test/connect-pre-shared-session.js index c10e3c82a3d..86e7be5d185 100644 --- a/test/connect-pre-shared-session.js +++ b/test/connect-pre-shared-session.js @@ -4,8 +4,8 @@ const { tspl } = require('@matteo.collina/tspl') const { test, after, mock } = require('node:test') const { Client } = require('..') const { createServer } = require('node:https') -const pem = require('https-pem') const tls = require('node:tls') +const pem = require('./fixtures/https-pem.js') test('custom session passed to client will be used in tls connect call', async (t) => { t = tspl(t, { plan: 4 }) diff --git a/test/fetch/cookies.js b/test/fetch/cookies.js index ac30938dbad..29ca9152771 100644 --- a/test/fetch/cookies.js +++ b/test/fetch/cookies.js @@ -7,9 +7,9 @@ const assert = require('node:assert') const { tspl } = require('@matteo.collina/tspl') const { Client, fetch, Headers } = require('../..') const { closeServerAsPromise } = require('../utils/node-http') -const pem = require('https-pem') const { createSecureServer } = require('node:http2') const { closeClientAndServerAsPromise } = require('../utils/node-http') +const pem = require('../fixtures/https-pem.js') test('Can receive set-cookie headers from a server using fetch - issue #1262', async (t) => { const server = createServer({ joinDuplicateHeaders: true }, (req, res) => { diff --git a/test/fetch/http2.js b/test/fetch/http2.js index afce8c4001d..b70b29164fe 100644 --- a/test/fetch/http2.js +++ b/test/fetch/http2.js @@ -7,7 +7,7 @@ const { Readable } = require('node:stream') const { test } = require('node:test') const { tspl } = require('@matteo.collina/tspl') -const pem = require('https-pem') +const pem = require('../fixtures/https-pem.js') const { Client, fetch, Headers } = require('../..') diff --git a/test/fixtures/https-pem.js b/test/fixtures/https-pem.js new file mode 100644 index 00000000000..d5ade52ed73 --- /dev/null +++ b/test/fixtures/https-pem.js @@ -0,0 +1,72 @@ +'use strict' + +const key = `-----BEGIN PRIVATE KEY----- +MIIG/gIBADANBgkqhkiG9w0BAQEFAASCBugwggbkAgEAAoIBgQDwcIAYm12nmQTG +B3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NHmczeakjj11tgtctsYbwgDSUYGA3w+DC +KD1aSfeuR3Hj89cSsVRrRrPFFih46Tr2PpTNoK6MtPH3RPJKV+Db8E1V2mXmNE0M +Lg6ramSHsD9iZXTLhG2JO+/876k3N3kCAwEAAaM3MDUwFAYDVR0RBA0wC4IJbG9j +YWxob3N0MB0GA1UdDgQWBBR459BlAel5MqCtG0DrvVtMZlQfuTANBgkqhkiG9w0B +AQsFAAOCAYEAaTFWjK/LFzOo+0TWqTTj4WC4N3I8JFrHnlqFJlpchYTW2z92SU1G +iEzFjWzuDNjp5KM9BqlmGtzXZvy6MItGkYsjPRdPVU0rbCmyTho6y77kTyiEG12V +UAJ1in3FOQfDwLPcp7wQRgCQq3iZlv7pwXp2Lm5fzu8kZPnxmTVdiKQun9Ps7uKq +BoM0fM2K14MxVO4Wc0SERnaPszE7xAhkIcs+NRT/gHYdTBlPhao83S3LOOdtCqCP +pNUOEaShlwI5bVsDPUXNX/eS0MYFNlsYTb5rCxK8jf3W3KNjKTOzN94pHiQOhpkg +xMPPi3m03/9oKTVXBtHI2A+u3ukheKE6sBXCLdv/GEs9zYI49zmpQxNWz5EOumWL +k+W/vPv7cD6LeHxxp+nCbEJi1gZtYb3gMY1sLkMNxcOu0QHTqHfme+k7VKWm8anO +3ogGdGtPuPAD/qjMwg3ChSDLl5Ur/E9UPlD4yM/7KtUD7mLv+jbddA62EiA9MxVB +t+yt7pOwOA66 +-----END CERTIFICATE-----` + +module.exports = { key, cert } diff --git a/test/h2c-client.js b/test/h2c-client.js index a726082bd80..ac78ebc0d23 100644 --- a/test/h2c-client.js +++ b/test/h2c-client.js @@ -5,7 +5,7 @@ const { once } = require('node:events') const { test } = require('node:test') const { tspl } = require('@matteo.collina/tspl') -const pem = require('https-pem') +const pem = require('./fixtures/https-pem.js') const { H2CClient } = require('..') diff --git a/test/http2.js b/test/http2.js index b185ab8a864..68f4e9e45f9 100644 --- a/test/http2.js +++ b/test/http2.js @@ -7,7 +7,7 @@ const { createReadStream, readFileSync } = require('node:fs') const { once } = require('node:events') const { Writable, pipeline, PassThrough, Readable } = require('node:stream') -const pem = require('https-pem') +const pem = require('./fixtures/https-pem.js') const { Client, Agent, FormData } = require('..') diff --git a/test/https.js b/test/https.js index 89e55b6a5ae..7c2c4398779 100644 --- a/test/https.js +++ b/test/https.js @@ -4,7 +4,7 @@ const { tspl } = require('@matteo.collina/tspl') const { test, after } = require('node:test') const { Client } = require('..') const { createServer } = require('node:https') -const pem = require('https-pem') +const pem = require('./fixtures/https-pem.js') test('https get with tls opts', async (t) => { t = tspl(t, { plan: 6 }) diff --git a/test/interceptors/dns.js b/test/interceptors/dns.js index 0d7e633bff6..cb0020bacc7 100644 --- a/test/interceptors/dns.js +++ b/test/interceptors/dns.js @@ -9,7 +9,7 @@ const { createServer: createSecureServer } = require('node:https') const { once } = require('node:events') const { tspl } = require('@matteo.collina/tspl') -const pem = require('https-pem') +const pem = require('../fixtures/https-pem.js') const { interceptors, Agent } = require('../..') const { dns } = interceptors diff --git a/test/node-test/ca-fingerprint.js b/test/node-test/ca-fingerprint.js index 54b9d7adc31..6f32f7662cd 100644 --- a/test/node-test/ca-fingerprint.js +++ b/test/node-test/ca-fingerprint.js @@ -4,7 +4,7 @@ const crypto = require('node:crypto') const https = require('node:https') const { test } = require('node:test') const { Client, buildConnector } = require('../..') -const pem = require('https-pem') +const pem = require('../fixtures/https-pem.js') const { tspl } = require('@matteo.collina/tspl') const caFingerprint = getFingerprint(pem.cert.toString() diff --git a/test/node-test/client-dispatch.js b/test/node-test/client-dispatch.js index 0f467f75cb4..dc4b6cfe7ee 100644 --- a/test/node-test/client-dispatch.js +++ b/test/node-test/client-dispatch.js @@ -7,7 +7,7 @@ const https = require('node:https') const { Client, Pool, errors } = require('../..') const stream = require('node:stream') const { createSecureServer } = require('node:http2') -const pem = require('https-pem') +const pem = require('../fixtures/https-pem.js') const { tspl } = require('@matteo.collina/tspl') const { closeServerAsPromise, closeClientAndServerAsPromise } = require('../utils/node-http') diff --git a/test/node-test/client-errors.js b/test/node-test/client-errors.js index 83a7e8a5064..8b8bea799a8 100644 --- a/test/node-test/client-errors.js +++ b/test/node-test/client-errors.js @@ -7,7 +7,7 @@ const { Readable } = require('node:stream') const { test, after } = require('node:test') const { Client, Pool, errors } = require('../..') const { createServer } = require('node:http') -const pem = require('https-pem') +const pem = require('../fixtures/https-pem.js') const { tspl } = require('@matteo.collina/tspl') const { kSocket } = require('../../lib/core/symbols') diff --git a/test/node-test/diagnostics-channel/get-h2.js b/test/node-test/diagnostics-channel/get-h2.js index 90d16287087..d8d2ad40f65 100644 --- a/test/node-test/diagnostics-channel/get-h2.js +++ b/test/node-test/diagnostics-channel/get-h2.js @@ -5,7 +5,7 @@ const { test, after } = require('node:test') const { createSecureServer } = require('node:http2') const diagnosticsChannel = require('node:diagnostics_channel') const { once } = require('node:events') -const pem = require('https-pem') +const pem = require('../../fixtures/https-pem.js') const { Client } = require('../../..') test('Diagnostics channel - get support H2', async t => { diff --git a/test/node-test/unix.js b/test/node-test/unix.js index 6ea46146583..398625a3c97 100644 --- a/test/node-test/unix.js +++ b/test/node-test/unix.js @@ -4,9 +4,9 @@ const { test } = require('node:test') const { Client, Pool } = require('../../') const http = require('node:http') const https = require('node:https') -const pem = require('https-pem') const fs = require('node:fs') const { tspl } = require('@matteo.collina/tspl') +const pem = require('../fixtures/https-pem.js') const skip = process.platform === 'win32'