Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

CI: Update npm when < 1.3.7

Nathan Houle5a793e403753
diff --git a/.travis.yml b/.travis.yml
index 2789c51d..92ca9874 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,6 @@
language: node_js
+before_install:
+- ./scripts/ensure-compatible-npm.sh
script: travis_retry npm test
node_js:
- 'iojs'
diff --git a/package.json b/package.json
index b3ab7097..4577c964 100644
--- a/package.json
+++ b/package.json
@@ -270,7 +270,8 @@
"_mocha": "./bin/_mocha"
},
"engines": {
- "node": ">= 0.8.x"
+ "node": ">= 0.8.x",
+ "npm": ">= 1.3.7"
},
"scripts": {
"test": "make test-all"
diff --git a/scripts/ensure-compatible-npm.sh b/scripts/ensure-compatible-npm.sh
new file mode 100755
index 00000000..00372f70
--- /dev/null
+++ b/scripts/ensure-compatible-npm.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env sh
+
+set -o nounset
+set -o errexit
+
+npm install semver
+if node -e "process.exit(require('semver').lt(process.argv[1], '1.3.7') ? 0 : 1)" $(npm -v); then
+ npm install -g npm@'>= 1.3.7'
+fi
+npm uninstall semver