Skip to content

Commit fe91beb

Browse files
LiviaMedeirosdanielleadams
authored andcommitted
test: loosen test for negative timestamps in test-fs-stat-date
PR-URL: #44707 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent db5aeed commit fe91beb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/parallel/test-fs-stat-date.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ function closeEnough(actual, expected, margin) {
3131
if (process.arch === 'ppc64') {
3232
margin += 1000;
3333
}
34+
35+
// Filesystems without support for timestamps before 1970-01-01, such as NFSv3,
36+
// should return 0 for negative numbers. Do not treat it as error.
37+
if (actual === 0 && expected < 0) {
38+
console.log(`ignored 0 while expecting ${expected}`);
39+
return;
40+
}
41+
3442
assert.ok(Math.abs(Number(actual - expected)) < margin,
3543
`expected ${expected} ± ${margin}, got ${actual}`);
3644
}

0 commit comments

Comments
 (0)