fix(ci): restore strip-ansi and typecheck fixtures (#39146)

* fix: restore strip-ansi and typecheck fixtures

* test: normalize windows install path assertions
This commit is contained in:
Altay
2026-03-07 23:13:13 +03:00
committed by GitHub
parent 4682f3cace
commit 97f9e25525
8 changed files with 40 additions and 5 deletions

View File

@@ -1,3 +1,4 @@
import fs from "node:fs";
import path from "node:path";
import { expect } from "vitest";
@@ -7,6 +8,15 @@ function normalizeDarwinTmpPath(filePath: string): string {
: filePath;
}
function canonicalizeComparableDir(dirPath: string): string {
const normalized = normalizeDarwinTmpPath(path.resolve(dirPath));
try {
return normalizeDarwinTmpPath(fs.realpathSync.native(normalized));
} catch {
return normalized;
}
}
export function expectSingleNpmInstallIgnoreScriptsCall(params: {
calls: Array<[unknown, { cwd?: string } | undefined]>;
expectedTargetDir: string;
@@ -27,9 +37,11 @@ export function expectSingleNpmInstallIgnoreScriptsCall(params: {
"--ignore-scripts",
]);
expect(opts?.cwd).toBeTruthy();
const cwd = normalizeDarwinTmpPath(String(opts?.cwd));
const expectedTargetDir = normalizeDarwinTmpPath(params.expectedTargetDir);
expect(path.dirname(cwd)).toBe(path.dirname(expectedTargetDir));
const cwd = String(opts?.cwd);
const expectedTargetDir = params.expectedTargetDir;
expect(canonicalizeComparableDir(path.dirname(cwd))).toBe(
canonicalizeComparableDir(path.dirname(expectedTargetDir)),
);
expect(path.basename(cwd)).toMatch(/^\.openclaw-install-stage-/);
}