Skip to content
Merged
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
16 changes: 16 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,22 @@ test('args are passed `type: "string"` and "multiple"', function(t) {
t.end();
});

test('args are passed `type: "boolean"` and "multiple"', function(t) {
Comment thread
bakkot marked this conversation as resolved.
Outdated
const passedArgs = ['--foo', '--foo'];
const passedOptions = {
foo: {
type: 'boolean',
multiple: true,
},
};
const expected = { flags: { foo: true }, values: { foo: [true, true] }, positionals: [] };
const args = parseArgs({ args: passedArgs, options: passedOptions });

t.deepEqual(args, expected, 'the array contains multiple `true`s');
Comment thread
shadowspawn marked this conversation as resolved.
Outdated

t.end();
});

test('order of option and positional does not matter (per README)', function(t) {
const passedArgs1 = ['--foo=bar', 'baz'];
const passedArgs2 = ['baz', '--foo=bar'];
Expand Down