Skip to content

Commit

Permalink
cli: fix csv for --output (#10188)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Jan 8, 2020
1 parent 17ac7e2 commit 2f63d28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lighthouse-cli/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function getFlags(manualArgv) {

.group(['output', 'output-path', 'view'], 'Output:')
.describe({
'output': `Reporter for the results, supports multiple values`,
'output': `Reporter for the results, supports multiple values. choices: ${printer.getValidOutputOptions().map(s => `"${s}"`).join(', ')}`,
'output-path': `The file path to output the results. Use 'stdout' to write to stdout.
If using JSON output, default is stdout.
If using HTML or CSV output, default is a file in the working directory with a name based on the test URL and date.
Expand All @@ -153,7 +153,6 @@ function getFlags(manualArgv) {
'list-trace-categories', 'view', 'verbose', 'quiet', 'help', 'print-config',
'chrome-ignore-default-flags',
])
.choices('output', printer.getValidOutputOptions())
.choices('emulated-form-factor', ['mobile', 'desktop', 'none'])
.choices('throttling-method', ['devtools', 'provided', 'simulate'])
.choices('preset', ['perf', 'mixed-content'])
Expand Down
9 changes: 7 additions & 2 deletions lighthouse-cli/test/cli/run-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ describe('CLI run', function() {

describe('flag coercing', () => {
it('should force to array', () => {
assert.deepStrictEqual(getFlags(`--only-audits foo chrome://version`).onlyAudits, ['foo']);
assert.deepStrictEqual(
getFlags('https://www.example.com --only-audits foo').onlyAudits, ['foo']);
});
});

it('should allow csv', () => {
assert.deepStrictEqual(
getFlags('https://www.example.com --output html,json').output, ['html', 'json']);
});
});

describe('saveResults', () => {
it('will quit early if we\'re in gather mode', async () => {
Expand Down

0 comments on commit 2f63d28

Please sign in to comment.