fix(ci): repair failing test expectations

This commit is contained in:
Armin Ronacher
2026-05-03 00:04:27 +02:00
committed by Mario Zechner
parent ee4a40c936
commit e1433cf65b
2 changed files with 12 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ import { PassThrough } from "node:stream";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { DefaultPackageManager, type ProgressEvent, type ResolvedResource } from "../src/core/package-manager.js";
import { SettingsManager } from "../src/core/settings-manager.js";
import { shouldUseWindowsShell } from "../src/utils/child-process.js";
function normalizeForMatch(value: string): string {
return value.replace(/\\/g, "/");
@@ -520,14 +521,11 @@ Content`,
describe("windows command spawning", () => {
it("should avoid the shell for git so Windows paths with spaces stay single arguments", () => {
vi.spyOn(process, "platform", "get").mockReturnValue("win32");
const managerWithInternals = packageManager as unknown as {
shouldUseWindowsShell(command: string): boolean;
};
expect(managerWithInternals.shouldUseWindowsShell("git")).toBe(false);
expect(managerWithInternals.shouldUseWindowsShell("npm")).toBe(true);
expect(managerWithInternals.shouldUseWindowsShell("pnpm")).toBe(true);
expect(managerWithInternals.shouldUseWindowsShell("C:/Program Files/nodejs/npm.cmd")).toBe(true);
expect(shouldUseWindowsShell("git")).toBe(false);
expect(shouldUseWindowsShell("npm")).toBe(true);
expect(shouldUseWindowsShell("pnpm")).toBe(true);
expect(shouldUseWindowsShell("C:/Program Files/nodejs/npm.cmd")).toBe(true);
});
});