From 482c38c287ff31688f0c9efa4ad4331009beeb40 Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Wed, 14 Jun 2017 00:45:34 +0300 Subject: [PATCH] feat(travis): start testing against Node.js 8 and other CI improvements (#1785) * Test against Node.js 8 Configure Travis CI test against Node.js 8 and allow failures. Node.js 8 release notes: https://nodejs.org/en/blog/release/v8.0.0/ * Updates to TravisCI * Refactor picking debug argument for different Node.js versions --- .travis.yml | 16 +++++++++------- gulpfile.js | 17 ++++------------- package.json | 5 +++-- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index db325ad685..31d5007461 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,11 @@ sudo: false node_js: - '6.10' - '7' -#matrix: -# allow_failures: -# - node_js: 7 + - '8' +matrix: + fast_finish: true + allow_failures: + - node_js: '8' os: - linux - centos @@ -27,11 +29,11 @@ addons: - gcc-4.8 - clang before_install: - - npm i nsp -g - - npm i snyk -g + - npm install nsp -g + - npm install snyk -g - npm install protractor - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" + - 'export DISPLAY=:99.0' + - 'sh -e /etc/init.d/xvfb start' - 'node_modules/protractor/bin/webdriver-manager update --standalone --firefox' - 'node_modules/protractor/bin/webdriver-manager start 2>&1 &' - sleep 3 diff --git a/gulpfile.js b/gulpfile.js index 5c51ee9bca..0a33e849e9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -25,7 +25,8 @@ var _ = require('lodash'), webdriver_update = require('gulp-protractor').webdriver_update, webdriver_standalone = require('gulp-protractor').webdriver_standalone, del = require('del'), - KarmaServer = require('karma').Server; + KarmaServer = require('karma').Server, + semver = require('semver'); // Local settings var changedTestFiles = []; @@ -48,18 +49,8 @@ gulp.task('env:prod', function () { // Nodemon task gulp.task('nodemon', function () { - var nodeVersions = process.versions; - var debugArgument = '--debug'; - switch (nodeVersions.node.substr(0, 1)) { - case '4': - case '5': - case '6': - debugArgument = '--debug'; - break; - case '7': - debugArgument = '--inspect'; - break; - } + // Node.js v7 and newer use different debug argument + var debugArgument = semver.satisfies(process.versions.node, '>=7.0.0') ? '--inspect' : '--debug'; return plugins.nodemon({ script: 'server.js', diff --git a/package.json b/package.json index e723384a80..c6394e544a 100644 --- a/package.json +++ b/package.json @@ -15,13 +15,14 @@ "npm": ">=3.10.8" }, "scripts": { - "update": "npm update && npm prune && bower install --allow-root && bower prune --allow-root", + "update": "npm update && npm prune && npm run bower", "clean": "rm -rf node_modules/ public/lib/", "reinstall": "npm cache clean && npm run clean && npm install", "start": "gulp", "start:prod": "gulp prod", "start:debug": "node-debug --web-host 0.0.0.0 server.js & gulp debug", "gulp": "gulp", + "bower": "bower install --allow-root && bower prune --allow-root", "lint": "gulp lint", "test": "gulp test", "test:server": "gulp test:server", @@ -29,7 +30,7 @@ "test:client": "gulp test:client", "test:e2e": "gulp test:e2e", "test:coverage": "gulp test:coverage", - "postinstall": "bower install --allow-root && bower prune --allow-root", + "postinstall": "npm run bower", "generate-ssl-certs": "scripts/generate-ssl-certs.sh" }, "dependencies": {