Skip to content

Commit bc430fe

Browse files
authored
Make dependency integration test not flaky (#1245)
1 parent 3c116a4 commit bc430fe

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

test/integration-tests/commands/dependency.test.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ import { FolderContext } from "../../../src/FolderContext";
2525
import { WorkspaceContext } from "../../../src/WorkspaceContext";
2626
import * as sinon from "sinon";
2727
import { Commands } from "../../../src/commands";
28-
import {
29-
activateExtensionForSuite,
30-
activateExtensionForTest,
31-
folderInRootWorkspace,
32-
} from "../utilities/testutilities";
28+
import { activateExtensionForSuite, folderInRootWorkspace } from "../utilities/testutilities";
3329

3430
suite("Dependency Commmands Test Suite", function () {
3531
// full workflow's interaction with spm is longer than the default timeout
@@ -82,7 +78,7 @@ suite("Dependency Commmands Test Suite", function () {
8278
let treeProvider: PackageDependenciesProvider;
8379
let item: PackageNode;
8480

85-
activateExtensionForTest({
81+
activateExtensionForSuite({
8682
async setup(ctx) {
8783
// Check before each test case start:
8884
// Expect to fail without setting up local version
@@ -111,13 +107,14 @@ suite("Dependency Commmands Test Suite", function () {
111107
// Contract: spm edit with user supplied local version of dependency
112108
const windowMock = sinon.stub(vscode.window, "showOpenDialog");
113109
windowMock.resolves([testAssetUri("Swift-Markdown")]);
114-
const result = await vscode.commands.executeCommand(
115-
Commands.USE_LOCAL_DEPENDENCY,
116-
item
117-
);
110+
let result = await vscode.commands.executeCommand(Commands.USE_LOCAL_DEPENDENCY, item);
118111
expect(result).to.be.true;
119112
windowMock.restore();
120113

114+
// Make sure new dependencies resolve before building
115+
result = await vscode.commands.executeCommand(Commands.RESOLVE_DEPENDENCIES);
116+
expect(result).to.be.true;
117+
121118
// This will now pass as we have the required library
122119
const { exitCode, output } = await executeTaskAndWaitForResult(tasks);
123120
expect(exitCode, `${output}`).to.equal(0);

0 commit comments

Comments
 (0)