test: harden exhaustive compatibility suites

This commit is contained in:
Hide_D committed 2026-07-30 16:19:30 +00:00
1 parent 4ebd3fd39b
commit a9dbb3fd4d
28 files changed
+454 -97

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { existsSync } from 'node:fs';
import path from 'node:path';
import { execFileSync } from 'node:child_process';
export const resolveRefRoot = (repositoryRoot = process.cwd()) => {
if (process.env.SAMMO_REF_ROOT) {
return path.resolve(process.env.SAMMO_REF_ROOT);
}
const candidates = [path.resolve(repositoryRoot, '..', 'ref', 'sam')];
try {
const commonDir = execFileSync('git', ['rev-parse', '--path-format=absolute', '--git-common-dir'], {
cwd: repositoryRoot,
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'ignore'],
}).trim();
candidates.push(path.resolve(path.dirname(commonDir), '..', 'ref', 'sam'));
} catch {
// The direct sibling remains the fallback outside a Git checkout.
}
return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0];
};