From 660a0e27b5e9aec7b9eb1b8ee587620dce6b2c9d Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Mon, 24 Mar 2025 15:40:13 +1100 Subject: [PATCH] Don't store hardhat logs in memory and do not print to term even if DebugHardhat=true Hardhat output is logged to file in hardhat.log for each test, and printing to screen is not necessarily needed as it is already logged to file and can create clutter in the output, so stop writing logging output to memory and writing to screen. --- tests/integration/testmanager.nim | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/tests/integration/testmanager.nim b/tests/integration/testmanager.nim index a61d8fba..6b10e94a 100644 --- a/tests/integration/testmanager.nim +++ b/tests/integration/testmanager.nim @@ -18,7 +18,6 @@ import ../examples type Hardhat = ref object process: HardhatProcess - output: seq[string] port: int TestManagerConfig* = object # Echoes stdout from Hardhat process @@ -199,9 +198,6 @@ proc startHardhat( let hardhat = Hardhat.new() - proc onOutputLineCaptured(line: string) {.raises: [].} = - hardhat.output.add line - withLock(test.manager.hardhatPortLock): port = await nextFreePort(test.manager.lastHardhatPort + 1) test.manager.lastHardhatPort = port @@ -215,7 +211,7 @@ proc startHardhat( try: withLock(test.manager.hardhatProcessLock): let node = await HardhatProcess.startNode( - args, false, "hardhat for '" & test.config.name & "'", onOutputLineCaptured + args, false, "hardhat for '" & test.config.name & "'" ) hardhat.process = node hardhat.port = port @@ -224,11 +220,6 @@ proc startHardhat( except CancelledError as e: raise e except CatchableError as e: - if not hardhat.isNil: - test.printOutputMarker(MarkerPosition.Start, "hardhat stdout") - for line in hardhat.output: - echo line - test.printOutputMarker(MarkerPosition.Finish, "hardhat stdout") raiseTestManagerError "hardhat node failed to start: " & e.msg, e proc printResult(test: IntegrationTest, colour: ForegroundColor) = @@ -396,12 +387,6 @@ proc teardownHardhat(test: IntegrationTest, hardhat: Hardhat) {.async: (raises: warn "Failed to stop hardhat node, continuing", error = e.msg, test = test.config.name - if test.manager.config.debugHardhat: - test.printOutputMarker(MarkerPosition.Start, "Hardhat stdout") - for line in hardhat.output: - echo line - test.printOutputMarker(MarkerPosition.Finish, "Hardhat stdout") - test.manager.hardhats.keepItIf(it != hardhat) proc teardownTest(test: IntegrationTest) {.async: (raises: []).} =