Skip to content

Commit

Permalink
fix: Add supported choices to --target option (#1644)
Browse files Browse the repository at this point in the history
  • Loading branch information
onlywicked authored and Rob--W committed Jul 11, 2019
1 parent 72bb28c commit 739aa52
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,12 @@ Example: $0 --help run.
.command('run', 'Run the extension', commands.run, {
'target': {
alias: 't',
describe: 'The extensions runners to enable (e.g. firefox-desktop, ' +
'firefox-android). Specify this option multiple times to ' +
'run against multiple targets.',
describe: 'The extensions runners to enable. Specify this option ' +
'multiple times to run against multiple targets.',
default: 'firefox-desktop',
demandOption: false,
type: 'array',
choices: ['firefox-desktop', 'firefox-android'],
},
'firefox': {
alias: ['f', 'firefox-binary'],
Expand Down
16 changes: 16 additions & 0 deletions tests/functional/test.cli.run.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* @flow */
import {describe, it} from 'mocha';
import {assert} from 'chai';

import {
minimalAddonPath, fakeFirefoxPath,
Expand Down Expand Up @@ -47,4 +48,19 @@ describe('web-ext run', () => {
}
});
}));

it('should not accept: --target INVALIDTARGET', async () => {
const argv = [
'run',
'--target', 'firefox-desktop',
'--target', 'not-supported',
'--target', 'firefox-android',
];

return execWebExt(argv, {}).waitForExit.then(({exitCode, stderr}) => {
assert.notEqual(exitCode, 0);
assert.match(stderr, /Invalid values/);
assert.match(stderr, /Given: "not-supported"/);
});
});
});

0 comments on commit 739aa52

Please sign in to comment.