Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dependency integration test not flaky #1245

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions test/integration-tests/commands/dependency.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ import { FolderContext } from "../../../src/FolderContext";
import { WorkspaceContext } from "../../../src/WorkspaceContext";
import * as sinon from "sinon";
import { Commands } from "../../../src/commands";
import {
activateExtensionForSuite,
activateExtensionForTest,
folderInRootWorkspace,
} from "../utilities/testutilities";
import { activateExtensionForSuite, folderInRootWorkspace } from "../utilities/testutilities";

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

activateExtensionForTest({
activateExtensionForSuite({
async setup(ctx) {
// Check before each test case start:
// Expect to fail without setting up local version
Expand Down Expand Up @@ -111,13 +107,14 @@ suite("Dependency Commmands Test Suite", function () {
// Contract: spm edit with user supplied local version of dependency
const windowMock = sinon.stub(vscode.window, "showOpenDialog");
windowMock.resolves([testAssetUri("Swift-Markdown")]);
const result = await vscode.commands.executeCommand(
Commands.USE_LOCAL_DEPENDENCY,
item
);
let result = await vscode.commands.executeCommand(Commands.USE_LOCAL_DEPENDENCY, item);
expect(result).to.be.true;
windowMock.restore();

// Make sure new dependencies resolve before building
result = await vscode.commands.executeCommand(Commands.RESOLVE_DEPENDENCIES);
expect(result).to.be.true;

// This will now pass as we have the required library
const { exitCode, output } = await executeTaskAndWaitForResult(tasks);
expect(exitCode, `${output}`).to.equal(0);
Expand Down
Loading