Skip to content

Commit e373144

Browse files
LiviaMedeirosruyadorno
authored andcommitted
test: add filesystem check to test-fs-stat-date.mjs
PR-URL: #44174 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent a3cc8ce commit e373144

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
@@ -17,6 +17,14 @@ const filepath = path.resolve(tmpdir.path, 'timestamp');
1717

1818
await (await fsPromises.open(filepath, 'w')).close();
1919

20+
// Perform a trivial check to determine if filesystem supports setting
21+
// and retrieving atime and mtime. If it doesn't, skip the test.
22+
await fsPromises.utimes(filepath, 2, 2);
23+
const { atimeMs, mtimeMs } = await fsPromises.stat(filepath);
24+
if (atimeMs !== 2000 || mtimeMs !== 2000) {
25+
common.skip(`Unsupported filesystem (atime=${atimeMs}, mtime=${mtimeMs})`);
26+
}
27+
2028
// Date might round down timestamp
2129
function closeEnough(actual, expected, margin) {
2230
// On ppc64, value is rounded to seconds

0 commit comments

Comments
 (0)