From ca48a128cda30487237f75a261ccf899f9829128 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Fri, 30 Aug 2024 12:21:11 +0200 Subject: [PATCH] Test node server Signed-off-by: Timo Stamm --- packages/connect-node/conformance/server.ts | 19 ++++++++++--------- packages/connect-node/package.json | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/connect-node/conformance/server.ts b/packages/connect-node/conformance/server.ts index af25542e6..7ad82bdaf 100755 --- a/packages/connect-node/conformance/server.ts +++ b/packages/connect-node/conformance/server.ts @@ -40,6 +40,16 @@ import { main(); + +process.on("beforeExit", () => { + console.error("connect-node/conformance/server.ts beforeExit", process.pid); +}); + +process.on("exit", () => { + console.error("connect-node/conformance/server.ts exit", process.pid); +}); + + /** * This program implements a server under test for the connect conformance test * runner. It reads ServerCompatRequest messages from stdin, starts the server @@ -56,7 +66,6 @@ function main() { const req = ServerCompatRequest.fromBinary( stdinAll.subarray(4), ); - console.error("connect-node/conformance/server.ts compat req", req, process.pid); const adapter = connectNodeAdapter({ routes, @@ -113,14 +122,6 @@ function main() { throw new Error("Unknown HTTP version"); } - process.on("beforeExit", () => { - console.error("connect-node/conformance/server.ts beforeExit", process.pid); - }); - - process.on("beforeExit", () => { - console.error("connect-node/conformance/server.ts beforeExit", process.pid); - }); - process.on("SIGTERM", () => { console.error("connect-node/conformance/server.ts SIGTERM", process.pid); if ("closeAllConnections" in server) { diff --git a/packages/connect-node/package.json b/packages/connect-node/package.json index 19c361a06..30916d9aa 100644 --- a/packages/connect-node/package.json +++ b/packages/connect-node/package.json @@ -13,8 +13,8 @@ "build:cjs": "tsc --project tsconfig.build.json --module commonjs --moduleResolution node10 --verbatimModuleSyntax false --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", "build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm", "test": "jasmine --config=jasmine.json", - "conformance:server": "tsc --noEmit && connectconformance --mode server --conf ./conformance/conformance-node.yaml -v ./conformance/server.ts", - "conformance:client": "tsc --noEmit && connectconformance --mode client --conf ./conformance/conformance-node.yaml -v ./conformance/client.ts", + "conformance:server": "tsc --noEmit && connectconformance --mode server --conf ./conformance/conformance-node.yaml -v -- npx tsx ./conformance/server.ts", + "conformance:client": "tsc --noEmit && connectconformance --mode client --conf ./conformance/conformance-node.yaml -v -- npx tsx ./conformance/client.ts", "format": "prettier --write --ignore-unknown '.' '!dist'", "license-header": "license-header", "lint": "eslint --max-warnings 0 .",