diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index 5a0e7735b6277d..fda5e01e500078 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -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 diff --git a/test/parallel/test-fs-readdir-ucs2.js b/test/parallel/test-fs-readdir-ucs2.js index 4d5f53abd8ead9..c20e77d64d1cf6 100644 --- a/test/parallel/test-fs-readdir-ucs2.js +++ b/test/parallel/test-fs-readdir-ucs2.js @@ -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); -}); +}));