Skip to content

Commit

Permalink
Merge pull request #531 from feross/0.10
Browse files Browse the repository at this point in the history
Add back node 0.10, 0.12 tests
  • Loading branch information
feross committed May 26, 2016
2 parents 61a54d1 + 8ea6a10 commit 24e2843
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ language: node_js
node_js:
- '4'
- 'node'
- '0.12'
- '0.10'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 16 additions & 3 deletions test/clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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 + ')')
Expand Down Expand Up @@ -122,11 +122,24 @@ 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))
cb(null)
})
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)
}
}
4 changes: 2 additions & 2 deletions test/cmd.js
Original file line number Diff line number Diff line change
@@ -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)
})
Expand Down

0 comments on commit 24e2843

Please sign in to comment.