Skip to content

Commit

Permalink
Add a test for discerning errors from warnings
Browse files Browse the repository at this point in the history
When `emitErrors` is set to false, errors no longer abort the
compilation. However, the user might still want to know which
warnings are the result of stylelint errors, and which are the
results of stylelint warnings. These tests ensure that.
  • Loading branch information
Vinnl committed Feb 19, 2017
1 parent 2b20f1c commit d065a72
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,44 @@ describe('stylelint-webpack-plugin', function () {
});
});

it('still indicates that errors are errors to the user, even when emitting them as warnings', function () {
var config = {
context: './test/fixtures/single-error',
entry: './index',
plugins: [
new StyleLintPlugin({
configFile: configFilePath,
quiet: true,
emitErrors: false
})
]
};

return pack(assign({}, baseConfig, config))
.then(function (stats) {
expect(stats.compilation.warnings[0]).to.contain('✖');
});
});

it('still indicates that warnings are warnings to the user, even when emitting errors as warnings too', function () {
var config = {
context: './test/fixtures/rule-warning',
entry: './index',
plugins: [
new StyleLintPlugin({
configFile: configFilePath,
quiet: true,
emitErrors: false
})
]
};

return pack(assign({}, baseConfig, config))
.then(function (stats) {
expect(stats.compilation.warnings[0]).to.contain('⚠');
});
});

it('does not emit errors as warnings when asked not to', function () {
var config = {
context: './test/fixtures/single-error',
Expand Down

0 comments on commit d065a72

Please sign in to comment.