@@ -15,7 +15,7 @@ test('Compile css file', async t => {
1515 const { preprocessor, debug} = mockPreprocessor ( { } , { postcssPreprocessor : { options} } ) ;
1616 const file = { originalPath : fixture } ;
1717
18- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture , options ) ) ;
18+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , ( await compile ( fixture , options ) ) . css ) ;
1919 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
2020 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/fixtures/basic.css' ) ) ;
2121} ) ;
@@ -25,7 +25,7 @@ test('Compile css file without plugins', async t => {
2525 const { preprocessor, debug} = mockPreprocessor ( ) ;
2626 const file = { originalPath : fixture } ;
2727
28- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture ) ) ;
28+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , ( await compile ( fixture ) ) . css ) ;
2929 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
3030 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/fixtures/basic.css' ) ) ;
3131} ) ;
@@ -35,8 +35,12 @@ test('Compile css file with sourcemap (options.sourceMap)', async t => {
3535 const options = { plugins : [ atImport , mixins , simpleVars , cssnano ] , sourceMap : true } ;
3636 const { preprocessor, debug} = mockPreprocessor ( { } , { postcssPreprocessor : { options} } ) ;
3737 const file = { originalPath : fixture } ;
38+ const { css, map} = await compile ( fixture , options ) ;
3839
39- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture , options ) ) ;
40+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , css ) ;
41+ t . deepEqual ( file . sourceMap , map ) ;
42+ t . is ( file . sourceMap . file , path . basename ( fixture ) ) ;
43+ t . truthy ( file . sourceMap . mappings ) ;
4044 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
4145 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/fixtures/basic.css' ) ) ;
4246} ) ;
@@ -46,8 +50,12 @@ test('Compile css file with sourcemap (options.map)', async t => {
4650 const options = { plugins : [ atImport , mixins , simpleVars , cssnano ] , map : true } ;
4751 const { preprocessor, debug} = mockPreprocessor ( { } , { postcssPreprocessor : { options} } ) ;
4852 const file = { originalPath : fixture } ;
53+ const { css, map} = await compile ( fixture , options ) ;
4954
50- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture , options ) ) ;
55+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , css ) ;
56+ t . deepEqual ( file . sourceMap , map ) ;
57+ t . is ( file . sourceMap . file , path . basename ( fixture ) ) ;
58+ t . truthy ( file . sourceMap . mappings ) ;
5159 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
5260 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/fixtures/basic.css' ) ) ;
5361} ) ;
@@ -57,8 +65,12 @@ test('Compile scss file with sourcemap (options.sourceMap) and custom preprocess
5765 const options = { plugins : [ atImport , mixins , simpleVars , cssnano ] , sourceMap : true } ;
5866 const { preprocessor, debug} = mockPreprocessor ( { options} ) ;
5967 const file = { originalPath : fixture } ;
68+ const { css, map} = await compile ( fixture , options ) ;
6069
61- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture , options ) ) ;
70+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , css ) ;
71+ t . deepEqual ( file . sourceMap , map ) ;
72+ t . is ( file . sourceMap . file , path . basename ( fixture ) ) ;
73+ t . truthy ( file . sourceMap . mappings ) ;
6274 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
6375 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/fixtures/basic.custom.css' ) ) ;
6476} ) ;
@@ -68,8 +80,12 @@ test('Compile scss file with sourcemap (options.map) and custom preprocessor', a
6880 const options = { plugins : [ atImport , mixins , simpleVars , cssnano ] , map : true } ;
6981 const { preprocessor, debug} = mockPreprocessor ( { options} ) ;
7082 const file = { originalPath : fixture } ;
83+ const { css, map} = await compile ( fixture , options ) ;
7184
72- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture , options ) ) ;
85+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , css ) ;
86+ t . deepEqual ( file . sourceMap , map ) ;
87+ t . is ( file . sourceMap . file , path . basename ( fixture ) ) ;
88+ t . truthy ( file . sourceMap . mappings ) ;
7389 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
7490 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/fixtures/basic.custom.css' ) ) ;
7591} ) ;
@@ -80,7 +96,7 @@ test('Compile scss file with partial import', async t => {
8096 const { preprocessor, debug} = mockPreprocessor ( { } , { postcssPreprocessor : { options} } ) ;
8197 const file = { originalPath : fixture } ;
8298
83- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture , options ) ) ;
99+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , ( await compile ( fixture , options ) ) . css ) ;
84100 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
85101 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/fixtures/with-partial.css' ) ) ;
86102} ) ;
@@ -91,7 +107,7 @@ test('Compile scss file with non css extension', async t => {
91107 const { preprocessor, debug} = mockPreprocessor ( { } , { postcssPreprocessor : { options} } ) ;
92108 const file = { originalPath : fixture } ;
93109
94- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture , options ) ) ;
110+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , ( await compile ( fixture , options ) ) . css ) ;
95111 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
96112 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/fixtures/basic.css' ) ) ;
97113} ) ;
@@ -102,7 +118,7 @@ test('Compile css file with no extension', async t => {
102118 const { preprocessor, debug} = mockPreprocessor ( { } , { postcssPreprocessor : { options} } ) ;
103119 const file = { originalPath : fixture } ;
104120
105- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture , options ) ) ;
121+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , ( await compile ( fixture , options ) ) . css ) ;
106122 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
107123 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/fixtures/basic.css' ) ) ;
108124} ) ;
@@ -114,7 +130,7 @@ test('Compile css file with custom transformPath', async t => {
114130 const { preprocessor, debug} = mockPreprocessor ( { } , { postcssPreprocessor : { transformPath, options} } ) ;
115131 const file = { originalPath : fixture } ;
116132
117- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture , options ) ) ;
133+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , ( await compile ( fixture , options ) ) . css ) ;
118134 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
119135 t . true ( transformPath . calledOnce ) ;
120136 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/basic.css' ) ) ;
@@ -127,7 +143,7 @@ test('Compile css file with custom transformPath and custom preprocessor', async
127143 const { preprocessor, debug} = mockPreprocessor ( { transformPath, options} ) ;
128144 const file = { originalPath : fixture } ;
129145
130- t . is ( ( await preprocessor ( await readFile ( fixture ) , file ) ) . toString ( ) , await compile ( fixture , options ) ) ;
146+ t . is ( await preprocessor ( await readFile ( fixture ) , file ) , ( await compile ( fixture , options ) ) . css ) ;
131147 t . true ( debug . firstCall . calledWith ( match ( 'Processing' ) , fixture ) ) ;
132148 t . true ( transformPath . calledOnce ) ;
133149 t . is ( path . resolve ( file . path ) , path . resolve ( 'test/basic.custom.css' ) ) ;
0 commit comments