From 9050df0b243d3d3e3340d418b7d12cd0199f5328 Mon Sep 17 00:00:00 2001 From: Masashi Hirano Date: Fri, 25 May 2018 01:26:37 +0900 Subject: [PATCH] test: fix to run fsPromises.lchmod test on only macOS --- test/parallel/test-fs-promises.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-fs-promises.js b/test/parallel/test-fs-promises.js index 4ed280f5f5a009..be263c3ae4fec9 100644 --- a/test/parallel/test-fs-promises.js +++ b/test/parallel/test-fs-promises.js @@ -129,10 +129,7 @@ function verifyStatObject(stat) { if (common.canCreateSymLink()) { const newLink = path.resolve(tmpDir, 'baz3.js'); - const newMode = 0o666; await symlink(newPath, newLink); - await lchmod(newLink, newMode); - stats = await lstat(newLink); verifyStatObject(stats); @@ -140,7 +137,13 @@ function verifyStatObject(stat) { (await realpath(newLink)).toLowerCase()); assert.strictEqual(newPath.toLowerCase(), (await readlink(newLink)).toLowerCase()); - assert.strictEqual(stats.mode & 0o777, newMode); + if (common.isOSX) { + // lchmod is only available on macOS + const newMode = 0o666; + await lchmod(newLink, newMode); + assert.strictEqual(await lstat(newLink).mode & 0o777, newMode); + } + await unlink(newLink); }