@@ -2,7 +2,6 @@ var expect = require('chai').expect;
22var sinon = require ( 'sinon' ) ;
33var child = require ( 'child_process' ) ;
44var exec = child . exec ;
5- var spawn = child . spawn ;
65var fs = require ( 'fs' ) ;
76var rewire = require ( 'rewire' ) ;
87var suitcss = rewire ( '../lib' ) ;
@@ -12,8 +11,8 @@ var path = require('path');
1211 * Node API tests.
1312 */
1413
15- describe ( 'suitcss' , function ( ) {
16- it ( 'should return a css string' , function ( done ) {
14+ describe ( 'suitcss' , function ( ) {
15+ it ( 'should return a css string' , function ( done ) {
1716 suitcss ( 'body {}' ) . then ( function ( result ) {
1817 expect ( result . css ) . to . be . a ( 'string' ) ;
1918 done ( ) ;
@@ -119,13 +118,12 @@ describe('suitcss', function () {
119118 describe ( 'stylelint' , function ( ) {
120119 it ( 'should check the input conforms to SUIT style rules' , function ( done ) {
121120 suitcss ( '@import ./stylelint.css' , {
122- lint : true ,
123- root : 'test/fixtures' ,
124- 'postcss-reporter' : {
125- throwError : true
126- }
121+ lint : true ,
122+ root : 'test/fixtures' ,
123+ 'postcss-reporter' : {
124+ throwError : true
127125 }
128- ) . then ( function ( result ) {
126+ } ) . then ( function ( ) {
129127 done ( new Error ( 'stylelint should have failed conformance' ) ) ;
130128 } ) . catch ( function ( err ) {
131129 expect ( err . message ) . to . contain ( 'postcss-reporter: warnings or errors were found' ) ;
@@ -150,7 +148,7 @@ describe('suitcss', function () {
150148 revert ( ) ;
151149 } ) ;
152150
153- it ( 'should call user supplied function before linting' , function ( done ) {
151+ it ( 'should call user supplied function before linting' , function ( done ) {
154152 suitcss ( read ( 'fixtures/component' ) , {
155153 root : 'test/fixtures' ,
156154 beforeLint : beforeLintStub
@@ -163,7 +161,7 @@ describe('suitcss', function () {
163161 done ( ) ;
164162 } ) ;
165163
166- it ( 'should pass processed CSS to the linting transform function' , function ( done ) {
164+ it ( 'should pass processed CSS to the linting transform function' , function ( done ) {
167165 suitcss ( read ( 'fixtures/component' ) , {
168166 root : 'test/fixtures' ,
169167 beforeLint : beforeLintStub
@@ -174,7 +172,7 @@ describe('suitcss', function () {
174172 done ( ) ;
175173 } ) ;
176174
177- it ( 'should pass the merged options to the beforeLint function' , function ( done ) {
175+ it ( 'should pass the merged options to the beforeLint function' , function ( done ) {
178176 suitcss ( read ( 'fixtures/component' ) , {
179177 root : 'test/fixtures' ,
180178 beforeLint : beforeLintStub
@@ -192,8 +190,8 @@ describe('suitcss', function () {
192190 * Feature tests.
193191 */
194192
195- describe ( 'features' , function ( ) {
196- it ( 'should preprocess CSS correctly' , function ( done ) {
193+ describe ( 'features' , function ( ) {
194+ it ( 'should preprocess CSS correctly' , function ( done ) {
197195 var input = read ( 'fixtures/component' ) ;
198196 var output = read ( 'fixtures/component.out' ) ;
199197
@@ -208,54 +206,54 @@ describe('features', function () {
208206 * CLI tests.
209207 */
210208
211- describe ( 'cli' , function ( ) {
209+ describe ( 'cli' , function ( ) {
212210 var input = read ( 'fixtures/cli/input' ) ;
213211 var output = read ( 'fixtures/cli/input.out' ) ;
214212
215- afterEach ( function ( ) {
213+ afterEach ( function ( ) {
216214 remove ( 'fixtures/cli/output' ) ;
217215 } ) ;
218216
219- it ( 'should read from a file and write to a file' , function ( done ) {
220- exec ( 'bin/suitcss test/fixtures/cli/input.css test/fixtures/cli/output.css' , function ( err , stdout ) {
217+ it ( 'should read from a file and write to a file' , function ( done ) {
218+ exec ( 'bin/suitcss test/fixtures/cli/input.css test/fixtures/cli/output.css' , function ( err ) {
221219 if ( err ) return done ( err ) ;
222220 var res = read ( 'fixtures/cli/output' ) ;
223221 expect ( res ) . to . equal ( output ) ;
224222 done ( ) ;
225223 } ) ;
226224 } ) ;
227225
228- it ( 'should read from a file and write to stdout' , function ( done ) {
229- exec ( 'bin/suitcss test/fixtures/cli/input.css' , function ( err , stdout ) {
226+ it ( 'should read from a file and write to stdout' , function ( done ) {
227+ exec ( 'bin/suitcss test/fixtures/cli/input.css' , function ( err , stdout ) {
230228 if ( err ) return done ( err ) ;
231229 expect ( stdout ) . to . equal ( output ) ;
232230 done ( ) ;
233231 } ) ;
234232 } ) ;
235233
236- it ( 'should read from stdin and write to stdout' , function ( done ) {
237- var child = exec ( 'bin/suitcss' , function ( err , stdout ) {
234+ it ( 'should read from stdin and write to stdout' , function ( done ) {
235+ var testChild = exec ( 'bin/suitcss' , function ( err , stdout ) {
238236 if ( err ) return done ( err ) ;
239237 expect ( stdout ) . to . equal ( output ) ;
240238 expect ( stdout ) . to . not . contain ( 'beforeLint ran' ) ;
241239 done ( ) ;
242240 } ) ;
243241
244- child . stdin . write ( new Buffer ( input ) ) ;
245- child . stdin . end ( ) ;
242+ testChild . stdin . write ( new Buffer ( input ) ) ;
243+ testChild . stdin . end ( ) ;
246244 } ) ;
247245
248- it ( 'should log on verbose' , function ( done ) {
249- exec ( 'bin/suitcss -v test/fixtures/cli/input.css test/fixtures/cli/output.css' , function ( err , stdout ) {
246+ it ( 'should log on verbose' , function ( done ) {
247+ exec ( 'bin/suitcss -v test/fixtures/cli/input.css test/fixtures/cli/output.css' , function ( err , stdout ) {
250248 if ( err ) return done ( err ) ;
251249 expect ( stdout ) . to . contain ( 'write' ) ;
252250 expect ( stdout ) . to . not . contain ( 'beforeLint ran' ) ;
253251 done ( ) ;
254252 } ) ;
255253 } ) ;
256254
257- it ( 'should allow configurable import root' , function ( done ) {
258- exec ( 'bin/suitcss -i test/fixtures test/fixtures/import.css test/fixtures/cli/output.css' , function ( err , stdout ) {
255+ it ( 'should allow configurable import root' , function ( done ) {
256+ exec ( 'bin/suitcss -i test/fixtures test/fixtures/import.css test/fixtures/cli/output.css' , function ( err , stdout ) {
259257 if ( err ) return done ( err ) ;
260258 var res = read ( 'fixtures/cli/output' ) ;
261259 var expected = read ( 'fixtures/component.out' ) ;
@@ -265,16 +263,16 @@ describe('cli', function () {
265263 } ) ;
266264 } ) ;
267265
268- it ( 'should output stylelint warnings' , function ( done ) {
269- exec ( 'bin/suitcss -i test/fixtures test/fixtures/stylelint-import.css test/fixtures/cli/output.css -l' , function ( err , stdout ) {
266+ it ( 'should output stylelint warnings' , function ( done ) {
267+ exec ( 'bin/suitcss -i test/fixtures test/fixtures/stylelint-import.css test/fixtures/cli/output.css -l' , function ( err , stdout ) {
270268 if ( err ) return done ( err ) ;
271269 expect ( stdout ) . to . contain ( 'Expected property "box-sizing" to come before property "flex"' ) ;
272270 done ( ) ;
273271 } ) ;
274272 } ) ;
275273
276- it ( 'should minify the output' , function ( done ) {
277- exec ( 'bin/suitcss -i test/fixtures test/fixtures/import.css test/fixtures/cli/output.css -m' , function ( err , stdout ) {
274+ it ( 'should minify the output' , function ( done ) {
275+ exec ( 'bin/suitcss -i test/fixtures test/fixtures/import.css test/fixtures/cli/output.css -m' , function ( err , stdout ) {
278276 if ( err ) return done ( err ) ;
279277 var res = read ( 'fixtures/cli/output' ) ;
280278 var expected = read ( 'fixtures/minify.out' ) ;
@@ -284,8 +282,8 @@ describe('cli', function () {
284282 } ) ;
285283 } ) ;
286284
287- it ( 'should allow a config file to be passed' , function ( done ) {
288- exec ( 'bin/suitcss -i test/fixtures -c test/test.config.js test/fixtures/config.css test/fixtures/cli/output.css' , function ( err , stdout ) {
285+ it ( 'should allow a config file to be passed' , function ( done ) {
286+ exec ( 'bin/suitcss -i test/fixtures -c test/test.config.js test/fixtures/config.css test/fixtures/cli/output.css' , function ( err , stdout ) {
289287 if ( err ) return done ( err ) ;
290288 var res = read ( 'fixtures/cli/output' ) ;
291289 var expected = read ( 'fixtures/config.out' ) ;
@@ -296,16 +294,16 @@ describe('cli', function () {
296294 } ) ;
297295
298296 it ( 'should output an error to stderr on conformance failure when throwError is set' , function ( done ) {
299- exec ( 'bin/suitcss -i test/fixtures -c test/error.config.json test/fixtures/import-error.css test/fixtures/cli/output.css' , function ( err , stdout , stderr ) {
297+ exec ( 'bin/suitcss -i test/fixtures -c test/error.config.json test/fixtures/import-error.css test/fixtures/cli/output.css' , function ( err , stdout , stderr ) {
300298 expect ( err ) . to . be . an ( 'error' ) ;
301299 expect ( err . code ) . to . equal ( 1 ) ;
302300 expect ( stderr ) . to . contain ( 'postcss-reporter: warnings or errors were found' ) ;
303301 done ( ) ;
304302 } ) ;
305303 } ) ;
306304
307- it ( 'should log on non-existant file' , function ( done ) {
308- exec ( 'bin/suitcss test/fixtures/cli/non-existant.css' , function ( err , stdout , stderr ) {
305+ it ( 'should log on non-existant file' , function ( done ) {
306+ exec ( 'bin/suitcss test/fixtures/cli/non-existant.css' , function ( err , stdout , stderr ) {
309307 expect ( err ) . to . be . an ( 'error' ) ;
310308 expect ( err . code ) . to . equal ( 1 ) ;
311309 expect ( stderr ) . to . contain ( 'not found' ) ;
@@ -321,7 +319,7 @@ describe('cli', function () {
321319 * @return {String }
322320 */
323321
324- function read ( filename ) {
322+ function read ( filename ) {
325323 var file = resolve ( filename ) ;
326324 return fs . readFileSync ( file , 'utf8' ) ;
327325}
@@ -332,7 +330,7 @@ function read (filename) {
332330 * @param {String } filename
333331 */
334332
335- function remove ( filename ) {
333+ function remove ( filename ) {
336334 var file = resolve ( filename ) ;
337335 if ( ! fs . existsSync ( file ) ) return ;
338336 fs . unlinkSync ( file ) ;
@@ -345,6 +343,6 @@ function remove (filename) {
345343 * @return {String }
346344 */
347345
348- function resolve ( filename ) {
346+ function resolve ( filename ) {
349347 return path . resolve ( __dirname , filename + '.css' ) ;
350348}
0 commit comments