Skip to content

Commit 4c91308

Browse files
committed
Log the Package.resolved on a failed dependencies test
1 parent afe43b4 commit 4c91308

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414
import { expect } from "chai";
15+
import * as fs from "fs/promises";
16+
import * as path from "path";
1517
import * as vscode from "vscode";
1618

1719
import { FolderContext } from "@src/FolderContext";
@@ -22,9 +24,13 @@ import { PackageNode, ProjectPanelProvider } from "@src/ui/ProjectPanelProvider"
2224
import { testAssetUri } from "../../fixtures";
2325
import { tag } from "../../tags";
2426
import { waitForNoRunningTasks } from "../../utilities/tasks";
25-
import { activateExtensionForSuite, findWorkspaceFolder } from "../utilities/testutilities";
27+
import {
28+
activateExtensionForSuite,
29+
findWorkspaceFolder,
30+
folderInRootWorkspace,
31+
} from "../utilities/testutilities";
2632

27-
tag("large").suite("Dependency Commmands Test Suite", function () {
33+
tag("large").suite("Dependency Commands Test Suite", function () {
2834
let depsContext: FolderContext;
2935
let workspaceContext: WorkspaceContext;
3036

@@ -95,12 +101,25 @@ tag("large").suite("Dependency Commmands Test Suite", function () {
95101
headers.find(n => n.name === "Dependencies") as PackageNode
96102
)?.getChildren();
97103
const childrenNames = depChildren?.map(n => n.name) ?? [];
104+
105+
const dependenciesFolderContext = await folderInRootWorkspace(
106+
"dependencies",
107+
workspaceContext
108+
);
109+
const resolvedPath = path.join(
110+
dependenciesFolderContext.folder.fsPath,
111+
"Package.resolved"
112+
);
113+
const packageResolvedContents = await fs.readFile(resolvedPath, "utf8");
114+
98115
throw Error(
99-
`Could not find dependency with state "${state}", instead it was "${depType}". Current headers: ${headerNames.map(h => `"${h}"`).join(", ")}, Current children for "Dependencies" entry: ${childrenNames.map(c => `"${c}"`).join(", ")}`
116+
`Could not find dependency with state "${state}", instead it was "${depType}". Current headers: ${headerNames.map(h => `"${h}"`).join(", ")}, Current children for "Dependencies" entry: ${childrenNames.map(c => `"${c}"`).join(", ")}\nContents of Package.resolved:\n${packageResolvedContents}`
100117
);
101118
}
102119

103120
async function useLocalDependencyTest() {
121+
workspaceContext.logger.info("Fetching the dependency in the 'remote' state");
122+
104123
// spm edit with user supplied local version of dependency
105124
const item = await getDependencyInState("remote");
106125
const localDep = testAssetUri("swift-markdown");

0 commit comments

Comments
 (0)