Huge News!Announcing our $40M Series B led by Abstract Ventures.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 0.4.3 to 0.4.5

7

index.js

@@ -20,7 +20,4 @@ var through = require("through2"),

report(reporter, file, options, templateOptions, function (err) {
if (err) {
stream.emit("error", err);
} else {
stream.push(file);
}
err && stream.emit("error", err);
stream.push(file);
callback();

@@ -27,0 +24,0 @@ });

{
"name": "gulp-notify",
"version": "0.4.3",
"version": "0.4.5",
"description": "A plugin for Gulp to send messages to Mac Notification Center or Linux' notify-send",

@@ -34,5 +34,6 @@ "keywords": [

"devDependencies": {
"mocha": "~1.17.0",
"should": "~3.0.1",
"gulp": "~3.4.0"
"mocha": "~1.17.1",
"should": "~3.1.2",
"gulp": "~3.5.2",
"gulp-plumber": "~0.5.6"
},

@@ -39,0 +40,0 @@ "engines": {

@@ -42,2 +42,11 @@ # gulp-notify [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]

## Notes/tip
`gulp-notify` passes on the `vinyl files` even on error. So if you are
using [`gulp-plumber`](https://github.com/floatdrop/gulp-plumber) the run
will not break if the notifier returns an error.
If you want to notify on errors [`gulp-plumber`](https://github.com/floatdrop/gulp-plumber)
can be used to not break the run and force you to have to restart gulp.
## API

@@ -130,4 +139,4 @@

Same API as using `notify()`, but instead of being passed `vinyl File` an
error object gets sent.
The exact same API as using `notify()`, but where a `vinyl File`
is passed, the error object is passed instead.

@@ -139,3 +148,3 @@ Example:

.pipe(through(function () {
this.emit("error", "Something happend: Error message!")
this.emit("error", new Error("Something happend: Error message!"))
}))

@@ -147,2 +156,23 @@ .on("error", notify.onError(function (error) {

Or simply:
```javascript
gulp.src("../test/fixtures/*")
.pipe(through(function () {
this.emit("error", new Error("Something happend: Error message!"))
}))
.on("error", notify.onError("Error: <%= error.message %>"));
```
```javascript
gulp.src("../test/fixtures/*")
.pipe(through(function () {
this.emit("error", new Error("Something happend: Error message!"))
}))
.on("error", notify.onError({
message: "Error: <%= error.message %>",
title: "Error running something"
}));
```
The `onError()` end point does not support `lodash.template`.

@@ -149,0 +179,0 @@

@@ -7,2 +7,3 @@ /*global describe, it*/

through = require('through2'),
plumber = require('gulp-plumber'),
gutil = require('gulp-util'),

@@ -80,3 +81,73 @@ join = require('path').join,

it('should pass on files', function(done) {
var
testSuffix = "tester",
srcFile = join(__dirname, "./fixtures/*"),
instream = gulp.src(srcFile),
outstream = notify({
notifier: mockGenerator()
});
var numFilesBefore = 0,
numFilesAfter = 0;
instream
.pipe(through.obj(function (file, enc, cb) {
numFilesBefore++;
this.push(file);
cb();
}, function (cb) {
numFilesBefore.should.equal(3);
cb();
}))
.pipe(outstream)
.pipe(through.obj(function (file, enc, cb) {
numFilesAfter++;
this.push(file);
cb();
}, function (callback) {
numFilesAfter.should.equal(3);
done();
}));
});
it('should pass on files even on error in notifier (with use of plumber)', function(done) {
var
testString = "tester",
srcFile = join(__dirname, "./fixtures/*"),
instream = gulp.src(srcFile),
outstream = notify({
notifier: function (options, callback) {
callback(new Error(testString));
}
});
var numFilesBefore = 0,
numFilesAfter = 0;
instream
.pipe(plumber())
.pipe(through.obj(function (file, enc, cb) {
numFilesBefore++;
this.push(file);
cb();
}, function (cb) {
numFilesBefore.should.equal(3);
cb();
}))
.pipe(outstream)
.on('error', function (error) {
error.message.should.equal(testString);
})
.pipe(through.obj(function (file, enc, cb) {
numFilesAfter++;
this.push(file);
cb();
}, function (callback) {
numFilesAfter.should.equal(3);
done();
}));
});
it('should emit error when sub-module throws exception/error', function(done) {

@@ -358,2 +429,27 @@ var testString = "some exception",

it('should support lodash template for titles and messages on onError', function (done) {
var testString = "Template: <%= error.message %>";
var expectedString = "Template: test";
var srcFile = join(__dirname, "./fixtures/*");
var onError = notify.onError({
message: testString,
title: testString,
notifier: mockGenerator(function (opts) {
should.exist(opts);
should.exist(opts.title);
should.exist(opts.message);
String(opts.message).should.equal(expectedString);
String(opts.title).should.equal(expectedString);
done();
})
});
gulp.src(srcFile)
.pipe(through.obj(function (file, enc, cb) {
this.emit("error", new gutil.PluginError("testPlugin", "test"));
cb();
}))
.on('error', onError);
});
it('should support lodash template for titles and messages when onLast', function (done) {

@@ -360,0 +456,0 @@ var

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