From c1f0888096777e2b8d12cc373ab536f16c409c2f Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Thu, 20 Feb 2025 11:50:16 +1100 Subject: [PATCH] formatting --- tests/integration/hardhatprocess.nim | 11 +++-------- tests/integration/nodeprocess.nim | 17 ++++++++--------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/tests/integration/hardhatprocess.nim b/tests/integration/hardhatprocess.nim index 51967f5c..52af0810 100644 --- a/tests/integration/hardhatprocess.nim +++ b/tests/integration/hardhatprocess.nim @@ -36,10 +36,8 @@ method workingDir(node: HardhatProcess): string = return currentSourcePath() / ".." / ".." / ".." / "vendor" / "codex-contracts-eth" method executable(node: HardhatProcess): string = - return "node_modules" / ".bin" / (when defined(windows): - "hardhat.cmd" - else: - "hardhat") + return + "node_modules" / ".bin" / (when defined(windows): "hardhat.cmd" else: "hardhat") method startedOutput(node: HardhatProcess): string = return "Started HTTP and WebSocket JSON-RPC server at" @@ -80,10 +78,7 @@ method start*( let poptions = node.processOptions + {AsyncProcessOption.StdErrToStdOut} let args = @["node", "--export", "deployment-localhost.json"].concat(node.arguments) trace "starting node", - args, - executable, - workingDir = node.workingDir, - processOptions = poptions + args, executable, workingDir = node.workingDir, processOptions = poptions try: node.process = await startProcess( diff --git a/tests/integration/nodeprocess.nim b/tests/integration/nodeprocess.nim index 3fc020a4..e29c5811 100644 --- a/tests/integration/nodeprocess.nim +++ b/tests/integration/nodeprocess.nim @@ -14,7 +14,7 @@ import ./codexclient export codexclient export chronicles -{.push raises:[].} +{.push raises: [].} logScope: topics = "integration testing node process" @@ -44,9 +44,7 @@ method processOptions(node: NodeProcess): set[AsyncProcessOption] {.base, gcsafe method outputLineEndings(node: NodeProcess): string {.base, gcsafe.} = raiseAssert "not implemented" -method onOutputLineCaptured( - node: NodeProcess, line: string -) {.base, gcsafe.} = +method onOutputLineCaptured(node: NodeProcess, line: string) {.base, gcsafe.} = raiseAssert "not implemented" method start*(node: NodeProcess) {.base, async.} = @@ -126,10 +124,9 @@ method stop*(node: NodeProcess, expectedErrCode: int = -1) {.base, async.} = if not node.process.isNil: trace "terminating node process..." try: - let exitCode = await node.process.terminateAndWaitForExit(2.seconds) - if exitCode > 0 and - exitCode != 143 and # 143 = SIGTERM (initiated above) - exitCode != expectedErrCode: + let exitCode = await node.process.terminateAndWaitForExit(2.seconds) + if exitCode > 0 and exitCode != 143 and # 143 = SIGTERM (initiated above) + exitCode != expectedErrCode: error "process exited with a non-zero exit code", exitCode trace "node stopped", exitCode except CancelledError as error: @@ -139,7 +136,8 @@ method stop*(node: NodeProcess, expectedErrCode: int = -1) {.base, async.} = let forcedExitCode = await node.process.killAndWaitForExit(3.seconds) trace "node process forcibly killed with exit code: ", exitCode = forcedExitCode except CatchableError as e: - error "failed to kill node process in time, it will be killed when the parent process exits", error = e.msg + error "failed to kill node process in time, it will be killed when the parent process exits", + error = e.msg writeStackTrace() finally: proc closeProcessStreams() {.async: (raises: []).} = @@ -147,6 +145,7 @@ method stop*(node: NodeProcess, expectedErrCode: int = -1) {.base, async.} = await node.process.closeWait() node.process = nil trace "node process' streams closed" + asyncSpawn closeProcessStreams() proc waitUntilOutput*(node: NodeProcess, output: string) {.async.} =