Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: skip test-fs-readdir-ucs2 if no support
If the filesystem does not support UCS2, do not run the test.

Fixes: #14028
  • Loading branch information
Trott committed Jul 3, 2017
commit f03541e9bcc0345eb032e62152f84c7336fa5ef3
1 change: 0 additions & 1 deletion test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ prefix parallel
[$system==macos]

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

[$system==solaris] # Also applies to SmartOS
Expand Down
18 changes: 11 additions & 7 deletions test/parallel/test-fs-readdir-ucs2.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,20 @@ const root = Buffer.from(`${common.tmpDir}${path.sep}`);
const filebuff = Buffer.from(filename, 'ucs2');
const fullpath = Buffer.concat([root, filebuff]);

fs.closeSync(fs.openSync(fullpath, 'w+'));
try {
fs.closeSync(fs.openSync(fullpath, 'w+'));
} catch (e) {
if (e.code === 'EINVAL') {
common.skip('test requires filesystem that supports UCS2');
return;
}
throw e;
}

fs.readdir(common.tmpDir, 'ucs2', (err, list) => {
fs.readdir(common.tmpDir, 'ucs2', common.mustCall((err, list) => {
assert.ifError(err);
assert.strictEqual(1, list.length);
const fn = list[0];
assert.deepStrictEqual(filebuff, Buffer.from(fn, 'ucs2'));
assert.strictEqual(fn, filename);
});

process.on('exit', () => {
fs.unlinkSync(fullpath);
});
}));