Skip to content

Commit f149307

Browse files
committed
cleanup
1 parent 3c86923 commit f149307

2 files changed

Lines changed: 22 additions & 19 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"standard-packages": "^1.2.0",
2929
"tape": "^4.0.0",
3030
"win-spawn": "^2.0.0",
31-
"xtend": "^4.0.0"
3231
},
3332
"homepage": "http://standardjs.com",
3433
"keywords": [

test/clone.js

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* VERSION BUMP.)
99
*/
1010

11-
var extend = require('xtend')
1211
var fs = require('fs')
1312
var minimist = require('minimist')
1413
var mkdirp = require('mkdirp')
@@ -55,9 +54,6 @@ test('test github repos that use `standard`', function (t) {
5554

5655
mkdirp.sync(TMP)
5756

58-
// test an empty repo
59-
mkdirp.sync(path.join(TMP, 'empty'))
60-
6157
parallelLimit(testPackages.map(function (pkg) {
6258
var name = pkg.name
6359
var url = pkg.repo + '.git'
@@ -71,28 +67,37 @@ test('test github repos that use `standard`', function (t) {
7167
}
7268
runStandard(cb)
7369
} else {
74-
gitFetch(function (err) {
70+
downloadPackage(function (err) {
7571
if (err) return cb(err)
7672
runStandard(cb)
7773
})
7874
}
7975

80-
function gitFetch (cb) {
81-
var gitArgs = err
82-
? [ 'clone', '--depth', 1, url, path.join(TMP, name) ]
83-
: [ 'pull' ]
84-
var gitOpts = { stdio: 'ignore' }
85-
gitOpts = err
86-
? gitOpts
87-
: extend(gitOpts, { cwd: folder })
88-
spawn(GIT, gitArgs, gitOpts, function (err) {
76+
function downloadPackage (cb) {
77+
if (err) gitClone(cb)
78+
else gitPull(cb)
79+
}
80+
81+
function gitClone (cb) {
82+
var args = [ 'clone', '--depth', 1, url, path.join(TMP, name) ]
83+
spawn(GIT, args, {}, function (err) {
84+
if (err) err.message += ' (' + name + ')'
85+
cb(err)
86+
})
87+
}
88+
89+
function gitPull (cb) {
90+
var args = [ 'pull' ]
91+
spawn(GIT, args, { cwd: folder }, function (err) {
8992
if (err) err.message += ' (' + name + ')'
9093
cb(err)
9194
})
9295
}
9396

9497
function runStandard (cb) {
95-
spawn(STANDARD, [ '--verbose' ], { cwd: folder }, function (err) {
98+
var args = [ '--verbose' ]
99+
if (pkg.args) args.push.apply(args, pkg.args)
100+
spawn(STANDARD, args, { cwd: folder }, function (err) {
96101
var str = name + ' (' + pkg.repo + ')'
97102
if (err) { t.fail(str) } else { t.pass(str) }
98103
cb(null)
@@ -106,9 +111,8 @@ test('test github repos that use `standard`', function (t) {
106111
})
107112

108113
function spawn (command, args, opts, cb) {
109-
if (!argv.quiet) {
110-
opts = extend({ stdio: 'inherit' }, opts)
111-
}
114+
opts.stdio = argv.quiet ? 'ignore' : 'inherit'
115+
112116
var child = winSpawn(command, args, opts)
113117
child.on('error', cb)
114118
child.on('close', function (code) {

0 commit comments

Comments
 (0)