Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1c3f81d
win,msi: install tools for native modules
joaocgreis Aug 29, 2018
05ace78
doc: `node debug` → `node inspect` in CLI docs
addaleax Sep 9, 2018
94e67b6
tools: fix doc tool behavior for version arrays
tniessen Sep 8, 2018
779e072
fs: implement mkdir recursive (mkdirp)
Aug 9, 2018
b1be08f
test: add comment describing test-fs-mkdir
Aug 21, 2018
75c288e
url: provide pathToFileURL and fileURLToPath
guybedford Aug 24, 2018
42e6ce2
test: check parameter type of fs.mkdir()
Aug 30, 2018
cf61a04
test: refactor structure of common/index
jasnell Aug 24, 2018
108a169
assert: align argument names
BridgeAR Sep 8, 2018
09ae073
doc: add history for withFileTypes in fs.readdir[Sync]()
tiendq Sep 10, 2018
8b6a161
crypto: fix public key encryption internals
tniessen Sep 9, 2018
b87ab0f
crypto: rename symbols to match guidelines
tniessen Sep 5, 2018
b9fd99e
doc: add gabrielschulhof to TSC
Trott Sep 12, 2018
8153c10
n-api: add generic finalizer callback
Aug 10, 2018
2b3b205
test: checks on napi factory wrap’s finalization
legendecas Aug 31, 2018
f41911f
lib: remove unnecessary symbols
Aug 22, 2018
01a5c7d
test: minor refactor in common/index.js
jasnell Sep 6, 2018
353cb4e
doc: document http2 timeouts
sagitsofan Sep 10, 2018
a214769
doc: add reference to guide for N-API additions
mhdawson Aug 29, 2018
e85c814
deps: cherry-pick 2363cdf from upstream V8
ofrobots Sep 11, 2018
92b695e
trace_events: avoid flusing uninitialized traces
ofrobots Sep 12, 2018
4159000
fs: ensure readdir() callback is only called once
cjihrig Sep 10, 2018
d853a3f
lib: simplify 'processChunkSync'
Sep 11, 2018
535c30c
module: add createRequireFunction method
devsnek Mar 14, 2018
ec6afb9
worker: correct (de)initialization order
addaleax Sep 9, 2018
c9f2283
tools: implement update-authors in JS
addaleax Sep 9, 2018
c898071
doc: update AUTHORS list
addaleax Sep 9, 2018
878d616
src: move getActiveResources/Handles to node_process.cc
jasnell Sep 7, 2018
27b0cb5
src: move DebugPortGetter/Setter to node_process.cc
jasnell Sep 7, 2018
4ba80b1
doc: fix typo in dns docs
MohammedEssehemy Sep 14, 2018
da86003
doc: add withFileTypes option to fsPromises.readdir
bengl Sep 13, 2018
1e07002
process: generate list of allowed env flags programmatically
addaleax Aug 31, 2018
a793163
lib: generate allowedNodeEnvironmentFlags lazily
addaleax Aug 31, 2018
81fd5d2
doc: add full deprecation history
tniessen Sep 8, 2018
479e1ec
fs: fix promisified fs.readdir withFileTypes
apapirovski Sep 13, 2018
f2ae0cb
src: fix `--prof-process` CLI argument handling
addaleax Sep 10, 2018
9441282
tracing: remove shutdown-on-signal
addaleax Sep 6, 2018
14c491c
path: remove unnecessary if statement
wchargin Aug 11, 2018
7c5e0d8
tools: update ESLint to 5.6.0
Trott Sep 16, 2018
3b763cd
src: move no_async_hooks_checks to env
danbev Sep 10, 2018
9b0acb6
deps: cherry-pick dbfcc48 from upstream V8
alexkozy Aug 10, 2018
1532de2
src: added URL::FromFilePath method
alexkozy Aug 30, 2018
c13c70c
inspector: implemented V8InspectorClient::resourceNameToUrl
alexkozy Aug 30, 2018
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
Prev Previous commit
Next Next commit
test: check parameter type of fs.mkdir()
Added tests to check parameter type of fs.mkdir(), fs.mkdirSync()
and fsPromises.mkdir() to increase coverage.

PR-URL: #22616
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: George Adams <george.adams@uk.ibm.com>
  • Loading branch information
Masashi Hirano authored and targos committed Sep 12, 2018
commit 42e6ce270e966cb927db0b22e881618a4714ec85
26 changes: 26 additions & 0 deletions test/parallel/test-fs-mkdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,32 @@ if (common.isMainThread && (common.isLinux || common.isOSX)) {
});
}

// mkdirSync and mkdir require options.recursive to be a boolean.
// Anything else generates an error.
{
const pathname = path.join(tmpdir.path, nextdir());
['', 1, {}, [], null, Symbol('test'), () => {}].forEach((recursive) => {
common.expectsError(
() => fs.mkdir(pathname, { recursive }, common.mustNotCall()),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "recursive" argument must be of type boolean. Received ' +
`type ${typeof recursive}`
}
);
common.expectsError(
() => fs.mkdirSync(pathname, { recursive }),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "recursive" argument must be of type boolean. Received ' +
`type ${typeof recursive}`
}
);
});
}

// Keep the event loop alive so the async mkdir() requests
// have a chance to run (since they don't ref the event loop).
process.nextTick(() => {});
34 changes: 34 additions & 0 deletions test/parallel/test-fs-promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,22 @@ function verifyStatObject(stat) {
assert.deepStrictEqual(list, ['baz2.js', 'dir']);
await rmdir(newdir);

// mkdir when options is number.
{
const dir = path.join(tmpDir, nextdir());
await mkdir(dir, 777);
stats = await stat(dir);
assert(stats.isDirectory());
}

// mkdir when options is string.
{
const dir = path.join(tmpDir, nextdir());
await mkdir(dir, '777');
stats = await stat(dir);
assert(stats.isDirectory());
}

// mkdirp when folder does not yet exist.
{
const dir = path.join(tmpDir, nextdir(), nextdir());
Expand Down Expand Up @@ -250,6 +266,24 @@ function verifyStatObject(stat) {
assert(stats.isDirectory());
}

// mkdirp require recursive option to be a boolean.
// Anything else generates an error.
{
const dir = path.join(tmpDir, nextdir(), nextdir());
['', 1, {}, [], null, Symbol('test'), () => {}].forEach((recursive) => {
assert.rejects(
// mkdir() expects to get a boolean value for options.recursive.
async () => mkdir(dir, { recursive }),
{
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError [ERR_INVALID_ARG_TYPE]',
message: 'The "recursive" argument must be of type boolean. ' +
`Received type ${typeof recursive}`
}
);
});
}

await mkdtemp(path.resolve(tmpDir, 'FOO'));
assert.rejects(
// mkdtemp() expects to get a string prefix.
Expand Down