test(ci): make discovery and private Git fixtures portable

This commit is contained in:
haelyra committed 2026-11-16 16:16:57 -05:00
1 parent 75b5c4d299
commit ef71901a84
2 files changed
+13 -6

No files matched your search

+5 -3
View File
@@ -42,11 +42,13 @@ function coverageEnvironment() {
function checkDiscovery(root) {
for (const engine of [glob, rawGlob]) {
assert.deepEqual(engine.globSync('scripts/alpha.js', { cwd: root }), ['scripts/alpha.js']);
assert.deepEqual(engine.globSync('scripts/**/*.js', { cwd: root }).sort(), [
const discover = pattern => engine.globSync(pattern, { cwd: root })
.map(name => name.split(path.sep).join('/')).sort();
assert.deepEqual(discover('scripts/alpha.js'), ['scripts/alpha.js']);
assert.deepEqual(discover('scripts/**/*.js'), [
'scripts/alpha.js', 'scripts/never.js', 'scripts/skip.test.js',
]);
assert.deepEqual(engine.globSync('scripts/**/*.mjs', { cwd: root }), ['scripts/nested/beta.mjs']);
assert.deepEqual(discover('scripts/**/*.mjs'), ['scripts/nested/beta.mjs']);
}
}
+8 -3
View File
@@ -621,9 +621,14 @@ function syntheticIntentRunner(root, { fakeEnv = {}, arms = 'off,gate' } = {}) {
const env = { ...process.env, HOME: path.join(root, 'home'), USERPROFILE: path.join(root, 'home'), CLAUDE_CONFIG_DIR: config, CLAUDE_CODE_PROJECT_DIR_NAME: '',
NODE_PATH: path.join(ROOT, 'node_modules'), GIT_CONFIG_GLOBAL: path.join(root, 'unused-gitconfig'),
GIT_AUTHOR_NAME: 'Synthetic Eval', GIT_COMMITTER_NAME: 'Synthetic Eval', GIT_AUTHOR_EMAIL: 'eval@example.invalid', GIT_COMMITTER_EMAIL: 'eval@example.invalid' };
for (const args of [['init', '-q'], ['add', '.'], ['commit', '-q', '--no-gpg-sign', '-m', 'synthetic source snapshot']]) {
const result = spawnSync('git', args, { cwd: repo, env, encoding: 'utf8', timeout: 30000 });
assert.strictEqual(result.status, 0, result.stderr);
// Freeze the copied source bytes, independent of the host Git line-ending
// policy. The full scripts snapshot can take longer to stage on busy Windows
// runners; keep setup bounded at the same 60s limit as the harness Git calls.
for (const args of [['init', '-q'], ['config', 'core.autocrlf', 'false'], ['add', '.'], ['commit', '-q', '--no-gpg-sign', '-m', 'synthetic source snapshot']]) {
const result = spawnSync('git', args, { cwd: repo, env, encoding: 'utf8', timeout: 60000 });
const diagnostic = `git ${args.join(' ')}: status=${result.status}, signal=${result.signal || 'none'}, error=${result.error?.code || 'none'}\n${result.error?.message || ''}\n${result.stderr || ''}`;
assert.strictEqual(result.error, undefined, diagnostic);
assert.strictEqual(result.status, 0, diagnostic);
}
const scenario = intentEval.loadIntentScenarios()[0];
const copiedReference = path.join(copied, 'scenarios-intent', scenario.id, 'reference');