Skip to content

Commit f4a365c

Browse files
committed
Format code
1 parent 71f6d26 commit f4a365c

File tree

3 files changed

+43
-47
lines changed

3 files changed

+43
-47
lines changed

gulpfile.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ const gulp = require('gulp')
22
const shell = require('./')
33

44
const paths = {
5-
js: [
6-
'*.js',
7-
'test/*.js'
8-
]
5+
js: ['*.js', 'test/*.js']
96
}
107

118
gulp.task('test', shell.task('mocha'))
129

1310
gulp.task('coverage', ['test'], shell.task('istanbul cover _mocha'))
1411

15-
gulp.task('coveralls', ['coverage'], shell.task('cat coverage/lcov.info | coveralls'))
12+
gulp.task(
13+
'coveralls',
14+
['coverage'],
15+
shell.task('cat coverage/lcov.info | coveralls')
16+
)
1617

1718
gulp.task('lint', shell.task('standard ' + paths.js.join(' ')))
1819

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const _ = require('lodash')
22
const async = require('async')
3-
const PluginError = require('plugin-error')
4-
const fancyLog = require('fancy-log')
5-
const template = require('lodash.template')
63
const chalk = require('chalk')
4+
const fancyLog = require('fancy-log')
75
const path = require('path')
6+
const PluginError = require('plugin-error')
87
const spawn = require('child_process').spawn
8+
const template = require('lodash.template')
99
const through = require('through2')
1010

1111
const PLUGIN_NAME = 'gulp-shell'

test/index.js

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/* eslint-env mocha */
22

3-
const Vinyl = require('vinyl')
4-
const join = require('path').join
53
const expect = require('chai').expect
4+
const join = require('path').join
5+
const Vinyl = require('vinyl')
66

77
const shell = require('..')
88

99
function 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

1515
describe('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

Comments
 (0)