From ab0773b62b58e1122b45ad620a07c757c246baf9 Mon Sep 17 00:00:00 2001 From: "Michael (SPG) Weng" Date: Tue, 3 Dec 2024 12:12:19 -0500 Subject: [PATCH] Minor clean up to the comment and unused import --- test/integration-tests/commands/build.test.ts | 14 ++------------ test/integration-tests/commands/dependency.test.ts | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/test/integration-tests/commands/build.test.ts b/test/integration-tests/commands/build.test.ts index d4af6c67f..0b5d5e9e2 100644 --- a/test/integration-tests/commands/build.test.ts +++ b/test/integration-tests/commands/build.test.ts @@ -29,7 +29,6 @@ import { folderInRootWorkspace, updateSettings, } from "../utilities/testutilities"; -import { pathExists } from "../../../src/utilities/filesystem"; suite("Build Commands", function () { // Default timeout is a bit too short, give it a little bit more time @@ -37,7 +36,6 @@ suite("Build Commands", function () { let folderContext: FolderContext; let workspaceContext: WorkspaceContext; - let buildPath: string; const uri = testAssetUri("defaultPackage/Sources/PackageExe/main.swift"); const breakpoints = [ new vscode.SourceBreakpoint(new vscode.Location(uri, new vscode.Position(2, 0))), @@ -48,7 +46,6 @@ suite("Build Commands", function () { workspaceContext = ctx; await waitForNoRunningTasks(); folderContext = await folderInRootWorkspace("defaultPackage", workspaceContext); - buildPath = path.join(folderContext.folder.fsPath, ".build"); await workspaceContext.focusFolder(folderContext); await vscode.window.showTextDocument(uri); const settingsTeardown = await updateSettings({ @@ -62,13 +59,6 @@ suite("Build Commands", function () { }, }); - teardown(async () => { - // Remove the build directory after each test case - if (await pathExists(buildPath)) { - await fs.rm(buildPath, { recursive: true, force: true }); - } - }); - test("Swift: Run Build", async () => { // A breakpoint will have not effect on the Run command. vscode.debug.addBreakpoints(breakpoints); @@ -83,14 +73,14 @@ suite("Build Commands", function () { let result = await vscode.commands.executeCommand(Commands.RUN); expect(result).to.be.true; + const buildPath = path.join(folderContext.folder.fsPath, ".build"); const beforeItemCount = (await fs.readdir(buildPath)).length; result = await vscode.commands.executeCommand(Commands.CLEAN_BUILD); expect(result).to.be.true; const afterItemCount = (await fs.readdir(buildPath)).length; - // This test will run in order after the Swift: Run Build test, - // where .build folder is going to be filled with built artifacts. + // .build folder is going to be filled with built artifacts after Commands.RUN command // After executing the clean command the build directory is guranteed to have less entry. expect(afterItemCount).to.be.lessThan(beforeItemCount); }); diff --git a/test/integration-tests/commands/dependency.test.ts b/test/integration-tests/commands/dependency.test.ts index 0e2418b5d..55d5543c0 100644 --- a/test/integration-tests/commands/dependency.test.ts +++ b/test/integration-tests/commands/dependency.test.ts @@ -120,7 +120,7 @@ suite("Dependency Commmands Test Suite", function () { // This will now pass as we have the required library const { exitCode, output } = await executeTaskAndWaitForResult(tasks); - expect(exitCode, `Exit code non zero, command output:\n${output}`).to.equal(0); + expect(exitCode, `${output}`).to.equal(0); expect(output).to.include("defaultpackage"); expect(output).to.include("not used by any target"); }