Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Commit 0a980b1

Browse files
nkzawageowarin
authored andcommitted
fix default value of the clearConsole option (#11)
1 parent cf5047a commit 0a980b1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/friendly-errors-plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FriendlyErrorsWebpackPlugin {
2828
options = options || {};
2929
this.compilationSuccessInfo = options.compilationSuccessInfo || {};
3030
this.onErrors = options.onErrors;
31-
this.shouldClearConsole = Boolean(options.clearConsole);
31+
this.shouldClearConsole = options.clearConsole == null ? true : Boolean(options.clearConsole);
3232
this.formatters = concat(defaultFormatters, options.additionalFormatters);
3333
this.transformers = concat(defaultTransformers, options.additionalTransformers);
3434
}

test/unit/plugin/friendlyErrors.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ test('friendlyErrors : capture compilation without errors', t => {
3939
]);
4040
});
4141

42+
test('friendlyErrors : default clearConsole option', t => {
43+
const plugin = new FriendlyErrorsPlugin();
44+
assert.strictEqual(plugin.shouldClearConsole, true)
45+
});
46+
47+
test('friendlyErrors : clearConsole option', t => {
48+
const plugin = new FriendlyErrorsPlugin({ clearConsole: false });
49+
assert.strictEqual(plugin.shouldClearConsole, false)
50+
});
51+
4252
function successfulCompilationStats() {
4353
const compilation = {
4454
errors: [],

0 commit comments

Comments
 (0)