Skip to content

Commit d288cf1

Browse files
Trottaddaleax
authored andcommitted
test: skip test-fs-readdir-ucs2 if no support
If the filesystem does not support UCS2, do not run the test. PR-URL: #14029 Fixes: #14028 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 32a8f36 commit d288cf1

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

test/parallel/parallel.status

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ prefix parallel
1313
[$system==macos]
1414

1515
[$arch==arm || $arch==arm64]
16-
test-fs-readdir-ucs2 : PASS,FLAKY
1716
test-npm-install: PASS,FLAKY
1817

1918
[$system==solaris] # Also applies to SmartOS

test/parallel/test-fs-readdir-ucs2.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ const root = Buffer.from(`${common.tmpDir}${path.sep}`);
1414
const filebuff = Buffer.from(filename, 'ucs2');
1515
const fullpath = Buffer.concat([root, filebuff]);
1616

17-
fs.closeSync(fs.openSync(fullpath, 'w+'));
17+
try {
18+
fs.closeSync(fs.openSync(fullpath, 'w+'));
19+
} catch (e) {
20+
if (e.code === 'EINVAL')
21+
common.skip('test requires filesystem that supports UCS2');
22+
throw e;
23+
}
1824

19-
fs.readdir(common.tmpDir, 'ucs2', (err, list) => {
25+
fs.readdir(common.tmpDir, 'ucs2', common.mustCall((err, list) => {
2026
assert.ifError(err);
2127
assert.strictEqual(1, list.length);
2228
const fn = list[0];
2329
assert.deepStrictEqual(filebuff, Buffer.from(fn, 'ucs2'));
2430
assert.strictEqual(fn, filename);
25-
});
26-
27-
process.on('exit', () => {
28-
fs.unlinkSync(fullpath);
29-
});
31+
}));

0 commit comments

Comments
 (0)