Skip to content

Commit

Permalink
silence the CLI tests from logging out.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Feb 7, 2017
1 parent 1fd9580 commit 77cd6c6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lighthouse-cli/test/cli/chrome-launcher-test.js
Expand Up @@ -19,15 +19,18 @@
require('../../compiled-check.js')('chrome-launcher.js');

const ChromeLauncher = require('../../chrome-launcher.js').ChromeLauncher;
const log = require('../../../lighthouse-core/lib/log');
const assert = require('assert');

/* eslint-env mocha */

describe('ChromeLauncher', () => {
it('doesn\'t fail when killed twice', () => {
log.setLevel('error');
const chromeInstance = new ChromeLauncher();
return chromeInstance.run()
.then(() => {
log.setLevel();
return Promise.all([
chromeInstance.kill(),
chromeInstance.kill()
Expand All @@ -36,6 +39,7 @@ describe('ChromeLauncher', () => {
});

it('doesn\'t launch multiple chrome processes', () => {
log.setLevel('error');
const chromeInstance = new ChromeLauncher();
let pid;
return chromeInstance.run()
Expand All @@ -44,6 +48,7 @@ describe('ChromeLauncher', () => {
return chromeInstance.run();
})
.then(() => {
log.setLevel();
assert.strictEqual(pid, chromeInstance.chrome.pid);
return chromeInstance.kill();
});
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-cli/test/cli/index-test.js
Expand Up @@ -22,7 +22,7 @@ const childProcess = require('child_process');

describe('CLI Tests', function() {
it('fails if a url is not provided', () => {
assert.throws(() => childProcess.execSync('node lighthouse-cli/index.js'),
assert.throws(() => childProcess.execSync('node lighthouse-cli/index.js', {stdio: 'pipe'}),
/Please provide a url/);
});

Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/lib/log.js
Expand Up @@ -87,13 +87,13 @@ class Log {
static setLevel(level) {
switch (level) {
case 'silent':
debug.disable();
debug.enable('-*');
break;
case 'verbose':
debug.enable('*');
break;
case 'error':
debug.enable('*:error');
debug.enable('-*, *:error');
break;
default:
debug.enable('*, -*:verbose');
Expand Down
4 changes: 3 additions & 1 deletion lighthouse-core/scripts/run-mocha.sh
Expand Up @@ -15,5 +15,7 @@ elif [ "$flag" == '--viewer' ]; then
elif [ "$flag" == '--core' ]; then
_runmocha 'lighthouse-core'
else
_runmocha 'lighthouse-cli' && _runmocha 'lighthouse-core' && _runmocha 'lighthouse-viewer'
echo "lighthouse-core tests" && _runmocha 'lighthouse-core' && \
echo "lighthouse-cli tests" && _runmocha 'lighthouse-cli' && \
echo "lighthouse-viewer tests" && _runmocha 'lighthouse-viewer'
fi

0 comments on commit 77cd6c6

Please sign in to comment.