Skip to content

Commit

Permalink
remove support for node before v6 (#1519)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Jan 24, 2017
1 parent 9ea9738 commit a17238a
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 81 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
language: node_js
matrix:
include:
- node_js: "4.3.2"
- node_js: "5"
- node_js: "6"
- node_js: "6.9.1"
- node_js: "7"
sudo: required
dist: trusty
Expand All @@ -17,7 +15,6 @@ install:
- npm install
- npm run install-all
before_script:
- if [[ $(node -v) =~ ^v4.* ]]; then export __node_harmony=--harmony; fi
- export DISPLAY=:99.0
- export LIGHTHOUSE_CHROMIUM_PATH="$(pwd)/chrome-linux/chrome"
- sh -e /etc/init.d/xvfb start
Expand Down
6 changes: 0 additions & 6 deletions lighthouse-cli/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ const _SIGINT_EXIT_CODE = 130;
const _RUNTIME_ERROR_CODE = 1;
const _PROTOCOL_TIMEOUT_EXIT_CODE = 67;

const environment = require('../lighthouse-core/lib/environment.js');
if (!environment.checkNodeCompatibility()) {
console.warn('Compatibility error', 'Lighthouse requires node 5+ or 4 with --harmony');
process.exit(_RUNTIME_ERROR_CODE);
}

const assetSaver = require('../lighthouse-core/lib/asset-saver.js');
import {ChromeLauncher} from './chrome-launcher';
import * as Commands from './commands/commands';
Expand Down
13 changes: 3 additions & 10 deletions lighthouse-cli/test/cli/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,23 @@
/* eslint-env mocha */
const assert = require('assert');
const childProcess = require('child_process');
let node = 'node';

describe('CLI Tests', function() {
before(() => {
if (/^v4.*/.test(process.version)) {
node = 'node --harmony';
}
});

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'),
/Please provide a url/);
});

it('should list all audits without a url and exit immediately after', () => {
const output = JSON.parse(childProcess.execSync(
`${node} lighthouse-cli/index.js --list-all-audits`).toString());
'node lighthouse-cli/index.js --list-all-audits').toString());
assert.ok(Array.isArray(output.audits));
assert.ok(output.audits.length > 0);
});

it('accepts just the list-trace-categories flag and exit immediately after', () => {
const output = JSON.parse(childProcess.execSync(
`${node} lighthouse-cli/index.js --list-trace-categories`).toString());
'node lighthouse-cli/index.js --list-trace-categories').toString());
assert.ok(Array.isArray(output.traceCategories));
assert.ok(output.traceCategories.length > 0);
});
Expand Down
6 changes: 0 additions & 6 deletions lighthouse-cli/test/smokehouse/smokehouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ function runLighthouse(url, configPath) {
'--port=0'
];

// Assume if currently running in Node v4 that child process will as well, so
// run Lighthouse with --harmony flag.
if (/v4/.test(process.version)) {
args.unshift('--harmony');
}

// Lighthouse sometimes times out waiting to for a connection to Chrome in CI.
// Watch for this error and retry relaunching Chrome and running Lighthouse up
// to RETRIES times. See https://github.com/GoogleChrome/lighthouse/issues/833
Expand Down
1 change: 0 additions & 1 deletion lighthouse-core/.npmrc

This file was deleted.

7 changes: 0 additions & 7 deletions lighthouse-core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@

'use strict';

const environment = require('../lighthouse-core/lib/environment');
if (!environment.checkNodeCompatibility()) {
// eslint-disable-next-line no-console
console.warn('Compatibility error', 'Lighthouse requires node 5+ or 4 with --harmony');
process.exit(1);
}

const Runner = require('./runner');
const log = require('./lib/log.js');
const ChromeProtocol = require('./gather/connections/cri.js');
Expand Down
39 changes: 0 additions & 39 deletions lighthouse-core/lib/environment.js

This file was deleted.

2 changes: 1 addition & 1 deletion lighthouse-core/scripts/run-mocha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
flag=$1

function _runmocha() {
mocha $2 $__node_harmony $(find $1/test -name '*-test.js') --timeout 60000;
mocha $2 $(find $1/test -name '*-test.js') --timeout 60000;
}

if [ "$flag" == '--watch' ]; then
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "lighthouse-extension",
"private": true,
"engines": {
"node": ">=0.8.0"
"node": ">=6"
},
"scripts": {
"watch": "gulp watch",
"build": "gulp build -- $__node_harmony"
"build": "gulp build"
},
"devDependencies": {
"brfs": "^1.4.3",
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "lighthouse-viewer",
"private": true,
"engines": {
"node": ">=5"
"node": ">=6"
},
"scripts": {
"watch": "gulp watch",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"chrome-debug": "./lighthouse-cli/manual-chrome-launcher.js"
},
"engines": {
"node": ">=5"
"node": ">=6"
},
"scripts": {
"install-all": "npm run install-cli && npm run install-extension && npm run install-viewer",
Expand All @@ -21,7 +21,7 @@
"build-viewer": "npm run build -C ./lighthouse-viewer",
"lint": "[ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .",
"smoke": "lighthouse-cli/test/smokehouse/offline-local/run-tests.sh && lighthouse-cli/test/smokehouse/dobetterweb/run-tests.sh",
"coverage": "node $__node_harmony $(npm bin)/istanbul cover -x \"**/third_party/**\" _mocha -- $(find */test -name '*-test.js') --timeout 10000 --reporter progress",
"coverage": "node $(npm bin)/istanbul cover -x \"**/third_party/**\" _mocha -- $(find */test -name '*-test.js') --timeout 10000 --reporter progress",
"coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
"start": "node ./lighthouse-cli/index.js",
"test": "npm run lint --silent && npm run unit",
Expand All @@ -33,7 +33,7 @@
"watch": "lighthouse-core/scripts/run-mocha.sh --watch",
"chrome": "./lighthouse-cli/manual-chrome-launcher.js",
"fast": "npm run start -- --disable-device-emulation --disable-cpu-throttling --disable-network-throttling",
"smokehouse": "node $__node_harmony lighthouse-cli/test/smokehouse/smokehouse.js",
"smokehouse": "node lighthouse-cli/test/smokehouse/smokehouse.js",
"deploy-viewer": "cd lighthouse-viewer && gulp deploy"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Quick-start guide on using the Lighthouse extension: http://bit.ly/lighthouse-qu

## Install CLI [![NPM lighthouse package](https://img.shields.io/npm/v/lighthouse.svg)](https://npmjs.org/package/lighthouse)

Requires Node v5+ or Node v4 w/ `--harmony`
Requires Node v6+

```sh
npm install -g lighthouse
Expand Down

0 comments on commit a17238a

Please sign in to comment.