test(metrics): make snapshot mode assertion portable

Skip POSIX permission-bit equality on Windows, where stat reports synthesized mode bits, while retaining the atomic publication and readback assertions on every platform.
This commit is contained in:
wellkilo
2026-09-13 03:56:58 +08:00
parent 1b12e19c63
commit c2405149f7
+3 -1
View File
@@ -46,7 +46,9 @@ try {
assert.strictEqual(appendSessionCostRow(root, 'session-1', current), true);
const filePath = getCostSnapshotPath(root, 'session-1');
assert.deepStrictEqual(readSessionCostSnapshot(root, 'session-1').row, current);
assert.strictEqual(fs.statSync(filePath).mode & 0o777, 0o600);
if (process.platform !== 'win32') {
assert.strictEqual(fs.statSync(filePath).mode & 0o777, 0o600);
}
assert.deepStrictEqual(
fs.readdirSync(path.dirname(filePath)).filter(name => name.endsWith('.tmp')),
[]