Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/helpers/arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const convertOptionsFromArguments = options => {
}

// format array
if (option.type === 'array' && value) {
if (option.type === 'array' && typeof value === 'string') {
value = value.split(',');
}

Expand Down
12 changes: 11 additions & 1 deletion src/helpers/arguments.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ describe('convertOptionsFromArguments', () => {
'world',
'--foo',
'bar',
'--some-string'
'--some-string',
'--some-array',
];
});

Expand Down Expand Up @@ -83,6 +84,15 @@ describe('convertOptionsFromArguments', () => {
expect(actual['some-string']).toBeUndefined();
});

it('should ignore empty flag values that are explicitly defined as array types', () => {
const actual = convertOptionsFromArguments({
'some-array': {
type: 'array'
}
});
expect(actual['some-array']).toBeUndefined();
});

it('should create correct types from CLI string argument', () => {
const options = convertOptionsFromArguments({
myEmptyString: {
Expand Down