mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 13:44:58 +00:00
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:
@@ -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-/);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user