1
1
'use strict'
2
- var t = require ( 'tap' ) ;
2
+ var t = require ( 'tap' )
3
3
4
4
const spawn = require ( 'child_process' ) . spawn
5
5
const bin = require . resolve ( '../bin/semver' )
6
- const run = args => new Promise ( ( res , rej ) => {
6
+ const run = args => new Promise ( ( resolve , reject ) => {
7
7
const c = spawn ( process . execPath , [ bin ] . concat ( args ) )
8
- c . on ( 'error' , rej )
8
+ c . on ( 'error' , reject )
9
9
const out = [ ]
10
10
const err = [ ]
11
11
c . stdout . setEncoding ( 'utf-8' )
12
12
c . stdout . on ( 'data' , chunk => out . push ( chunk ) )
13
13
c . stderr . setEncoding ( 'utf-8' )
14
14
c . stderr . on ( 'data' , chunk => err . push ( chunk ) )
15
15
c . on ( 'close' , ( code , signal ) => {
16
- res ( {
16
+ resolve ( {
17
17
out : out . join ( '' ) ,
18
18
err : err . join ( '' ) ,
19
19
code : code ,
@@ -22,13 +22,10 @@ const run = args => new Promise((res, rej) => {
22
22
} )
23
23
} )
24
24
25
- const runTest = ( t , args , expect ) =>
26
- run ( args ) . then ( actual => t . match ( actual , expect ) )
27
-
28
25
t . test ( 'inc tests' , t => {
29
26
[
30
27
[ [ '-i' , 'major' , '1.0.0' ] , { out : '2.0.0' , code : 0 , signal : null } ] ,
31
28
[ [ '-i' , 'major' , '1.0.0' , '1.0.1' ] , { out : '' , err : '--inc can only be used on a single version with no range' , code : 1 } ]
32
29
] . forEach ( c => t . resolveMatch ( run ( c [ 0 ] ) , c [ 1 ] ) )
33
30
t . end ( )
34
- } ) ;
31
+ } )
0 commit comments