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
6 changes: 4 additions & 2 deletions packages/cli/lib/commands/validate-args.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const { error } = require('../util');

function validateArgs(argv, options, command) {
let normalizedOptions = options.map(option => option.name.split(',')).reduce((acc, val) => acc.concat(val), []);
let normalizedOptions = options
.map(option => option.name.split(','))
.reduce((acc, val) => acc.concat(val), []);
normalizedOptions = normalizedOptions.map(option => {
option = option.trim();
if (option.startsWith('--')) {
Expand All @@ -19,7 +21,7 @@ function validateArgs(argv, options, command) {
error(
`Invalid argument ${arg} passed to ${command}. Please refer to 'preact ${command} --help' for full list of options.\n\n`
);
throw new Error('Invalid argunment found.');
throw new Error('Invalid argument found.');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tests/build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ describe('preact build', () => {
let dir = await subject('custom-template-3');
const mockExit = jest.spyOn(process, 'exit').mockImplementation(() => {});
expect(build(dir, { 'service-worker': false })).rejects.toEqual(
new Error('Invalid argunment found.')
new Error('Invalid argument found.')
);
expect(mockExit).toHaveBeenCalledWith(1);
mockExit.mockRestore();
Expand Down