Skip to content

Commit 9fbf37e

Browse files
committedSep 3, 2019
refactor: rename report command to upload
1 parent acd9c30 commit 9fbf37e

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed
 

‎README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ lighthouse-ci collect --numberOfRuns=5 --url=https://example.com
2222

2323
Runs Lighthouse `N` times and stores the LHRs in a local `.lighthouseci/` folder, similar to the way test coverage tools operate.
2424

25-
### `report`
25+
### `upload`
2626

2727
```bash
28-
lighthouse-ci report
28+
lighthouse-ci upload
2929
```
3030

3131
Saves all the runs in the `.lighthouseci/` folder to the server as a single build, similar to a Coveralls/CodeCov upload step. In the future, I imagine this can also return the results of the server's assertions against the parent hash.
@@ -73,7 +73,7 @@ lighthouse-ci --rc-file=path/to/different/rc/file <command>
7373
"collect": {
7474
"numberOfRuns": 2
7575
},
76-
"report": {
76+
"upload": {
7777
"serverBaseUrl": "http://localhost:9009"
7878
},
7979
"server": {

‎src/cli.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const yargs = require('yargs');
1010
const loadAndParseRcFile = require('./shared/lighthouserc.js').loadAndParseRcFile;
1111
const getVersion = require('./shared/version.js').getVersion;
1212
const assertCmd = require('./assert/assert.js');
13-
const reportCmd = require('./report/report.js');
13+
const uploadCmd = require('./upload/upload.js');
1414
const collectCmd = require('./collect/collect.js');
1515
const serverCmd = require('./server/server.js');
1616
const wizardCmd = require('./wizard/wizard.js');
@@ -27,8 +27,8 @@ async function run() {
2727
.command('collect', 'Run Lighthouse and save the results to a local folder', commandYargs =>
2828
collectCmd.buildCommand(commandYargs)
2929
)
30-
.command('report', 'Save the results to the server', commandYargs =>
31-
reportCmd.buildCommand(commandYargs)
30+
.command('upload', 'Save the results to the server', commandYargs =>
31+
uploadCmd.buildCommand(commandYargs)
3232
)
3333
.command('assert', 'Assert that the latest results meet expectations', commandYargs =>
3434
assertCmd.buildCommand(commandYargs)
@@ -44,8 +44,8 @@ async function run() {
4444
case 'assert':
4545
await assertCmd.runCommand(argv);
4646
break;
47-
case 'report':
48-
await reportCmd.runCommand(argv);
47+
case 'upload':
48+
await uploadCmd.runCommand(argv);
4949
break;
5050
case 'server': {
5151
const {port} = await serverCmd.runCommand(argv);

‎src/shared/lighthouserc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const fs = require('fs');
99
const path = require('path');
1010
const _ = require('./lodash.js');
1111

12-
/** @typedef {Partial<LHCI.AssertCommand.Options & LHCI.CollectCommand.Options & LHCI.ReportCommand.Options & LHCI.ServerCommand.Options & {extends?: string | undefined}>} YargsOptions */
12+
/** @typedef {Partial<LHCI.AssertCommand.Options & LHCI.CollectCommand.Options & LHCI.UploadCommand.Options & LHCI.ServerCommand.Options & {extends?: string | undefined}>} YargsOptions */
1313

1414
/**
1515
* @param {string} pathToRcFile
@@ -31,7 +31,7 @@ function loadAndParseRcFile(pathToRcFile) {
3131
function convertRcFileToYargsOptions(rcFile, pathToRcFile) {
3232
const {ci = {}} = rcFile;
3333
/** @type {YargsOptions} */
34-
let merged = {...ci.assert, ...ci.collect, ...ci.report, ...ci.server};
34+
let merged = {...ci.assert, ...ci.collect, ...ci.upload, ...ci.server};
3535
if (ci.extends) {
3636
const extendedRcFilePath = path.resolve(path.dirname(pathToRcFile), ci.extends);
3737
const extensionBase = loadAndParseRcFile(extendedRcFilePath);

‎src/report/report.js ‎src/upload/upload.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function getAncestorHash() {
106106
}
107107

108108
/**
109-
* @param {LHCI.ReportCommand.Options} options
109+
* @param {LHCI.UploadCommand.Options} options
110110
* @return {Promise<void>}
111111
*/
112112
async function runCommand(options) {

‎test/cli.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ describe('Lighthouse CI CLI', () => {
104104
}, 60000);
105105
});
106106

107-
describe('report', () => {
107+
describe('upload', () => {
108108
let uuids;
109109
it('should read LHRs from folders', () => {
110110
let {stdout = '', stderr = '', status = -1} = spawnSync(
111111
CLI_PATH,
112-
['report', `--serverBaseUrl=http://localhost:${serverPort}`],
112+
['upload', `--serverBaseUrl=http://localhost:${serverPort}`],
113113
{env: {...process.env, LHCI_TOKEN: projectToken}}
114114
);
115115

‎test/fixtures/lighthouserc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"budgets": [{"resourceSizes": [{"resourceType": "script", "budget": 1}]}]
1414
}
1515
},
16-
"report": {
16+
"upload": {
1717
"serverBaseUrl": "http://localhost:9009"
1818
},
1919
"server": {

‎types/lighthouserc.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ declare global {
1111
extends?: string;
1212
assert?: Partial<AssertCommand.Options>;
1313
collect?: Partial<CollectCommand.Options>;
14-
report?: Partial<ReportCommand.Options>;
14+
upload?: Partial<UploadCommand.Options>;
1515
server?: Partial<ServerCommand.Options>;
1616
};
1717
}

‎types/report.d.ts ‎types/upload.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
declare global {
88
namespace LHCI {
9-
namespace ReportCommand {
9+
namespace UploadCommand {
1010
export interface Options {
1111
token: string;
1212
serverBaseUrl: string;

0 commit comments

Comments
 (0)
Please sign in to comment.