@@ -6,28 +6,40 @@ test(function (t) {
66 t . test ( 'module should work with postcss plugins without options' , function ( t ) {
77 t . plan ( 2 )
88
9- sheetifyPostcss ( 'test.css' , '.rule {}' , { basedir : __dirname , plugins : [ './stubs/postcss-plugin' ] } , ( err , css ) => {
9+ sheetifyPostcss ( 'test.css' , '.rule {}' , { basedir : __dirname , plugins : [ './stubs/postcss-plugin' ] } , ( err , result ) => {
1010 t . equal ( err , null )
11- t . equal ( css , '.ok {}' )
11+ t . equal ( result . css , '.ok {}' )
1212 } )
1313 } )
1414
1515 t . test ( 'module should work with postcss plugins and their options' , function ( t ) {
1616 t . plan ( 2 )
1717
18- sheetifyPostcss ( 'test.css' , '.rule {}' , { basedir : __dirname , plugins : [ [ './stubs/postcss-plugin' , { has : true } ] ] } , ( err , css ) => {
18+ sheetifyPostcss ( 'test.css' , '.rule {}' , { basedir : __dirname , plugins : [ [ './stubs/postcss-plugin' , { has : true } ] ] } , ( err , result ) => {
1919 t . equal ( err , null )
20- t . equal ( css , '.ok-with-options {}' )
20+ t . equal ( result . css , '.ok-with-options {}' )
2121 } )
2222 } )
2323
2424 t . test ( 'module should respect postcssrc config file' , function ( t ) {
2525 t . plan ( 2 )
2626
27- sheetifyPostcss ( 'test.css' , '.rule {}' , { basedir : path . join ( __dirname , 'stubs' ) } , ( err , css ) => {
27+ sheetifyPostcss ( 'test.css' , '.rule {}' , { basedir : path . join ( __dirname , 'stubs' ) } , ( err , result ) => {
2828 t . equal ( err , null )
29- t . equal ( css , '.ok-with-postcssrc {}' )
29+ t . equal ( result . css , '.ok-with-postcssrc {}' )
3030 } )
3131 } )
32- } )
3332
33+ t . test ( 'should report imported files if postcss-import is used' , function ( t ) {
34+ t . plan ( 3 )
35+
36+ sheetifyPostcss ( path . join ( __dirname , 'test.css' ) , '@import "./stubs/dep.css"' , { basedir : __dirname , plugins : [ 'postcss-import' ] } , ( err , result ) => {
37+ t . equal ( err , null )
38+ t . equal ( result . css , '.dependency {}' )
39+ t . deepEqual ( result . files , [
40+ path . join ( __dirname , 'test.css' ) ,
41+ path . join ( __dirname , 'stubs/dep.css' )
42+ ] )
43+ } )
44+ } )
45+ } )
0 commit comments