From c2405149f7aaaa79f59f6ee3e0dea62001ce7764 Mon Sep 17 00:00:00 2001 From: wellkilo Date: Sun, 13 Sep 2026 03:56:58 +0800 Subject: [PATCH] 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. --- tests/lib/session-cost-snapshot.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/lib/session-cost-snapshot.test.js b/tests/lib/session-cost-snapshot.test.js index a41165ba4..153c2e932 100644 --- a/tests/lib/session-cost-snapshot.test.js +++ b/tests/lib/session-cost-snapshot.test.js @@ -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')), []