@@ -20,15 +20,15 @@ var expect = chai.expect;
2020
2121describe ( 'suitcss' , function ( ) {
2222 it ( 'should return a css string' , function ( done ) {
23- suitcss ( 'body {}' ) . then ( function ( result ) {
23+ suitcss ( 'body {}' , { lint : false } ) . then ( function ( result ) {
2424 expect ( result . css ) . to . be . a ( 'string' ) ;
2525 done ( ) ;
2626 } ) ;
2727 } ) ;
2828
2929 it ( 'should handle invalid input' , function ( ) {
3030 expect ( function ( ) {
31- suitcss ( null ) ;
31+ suitcss ( null , { lint : false } ) ;
3232 } ) . to . throw ( TypeError ) ;
3333 } ) ;
3434
@@ -59,7 +59,8 @@ describe('suitcss', function() {
5959 } ) ;
6060
6161 suitcss ( 'body {}' , {
62- debug : debug
62+ debug : debug ,
63+ lint : false
6364 } ) . then ( function ( ) {
6465 expect ( debug . calledOnce ) . to . be . true ;
6566 done ( ) ;
@@ -102,19 +103,20 @@ describe('suitcss', function() {
102103
103104 beforeEach ( function ( ) {
104105 postcssStub = sinon . stub ( ) ;
105- processMethodStub = sinon . stub ( ) ;
106+ processMethodStub = sinon . stub ( ) . returns ( Promise . resolve ( ) ) ;
106107
107108 postcssStub . returns ( {
108- use : sinon . spy ( ) ,
109+ use : sinon . stub ( ) . returns ( { use : sinon . spy ( ) } ) ,
109110 process : processMethodStub
110111 } ) ;
111112 revert = suitcss . __set__ ( 'postcss' , postcssStub ) ;
112113 suitcss ( 'body {}' , {
113114 root : 'something' ,
115+ lint : false ,
114116 postcss : {
115- from : 'somefile.css '
117+ test : 'testing '
116118 }
117- } ) ;
119+ } , 'filename.css' ) ;
118120 } ) ;
119121
120122 afterEach ( function ( ) {
@@ -123,15 +125,17 @@ describe('suitcss', function() {
123125
124126 it ( 'should pass postcss options to the processor' , function ( ) {
125127 expect ( processMethodStub . getCall ( 0 ) . args [ 1 ] ) . to . eql ( {
126- from : 'somefile.css'
128+ from : 'filename.css' ,
129+ test : 'testing'
127130 } ) ;
128131 } ) ;
129132 } ) ;
130133
131134 describe ( 'using the transform option in postcss-import' , function ( ) {
132135 it ( 'should use a default transform function that just returns the css' , function ( done ) {
133136 suitcss ( '@import "./util.css";' , {
134- root : 'test/fixtures'
137+ root : 'test/fixtures' ,
138+ lint : false
135139 } ) . then ( function ( result ) {
136140 expect ( result . css ) . to . equal ( '.u-img {\n border-radius: 50%;\n}' ) ;
137141 done ( ) ;
@@ -144,6 +148,7 @@ describe('suitcss', function() {
144148
145149 suitcss ( '@import "./util.css";' , {
146150 root : 'test/fixtures' ,
151+ lint : false ,
147152 'postcss-easy-import' : {
148153 transform : transformStub
149154 }
@@ -159,6 +164,7 @@ describe('suitcss', function() {
159164 it ( 'should also work with a promise returned from the custom transform function' , function ( done ) {
160165 suitcss ( '@import "./util.css";' , {
161166 root : 'test/fixtures' ,
167+ lint : false ,
162168 'postcss-easy-import' : {
163169 transform : function ( ) {
164170 return Promise . resolve ( 'body { font: red; }' ) ;
@@ -186,7 +192,8 @@ describe('suitcss', function() {
186192
187193 it ( 'should call the updateWatchTaskFiles function with the file paths' , function ( done ) {
188194 suitcss ( '@import "./util.css";' , {
189- root : 'test/fixtures'
195+ root : 'test/fixtures' ,
196+ lint : false
190197 } ) . then ( function ( ) {
191198 expect ( updateWatchTaskFilesSpy . getCall ( 0 ) . args [ 0 ] [ 0 ] ) . to . contain ( 'util.css' ) ;
192199 done ( ) ;
@@ -199,6 +206,7 @@ describe('suitcss', function() {
199206
200207 suitcss ( '@import "./util.css";' , {
201208 root : 'test/fixtures' ,
209+ lint : false ,
202210 'postcss-easy-import' : {
203211 onImport : onImportSpy
204212 }
@@ -264,7 +272,7 @@ describe('suitcss', function() {
264272
265273 it ( 'should allow the config to be overidden' , function ( ) {
266274 return expect (
267- suitcss ( '@import "./stylelint.css"' , {
275+ suitcss ( '@import "./stylelint.css"\n\n ' , {
268276 root : 'test/fixtures' ,
269277 stylelint : {
270278 extends : 'stylelint-config-suitcss' ,
@@ -281,14 +289,24 @@ describe('suitcss', function() {
281289
282290 it ( 'should throw an error if stylelint fails' , function ( ) {
283291 return expect (
284- suitcss ( '@import "./stylelint.css"' , {
292+ suitcss ( '@import "./stylelint.css"\n\n ' , {
285293 root : 'test/fixtures' ,
286294 'postcss-reporter' : {
287295 throwError : true
288296 }
289297 } )
290298 ) . to . be . rejectedWith ( Error , 'postcss-reporter: warnings or errors were found' ) ;
291299 } ) ;
300+
301+ it ( 'should lint the input file' , function ( ) {
302+ return expect (
303+ suitcss ( 'body {}' , {
304+ 'postcss-reporter' : {
305+ throwError : true
306+ }
307+ } )
308+ ) . to . be . rejectedWith ( Error , 'postcss-reporter: warnings or errors were found' ) ;
309+ } ) ;
292310 } ) ;
293311 } ) ;
294312} ) ;
@@ -304,6 +322,7 @@ describe('features', function() {
304322
305323 suitcss ( input , {
306324 root : 'test/fixtures' ,
325+ lint : false ,
307326 // disable autoprefixer
308327 autoprefixer : { add : false , remove : false }
309328 } ) . then ( function ( result ) {
@@ -317,6 +336,7 @@ describe('features', function() {
317336 var output = '.test { -webkit-filter: blur(1px); filter: blur(1px) }' ;
318337
319338 suitcss ( input , {
339+ lint : false ,
320340 autoprefixer : {
321341 browsers : 'Chrome 50'
322342 }
@@ -349,15 +369,15 @@ describe('cli', function() {
349369 } ) ;
350370
351371 it ( 'should read from a file and write to stdout' , function ( done ) {
352- exec ( 'node bin/suitcss -c test/noautoprefixer.config.js test/fixtures/cli/input.css' , function ( err , stdout ) {
372+ exec ( 'node bin/suitcss -L - c test/noautoprefixer.config.js test/fixtures/cli/input.css' , function ( err , stdout ) {
353373 if ( err ) return done ( err ) ;
354374 expect ( stdout ) . to . equal ( output ) ;
355375 done ( ) ;
356376 } ) ;
357377 } ) ;
358378
359379 it ( 'should read from stdin and write to stdout' , function ( done ) {
360- var testChild = exec ( 'node bin/suitcss -c test/noautoprefixer.config.js' , function ( err , stdout ) {
380+ var testChild = exec ( 'node bin/suitcss -L - c test/noautoprefixer.config.js' , function ( err , stdout ) {
361381 if ( err ) return done ( err ) ;
362382 expect ( stdout ) . to . equal ( output ) ;
363383 done ( ) ;
0 commit comments