mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
test: loosen test for negative timestamps in test-fs-stat-date
PR-URL: https://github.com/nodejs/node/pull/44707 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
1 parent
db5aeed702
commit
fe91bebb67
1 file changed
+8
@@ -31,6 +31,14 @@ function closeEnough(actual, expected, margin) {
|
||||
if (process.arch === 'ppc64') {
|
||||
margin += 1000;
|
||||
}
|
||||
|
||||
// Filesystems without support for timestamps before 1970-01-01, such as NFSv3,
|
||||
// should return 0 for negative numbers. Do not treat it as error.
|
||||
if (actual === 0 && expected < 0) {
|
||||
console.log(`ignored 0 while expecting ${expected}`);
|
||||
return;
|
||||
}
|
||||
|
||||
assert.ok(Math.abs(Number(actual - expected)) < margin,
|
||||
`expected ${expected} ± ${margin}, got ${actual}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user