New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-notify

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-notify - npm Package Compare versions

Comparing version 1.2.6 to 1.3.0

10

examples/gulpfile.js

@@ -96,6 +96,3 @@

}))
.on("error", custom.onError('Error: <%= error.message %>'))
.on("error", function (err) {
console.log("Error:", err);
})
.on("error", custom.onError('Error: <%= error.message %>'));
});

@@ -119,3 +116,6 @@

}))
.on("error", custom.onError('Error: <%= error.message %>'))
.on("error", custom.onError({
message: 'Error: <%= error.message %>',
emitError: true
}))
.on("error", function (err) {

@@ -122,0 +122,0 @@ console.log("Error:", err);

var through = require("through2");
var report = require('./report');
var extra = require('./extra_api');
var Notification = require("node-notifier");

@@ -24,3 +25,3 @@

report(reporter, file, options, templateOptions, function (err) {
err && stream.emit("error", err);
logError(err, stream);
stream.push(file);

@@ -47,11 +48,21 @@ callback();

report(reporter, lastFile, options, templateOptions, function (err, file) {
if (err) {
stream.emit("error", err);
return callback();
}
report(reporter, lastFile, options, templateOptions, function (err) {
logError(err, stream);
return callback();
});
lastFile = null; // reset
return callback();
});
function logError (err, stream) {
if (err) {
if (!options.emitError) {
extra.logError({
title: "Error in notifier",
message: err
}, true);
} else {
stream.emit('error', err);
}
}
}
};
{
"name": "gulp-notify",
"version": "1.2.6",
"version": "1.3.0",
"description": "A plugin for Gulp to send notification messages (Mac, Linux and Windows",

@@ -5,0 +5,0 @@ "keywords": [

@@ -96,3 +96,16 @@ # gulp-notify [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]

#### options.emitError
Type: `Boolean`
Default: `false`
If the returned stream should emit an error or not.
If `emitError` is true, you have to handle `.on('error')`
manually in case the notifier (gulp-notify) fails. If
the default `false` is set, the error will not be emitted
but simply printed to the console.
This means you can run the notifier on a CI system without
opting it out but simply letting it fail gracefully.
#### options.message

@@ -99,0 +112,0 @@ Type: `String`

@@ -110,3 +110,3 @@ /*global describe, it*/

it('should emit error when sub-module returns error', function(done) {
it('should emit error when sub-module returns error and emitError is true', function(done) {
var mockedNotify = notify.withReporter(function (options, callback) {

@@ -120,3 +120,4 @@ callback(new Error(testString));

outstream = mockedNotify({
message: testString
message: testString,
emitError: true
});

@@ -204,3 +205,3 @@

it('should emit error when sub-module throws exception/error', function(done) {
it('should emit error when sub-module throws exception/error and emitError flag is true', function(done) {
var testString = "some exception",

@@ -212,3 +213,4 @@ instream = gulp.src(join(__dirname, "./fixtures/*.txt")),

throw new Error(testString);
}
},
emitError: true
});

@@ -226,2 +228,40 @@

it('should not emit error when sub-module throws exception/error if emitError flag is false (default)', function(done) {
notify.logLevel(1);
notify.logger(function () {
should.exist(true);
done();
});
var testString = "some exception",
expectedFile = new gutil.File({
path: "test/fixtures/1.txt",
cwd: "test/",
base: "test/fixtures/",
contents: fs.createReadStream("test/fixtures/1.txt")
}),
outstream = notify({
message: testString,
notifier: function (options, callback) {
throw new Error(testString);
}
});
outstream.on('error', function (error) {
should.not.exist(error);
should.not.exist(error.message);
String(error.message).should.not.equal(testString);
done();
});
outstream.on('end', function () {
done();
});
outstream.write(expectedFile);
outstream.write(null);
outstream.end();
});
it('should default to notifying file path and default title', function(done) {

@@ -228,0 +268,0 @@ var srcFile = join(__dirname, "./fixtures/1.txt");

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc