Skip to content
Merged
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
chore: fix linting
  • Loading branch information
Eomm committed Sep 29, 2022
commit 0c502132ca5df6f8aebeaac65bbe2d831f5fdb80
4 changes: 2 additions & 2 deletions lib/internal/util/parse_args/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ function findLongOptionForShort(shortOption, options) {
* @param {object} optionConfig - the option configuration properties
* @param {object} values - option values returned in `values` by parseArgs
*/
function useDefaultValueOption(longOption, optionConfig, values) {
function useDefaultValueOption(longOption, optionConfig, values) {
return objectGetOwn(optionConfig, 'default') !== undefined &&
values[longOption] === undefined;
values[longOption] === undefined;
Comment thread
aduh95 marked this conversation as resolved.
}

module.exports = {
Expand Down
14 changes: 7 additions & 7 deletions test/parallel/test-parse-args.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ test('default must be a boolean when option type is boolean', () => {
const options = { alpha: { type: 'boolean', default: 'not a boolean' } };
assert.throws(() => {
parseArgs({ args, options });
}, `TypeError [ERR_INVALID_ARG_TYPE]: The "options.alpha.default" property must be an instance of Array. Received type string ('not an array')`
}, /"options\.alpha\.default" property must be of type boolean/
);
});

Expand All @@ -838,7 +838,7 @@ test('default must be a boolean array when option type is boolean and multiple',
const options = { alpha: { type: 'boolean', multiple: true, default: 'not an array' } };
assert.throws(() => {
parseArgs({ args, options });
}, `TypeError [ERR_INVALID_ARG_TYPE]: The "options.alpha.default" property must be an instance of Array. Received type string ('not an array')`
}, /"options\.alpha\.default" property must be an instance of Array/
);
});

Expand All @@ -847,7 +847,7 @@ test('default must be a boolean array when option type is string and multiple is
const options = { alpha: { type: 'boolean', multiple: true, default: [true, true, 42] } };
assert.throws(() => {
parseArgs({ args, options });
}, `TypeError [ERR_INVALID_ARG_TYPE]: The "options.alpha.default[2]" property must be of type boolean. Received type number (42)`
}, /"options\.alpha\.default\[2\]" property must be of type boolean/
);
});

Expand All @@ -856,7 +856,7 @@ test('default must be a string when option type is string', () => {
const options = { alpha: { type: 'string', default: true } };
assert.throws(() => {
parseArgs({ args, options });
}, `TypeError [ERR_INVALID_ARG_TYPE]: The "options.alpha.default" property must be of type string. Received type boolean (true)`
}, /"options\.alpha\.default" property must be of type string/
);
});

Expand All @@ -865,7 +865,7 @@ test('default must be an array when option type is string and multiple is true',
const options = { alpha: { type: 'string', multiple: true, default: 'not an array' } };
assert.throws(() => {
parseArgs({ args, options });
}, `TypeError [ERR_INVALID_ARG_TYPE]: The "options.alpha.default" property must be an instance of Array. Received type string ('not an array')`
}, /"options\.alpha\.default" property must be an instance of Array/
);
});

Expand All @@ -874,7 +874,7 @@ test('default must be a string array when option type is string and multiple is
const options = { alpha: { type: 'string', multiple: true, default: ['str', 42] } };
assert.throws(() => {
parseArgs({ args, options });
}, `TypeError [ERR_INVALID_ARG_TYPE]: The "options.alpha.default[1]" property must be of type string. Received type number (42)`
}, /"options\.alpha\.default\[1\]" property must be of type string/
);
});

Expand Down Expand Up @@ -976,6 +976,6 @@ test('multiple as false should expect a String', () => {
const options = { alpha: { type: 'string', multiple: false, default: ['array'] } };
assert.throws(() => {
parseArgs({ args, options });
}, `TypeError [ERR_INVALID_ARG_TYPE]: The "options.alpha.default" property must be of type string. Received an instance of Array`
}, /"options\.alpha\.default" property must be of type string/
);
});