From c933e32175305f3c1a85ecba28daec7ace91eed0 Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Thu, 26 Sep 2019 22:07:17 -0400 Subject: [PATCH] build: mocha@6.2.0 closes #180 --- .travis.yml | 13 +++++++++++++ appveyor.yml | 13 +++++++++++++ package.json | 2 +- test/3.x/app.js | 6 ++++++ test/4.x/app.js | 6 ++++++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7581382..a10b963 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,19 @@ 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()