@@ -27,7 +27,9 @@ describe('suitcss', function() {
2727 } ) ;
2828
2929 it ( 'should handle invalid input' , function ( ) {
30- expect ( function ( ) { suitcss ( null ) ; } ) . to . throw ( TypeError ) ;
30+ expect ( function ( ) {
31+ suitcss ( null ) ;
32+ } ) . to . throw ( TypeError ) ;
3133 } ) ;
3234
3335 describe ( 'using options' , function ( ) {
@@ -197,77 +199,6 @@ describe('suitcss', function() {
197199 ) . to . be . rejectedWith ( Error , 'postcss-reporter: warnings or errors were found' ) ;
198200 } ) ;
199201 } ) ;
200-
201- describe ( 'transforming css before linting' , function ( ) {
202- describe ( 'ensuring functions are called correctly' , function ( ) {
203- var lintImportedFilesStub , beforeLintStub , revert ;
204-
205- beforeEach ( function ( ) {
206- var postcssPromise = sinon . stub ( ) . resolves ( '/*linting done*/' ) ( ) ;
207- lintImportedFilesStub = sinon . stub ( ) . returns ( postcssPromise ) ;
208- beforeLintStub = sinon . stub ( ) . returns ( '/*before lint*/' ) ;
209- revert = suitcss . __set__ ( 'lintImportedFiles' , lintImportedFilesStub ) ;
210- } ) ;
211-
212- afterEach ( function ( ) {
213- revert ( ) ;
214- } ) ;
215-
216- it ( 'should call `beforeLint` function before linting' , function ( done ) {
217- suitcss ( read ( 'fixtures/component' ) , {
218- root : 'test/fixtures' ,
219- beforeLint : beforeLintStub
220- } )
221- . then ( function ( ) {
222- expect ( beforeLintStub ) . to . be . calledOnce ;
223- expect ( lintImportedFilesStub ) . to . be . calledOnce ;
224- expect ( beforeLintStub ) . to . have . been . calledBefore ( lintImportedFilesStub ) ;
225- done ( ) ;
226- } )
227- . catch ( done ) ;
228- } ) ;
229-
230- it ( 'should pass the result of `beforeLint` to `lintImportedFiles`' , function ( done ) {
231- suitcss ( read ( 'fixtures/component' ) , {
232- root : 'test/fixtures' ,
233- beforeLint : beforeLintStub
234- } )
235- . then ( function ( ) {
236- expect ( lintImportedFilesStub . args [ 0 ] [ 1 ] ) . to . equal ( '/*before lint*/' ) ;
237- done ( ) ;
238- } )
239- . catch ( done ) ;
240- } ) ;
241-
242- it ( 'should pass the options object to the beforeLint function as the third parameter' , function ( done ) {
243- suitcss ( read ( 'fixtures/component' ) , {
244- root : 'test/fixtures' ,
245- beforeLint : beforeLintStub
246- } )
247- . then ( function ( ) {
248- expect ( beforeLintStub . args [ 0 ] [ 2 ] ) . to . contain ( { root : 'test/fixtures' } ) ;
249- done ( ) ;
250- } )
251- . catch ( done ) ;
252- } ) ;
253- } ) ;
254-
255- describe ( 'outputting transformed css' , function ( ) {
256- it ( 'should use the CSS returned from beforeLint' , function ( done ) {
257- suitcss ( read ( 'fixtures/import' ) , {
258- root : 'test/fixtures' ,
259- beforeLint : function ( ) {
260- return 'body {}' ;
261- }
262- } )
263- . then ( function ( result ) {
264- expect ( result . css ) . to . equal ( 'body {}\n' ) ;
265- done ( ) ;
266- } )
267- . catch ( done ) ;
268- } ) ;
269- } ) ;
270- } ) ;
271202 } ) ;
272203} ) ;
273204
@@ -338,7 +269,6 @@ describe('cli', function() {
338269 var testChild = exec ( 'node bin/suitcss -c test/noautoprefixer.config.js' , function ( err , stdout ) {
339270 if ( err ) return done ( err ) ;
340271 expect ( stdout ) . to . equal ( output ) ;
341- expect ( stdout ) . to . not . contain ( 'beforeLint ran' ) ;
342272 done ( ) ;
343273 } ) ;
344274
@@ -350,18 +280,16 @@ describe('cli', function() {
350280 exec ( 'node bin/suitcss -v -c test/noautoprefixer.config.js test/fixtures/cli/input.css test/fixtures/cli/output.css' , function ( err , stdout ) {
351281 if ( err ) return done ( err ) ;
352282 expect ( stdout ) . to . contain ( 'write' ) ;
353- expect ( stdout ) . to . not . contain ( 'beforeLint ran' ) ;
354283 done ( ) ;
355284 } ) ;
356285 } ) ;
357286
358287 it ( 'should allow configurable import root' , function ( done ) {
359- exec ( 'node bin/suitcss -i test/fixtures -c test/noautoprefixer.config.js test/fixtures/import.css test/fixtures/cli/output.css' , function ( err , stdout ) {
288+ exec ( 'node bin/suitcss -i test/fixtures -c test/noautoprefixer.config.js test/fixtures/import.css test/fixtures/cli/output.css' , function ( err ) {
360289 if ( err ) return done ( err ) ;
361290 var res = read ( 'fixtures/cli/output' ) ;
362291 var expected = read ( 'fixtures/component.out' ) ;
363292 expect ( res ) . to . equal ( expected ) ;
364- expect ( stdout ) . to . not . contain ( 'beforeLint ran' ) ;
365293 done ( ) ;
366294 } ) ;
367295 } ) ;
@@ -375,22 +303,20 @@ describe('cli', function() {
375303 } ) ;
376304
377305 it ( 'should minify the output' , function ( done ) {
378- exec ( 'node bin/suitcss -i test/fixtures -c test/noautoprefixer.config.js test/fixtures/import.css test/fixtures/cli/output.css -m' , function ( err , stdout ) {
306+ exec ( 'node bin/suitcss -i test/fixtures -c test/noautoprefixer.config.js test/fixtures/import.css test/fixtures/cli/output.css -m' , function ( err ) {
379307 if ( err ) return done ( err ) ;
380308 var res = read ( 'fixtures/cli/output' ) ;
381309 var expected = read ( 'fixtures/minify.out' ) ;
382- expect ( stdout ) . to . not . contain ( 'beforeLint ran' ) ;
383310 expect ( res ) . to . equal ( expected ) ;
384311 done ( ) ;
385312 } ) ;
386313 } ) ;
387314
388315 it ( 'should allow a config file to be passed' , function ( done ) {
389- exec ( 'node bin/suitcss -i test/fixtures -c test/test.config.js test/fixtures/config.css test/fixtures/cli/output.css' , function ( err , stdout ) {
316+ exec ( 'node bin/suitcss -i test/fixtures -c test/test.config.js test/fixtures/config.css test/fixtures/cli/output.css' , function ( err ) {
390317 if ( err ) return done ( err ) ;
391318 var res = read ( 'fixtures/cli/output' ) ;
392319 var expected = read ( 'fixtures/config.out' ) ;
393- expect ( stdout ) . to . contain ( 'beforeLint ran' ) ;
394320 expect ( res ) . to . equal ( expected ) ;
395321 done ( ) ;
396322 } ) ;
0 commit comments