diff --git a/.travis.yml b/.travis.yml index 4d7e22ab8..b9f31b674 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,3 +2,5 @@ language: node_js node_js: - '4' - 'node' + - '0.12' + - '0.10' diff --git a/package.json b/package.json index 4104af935..29c5240fb 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "devDependencies": { "babel-eslint": "^6.0.0", - "cross-spawn-async": "^2.1.8", + "cross-spawn": "^3.0.1", "minimist": "^1.2.0", "mkdirp": "^0.5.1", "run-parallel-limit": "^1.0.2", diff --git a/test/clone.js b/test/clone.js index f99084e73..8c0d50010 100644 --- a/test/clone.js +++ b/test/clone.js @@ -8,7 +8,7 @@ * VERSION BUMP.) */ -var crossSpawnAsync = require('cross-spawn-async') +var crossSpawn = require('cross-spawn') var fs = require('fs') var minimist = require('minimist') var mkdirp = require('mkdirp') @@ -68,7 +68,7 @@ test('test github repos that use `standard`', function (t) { var url = pkg.repo + '.git' var folder = path.join(TMP, name) return function (cb) { - fs.access(path.join(TMP, name), fs.R_OK | fs.W_OK, function (err) { + access(path.join(TMP, name), fs.R_OK | fs.W_OK, function (err) { if (argv.offline) { if (err) { t.pass('SKIPPING (offline): ' + name + ' (' + pkg.repo + ')') @@ -122,7 +122,7 @@ test('test github repos that use `standard`', function (t) { function spawn (command, args, opts, cb) { if (!opts.stdio) opts.stdio = argv.quiet ? 'ignore' : 'inherit' - var child = crossSpawnAsync(command, args, opts) + var child = crossSpawn(command, args, opts) child.on('error', cb) child.on('close', function (code) { if (code !== 0) return cb(new Error('non-zero exit code: ' + code)) @@ -130,3 +130,16 @@ function spawn (command, args, opts, cb) { }) return child } + +function access (path, mode, callback) { + if (typeof mode === 'function') { + return access(path, null, callback) + } + + // Node v0.10 lacks `fs.access`, which is faster, so fallback to `fs.stat` + if (typeof fs.access === 'function') { + fs.access(path, mode, callback) + } else { + fs.stat(path, callback) + } +} diff --git a/test/cmd.js b/test/cmd.js index ae5d8a525..ddb2cdf06 100644 --- a/test/cmd.js +++ b/test/cmd.js @@ -1,13 +1,13 @@ var path = require('path') var test = require('tape') -var crossSpawnAsync = require('cross-spawn-async') +var crossSpawn = require('cross-spawn') var CMD_PATH = path.join(__dirname, '..', 'bin', 'cmd.js') test('command line usage: --help', function (t) { t.plan(1) - var child = crossSpawnAsync(CMD_PATH, ['--help']) + var child = crossSpawn(CMD_PATH, ['--help']) child.on('error', function (err) { t.fail(err) })