@@ -4,8 +4,8 @@ var assert = require('assert'),
4
4
path = require ( 'path' ) ,
5
5
exec = require ( 'child_process' ) . exec ;
6
6
7
-
8
7
describe ( 'cli' , function ( ) {
8
+
9
9
it ( 'should return help instructions' , function ( done ) {
10
10
var command = 'sass-lint -h' ;
11
11
@@ -16,7 +16,7 @@ describe('cli', function () {
16
16
17
17
assert ( stdout . indexOf ( 'Usage' ) > 0 ) ;
18
18
19
- return done ( null ) ;
19
+ return done ( ) ;
20
20
} ) ;
21
21
} ) ;
22
22
@@ -30,12 +30,12 @@ describe('cli', function () {
30
30
31
31
should ( stdout ) . match ( / ^ [ 0 - 9 ] + .[ 0 - 9 ] + ( .[ 0 - 9 ] + ) ? / ) ;
32
32
33
- return done ( null ) ;
33
+ return done ( ) ;
34
34
} ) ;
35
35
} ) ;
36
36
37
37
it ( 'CLI format option should output JSON' , function ( done ) {
38
- var command = 'sass-lint -c tests/yml/.stylish-output.yml tests/sass /cli.scss --verbose --format json' ;
38
+ var command = 'sass-lint -c tests/yml/.stylish-output.yml tests/cli /cli.scss --verbose --format json' ;
39
39
40
40
exec ( command , function ( err , stdout ) {
41
41
@@ -55,7 +55,7 @@ describe('cli', function () {
55
55
} ) ;
56
56
57
57
it ( 'CLI output option should write to test file' , function ( done ) {
58
- var command = 'sass-lint -c tests/yml/.stylish-output.yml tests/sass /cli.scss --verbose --format json --output tests/cli-output.json' ,
58
+ var command = 'sass-lint -c tests/yml/.stylish-output.yml tests/cli /cli.scss --verbose --format json --output tests/cli-output.json' ,
59
59
outputFile = path . resolve ( process . cwd ( ) , 'tests/cli-output.json' ) ;
60
60
61
61
exec ( command , function ( err ) {
@@ -78,7 +78,7 @@ describe('cli', function () {
78
78
} ) ;
79
79
80
80
it ( 'CLI output option should write JSON to test file' , function ( done ) {
81
- var command = 'sass-lint -c tests/yml/.stylish-output.yml tests/sass /cli.scss --verbose --format json --output tests/cli-output.json' ,
81
+ var command = 'sass-lint -c tests/yml/.stylish-output.yml tests/cli /cli.scss --verbose --format json --output tests/cli-output.json' ,
82
82
outputFile = path . resolve ( process . cwd ( ) , 'tests/cli-output.json' ) ;
83
83
84
84
exec ( command , function ( err ) {
@@ -111,7 +111,7 @@ describe('cli', function () {
111
111
} ) ;
112
112
113
113
it ( 'CLI output option should write JSON to test file when upper case format is used' , function ( done ) {
114
- var command = 'sass-lint -c tests/yml/.stylish-output.yml tests/sass /cli.scss --verbose --format JSON --output tests/cli-output.json' ,
114
+ var command = 'sass-lint -c tests/yml/.stylish-output.yml tests/cli /cli.scss --verbose --format JSON --output tests/cli-output.json' ,
115
115
outputFile = path . resolve ( process . cwd ( ) , 'tests/cli-output.json' ) ;
116
116
117
117
exec ( command , function ( err ) {
@@ -146,7 +146,7 @@ describe('cli', function () {
146
146
// Test custom config path
147
147
148
148
it ( 'should return JSON from a custom config' , function ( done ) {
149
- var command = 'sass-lint -c tests/yml/.color-keyword-errors.yml tests/sass /cli.scss --verbose' ;
149
+ var command = 'sass-lint -c tests/yml/.color-keyword-errors.yml tests/cli /cli.scss --verbose' ;
150
150
151
151
exec ( command , function ( err , stdout ) {
152
152
@@ -168,7 +168,7 @@ describe('cli', function () {
168
168
// Test 0 errors/warnings when rules set to 0 in config
169
169
170
170
it ( 'output should return no errors/warnings' , function ( done ) {
171
- var command = 'sass-lint -c tests/yml/.json-lint.yml tests/sass /cli.scss --verbose' ;
171
+ var command = 'sass-lint -c tests/yml/.json-lint.yml tests/cli /cli.scss --verbose' ;
172
172
173
173
exec ( command , function ( err , stdout ) {
174
174
@@ -190,7 +190,7 @@ describe('cli', function () {
190
190
// Test 1 warning when rules set to 0 in config
191
191
192
192
it ( 'should return a warning' , function ( done ) {
193
- var command = 'sass-lint -c tests/yml/.color-keyword-errors.yml tests/sass /cli.scss --verbose' ;
193
+ var command = 'sass-lint -c tests/yml/.color-keyword-errors.yml tests/cli /cli.scss --verbose' ;
194
194
195
195
exec ( command , function ( err , stdout ) {
196
196
@@ -219,8 +219,8 @@ describe('cli', function () {
219
219
} ) ;
220
220
221
221
it ( 'should return a warning - stylish' , function ( done ) {
222
- var command = 'sass-lint -c tests/yml/.stylish-errors.yml tests/sass /cli.scss --verbose' ,
223
- expectedOutputLength = 155 ;
222
+ var command = 'sass-lint -c tests/yml/.stylish-errors.yml tests/cli /cli.scss --verbose' ,
223
+ expectedOutputLength = 154 ;
224
224
225
225
exec ( command , function ( err , stdout ) {
226
226
@@ -236,59 +236,38 @@ describe('cli', function () {
236
236
} ) ;
237
237
238
238
it ( 'should not include ignored paths' , function ( done ) {
239
-
240
- var sassTestsPath = path . join ( __dirname , '/sass/' ) ,
241
- files = [ ] ;
242
-
243
- files . push ( sassTestsPath + fs . readdirSync ( sassTestsPath ) ) ;
244
-
245
- var command = 'sass-lint -i \'**/*.s+(a|c)ss\'' ;
239
+ var command = 'sass-lint -i **/*.scss -v -q --format json **/cli/*.scss' ;
246
240
247
241
exec ( command , function ( err , stdout ) {
248
242
249
243
if ( err ) {
250
244
return done ( err ) ;
251
245
}
252
246
253
- files . forEach ( function ( file ) {
254
- assert ( stdout . indexOf ( file ) === - 1 ) ;
255
- } ) ;
247
+ assert ( stdout . indexOf ( '.scss' ) === - 1 ) ;
256
248
257
249
return done ( ) ;
258
250
} ) ;
259
251
} ) ;
260
252
261
253
it ( 'should not include multiple ignored paths' , function ( done ) {
262
-
263
- var sassTestsPath = path . join ( __dirname , '/sass/' ) ,
264
- files = [ ] ;
265
-
266
- files . push ( sassTestsPath + fs . readdirSync ( sassTestsPath ) ) ;
267
-
268
- var command = 'sass-lint -i \'**/*.scss, **/*.sass \'' ;
254
+ var command = 'sass-lint -i \'**/*.scss, **/*.sass\' -q -v --format json' ;
269
255
270
256
exec ( command , function ( err , stdout ) {
271
257
272
258
if ( err ) {
273
259
return done ( err ) ;
274
260
}
275
261
276
- files . forEach ( function ( file ) {
277
- assert ( stdout . indexOf ( file ) === - 1 ) ;
278
- } ) ;
262
+ assert ( stdout . indexOf ( '.scss' ) === - 1 ) ;
263
+ assert ( stdout . indexOf ( '.sass' ) === - 1 ) ;
279
264
280
265
return done ( ) ;
281
266
} ) ;
282
267
} ) ;
283
268
284
269
it ( 'should override filename convention if a valid --syntax is provided' , function ( done ) {
285
-
286
- var sassTestsPath = path . join ( __dirname , '/sass/' ) ,
287
- files = [ ] ;
288
-
289
- files . push ( sassTestsPath + fs . readdirSync ( sassTestsPath ) ) ;
290
-
291
- var command = 'sass-lint --syntax scss tests/sass/cli.txt --verbose' ;
270
+ var command = 'sass-lint --syntax scss tests/cli/cli.txt --verbose --format json' ;
292
271
293
272
exec ( command , function ( err , stdout ) {
294
273
@@ -309,7 +288,7 @@ describe('cli', function () {
309
288
} ) ;
310
289
311
290
it ( 'should exit with exit code 1 when quiet' , function ( done ) {
312
- var command = 'sass-lint -c tests/yml/.error-output.yml tests/sass /cli-error.scss --verbose --no-exit' ;
291
+ var command = 'sass-lint -c tests/yml/.error-output.yml tests/cli /cli-error.scss --verbose --no-exit' ;
313
292
314
293
exec ( command , function ( err ) {
315
294
if ( err . code === 1 ) {
@@ -321,7 +300,7 @@ describe('cli', function () {
321
300
} ) ;
322
301
323
302
it ( 'should exit with exit code 1 when more warnings than --max-warnings' , function ( done ) {
324
- var command = 'sass-lint -c tests/yml/.color-keyword-errors.yml tests/sass /cli.scss --max-warnings 0' ;
303
+ var command = 'sass-lint -c tests/yml/.color-keyword-errors.yml tests/cli /cli.scss --max-warnings 0' ;
325
304
326
305
exec ( command , function ( err ) {
327
306
if ( err && err . code === 1 ) {
@@ -333,7 +312,7 @@ describe('cli', function () {
333
312
} ) ;
334
313
335
314
it ( 'should not exit with an error if no config is specified' , function ( done ) {
336
- var command = 'sass-lint tests/sass /cli-clean.scss --verbose --no-exit' ;
315
+ var command = 'sass-lint tests/cli /cli-clean.scss --verbose --no-exit' ;
337
316
338
317
exec ( command , function ( err ) {
339
318
if ( ! err ) {
0 commit comments