Turbo87 / webpack-notifier

webpack + node-notifier = build status system notifications
ISC License
306 stars 41 forks source link

Add onlyOnError option #51

Closed sergejmueller closed 3 years ago

sergejmueller commented 5 years ago

Trigger a notification only on error.

Turbo87 commented 5 years ago

This is not much different from the default behavior. Can you explain why you think that this should be included too?

Gvozd commented 4 years ago

This option different from current default behaviour, when build succeed(with no errors) This option fully ignored alwaysNotify, excludeWarnings options, and lastBuildSucceeded And only shows failed builds

Comparasion:

  1. Success build, that fixed after previos error - are shown by default. But are not shown with onlyOnError
  2. Warnings - are shown by default. But are not shown with onlyOnError

code may be simplification for the greater of clarity:

if (stats.hasErrors()) {
    error = findFirstDFS(stats.compilation, 'errors');
 } else if (this.options.onlyOnError) {
    return;
 } else if (stats.hasWarnings() && !this.options.excludeWarnings) {
... // current code
Gvozd commented 3 years ago

rebased manually