Skip to content
Closed
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: add tests for mode passed as an options object in mkdir and mkd…
…irSync

This also adds coverage for mkdirSync inside the conditional where
options.mode is not undefined.
  • Loading branch information
RaisinTen committed Jan 20, 2021
commit 75df964b6559f0a7216a7b8ec5f56915a06ebec1
19 changes: 19 additions & 0 deletions test/parallel/test-fs-mkdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ function nextdir() {
}));
}

// fs.mkdir creates directory with mode passed as an options object
{
const pathname = path.join(tmpdir.path, nextdir());

fs.mkdir(pathname, { mode: 0o777 }, common.mustCall(function(err) {
assert.strictEqual(err, null);
assert.strictEqual(fs.existsSync(pathname), true);
}));
}

// fs.mkdirSync creates directory with mode passed as an options object
{
const pathname = path.join(tmpdir.path, nextdir());

fs.mkdirSync(pathname, { mode: 0o777 });

assert.strictEqual(fs.existsSync(pathname), true);
}

// mkdirSync successfully creates directory from given path
{
const pathname = path.join(tmpdir.path, nextdir());
Expand Down