Skip to content

Commit

Permalink
Make sure build command tests can has no ordering requisite
Browse files Browse the repository at this point in the history
Right now the clean command test relies on the build command test to
complete. That's not behaviour we want. Ideally tests should be able to
run in isolation.

Issue: #1184
  • Loading branch information
michael-weng committed Nov 19, 2024
1 parent b87f8f3 commit dabe01e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/integration-tests/commands/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,23 @@ suite("Build Commands", function () {
await deactivateExtension();
});

test("Swift: Run Build", async () => {
test("Swift: Run Build, Swift: Clean Build", async () => {
// A breakpoint will have not effect on the Run command.
vscode.debug.addBreakpoints(breakpoints);

const result = await vscode.commands.executeCommand(Commands.RUN);
let result = await vscode.commands.executeCommand(Commands.RUN);
expect(result).to.be.true;

vscode.debug.removeBreakpoints(breakpoints);
});

test("Swift: Clean Build", async () => {
const buildPath = path.join(folderContext.folder.fsPath, ".build");
const beforeItemCount = fs.readdirSync(buildPath).length;

const result = await vscode.commands.executeCommand(Commands.CLEAN_BUILD);
result = await vscode.commands.executeCommand(Commands.CLEAN_BUILD);
expect(result).to.be.true;

const afterItemCount = fs.readdirSync(buildPath).length;
// This test will run in order after the Swift: Run Build test,
// This test step will run in order after the Swift: Run Build test step,
// where .build folder is going to be filled with built artifacts.
// After executing the clean command the build directory is guranteed to have less entry.
expect(afterItemCount).to.be.lessThan(beforeItemCount);
Expand Down

0 comments on commit dabe01e

Please sign in to comment.