diff --git a/.travis.yml b/.travis.yml index 6c8c1c826..1fd3be813 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ node_js: - "0.12" - 4 - 5 - - 6 - 7 env: @@ -13,9 +12,11 @@ env: - SAUCE_USERNAME: karmarunnerbot - secure: "bRVY+hYZwMf1SqVnMyZRJTLD0gN1hLx9/MwO8MM/qBiu3YNjXy49XElfMdzMKN6cZeKTmhcnjmZonbJuI1PQ2t+utGkyjnlVLJ/OlWptreKLzIlcbt4hrdPoTcjmUTwDWq9Ex9cVoYX8AzCasETttpczp3P+s3+vmOUj8z25JyU=" - CXX=g++-4.8 +matrix: + fast_finish: true include: - - node_js: "5" - env: VALIDATE_COMMIT_MSG=TRUE + - node_js: "6" + env: VALIDATE_COMMIT_MSG=true LINT=true before_install: - npm config set loglevel warn @@ -36,6 +37,8 @@ before_script: - sh -e /etc/init.d/xvfb start - npm run init - export $(openssl aes-256-cbc -pass env:CREDENTIALS_PASS -d -in credentials) + - 'if [ "$VALIDATE_COMMIT_MSG" == "true" ]; then npm run travis; else ./scripts/validate-commit-msg.sh $TRAVIS_COMMIT; fi' + - 'if [ "$LINT" == "true" ]; then npm run lint; fi' script: - - 'if [ "${VALIDATE_COMMIT_MSG}" != "TRUE" ]; then npm run travis; else ./scripts/validate-commit-msg.sh "${TRAVIS_COMMIT}"; fi' + - npm run travis diff --git a/gruntfile.js b/gruntfile.js index 261c04c1d..832cd5e22 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -137,7 +137,6 @@ module.exports = function (grunt) { grunt.registerTask('build', ['browserify:client']) grunt.registerTask('default', ['build', 'test', 'lint']) - grunt.registerTask('lint', ['eslint']) grunt.registerTask('test-appveyor', ['test:unit', 'test:client']) grunt.registerTask('release', 'Build, bump and publish to NPM.', function (type) { diff --git a/lib/helper.js b/lib/helper.js index 7c317cb9d..76179d2c5 100644 --- a/lib/helper.js +++ b/lib/helper.js @@ -16,7 +16,7 @@ exports.isDefined = function (value) { } var parser = function (pattern, out) { if (pattern.length === 0) return out - var p = /^(\[[^\]]*\]|[\*\+@\?]\((.+?)\))/g + var p = /^(\[[^\]]*\]|[*+@?]\((.+?)\))/g var matches = p.exec(pattern) if (!matches) { var c = pattern[0] diff --git a/lib/middleware/strip_host.js b/lib/middleware/strip_host.js index ebac2e3f0..1dd75b323 100644 --- a/lib/middleware/strip_host.js +++ b/lib/middleware/strip_host.js @@ -6,7 +6,7 @@ var createStripHostMiddleware = function () { return function (request, response, next) { function stripHostFromUrl (url) { - return url.replace(/^http[s]?:\/\/([a-z\-\.:\d]+)\//, '/') + return url.replace(/^http[s]?:\/\/([a-z\-.:\d]+)\//, '/') } request.normalizedUrl = stripHostFromUrl(request.url) || request.url diff --git a/lib/watcher.js b/lib/watcher.js index 19e23b8a2..284a45088 100644 --- a/lib/watcher.js +++ b/lib/watcher.js @@ -10,9 +10,9 @@ var DIR_SEP = require('path').sep // Get parent folder, that be watched (does not contain any special globbing character) var baseDirFromPattern = function (pattern) { return pattern - .replace(/[\/\\][^\/\\]*\*.*$/, '') // remove parts with * - .replace(/[\/\\][^\/\\]*[!\+]\(.*$/, '') // remove parts with !(...) and +(...) - .replace(/[\/\\][^\/\\]*\)\?.*$/, '') || DIR_SEP // remove parts with (...)? + .replace(/[/\\][^/\\]*\*.*$/, '') // remove parts with * + .replace(/[/\\][^/\\]*[!+]\(.*$/, '') // remove parts with !(...) and +(...) + .replace(/[/\\][^/\\]*\)\?.*$/, '') || DIR_SEP // remove parts with (...)? } var watchPatterns = function (patterns, watcher) { diff --git a/package.json b/package.json index 51fa3b209..d7e101ebf 100644 --- a/package.json +++ b/package.json @@ -311,11 +311,11 @@ ], "dependencies": { "bluebird": "^3.3.0", - "body-parser": "^1.12.4", + "body-parser": "^1.16.1", "chokidar": "^1.4.1", "colors": "^1.1.0", "combine-lists": "^1.0.0", - "connect": "^3.3.5", + "connect": "^3.6.0", "core-js": "^2.2.0", "di": "^0.0.1", "dom-serialize": "^2.2.0", @@ -331,28 +331,28 @@ "optimist": "^0.6.1", "qjobs": "^1.1.4", "range-parser": "^1.2.0", - "rimraf": "^2.3.3", + "rimraf": "^2.6.0", "safe-buffer": "^5.0.1", - "socket.io": "1.7.2", + "socket.io": "1.7.3", "source-map": "^0.5.3", - "tmp": "0.0.28", - "useragent": "^2.1.10" + "tmp": "0.0.31", + "useragent": "^2.1.12" }, "devDependencies": { "LiveScript": "^1.3.0", - "babel": "^6.5.2", - "babel-preset-es2015": "^6.9.0", - "babel-register": "^6.9.0", + "babel": "^6.23.0", + "babel-preset-es2015": "^6.22.0", + "babel-register": "^6.23.0", "chai": "^3.3.0", - "chai-as-promised": "^5.0.0", + "chai-as-promised": "^6.0.0", "chai-subset": "^1.2.2", - "coffee-script": "^1.12.1", + "coffee-script": "^1.12.4", "cucumber": "^1.2.0", - "eslint": "^3.12.1", - "eslint-config-standard": "^5.1.0", - "eslint-plugin-promise": "^1.0.8", - "eslint-plugin-react": "^6.9.0", - "eslint-plugin-standard": "^1.3.1", + "eslint": "^3.15.0", + "eslint-config-standard": "^6.2.1", + "eslint-plugin-promise": "^3.4.2", + "eslint-plugin-react": "^6.10.0", + "eslint-plugin-standard": "^2.0.1", "grunt": "^1.0.0", "grunt-auto-release": "^0.0.7", "grunt-browserify": "^5.0.0", @@ -362,8 +362,7 @@ "grunt-conventional-changelog": "^6.0.1", "grunt-conventional-github-releaser": "^1.0.0", "grunt-cucumberjs": "^0.10.2", - "grunt-eslint": "^18.0.0", - "grunt-mocha-test": "^0.12.7", + "grunt-mocha-test": "^0.13.2", "grunt-npm": "0.0.2", "http2": "^3.3.6", "husky": "^0.13.1", @@ -395,15 +394,14 @@ "mocha": "^3.2.0", "mocks": "^0.0.15", "phantomjs-prebuilt": "^2.1.3", - "proxyquire": "^1.5.0", + "proxyquire": "^1.7.11", "qunitjs": "^2.1.1", "requirejs": "^2.1.20", "sinon": "^1.17.5", "sinon-chai": "^2.7.0", "supertest": "^3.0.0", - "supertest-as-promised": "^3.0.0", "timer-shim": "^0.3.0", - "validate-commit-msg": "^2.4.1", + "validate-commit-msg": "^2.11.1", "which": "^1.1.1" }, "main": "./lib/index", @@ -416,7 +414,7 @@ "version": "1.4.1", "license": "MIT", "scripts": { - "lint": "grunt lint", + "lint": "eslint client/**/*.js common/**/*.js context/**/*.js gruntfile.js wallaby.js lib/**/*.js test/**/*.js static/debug.js", "test": "grunt test", "build": "grunt build", "test:appveyor": "grunt test-appveyor", @@ -425,8 +423,8 @@ "unlink": "node --eval \"require('fs').unlinkSync(require('path').resolve(__dirname, 'node_modules', 'karma'))\"", "init": "rm -rf node_modules/karma && cd node_modules && ln -nsf ../ karma && cd ../", "init:windows": "(IF EXIST node_modules\\karma (rmdir node_modules\\karma /S /q)) && npm run link", - "appveyor": "npm run lint && npm run build && npm run test:appveyor", - "travis": "npm run lint && npm run build && npm test && npm run test:integration", + "appveyor": "npm run build && npm run test:appveyor", + "travis": "npm run build && npm test && npm run test:integration", "commitmsg": "validate-commit-msg", "precommit": "npm run lint" } diff --git a/test/unit/config.spec.js b/test/unit/config.spec.js index 25ceae48d..288343f54 100644 --- a/test/unit/config.spec.js +++ b/test/unit/config.spec.js @@ -340,8 +340,10 @@ describe('config', () => { it('should normalize preprocessors to an array', () => { var config = normalizeConfigWithDefaults({ basePath: '', - preprocessors: {'/*.coffee': 'coffee', - '/*.html': 'html2js'} + preprocessors: { + '/*.coffee': 'coffee', + '/*.html': 'html2js' + } }) expect(config.preprocessors[resolveWinPath('/*.coffee')]).to.deep.equal(['coffee']) @@ -351,8 +353,10 @@ describe('config', () => { it('should resolve relative preprocessor patterns', () => { var config = normalizeConfigWithDefaults({ basePath: '/some/base', - preprocessors: {'*.coffee': 'coffee', - '/**/*.html': 'html2js'} + preprocessors: { + '*.coffee': 'coffee', + '/**/*.html': 'html2js' + } }) expect(config.preprocessors).to.have.property(resolveWinPath('/some/base/*.coffee')) diff --git a/test/unit/middleware/source_files.spec.js b/test/unit/middleware/source_files.spec.js index e99b07e13..9b3bc3c2f 100644 --- a/test/unit/middleware/source_files.spec.js +++ b/test/unit/middleware/source_files.spec.js @@ -1,6 +1,6 @@ import http from 'http' import mocks from 'mocks' -import request from 'supertest-as-promised' +import request from 'supertest' import helper from '../../../lib/helper' import File from '../../../lib/file' import {createServeFile} from '../../../lib/middleware/common' diff --git a/test/unit/server.spec.js b/test/unit/server.spec.js index dc86788fd..22a1c8987 100644 --- a/test/unit/server.spec.js +++ b/test/unit/server.spec.js @@ -23,17 +23,18 @@ describe('server', () => { doneSpy = sinon.spy() - mockConfig = - {frameworks: [], - port: 9876, - autoWatch: true, - listenAddress: '127.0.0.1', - hostname: 'localhost', - urlRoot: '/', - browsers: ['fake'], - singleRun: true, - logLevel: 'OFF', - browserDisconnectTolerance: 0} + mockConfig = { + frameworks: [], + port: 9876, + autoWatch: true, + listenAddress: '127.0.0.1', + hostname: 'localhost', + urlRoot: '/', + browsers: ['fake'], + singleRun: true, + logLevel: 'OFF', + browserDisconnectTolerance: 0 + } server = new Server(mockConfig, doneSpy) diff --git a/test/unit/web-server.spec.js b/test/unit/web-server.spec.js index 42018d505..51ee479da 100644 --- a/test/unit/web-server.spec.js +++ b/test/unit/web-server.spec.js @@ -1,6 +1,6 @@ require('core-js') import {EventEmitter} from 'events' -import request from 'supertest-as-promised' +import request from 'supertest' import di from 'di' import mocks from 'mocks' import fs from 'fs' @@ -217,8 +217,13 @@ describe('web-server', () => { emitter = new EventEmitter() var injector = new di.Injector([{ - config: ['value', {basePath: '/base/path', urlRoot: '/', protocol: 'https:', httpsServerOptions: credentials, - client: {useIframe: true, useSingleWindow: false}}], + config: ['value', { + basePath: '/base/path', + urlRoot: '/', + protocol: 'https:', + httpsServerOptions: credentials, + client: {useIframe: true, useSingleWindow: false} + }], customFileHandlers: ['value', customFileHandlers], emitter: ['value', emitter], fileList: ['value', {files: {served: [], included: []}}],