Skip to content

Commit

Permalink
fix: missing warning and error messages (#51)
Browse files Browse the repository at this point in the history
Fixes #50.

* No warning and error messages

* Add test for warning messaging
  • Loading branch information
ihorkrys authored and JaKXz committed Dec 27, 2016
1 parent 6b74bb6 commit ffbab73
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/run-compilation.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ module.exports = function runCompilation(options, compiler, done) {
return f.errored;
});

if (!options.quiet) {
console.log(chalk.yellow(options.formatter(lint.results)));
}

if (options.failOnError && errors.length) {
done(new Error('Failed because of a stylelint error.\n'));
} else {
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/test10/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require(getPath('./../../../node_modules/file-loader/index') + '!./test.scss');

console.log('test10');
4 changes: 4 additions & 0 deletions test/fixtures/test10/test.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
html {
margin: 0
;;
}
18 changes: 18 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,24 @@ describe('stylelint-webpack-plugin', function () {
});
});

it('send messages to console when css file with errors and quiet props set to false', function () {
var config = {
context: './test/fixtures/test10',
entry: './index',
plugins: [
new StyleLintPlugin({
configFile: configFilePath
})
]
};

return pack(assign({}, baseConfig, config))
.then(function (stats) {
expect(stats.compilation.warnings).to.have.length(1);
expect(stats.compilation.errors).to.have.length(1);
});
});

context('interop with NoErrorsPlugin', function () {
it('works when failOnError is false', function () {
var config = {
Expand Down

0 comments on commit ffbab73

Please sign in to comment.