11/* eslint-env mocha */
22
3- const Vinyl = require ( 'vinyl' )
4- const join = require ( 'path' ) . join
53const expect = require ( 'chai' ) . expect
4+ const join = require ( 'path' ) . join
5+ const Vinyl = require ( 'vinyl' )
66
77const shell = require ( '..' )
88
99function expectToBeOk ( stream , done ) {
10- stream
11- . on ( 'error' , done )
12- . on ( 'data' , ( ) => { done ( ) } )
10+ stream . on ( 'error' , done ) . on ( 'data' , ( ) => {
11+ done ( )
12+ } )
1313}
1414
1515describe ( 'gulp-shell(commands, options)' , ( ) => {
@@ -27,39 +27,38 @@ describe('gulp-shell(commands, options)', () => {
2727 expect ( shell . bind ( null , 'true' ) ) . to . not . throw ( )
2828 } )
2929
30- it ( 'passes file through' , ( done ) => {
30+ it ( 'passes file through' , done => {
3131 const stream = shell ( [ 'true' ] )
3232
33- stream . on ( 'data' , ( file ) => {
33+ stream . on ( 'data' , file => {
3434 expect ( file ) . to . equal ( fakeFile )
3535 done ( )
3636 } )
3737
3838 stream . write ( fakeFile )
3939 } )
4040
41- it ( 'executes command after interpolation' , ( done ) => {
42- const stream = shell ( [
43- `test <%= file.path %> = ${ fakeFile . path } `
44- ] )
41+ it ( 'executes command after interpolation' , done => {
42+ const stream = shell ( [ `test <%= file.path %> = ${ fakeFile . path } ` ] )
4543
4644 expectToBeOk ( stream , done )
4745
4846 stream . write ( fakeFile )
4947 } )
5048
51- it ( 'prepends `./node_modules/.bin` to `PATH`' , ( done ) => {
52- const stream = shell ( [
53- `echo $PATH | grep -q "${ join ( process . cwd ( ) , 'node_modules/.bin' ) } "`
54- ] , { shell : 'bash' } )
49+ it ( 'prepends `./node_modules/.bin` to `PATH`' , done => {
50+ const stream = shell (
51+ [ `echo $PATH | grep -q "${ join ( process . cwd ( ) , 'node_modules/.bin' ) } "` ] ,
52+ { shell : 'bash' }
53+ )
5554
5655 expectToBeOk ( stream , done )
5756
5857 stream . write ( fakeFile )
5958 } )
6059
6160 describe ( '.task(commands, options)' , ( ) => {
62- it ( 'returns a function which returns a callback' , ( done ) => {
61+ it ( 'returns a function which returns a callback' , done => {
6362 const task = shell . task ( [ 'echo hello world' ] )
6463
6564 expect ( task ) . to . be . a ( 'function' )
@@ -70,20 +69,18 @@ describe('gulp-shell(commands, options)', () => {
7069
7170 describe ( 'options' , ( ) => {
7271 describe ( 'cwd' , ( ) => {
73- it ( 'sets the current working directory when `cwd` is a string' , ( done ) => {
74- const stream = shell ( [
75- `test $PWD = ${ join ( __dirname , '../..' ) } `
76- ] , { cwd : '..' } )
72+ it ( 'sets the current working directory when `cwd` is a string' , done => {
73+ const stream = shell ( [ `test $PWD = ${ join ( __dirname , '../..' ) } ` ] , {
74+ cwd : '..'
75+ } )
7776
7877 expectToBeOk ( stream , done )
7978
8079 stream . write ( fakeFile )
8180 } )
8281
83- it ( 'uses the process current working directory when `cwd` is not passed' , ( done ) => {
84- const stream = shell ( [
85- `test $PWD = ${ join ( __dirname , '..' ) } `
86- ] )
82+ it ( 'uses the process current working directory when `cwd` is not passed' , done => {
83+ const stream = shell ( [ `test $PWD = ${ join ( __dirname , '..' ) } ` ] )
8784
8885 expectToBeOk ( stream , done )
8986
@@ -92,10 +89,8 @@ describe('gulp-shell(commands, options)', () => {
9289 } )
9390
9491 describe ( 'shell' , ( ) => {
95- it ( 'changes the shell' , ( done ) => {
96- const stream = shell ( [
97- '[[ $0 = bash ]]'
98- ] , { shell : 'bash' } )
92+ it ( 'changes the shell' , done => {
93+ const stream = shell ( [ '[[ $0 = bash ]]' ] , { shell : 'bash' } )
9994
10095 expectToBeOk ( stream , done )
10196
@@ -104,8 +99,8 @@ describe('gulp-shell(commands, options)', () => {
10499 } )
105100
106101 describe ( 'quiet' , ( ) => {
107- it ( "won't output anything when `quiet` == true" , ( done ) => {
108- const stream = shell ( [ 'echo cannot see me!' ] , { quiet : true } )
102+ it ( "won't output anything when `quiet` == true" , done => {
103+ const stream = shell ( [ 'echo cannot see me!' ] , { quiet : true } )
109104
110105 expectToBeOk ( stream , done )
111106
@@ -114,7 +109,7 @@ describe('gulp-shell(commands, options)', () => {
114109 } )
115110
116111 describe ( 'ignoreErrors' , ( ) => {
117- it ( 'emits error by default' , ( done ) => {
112+ it ( 'emits error by default' , done => {
118113 const stream = shell ( [ 'false' ] )
119114
120115 stream . on ( 'error' , ( ) => {
@@ -124,8 +119,8 @@ describe('gulp-shell(commands, options)', () => {
124119 stream . write ( fakeFile )
125120 } )
126121
127- it ( "won't emit error when `ignoreErrors` == true" , ( done ) => {
128- const stream = shell ( [ 'false' ] , { ignoreErrors : true } )
122+ it ( "won't emit error when `ignoreErrors` == true" , done => {
123+ const stream = shell ( [ 'false' ] , { ignoreErrors : true } )
129124
130125 stream . on ( 'error' , ( ) => {
131126 throw new Error ( )
@@ -140,24 +135,24 @@ describe('gulp-shell(commands, options)', () => {
140135 } )
141136
142137 describe ( 'errorMessage' , ( ) => {
143- it ( 'allows for custom messages' , ( done ) => {
138+ it ( 'allows for custom messages' , done => {
144139 const errorMessage = 'foo'
145- const stream = shell ( [ 'false' ] , { errorMessage} )
140+ const stream = shell ( [ 'false' ] , { errorMessage } )
146141
147- stream . on ( 'error' , ( error ) => {
142+ stream . on ( 'error' , error => {
148143 expect ( error . message ) . to . equal ( errorMessage )
149144 done ( )
150145 } )
151146
152147 stream . write ( fakeFile )
153148 } )
154149
155- it ( 'includes the error object in the error context' , ( done ) => {
150+ it ( 'includes the error object in the error context' , done => {
156151 const errorMessage = 'Foo <%= error.code %>'
157152 const expectedMessage = 'Foo 2'
158- const stream = shell ( [ 'exit 2' ] , { errorMessage} )
153+ const stream = shell ( [ 'exit 2' ] , { errorMessage } )
159154
160- stream . on ( 'error' , ( error ) => {
155+ stream . on ( 'error' , error => {
161156 expect ( error . message ) . to . equal ( expectedMessage )
162157 done ( )
163158 } )
0 commit comments