From f7c461a506c0499a737d457d09f1c08da8d8a0d0 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 28 Nov 2024 11:30:41 +0100 Subject: [PATCH] chore: clean up after failed flatten test run --- .../test/builtin-tasks/flatten.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/hardhat-core/test/builtin-tasks/flatten.ts b/packages/hardhat-core/test/builtin-tasks/flatten.ts index cc5c508816..6249b3cf1c 100644 --- a/packages/hardhat-core/test/builtin-tasks/flatten.ts +++ b/packages/hardhat-core/test/builtin-tasks/flatten.ts @@ -416,14 +416,17 @@ describe("Flatten task", () => { it("should write to an output file when the parameter output is specified", async function () { const outputFile = `${tmpdir()}/flatten.sol`; - await this.env.run(TASK_FLATTEN, { - files: ["contracts/A.sol", "contracts/D.sol"], - output: outputFile, - }); - const expected = await getExpectedSol(); - const actual = readFileSync(outputFile, "utf8"); - assert.equal(actual, expected); - removeSync(outputFile); + try { + await this.env.run(TASK_FLATTEN, { + files: ["contracts/A.sol", "contracts/D.sol"], + output: outputFile, + }); + const expected = await getExpectedSol(); + const actual = readFileSync(outputFile, "utf8"); + assert.equal(actual, expected); + } finally { + removeSync(outputFile); + } }); describe("No contracts to flatten", () => {