Skip to content

Commit

Permalink
tests(cli): merge conflicts resolved with start server command
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Nov 8, 2019
1 parent 0e62625 commit c18364f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 1 addition & 5 deletions packages/cli/test/cli.test.js
Expand Up @@ -166,18 +166,14 @@ describe('Lighthouse CI CLI', () => {

it('should collect results with a server command', () => {
const startCommand = `yarn start server -p=14927 --storage.sqlDatabasePath=${tmpSqlFilePath}`;
let {stdout = '', stderr = '', status = -1} = spawnSync(CLI_PATH, [
const {stdout, stderr, status} = runCLI([
'collect',
`-n=1`,
`--rc-file=${rcFile}`,
`--start-server-command=${startCommand}`,
`--url=http://localhost:14927/app/`,
]);

stdout = stdout.toString();
stderr = stderr.toString();
status = status || 0;

const stdoutClean = stdout
.replace(/:\d{4,6}/g, ':XXXX')
.replace(/sqlDatabasePath=.*?"/, 'sqlDatabasePath=<file>"');
Expand Down
5 changes: 4 additions & 1 deletion packages/utils/src/child-process-helper.js
Expand Up @@ -72,7 +72,10 @@ function getListOfRunningCommands() {
.spawnSync('ps', ['aux'])
.stdout.toString()
.split('\n')
.map(line => line.split(/\d+:\d+\.\d+/)[1])
.map(line => {
const matches = line.split(/\s+\d+:\d+(\.\d+)?/g);
return matches && matches[matches.length - 1];
})
.filter(Boolean)
.map(command => command.trim());
}
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/test/child-process-helper.test.js
Expand Up @@ -22,7 +22,7 @@ async function tryUntilPasses(fn, timeout = 5000) {
await fn();
return;
} catch (err) {
lastError = error;
lastError = err;
await wait();
}
}
Expand Down

0 comments on commit c18364f

Please sign in to comment.