Skip to content

Commit

Permalink
✅ Add output validity test
Browse files Browse the repository at this point in the history
  • Loading branch information
DanPurdy committed Sep 2, 2017
1 parent 9eaeef3 commit 9aa2ccb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,29 @@ describe('cli', function () {
});
});

it('CLI format option should output valid JSON', function (done) {
var command = 'node bin/sass-lint -c tests/yml/.stylish-output.yml tests/cli/*.scss --verbose --format json';

exec(command, function (err, stdout) {

if (err) {
return done(err);
}
else {
try {
var result = JSON.parse(stdout);
if (result && result.length && result.length > 1) {
return done();
}
return done(new Error('Output is not combined'));
}
catch (e) {
return done(new Error('Not JSON'));
}
}
});
});

it('CLI output option should write to test file', function (done) {
var command = 'node bin/sass-lint -c tests/yml/.stylish-output.yml tests/cli/cli.scss --verbose --format json --output tests/cli-output.json',
outputFile = path.resolve(process.cwd(), 'tests/cli-output.json');
Expand Down
3 changes: 3 additions & 0 deletions tests/cli/cli-warn.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.cli {
color: red;
}

0 comments on commit 9aa2ccb

Please sign in to comment.