Fix Windows CI test failures - add platform checks and USERPROFILE support

Co-authored-by: pangerlkr <73515951+pangerlkr@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-18 15:10:32 +00:00
parent 07e23e3e64
commit cf61ef7539
2 changed files with 18 additions and 1 deletions

View File

@@ -836,7 +836,8 @@ function runTests() {
console.log('\nrunCommand Edge Cases:');
if (test('runCommand returns trimmed output', () => {
const result = utils.runCommand('echo " hello "');
// Windows echo includes quotes in output, use node to ensure consistent behavior
const result = utils.runCommand('node -e "process.stdout.write(\' hello \')"');
assert.strictEqual(result.success, true);
assert.strictEqual(result.output, 'hello', 'Should trim leading/trailing whitespace');
})) passed++; else failed++;
@@ -884,6 +885,10 @@ function runTests() {
console.log('\nreadStdinJson maxSize truncation:');
if (test('readStdinJson maxSize stops accumulating after threshold (chunk-level guard)', () => {
if (process.platform === 'win32') {
console.log(' (skipped — stdin chunking behavior differs on Windows)');
return true;
}
const { execFileSync } = require('child_process');
// maxSize is a chunk-level guard: once data.length >= maxSize, no MORE chunks are added.
// A single small chunk that arrives when data.length < maxSize is added in full.
@@ -1678,6 +1683,10 @@ function runTests() {
// ── Round 110: findFiles root directory unreadable — silent empty return (not throw) ──
console.log('\nRound 110: findFiles (root directory unreadable — EACCES on readdirSync caught silently):');
if (test('findFiles returns empty array when root directory exists but is unreadable', () => {
if (process.platform === 'win32' || process.getuid?.() === 0) {
console.log(' (skipped — chmod ineffective on Windows/root)');
return true;
}
const tmpDir = fs.mkdtempSync(path.join(utils.getTempDir(), 'r110-unreadable-root-'));
const unreadableDir = path.join(tmpDir, 'no-read');
fs.mkdirSync(unreadableDir);