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

Two tests provoke EACCES via chmod (saveAliases backup double failure,
appendSessionContent on a read-only file) and already skip on win32, but
root ignores file modes so both fail when the suite runs as root (for
example in a default Docker container). Every other chmod-based test in
the repo already guards with process.getuid?.() === 0; these two were the
only ones missing the guard. Apply the same skip condition and message.
This commit is contained in:
konstapukarifastnetfi
2026-06-07 08:25:53 +03:00
committed by GitHub
parent b189e8ec9f
commit 6614f79fe3
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -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-'));