diff --git a/.travis.yml b/.travis.yml index 7581382..25b18a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,18 @@ before_install: if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then npm rm --slient --save-dev eslint fi + - | + # mocha for testing + # - use 2.x for Node.js < 0.10 + # - use 3.x for Node.js < 4 + # - use 5.x for Node.js < 6 + if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -eq 0 && "$(cut -d. -f2 <<< "$TRAVIS_NODE_VERSION")" -lt 10 ]]; then + npm install --save-dev mocha@2.5.3 + elif [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 4 ]]; then + npm install --save-dev mocha@3.5.3 + elif [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then + npm install --save-dev mocha@5.2.0 + fi # nyc for coverage # - remove for Node.js < 6 if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then diff --git a/appveyor.yml b/appveyor.yml index 8cb2520..9a0134f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,6 +19,19 @@ install: - npm config set shrinkwrap false # Remove all non-test dependencies - npm rm --silent --save-dev eslint nyc + # Setup Node.js version-specific dependencies + - ps: | + # mocha for testing + # - use 2.x for Node.js < 0.10 + # - use 3.x for Node.js < 4 + # - use 5.x for Node.js < 6 + if ([int]$env:nodejs_version.split(".")[0] -eq 0 -and [int]$env:nodejs_version.split(".")[1] -lt 10) { + npm install --silent --save-dev mocha@2.5.3 + } elseif ([int]$env:nodejs_version.split(".")[0] -lt 4) { + npm install --silent --save-dev mocha@3.5.3 + } elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) { + npm install --silent --save-dev mocha@5.2.0 + } # Install Node.js modules - npm install build: off diff --git a/package.json b/package.json index c792e02..ec0d74b 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ }, "devDependencies": { "eslint": "5.16.0", - "mocha": "2.5.3", + "mocha": "6.2.0", "nyc": "14.1.1", "rimraf": "2.7.1", "supertest": "1.1.0" diff --git a/test/3.x/app.js b/test/3.x/app.js index 7b680a9..5d6afc8 100644 --- a/test/3.x/app.js +++ b/test/3.x/app.js @@ -1,5 +1,6 @@ var path = require('path') var request = require('supertest') +var utils = require('../support/utils') var FIXTURES_DIR = path.join(__dirname, '..', 'fixtures') @@ -32,6 +33,11 @@ hbs.registerPartials(__dirname + '/views/partials'); var app = null before(function () { + if (utils.nodeVersionCompare(10.0) >= 0) { + this.skip() + return + } + var express = require('express') app = express() diff --git a/test/4.x/app.js b/test/4.x/app.js index 822a259..02205ab 100644 --- a/test/4.x/app.js +++ b/test/4.x/app.js @@ -1,5 +1,6 @@ var path = require('path') var request = require('supertest') +var utils = require('../support/utils') var FIXTURES_DIR = path.join(__dirname, '..', 'fixtures') @@ -32,6 +33,11 @@ hbs.registerPartials(__dirname + '/views/partials'); var app = null before(function () { + if (utils.nodeVersionCompare(0.10) <= 0) { + this.skip() + return + } + var express = require('express') app = express()