From 72fd9cb13a6dab1cb9dbf0daa56823e993bdc44d Mon Sep 17 00:00:00 2001 From: Paul LeMarquand Date: Tue, 3 Dec 2024 10:37:52 -0500 Subject: [PATCH] Final cleanup --- .vscode-test.js | 2 +- src/commands/build.ts | 8 ++++---- test/integration-tests/DiagnosticsManager.test.ts | 8 -------- test/integration-tests/WorkspaceContext.test.ts | 2 +- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.vscode-test.js b/.vscode-test.js index b15850560..5fa7ce6ba 100644 --- a/.vscode-test.js +++ b/.vscode-test.js @@ -15,7 +15,7 @@ const { defineConfig } = require("@vscode/test-cli"); const path = require("path"); -const isCIBuild = false; // process.env["CI"] === "1"; +const isCIBuild = process.env["CI"] === "1"; const isFastTestRun = process.env["FAST_TEST_RUN"] === "1"; // "env" in launch.json doesn't seem to work with vscode-test diff --git a/src/commands/build.ts b/src/commands/build.ts index 4d07b2949..9c48c2a8b 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -74,25 +74,25 @@ export async function debugBuildWithOptions( ) { const current = ctx.currentFolder; if (!current) { - console.log(" >>> debugBuildWithOptions: No current folder on WorkspaceContext"); + console.log("debugBuildWithOptions: No current folder on WorkspaceContext"); return; } const file = vscode.window.activeTextEditor?.document.fileName; if (!file) { - console.log(" >>> debugBuildWithOptions: No active text editor"); + console.log("debugBuildWithOptions: No active text editor"); return; } const target = current.swiftPackage.getTarget(file); if (!target) { - console.log(" >>> debugBuildWithOptions: No active target"); + console.log("debugBuildWithOptions: No active target"); return; } if (target.type !== "executable") { console.log( - ` >>> debugBuildWithOptions: Target is not an executable, instead is ${target.type}` + `debugBuildWithOptions: Target is not an executable, instead is ${target.type}` ); return; } diff --git a/test/integration-tests/DiagnosticsManager.test.ts b/test/integration-tests/DiagnosticsManager.test.ts index 48db101a9..a55691cea 100644 --- a/test/integration-tests/DiagnosticsManager.test.ts +++ b/test/integration-tests/DiagnosticsManager.test.ts @@ -401,14 +401,12 @@ suite("DiagnosticsManager Test Suite", async function () { test("Parse partial line", async () => { const fixture = testSwiftTask("swift", ["build"], workspaceFolder, toolchain); await vscode.tasks.executeTask(fixture.task); - const diagnosticsPromise = Promise.resolve(); // waitForDiagnostics([mainUri]); // Wait to spawn before writing fixture.process.write(`${mainUri.fsPath}:13:5: err`, ""); fixture.process.write("or: Cannot find 'fo", ""); fixture.process.write("o' in scope"); fixture.process.close(1); await waitForNoRunningTasks(); - await diagnosticsPromise; // Should have parsed assertHasDiagnostic(mainUri, outputDiagnostic); }); @@ -417,7 +415,6 @@ suite("DiagnosticsManager Test Suite", async function () { test("Ignore duplicates", async () => { const fixture = testSwiftTask("swift", ["build"], workspaceFolder, toolchain); await vscode.tasks.executeTask(fixture.task); - const diagnosticsPromise = Promise.resolve(); // waitForDiagnostics([mainUri]); // Wait to spawn before writing const output = `${mainUri.fsPath}:13:5: error: Cannot find 'foo' in scope`; fixture.process.write(output); @@ -425,7 +422,6 @@ suite("DiagnosticsManager Test Suite", async function () { fixture.process.write(output); fixture.process.close(1); await waitForNoRunningTasks(); - await diagnosticsPromise; const diagnostics = vscode.languages.getDiagnostics(mainUri); // Should only include one assert.equal(diagnostics.length, 1); @@ -435,12 +431,10 @@ suite("DiagnosticsManager Test Suite", async function () { test("New set of swiftc diagnostics clear old list", async () => { let fixture = testSwiftTask("swift", ["build"], workspaceFolder, toolchain); await vscode.tasks.executeTask(fixture.task); - let diagnosticsPromise = Promise.resolve(); // waitForDiagnostics([mainUri]); // Wait to spawn before writing fixture.process.write(`${mainUri.fsPath}:13:5: error: Cannot find 'foo' in scope`); fixture.process.close(1); await waitForNoRunningTasks(); - await diagnosticsPromise; let diagnostics = vscode.languages.getDiagnostics(mainUri); // Should only include one assert.equal(diagnostics.length, 1); @@ -449,10 +443,8 @@ suite("DiagnosticsManager Test Suite", async function () { // Run again but no diagnostics returned fixture = testSwiftTask("swift", ["build"], workspaceFolder, toolchain); await vscode.tasks.executeTask(fixture.task); - diagnosticsPromise = Promise.resolve(); // waitForDiagnostics([mainUri]); fixture.process.close(0); await waitForNoRunningTasks(); - await diagnosticsPromise; diagnostics = vscode.languages.getDiagnostics(mainUri); // Should have cleaned up assert.equal(diagnostics.length, 0); diff --git a/test/integration-tests/WorkspaceContext.test.ts b/test/integration-tests/WorkspaceContext.test.ts index e12583216..d7f2030aa 100644 --- a/test/integration-tests/WorkspaceContext.test.ts +++ b/test/integration-tests/WorkspaceContext.test.ts @@ -74,7 +74,7 @@ suite("WorkspaceContext Test Suite", () => { assert.strictEqual( addedCount, 1, - `Expected only one add folder operation, instead got folders: ${recordedFolders}` + `Expected only one add folder operation, instead got folders: ${recordedFolders.map(folder => folder.folder?.name)}` ); } finally { observer?.dispose();