11'use strict' ;
22
3- var BinWrapper = require ( '../' ) ;
43var fs = require ( 'fs' ) ;
5- var nock = require ( 'nock' ) ;
64var path = require ( 'path' ) ;
7- var fixture = path . join . bind ( path , __dirname , 'fixtures' ) ;
8- var rm = require ( 'rimraf' ) ;
5+ var BinWrapper = require ( '../' ) ;
6+ var nock = require ( 'nock' ) ;
7+ var rimraf = require ( 'rimraf' ) ;
98var test = require ( 'ava' ) ;
9+ var fixture = path . join . bind ( path , __dirname , 'fixtures' ) ;
1010
1111test ( 'expose a constructor' , function ( t ) {
1212 t . plan ( 1 ) ;
@@ -24,7 +24,7 @@ test('add a source', function (t) {
2424 var bin = new BinWrapper ( )
2525 . src ( 'http://foo.com/bar.tar.gz' ) ;
2626
27- t . assert ( bin . _src [ 0 ] . url === 'http://foo.com/bar.tar.gz' ) ;
27+ t . assert ( bin . _src [ 0 ] . url === 'http://foo.com/bar.tar.gz' , bin . _src [ 0 ] . url ) ;
2828} ) ;
2929
3030test ( 'add a source to a specific os' , function ( t ) {
@@ -33,7 +33,7 @@ test('add a source to a specific os', function (t) {
3333 var bin = new BinWrapper ( )
3434 . src ( 'http://foo.com' , process . platform ) ;
3535
36- t . assert ( bin . _src [ 0 ] . os === process . platform ) ;
36+ t . assert ( bin . _src [ 0 ] . os === process . platform , bin . _src [ 0 ] . os ) ;
3737} ) ;
3838
3939test ( 'set destination directory' , function ( t ) {
@@ -42,7 +42,7 @@ test('set destination directory', function (t) {
4242 var bin = new BinWrapper ( )
4343 . dest ( path . join ( __dirname , 'foo' ) ) ;
4444
45- t . assert ( bin . _dest === path . join ( __dirname , 'foo' ) ) ;
45+ t . assert ( bin . _dest === path . join ( __dirname , 'foo' ) , bin . _dest ) ;
4646} ) ;
4747
4848test ( 'set which file to use as the binary' , function ( t ) {
@@ -51,7 +51,7 @@ test('set which file to use as the binary', function (t) {
5151 var bin = new BinWrapper ( )
5252 . use ( 'foo' ) ;
5353
54- t . assert ( bin . _use === 'foo' ) ;
54+ t . assert ( bin . _use === 'foo' , bin . _use ) ;
5555} ) ;
5656
5757test ( 'set a version range to test against' , function ( t ) {
@@ -60,7 +60,7 @@ test('set a version range to test against', function (t) {
6060 var bin = new BinWrapper ( )
6161 . version ( '1.0.0' ) ;
6262
63- t . assert ( bin . _version === '1.0.0' ) ;
63+ t . assert ( bin . _version === '1.0.0' , bin . _version ) ;
6464} ) ;
6565
6666test ( 'get the binary path' , function ( t ) {
@@ -70,7 +70,7 @@ test('get the binary path', function (t) {
7070 . dest ( 'tmp' )
7171 . use ( 'foo' ) ;
7272
73- t . assert ( bin . path ( ) === 'tmp/foo' ) ;
73+ t . assert ( bin . path ( ) === 'tmp/foo' , bin . path ( ) ) ;
7474} ) ;
7575
7676test ( 'verify that a binary is working' , function ( t ) {
@@ -90,7 +90,7 @@ test('verify that a binary is working', function (t) {
9090 t . assert ( fs . existsSync ( bin . path ( ) ) ) ;
9191 t . assert ( scope . isDone ( ) ) ;
9292
93- rm ( bin . dest ( ) , function ( err ) {
93+ rimraf ( bin . dest ( ) , function ( err ) {
9494 t . assert ( ! err , err ) ;
9595 } ) ;
9696 } ) ;
@@ -114,7 +114,7 @@ test('meet the desired version', function (t) {
114114 t . assert ( fs . existsSync ( bin . path ( ) ) ) ;
115115 t . assert ( scope . isDone ( ) ) ;
116116
117- rm ( bin . dest ( ) , function ( err ) {
117+ rimraf ( bin . dest ( ) , function ( err ) {
118118 t . assert ( ! err , err ) ;
119119 } ) ;
120120 } ) ;
@@ -144,11 +144,11 @@ test('download files even if they are not used', function (t) {
144144 t . assert ( ! err , err ) ;
145145 t . assert ( scope . isDone ( ) ) ;
146146 t . assert ( files . length === 3 ) ;
147- t . assert ( files [ 0 ] === 'gifsicle' ) ;
148- t . assert ( files [ 1 ] === 'gifsicle.exe' ) ;
149- t . assert ( files [ 2 ] === 'test.js' ) ;
147+ t . assert ( files [ 0 ] === 'gifsicle' , files [ 0 ] ) ;
148+ t . assert ( files [ 1 ] === 'gifsicle.exe' , files [ 1 ] ) ;
149+ t . assert ( files [ 2 ] === 'test.js' , files [ 2 ] ) ;
150150
151- rm ( bin . dest ( ) , function ( err ) {
151+ rimraf ( bin . dest ( ) , function ( err ) {
152152 t . assert ( ! err , err ) ;
153153 } ) ;
154154 } ) ;
@@ -171,7 +171,7 @@ test('skip running binary check', function (t) {
171171 t . assert ( fs . existsSync ( bin . path ( ) ) ) ;
172172 t . assert ( scope . isDone ( ) ) ;
173173
174- rm ( bin . dest ( ) , function ( err ) {
174+ rimraf ( bin . dest ( ) , function ( err ) {
175175 t . assert ( ! err , err ) ;
176176 } ) ;
177177 } ) ;
@@ -185,7 +185,7 @@ test('error if no binary is found and no source is provided', function (t) {
185185 . use ( process . platform === 'win32' ? 'gifsicle.exe' : 'gifsicle' ) ;
186186
187187 bin . run ( function ( err ) {
188- t . assert ( err ) ;
189- t . assert ( err . message === 'No binary found matching your system. It\'s probably not supported.' ) ;
188+ t . assert ( err , err ) ;
189+ t . assert ( err . message === 'No binary found matching your system. It\'s probably not supported.' , err . message ) ;
190190 } ) ;
191191} ) ;
0 commit comments