Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

test: skip chmod-based permission tests when running as root (#2171)

konstapukarifastnetfi6614f79fe382
diff --git a/tests/lib/session-aliases.test.js b/tests/lib/session-aliases.test.js
index 8e4b72263..11a4fa053 100644
--- a/tests/lib/session-aliases.test.js
+++ b/tests/lib/session-aliases.test.js
@@ -1230,8 +1230,8 @@ function runTests() {
// session-aliases.js lines 131-137: When saveAliases fails (outer catch),
// it tries to restore from backup. If the restore ALSO fails, the inner
// catch at line 135 logs restoreErr. No existing test creates this double-fault.
- if (process.platform === 'win32') {
- console.log(' (skipped — chmod not reliable on Windows)');
+ if (process.platform === 'win32' || process.getuid?.() === 0) {
+ console.log(' (skipped — chmod ineffective on Windows/root)');
return;
}
const isoHome = path.join(os.tmpdir(), `ecc-r90-restore-fail-${Date.now()}`);
diff --git a/tests/lib/session-manager.test.js b/tests/lib/session-manager.test.js
index a34447d7c..bdf164178 100644
--- a/tests/lib/session-manager.test.js
+++ b/tests/lib/session-manager.test.js
@@ -2071,9 +2071,9 @@ file.ts
// ── Round 112: appendSessionContent with read-only file — returns false ──
console.log('\nRound 112: appendSessionContent (read-only file):');
if (test('appendSessionContent returns false when file is read-only (EACCES)', () => {
- if (process.platform === 'win32') {
- // chmod doesn't work reliably on Windows — skip
- assert.ok(true, 'Skipped on Windows');
+ if (process.platform === 'win32' || process.getuid?.() === 0) {
+ // chmod ineffective on Windows/root — skip
+ assert.ok(true, 'Skipped on Windows/root');
return;
}
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'r112-readonly-'));