22/* eslint max-len: ["off"] */
33
44var assert = require ( 'assert' )
5- var gutil = require ( 'gulp-util' )
5+ var Vinyl = require ( 'vinyl' )
6+ var fancyLog = require ( 'fancy-log' )
7+ var PluginError = require ( 'plugin-error' )
68var sourceMaps = require ( 'gulp-sourcemaps' )
79var postcss = require ( './index' )
810var proxyquire = require ( 'proxyquire' )
@@ -38,7 +40,7 @@ it('should transform css with multiple processors', function (cb) {
3840 cb ( )
3941 } )
4042
41- stream . write ( new gutil . File ( {
43+ stream . write ( new Vinyl ( {
4244 contents : new Buffer ( 'a { color: black }' )
4345 } ) )
4446
@@ -61,7 +63,7 @@ it('should not transform css with out any processor', function (cb) {
6163 cb ( )
6264 } )
6365
64- stream . write ( new gutil . File ( {
66+ stream . write ( new Vinyl ( {
6567 contents : new Buffer ( css )
6668 } ) )
6769
@@ -74,7 +76,7 @@ it('should correctly wrap postcss errors', function (cb) {
7476 var stream = postcss ( [ doubler ] )
7577
7678 stream . on ( 'error' , function ( err ) {
77- assert . ok ( err instanceof gutil . PluginError )
79+ assert . ok ( err instanceof PluginError )
7880 assert . equal ( err . plugin , 'gulp-postcss' )
7981 assert . equal ( err . column , 1 )
8082 assert . equal ( err . lineNumber , 1 )
@@ -86,7 +88,7 @@ it('should correctly wrap postcss errors', function (cb) {
8688 cb ( )
8789 } )
8890
89- stream . write ( new gutil . File ( {
91+ stream . write ( new Vinyl ( {
9092 contents : new Buffer ( 'a {' ) ,
9193 path : path . resolve ( 'testpath' )
9294 } ) )
@@ -100,7 +102,7 @@ it('should respond with error on stream files', function (cb) {
100102 var stream = postcss ( [ doubler ] )
101103
102104 stream . on ( 'error' , function ( err ) {
103- assert . ok ( err instanceof gutil . PluginError )
105+ assert . ok ( err instanceof PluginError )
104106 assert . equal ( err . plugin , 'gulp-postcss' )
105107 assert . equal ( err . showStack , true )
106108 assert . equal ( err . message , 'Streams are not supported!' )
@@ -138,7 +140,7 @@ it('should generate source maps', function (cb) {
138140 cb ( )
139141 } )
140142
141- init . write ( new gutil . File ( {
143+ init . write ( new Vinyl ( {
142144 base : __dirname ,
143145 path : __dirname + '/fixture.css' ,
144146 contents : new Buffer ( 'a { color: black }' )
@@ -164,7 +166,7 @@ it('should correctly generate relative source map', function (cb) {
164166 cb ( )
165167 } )
166168
167- init . write ( new gutil . File ( {
169+ init . write ( new Vinyl ( {
168170 base : __dirname + '/src' ,
169171 path : __dirname + '/src/fixture.css' ,
170172 contents : new Buffer ( 'a { color: black }' )
@@ -238,7 +240,7 @@ describe('PostCSS Guidelines', function () {
238240 cb ( )
239241 } )
240242
241- stream . write ( new gutil . File ( {
243+ stream . write ( new Vinyl ( {
242244 contents : new Buffer ( 'a {}' ) ,
243245 path : cssPath
244246 } ) )
@@ -262,7 +264,7 @@ describe('PostCSS Guidelines', function () {
262264 cb ( )
263265 } )
264266
265- stream . write ( new gutil . File ( {
267+ stream . write ( new Vinyl ( {
266268 contents : new Buffer ( 'a {}' )
267269 } ) )
268270
@@ -273,7 +275,7 @@ describe('PostCSS Guidelines', function () {
273275 it ( 'should take plugins and options from callback' , function ( cb ) {
274276
275277 var cssPath = __dirname + '/fixture.css'
276- var file = new gutil . File ( {
278+ var file = new Vinyl ( {
277279 contents : new Buffer ( 'a {}' ) ,
278280 path : cssPath
279281 } )
@@ -305,7 +307,7 @@ describe('PostCSS Guidelines', function () {
305307 it ( 'should take plugins and options from postcss-load-config' , function ( cb ) {
306308
307309 var cssPath = __dirname + '/fixture.css'
308- var file = new gutil . File ( {
310+ var file = new Vinyl ( {
309311 contents : new Buffer ( 'a {}' ) ,
310312 path : cssPath
311313 } )
@@ -352,7 +354,7 @@ describe('PostCSS Guidelines', function () {
352354 assert . deepEqual ( postcssLoadConfigStub . getCall ( 0 ) . args [ 1 ] , __dirname )
353355 cb ( )
354356 } )
355- stream . end ( new gutil . File ( {
357+ stream . end ( new Vinyl ( {
356358 contents : new Buffer ( 'a {}' ) ,
357359 path : cssPath
358360 } ) )
@@ -372,7 +374,7 @@ describe('PostCSS Guidelines', function () {
372374 assert . deepEqual ( postcssLoadConfigStub . getCall ( 0 ) . args [ 1 ] , '/absolute/path' )
373375 cb ( )
374376 } )
375- stream . end ( new gutil . File ( {
377+ stream . end ( new Vinyl ( {
376378 contents : new Buffer ( 'a {}' ) ,
377379 path : cssPath
378380 } ) )
@@ -392,7 +394,7 @@ describe('PostCSS Guidelines', function () {
392394 assert . deepEqual ( postcssLoadConfigStub . getCall ( 0 ) . args [ 1 ] , path . join ( __dirname , 'relative/path' ) )
393395 cb ( )
394396 } )
395- stream . end ( new gutil . File ( {
397+ stream . end ( new Vinyl ( {
396398 contents : new Buffer ( 'a {}' ) ,
397399 path : cssPath ,
398400 base : __dirname
@@ -417,19 +419,19 @@ describe('PostCSS Guidelines', function () {
417419 }
418420 } ) )
419421
420- sandbox . stub ( gutil , 'log ' )
422+ sandbox . stub ( fancyLog , 'info ' )
421423
422424 stream . on ( 'data' , function ( ) {
423425 assert . deepEqual ( postcssStub . process . getCall ( 0 ) . args [ 1 ] . from , cssPath )
424426 assert . deepEqual ( postcssStub . process . getCall ( 0 ) . args [ 1 ] . map , { annotation : false } )
425- var firstMessage = gutil . log . getCall ( 0 ) . args [ 1 ]
426- var secondMessage = gutil . log . getCall ( 1 ) . args [ 1 ]
427+ var firstMessage = fancyLog . info . getCall ( 0 ) . args [ 1 ]
428+ var secondMessage = fancyLog . info . getCall ( 1 ) . args [ 1 ]
427429 assert ( firstMessage , '/fixture.css\nCannot override from option, because it is required by gulp-sourcemaps' )
428430 assert ( secondMessage , '/fixture.css\nCannot override map option, because it is required by gulp-sourcemaps' )
429431 cb ( )
430432 } )
431433
432- var file = new gutil . File ( {
434+ var file = new Vinyl ( {
433435 contents : new Buffer ( 'a {}' ) ,
434436 path : cssPath
435437 } )
@@ -450,7 +452,7 @@ describe('PostCSS Guidelines', function () {
450452 cb ( )
451453 } )
452454
453- stream . write ( new gutil . File ( {
455+ stream . write ( new Vinyl ( {
454456 contents : new Buffer ( 'a {}' )
455457 } ) )
456458
@@ -469,7 +471,7 @@ describe('PostCSS Guidelines', function () {
469471 }
470472 }
471473
472- sandbox . stub ( gutil , 'log ' )
474+ sandbox . stub ( fancyLog , 'info ' )
473475 postcssStub . process . returns ( Promise . resolve ( {
474476 css : '' ,
475477 warnings : function ( ) {
@@ -478,11 +480,11 @@ describe('PostCSS Guidelines', function () {
478480 } ) )
479481
480482 stream . on ( 'data' , function ( ) {
481- assert ( gutil . log . calledWith ( 'gulp-postcss:' , 'src' + path . sep + 'fixture.css\nmsg1\nmsg2' ) )
483+ assert ( fancyLog . info . calledWith ( 'gulp-postcss:' , 'src' + path . sep + 'fixture.css\nmsg1\nmsg2' ) )
482484 cb ( )
483485 } )
484486
485- stream . write ( new gutil . File ( {
487+ stream . write ( new Vinyl ( {
486488 contents : new Buffer ( 'a {}' ) ,
487489 path : cssPath
488490 } ) )
@@ -517,7 +519,7 @@ describe('PostCSS Guidelines', function () {
517519 cb ( )
518520 } )
519521
520- stream . write ( new gutil . File ( {
522+ stream . write ( new Vinyl ( {
521523 contents : new Buffer ( 'a {}' ) ,
522524 path : cssPath
523525 } ) )
0 commit comments