2
2
/* eslint-env mocha */
3
3
const path = require ( 'path' ) ;
4
4
const assert = require ( 'assert' ) ;
5
- const gutil = require ( 'gulp-util ' ) ;
5
+ const Vinyl = require ( 'vinyl ' ) ;
6
6
const filter = require ( '.' ) ;
7
7
8
8
describe ( 'filter()' , ( ) => {
@@ -20,12 +20,12 @@ describe('filter()', () => {
20
20
cb ( ) ;
21
21
} ) ;
22
22
23
- stream . write ( new gutil . File ( {
23
+ stream . write ( new Vinyl ( {
24
24
base : __dirname ,
25
25
path : path . join ( __dirname , 'included.js' )
26
26
} ) ) ;
27
27
28
- stream . write ( new gutil . File ( {
28
+ stream . write ( new Vinyl ( {
29
29
base : __dirname ,
30
30
path : path . join ( __dirname , 'ignored.js' )
31
31
} ) ) ;
@@ -48,12 +48,12 @@ describe('filter()', () => {
48
48
cb ( ) ;
49
49
} ) ;
50
50
51
- stream . write ( new gutil . File ( {
51
+ stream . write ( new Vinyl ( {
52
52
base : __dirname ,
53
53
path : path . join ( __dirname , 'included.js' )
54
54
} ) ) ;
55
55
56
- stream . write ( new gutil . File ( {
56
+ stream . write ( new Vinyl ( {
57
57
base : __dirname ,
58
58
path : path . join ( __dirname , 'ignored.js' )
59
59
} ) ) ;
@@ -76,12 +76,12 @@ describe('filter()', () => {
76
76
cb ( ) ;
77
77
} ) ;
78
78
79
- stream . write ( new gutil . File ( {
79
+ stream . write ( new Vinyl ( {
80
80
base : __dirname ,
81
81
path : path . join ( __dirname , 'nested' , 'resource.js' )
82
82
} ) ) ;
83
83
84
- stream . write ( new gutil . File ( {
84
+ stream . write ( new Vinyl ( {
85
85
base : __dirname ,
86
86
path : path . join ( __dirname , 'nested' , 'resource.css' )
87
87
} ) ) ;
@@ -106,8 +106,8 @@ describe('filter()', () => {
106
106
cb ( ) ;
107
107
} ) ;
108
108
109
- stream . write ( new gutil . File ( { path : 'included.js' } ) ) ;
110
- stream . write ( new gutil . File ( { path : 'ignored.js' } ) ) ;
109
+ stream . write ( new Vinyl ( { path : 'included.js' } ) ) ;
110
+ stream . write ( new Vinyl ( { path : 'ignored.js' } ) ) ;
111
111
stream . end ( ) ;
112
112
} ) ;
113
113
@@ -126,10 +126,10 @@ describe('filter()', () => {
126
126
cb ( ) ;
127
127
} ) ;
128
128
129
- stream . write ( new gutil . File ( { path : 'included.js' } ) ) ;
130
- stream . write ( new gutil . File ( { path : 'package.json' } ) ) ;
131
- stream . write ( new gutil . File ( { path : '.jshintrc' } ) ) ;
132
- stream . write ( new gutil . File ( { path : 'app.js' } ) ) ;
129
+ stream . write ( new Vinyl ( { path : 'included.js' } ) ) ;
130
+ stream . write ( new Vinyl ( { path : 'package.json' } ) ) ;
131
+ stream . write ( new Vinyl ( { path : '.jshintrc' } ) ) ;
132
+ stream . write ( new Vinyl ( { path : 'app.js' } ) ) ;
133
133
stream . end ( ) ;
134
134
} ) ;
135
135
@@ -148,12 +148,12 @@ describe('filter()', () => {
148
148
} ) ;
149
149
150
150
// Mimic `gulp.src('test/**/*.js')`
151
- stream . write ( new gutil . File ( {
151
+ stream . write ( new Vinyl ( {
152
152
base : path . join ( __dirname , 'test' ) ,
153
153
path : path . join ( __dirname , 'test' , 'included.js' )
154
154
} ) ) ;
155
155
156
- stream . write ( new gutil . File ( {
156
+ stream . write ( new Vinyl ( {
157
157
base : __dirname ,
158
158
path : path . join ( __dirname , 'ignored.js' )
159
159
} ) ) ;
@@ -176,7 +176,7 @@ describe('filter()', () => {
176
176
cb ( ) ;
177
177
} ) ;
178
178
179
- stream . write ( new gutil . File ( {
179
+ stream . write ( new Vinyl ( {
180
180
path : gfile
181
181
} ) ) ;
182
182
@@ -210,9 +210,9 @@ describe('filter.restore', () => {
210
210
cb ( ) ;
211
211
} ) ;
212
212
213
- stream . write ( new gutil . File ( { path : 'package.json' } ) ) ;
214
- stream . write ( new gutil . File ( { path : 'app.js' } ) ) ;
215
- stream . write ( new gutil . File ( { path : 'package2.json' } ) ) ;
213
+ stream . write ( new Vinyl ( { path : 'package.json' } ) ) ;
214
+ stream . write ( new Vinyl ( { path : 'app.js' } ) ) ;
215
+ stream . write ( new Vinyl ( { path : 'package2.json' } ) ) ;
216
216
stream . end ( ) ;
217
217
} ) ;
218
218
@@ -238,9 +238,9 @@ describe('filter.restore', () => {
238
238
cb ( ) ;
239
239
} ) ;
240
240
241
- streamFilter1 . write ( new gutil . File ( { path : 'package.json' } ) ) ;
242
- streamFilter1 . write ( new gutil . File ( { path : 'app.js' } ) ) ;
243
- streamFilter1 . write ( new gutil . File ( { path : 'main.css' } ) ) ;
241
+ streamFilter1 . write ( new Vinyl ( { path : 'package.json' } ) ) ;
242
+ streamFilter1 . write ( new Vinyl ( { path : 'app.js' } ) ) ;
243
+ streamFilter1 . write ( new Vinyl ( { path : 'main.css' } ) ) ;
244
244
streamFilter1 . end ( ) ;
245
245
} ) ;
246
246
@@ -259,9 +259,9 @@ describe('filter.restore', () => {
259
259
cb ( ) ;
260
260
} ) ;
261
261
262
- stream . write ( new gutil . File ( { path : 'package.json' } ) ) ;
263
- stream . write ( new gutil . File ( { path : 'app.js' } ) ) ;
264
- stream . write ( new gutil . File ( { path : 'package2.json' } ) ) ;
262
+ stream . write ( new Vinyl ( { path : 'package.json' } ) ) ;
263
+ stream . write ( new Vinyl ( { path : 'app.js' } ) ) ;
264
+ stream . write ( new Vinyl ( { path : 'package2.json' } ) ) ;
265
265
stream . end ( ) ;
266
266
} ) ;
267
267
@@ -276,7 +276,7 @@ describe('filter.restore', () => {
276
276
setImmediate ( ( ) => {
277
277
restoreStream . end ( ) ;
278
278
setImmediate ( ( ) => {
279
- stream . write ( new gutil . File ( { path : 'app2.js' } ) ) ;
279
+ stream . write ( new Vinyl ( { path : 'app2.js' } ) ) ;
280
280
stream . end ( ) ;
281
281
} ) ;
282
282
} ) ;
@@ -290,8 +290,8 @@ describe('filter.restore', () => {
290
290
cb ( ) ;
291
291
} ) ;
292
292
293
- stream . write ( new gutil . File ( { path : 'package.json' } ) ) ;
294
- stream . write ( new gutil . File ( { path : 'app.js' } ) ) ;
293
+ stream . write ( new Vinyl ( { path : 'package.json' } ) ) ;
294
+ stream . write ( new Vinyl ( { path : 'app.js' } ) ) ;
295
295
} ) ;
296
296
297
297
it ( 'should pass files as they come' , cb => {
@@ -316,17 +316,17 @@ describe('filter.restore', () => {
316
316
} ) ;
317
317
318
318
stream . pipe ( restoreStream ) ;
319
- stream . write ( new gutil . File ( { path : 'package.json' } ) ) ;
320
- stream . write ( new gutil . File ( { path : 'app.js' } ) ) ;
321
- stream . write ( new gutil . File ( { path : 'package2.json' } ) ) ;
322
- stream . write ( new gutil . File ( { path : 'app2.js' } ) ) ;
319
+ stream . write ( new Vinyl ( { path : 'package.json' } ) ) ;
320
+ stream . write ( new Vinyl ( { path : 'app.js' } ) ) ;
321
+ stream . write ( new Vinyl ( { path : 'package2.json' } ) ) ;
322
+ stream . write ( new Vinyl ( { path : 'app2.js' } ) ) ;
323
323
} ) ;
324
324
325
325
it ( 'should work when restore stream is not used' , cb => {
326
326
const stream = filter ( '*.json' ) ;
327
327
328
328
for ( let i = 0 ; i < stream . _writableState . highWaterMark + 1 ; i ++ ) {
329
- stream . write ( new gutil . File ( { path : 'nonmatch.js' } ) ) ;
329
+ stream . write ( new Vinyl ( { path : 'nonmatch.js' } ) ) ;
330
330
}
331
331
332
332
stream . on ( 'finish' , cb ) ;
0 commit comments