Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Jul 8, 2017
1 parent feeaf52 commit c9cd993
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lighthouse-cli/test/cli/run-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ describe('CLI run', function() {
const url = 'chrome://version';
const filename = path.join(process.cwd(), 'run.ts.results.json');
const flags = getFlags(`--output=json --output-path=${filename} ${url}`);
return run.runLighthouse(url, flags, fastConfig).then(_ => {
return run.runLighthouse(url, flags, fastConfig).then(passedResults => {
assert.ok(fs.existsSync(filename));
const results = JSON.parse(fs.readFileSync(filename, 'utf-8'));
assert.equal(results.audits.viewport.rawValue, false);

// passed results match saved results
assert.strictEqual(results.generatedTime, passedResults.generatedTime);
assert.strictEqual(results.url, passedResults.url);
assert.strictEqual(results.audits.viewport.rawValue, passedResults.audits.viewport.rawValue);
assert.deepStrictEqual(results.timing, passedResults.timing);

fs.unlinkSync(filename);
});
});
}).timeout(60000);
});

0 comments on commit c9cd993

Please sign in to comment.