@ac-kit/integration-test-util 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tls/create-self-signed-certificate.d.ts +17 -0
- package/dist/tls/create-self-signed-certificate.d.ts.map +1 -0
- package/dist/tls/create-self-signed-certificate.js +51 -0
- package/dist/tls/create-self-signed-certificate.js.map +1 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @ac-kit/integration-test-util
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1af504e: HTTP/2, and TLS with ALPN.
|
|
8
|
+
|
|
9
|
+
- `format-http`: `Http2FrameCodec`, the RFC 9113 frame codec with field blocks
|
|
10
|
+
HPACK-coded on the way, and `HpackEncoder`/`HpackDecoder` (RFC 7541) on their
|
|
11
|
+
own. Sensitive fields are sent never-indexed; an oversized header list is a
|
|
12
|
+
stream error that keeps both ends' tables in step.
|
|
13
|
+
- `net-http`: `Http2ServerConnection` and `Http2ClientConnection` — concurrent
|
|
14
|
+
streams, flow control as backpressure, trailers, `GOAWAY`, a control-frame
|
|
15
|
+
rate guard against rapid-reset floods, and extended `CONNECT` tunnels.
|
|
16
|
+
`HttpServer` serves HTTP/2 through ALPN `h2` and cleartext prior knowledge
|
|
17
|
+
with its `http2` option; `HttpAgent` offers `h2` and multiplexes one
|
|
18
|
+
connection per origin with its own. A request's `protocol` now also works
|
|
19
|
+
over HTTP/1.1, sent as an `Upgrade`.
|
|
20
|
+
- `net-core`: `peekTransport`, to read a connection's first bytes without
|
|
21
|
+
consuming them.
|
|
22
|
+
- `net-transport-node`: TLS in `TcpListener.listen` (`tls` option, ALPN,
|
|
23
|
+
handshake timeout) and in the new `createTcpConnector`; `connectTcp` opens
|
|
24
|
+
`secure` targets with Node's default trust. Concurrent writes waiting for
|
|
25
|
+
`drain` share one listener.
|
|
26
|
+
- `integration-test-util`: `createSelfSignedCertificate`, a throwaway
|
|
27
|
+
certificate for TLS tests.
|
|
28
|
+
- `net-websocket`: `connectWebSocket` over HTTP/2 (RFC 8441), through the same
|
|
29
|
+
version-neutral request.
|
|
30
|
+
|
|
3
31
|
## 0.2.4
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export * from "./docker/init-docker-suite.js";
|
|
|
2
2
|
export * from "./net/is-tcp-port-open.js";
|
|
3
3
|
export * from "./net/try-tcp-connect-n-read-banner.js";
|
|
4
4
|
export * from "./net/try-tls-connect-n-read-banner.js";
|
|
5
|
+
export * from "./tls/create-self-signed-certificate.js";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export * from "./docker/init-docker-suite.js";
|
|
|
2
2
|
export * from "./net/is-tcp-port-open.js";
|
|
3
3
|
export * from "./net/try-tcp-connect-n-read-banner.js";
|
|
4
4
|
export * from "./net/try-tls-connect-n-read-banner.js";
|
|
5
|
+
export * from "./tls/create-self-signed-certificate.js";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** A certificate and its private key, PEM-encoded. */
|
|
2
|
+
export type SelfSignedCertificate = {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly cert: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Create a throwaway self-signed certificate for `localhost` and `127.0.0.1`,
|
|
8
|
+
* for a test that needs a TLS server. Trust it explicitly on the client side
|
|
9
|
+
* (`ca: cert`); nothing is installed anywhere.
|
|
10
|
+
*
|
|
11
|
+
* Uses the `openssl` command, which must be on the `PATH`, with an ECDSA P-256
|
|
12
|
+
* key valid for one day. Takes tens of milliseconds: create one per suite.
|
|
13
|
+
*
|
|
14
|
+
* @throws When `openssl` is missing or fails.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createSelfSignedCertificate(): Promise<SelfSignedCertificate>;
|
|
17
|
+
//# sourceMappingURL=create-self-signed-certificate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-self-signed-certificate.d.ts","sourceRoot":"","sources":["../../src/tls/create-self-signed-certificate.ts"],"names":[],"mappings":"AAQA,sDAAsD;AACtD,MAAM,MAAM,qBAAqB,GAAG;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAgClF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
const execFileAsync = promisify(execFile);
|
|
7
|
+
/**
|
|
8
|
+
* Create a throwaway self-signed certificate for `localhost` and `127.0.0.1`,
|
|
9
|
+
* for a test that needs a TLS server. Trust it explicitly on the client side
|
|
10
|
+
* (`ca: cert`); nothing is installed anywhere.
|
|
11
|
+
*
|
|
12
|
+
* Uses the `openssl` command, which must be on the `PATH`, with an ECDSA P-256
|
|
13
|
+
* key valid for one day. Takes tens of milliseconds: create one per suite.
|
|
14
|
+
*
|
|
15
|
+
* @throws When `openssl` is missing or fails.
|
|
16
|
+
*/
|
|
17
|
+
export async function createSelfSignedCertificate() {
|
|
18
|
+
const directory = await mkdtemp(join(tmpdir(), "ac-kit-tls-"));
|
|
19
|
+
try {
|
|
20
|
+
const keyPath = join(directory, "key.pem");
|
|
21
|
+
const certPath = join(directory, "cert.pem");
|
|
22
|
+
await execFileAsync("openssl", [
|
|
23
|
+
"req",
|
|
24
|
+
"-x509",
|
|
25
|
+
"-newkey",
|
|
26
|
+
"ec",
|
|
27
|
+
"-pkeyopt",
|
|
28
|
+
"ec_paramgen_curve:P-256",
|
|
29
|
+
"-nodes",
|
|
30
|
+
"-days",
|
|
31
|
+
"1",
|
|
32
|
+
"-subj",
|
|
33
|
+
"/CN=localhost",
|
|
34
|
+
"-addext",
|
|
35
|
+
"subjectAltName=DNS:localhost,IP:127.0.0.1",
|
|
36
|
+
"-keyout",
|
|
37
|
+
keyPath,
|
|
38
|
+
"-out",
|
|
39
|
+
certPath,
|
|
40
|
+
]);
|
|
41
|
+
const [key, cert] = await Promise.all([
|
|
42
|
+
readFile(keyPath, "utf8"),
|
|
43
|
+
readFile(certPath, "utf8"),
|
|
44
|
+
]);
|
|
45
|
+
return { key, cert };
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
await rm(directory, { recursive: true, force: true });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=create-self-signed-certificate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-self-signed-certificate.js","sourceRoot":"","sources":["../../src/tls/create-self-signed-certificate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAQ1C;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B;IAChD,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC;IAC/D,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC7C,MAAM,aAAa,CAAC,SAAS,EAAE;YAC9B,KAAK;YACL,OAAO;YACP,SAAS;YACT,IAAI;YACJ,UAAU;YACV,yBAAyB;YACzB,QAAQ;YACR,OAAO;YACP,GAAG;YACH,OAAO;YACP,eAAe;YACf,SAAS;YACT,2CAA2C;YAC3C,SAAS;YACT,OAAO;YACP,MAAM;YACN,QAAQ;SACR,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;YACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;SAC1B,CAAC,CAAC;QACH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;YAAS,CAAC;QACV,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/integration-test-util",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Test helpers that drive and probe external services — Docker containers, TCP and TLS banner checks — from a package's integration tests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docker",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"@ac-kit/tsconfig": "0.1.0",
|
|
49
49
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
50
50
|
"@ac-kit/vitest-config": "0.1.1",
|
|
51
|
-
"@types/node": "26.6.
|
|
51
|
+
"@types/node": "26.6.6",
|
|
52
52
|
"@typescript/native": "typescript@7.0.2",
|
|
53
|
-
"rimraf": "6.1.
|
|
53
|
+
"rimraf": "6.1.4",
|
|
54
54
|
"typedoc": "0.28.20",
|
|
55
55
|
"typescript": "@typescript/typescript6@6.0.2",
|
|
56
|
-
"vite": "8.3.
|
|
57
|
-
"vitest": "5.0
|
|
56
|
+
"vite": "8.3.6",
|
|
57
|
+
"vitest": "5.1.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"vitest": ">=4.0.0"
|