Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLivia Medeiros <livia@cirno.name>2022-10-07 19:22:39 +0300
committerDanielle Adams <adamzdanielle@gmail.com>2022-10-11 16:10:09 +0300
commitfe91bebb67ab78c82bf8917590c28440e326ddb1 (patch)
tree4af66d2f84816d01602106e273c209d73f4d7d1c /test
parentdb5aeed7023504c76275bb88aceb835ac3313e5c (diff)
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>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-fs-stat-date.mjs8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/parallel/test-fs-stat-date.mjs b/test/parallel/test-fs-stat-date.mjs
index 979f6d5f453..71cdb1a40f9 100644
--- a/test/parallel/test-fs-stat-date.mjs
+++ b/test/parallel/test-fs-stat-date.mjs
@@ -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}`);
}