Skip to content

Commit

Permalink
Final cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
plemarquand committed Dec 3, 2024
1 parent a90cc0e commit 72fd9cb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .vscode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 0 additions & 8 deletions test/integration-tests/DiagnosticsManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -417,15 +415,13 @@ 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);
fixture.process.write("some random output");
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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/integration-tests/WorkspaceContext.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 72fd9cb

Please sign in to comment.