@@ -6,9 +6,9 @@ import pify from 'pify';
66import rimraf from 'rimraf' ;
77import test from 'ava' ;
88import tempy from 'tempy' ;
9+ import executable from 'executable' ;
910import Fn from '.' ;
1011
11- const fsP = pify ( fs ) ;
1212const rimrafP = pify ( rimraf ) ;
1313const fixture = path . join . bind ( path , __dirname , 'fixtures' ) ;
1414
@@ -93,7 +93,7 @@ test('download files even if they are not used', async t => {
9393 . use ( process . platform === 'win32' ? 'gifsicle.exe' : 'gifsicle' ) ;
9494
9595 await bin . run ( ) ;
96- const files = await fsP . readdirSync ( bin . dest ( ) ) ;
96+ const files = fs . readdirSync ( bin . dest ( ) ) ;
9797
9898 t . is ( files . length , 3 ) ;
9999 t . is ( files [ 0 ] , 'gifsicle' ) ;
@@ -121,3 +121,20 @@ test('error if no binary is found and no source is provided', async t => {
121121
122122 await t . throws ( bin . run ( ) , 'No binary found matching your system. It\'s probably not supported.' ) ;
123123} ) ;
124+
125+ test ( 'downloaded files are set to be executable' , async t => {
126+ const bin = new Fn ( { strip : 0 , skipCheck : true } )
127+ . src ( 'http://foo.com/gifsicle-darwin.tar.gz' )
128+ . src ( 'http://foo.com/gifsicle-win32.tar.gz' )
129+ . src ( 'http://foo.com/test.js' )
130+ . dest ( tempy . directory ( ) )
131+ . use ( process . platform === 'win32' ? 'gifsicle.exe' : 'gifsicle' ) ;
132+
133+ await bin . run ( ) ;
134+
135+ const files = fs . readdirSync ( bin . dest ( ) ) ;
136+
137+ files . forEach ( fileName => {
138+ t . true ( executable . sync ( path . join ( bin . dest ( ) , fileName ) ) ) ;
139+ } ) ;
140+ } ) ;
0 commit comments