diff options
author | Florian Dold <florian@dold.me> | 2023-02-16 13:54:19 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-02-16 13:54:19 +0100 |
commit | eca3819bcdf8f2a715c1f5e212ab4d81e3bbfd45 (patch) | |
tree | 64dd1288d9865176b6a47ea0d1c37b0af02316c6 /packages/taler-harness | |
parent | fedc45144ff25d61631015b8fb3c9e27a6c695a3 (diff) | |
download | wallet-core-eca3819bcdf8f2a715c1f5e212ab4d81e3bbfd45.tar.xz |
taler-util: node http fixes
Diffstat (limited to 'packages/taler-harness')
-rw-r--r-- | packages/taler-harness/src/harness/harness.ts | 19 | ||||
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-kyc.ts | 12 |
2 files changed, 23 insertions, 8 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index 518b98d82..81dabf348 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -1895,8 +1895,23 @@ export async function runTestWithState( process.on("SIGINT", handleSignal); process.on("SIGTERM", handleSignal); - process.on("unhandledRejection", handleSignal); - process.on("uncaughtException", handleSignal); + + process.on("unhandledRejection", (reason: unknown, promise: any) => { + logger.warn( + `**** received unhandled rejection (${reason}), terminating test ${testName}`, + ); + logger.warn(`reason type: ${typeof reason}`); + gc.shutdownSync(); + process.exit(1); + }); + process.on("uncaughtException", (error, origin) => { + logger.warn( + `**** received uncaught exception (${error}), terminating test ${testName}`, + ); + console.warn("stack", error.stack); + gc.shutdownSync(); + process.exit(1); + }); try { logger.info("running test in directory", gc.testDir); diff --git a/packages/taler-harness/src/integrationtests/test-kyc.ts b/packages/taler-harness/src/integrationtests/test-kyc.ts index 915c3d470..bb40d9274 100644 --- a/packages/taler-harness/src/integrationtests/test-kyc.ts +++ b/packages/taler-harness/src/integrationtests/test-kyc.ts @@ -17,11 +17,7 @@ /** * Imports. */ -import { - Duration, - j2s, - NotificationType, -} from "@gnu-taler/taler-util"; +import { Duration, j2s, NotificationType } from "@gnu-taler/taler-util"; import { BankAccessApi, BankApi, @@ -232,7 +228,11 @@ async function runTestfakeKycService(): Promise<TestfakeKycService> { if (path === "/oauth/v2/login") { // Usually this would render some HTML page for the user to log in, // but we return JSON here. - const redirUri = new URL(qp.get("redirect_uri")!); + const redirUriUnparsed = qp.get("redirect_uri"); + if (!redirUriUnparsed) { + throw Error("missing redirect_url"); + } + const redirUri = new URL(redirUriUnparsed); redirUri.searchParams.set("code", "code_is_ok"); res.writeHead(200, { "Content-Type": "application/json" }); res.end( |