Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: recursive argument name to check type in fs.mkdir
  • Loading branch information
Masashi Hirano committed Aug 31, 2018
commit df5ee0fca40593e782a9e41a31542468fbe709a9
10 changes: 5 additions & 5 deletions test/parallel/test-fs-mkdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,23 +181,23 @@ if (common.isMainThread && (common.isLinux || common.isOSX)) {
// Anything else generates an error.
{
const pathname = path.join(tmpdir.path, nextdir());
['', 1, {}, [], null, Symbol('test'), () => {}].forEach((i) => {
['', 1, {}, [], null, Symbol('test'), () => {}].forEach((recursive) => {
common.expectsError(
() => fs.mkdir(pathname, { recursive: i }, common.mustNotCall()),
() => 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 i}`
`type ${typeof recursive}`
}
);
common.expectsError(
() => fs.mkdirSync(pathname, { recursive: i }),
() => fs.mkdirSync(pathname, { recursive }),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "recursive" argument must be of type boolean. Received ' +
`type ${typeof i}`
`type ${typeof recursive}`
}
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-fs-promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,15 @@ function verifyStatObject(stat) {
// Anything else generates an error.
{
const dir = path.join(tmpDir, nextdir(), nextdir());
['', 1, {}, [], null, Symbol('test'), () => {}].forEach((i) => {
['', 1, {}, [], null, Symbol('test'), () => {}].forEach((recursive) => {
assert.rejects(
// mkdtemp() expects to get a string prefix.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mkdtemp()?

Copy link
Copy Markdown
Contributor Author

@shisama shisama Aug 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, sorry. this is wrong copy and paste. Fixed this.

async () => mkdir(dir, { recursive: i }),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small oversight: it should be recursive without : i

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review. I fixed this.

{
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError [ERR_INVALID_ARG_TYPE]',
message: 'The "recursive" argument must be of type boolean. ' +
`Received type ${typeof i}`
`Received type ${typeof recursive}`
}
);
});
Expand Down