node-notifier
Advanced tools
| var should = require('should') | ||
| , cp = require('child_process') | ||
| , assert = require('assert'); | ||
| var _ = require('../lib/utils'); | ||
| var originalPlatform = process.platform; | ||
| var originalVersion = _.getOSXVersion; | ||
| describe('utils', function(){ | ||
| before(function () { | ||
| process.platform = "darwin"; | ||
| }); | ||
| after(function () { | ||
| process.platform = originalPlatform; | ||
| _.getOSXVersion = originalVersion; | ||
| }); | ||
| it('should support mac 10.8', function (done) { | ||
| _.getOSXVersion = function (cb) { | ||
| cb(null, "10.8", ""); | ||
| }; | ||
| _.isMacOSX(function (error, msg) { | ||
| error.should.be.false; | ||
| done(); | ||
| }); | ||
| }); | ||
| it('should support not mac 10.7', function (done) { | ||
| _.getOSXVersion = function (cb) { | ||
| cb(null, "10.7", ""); | ||
| }; | ||
| _.isMacOSX(function (error, msg) { | ||
| error.should.be.true; | ||
| done(); | ||
| }); | ||
| }); | ||
| it('should support 10.10', function (done) { | ||
| _.getOSXVersion = function (cb) { | ||
| cb(null, "10.10", ""); | ||
| }; | ||
| _.isMacOSX(function (error, msg) { | ||
| error.should.be.false; | ||
| done(); | ||
| }); | ||
| }); | ||
| it('should sopport 10.10 with newline', function (done) { | ||
| _.getOSXVersion = function (cb) { | ||
| cb(null, "10.10\n", ""); | ||
| }; | ||
| _.isMacOSX(function (error, msg) { | ||
| error.should.be.false; | ||
| done(); | ||
| }); | ||
| }); | ||
| }); |
+7
-5
@@ -1,3 +0,2 @@ | ||
| var child_process = require('child_process') | ||
| , exec = child_process.exec | ||
| var cp = require('child_process') | ||
| , osVersionError = 'Incorrect OS. node-notify requires Mac OS 10.8 or higher' | ||
@@ -51,2 +50,6 @@ , shellwords = require('shellwords'); | ||
| module.exports.getOSXVersion = function (cb) { | ||
| return cp.exec("sw_vers -productVersion", cb); | ||
| } | ||
| module.exports.isMacOSX = function (cb) { | ||
@@ -56,8 +59,7 @@ if (process.platform != 'darwin') { | ||
| } | ||
| return exec("sw_vers -productVersion", function (error, stdout, stderr) { | ||
| return module.exports.getOSXVersion(function (error, stdout, stderr) { | ||
| if (error) { | ||
| return cb(true, error, stderr); | ||
| } | ||
| if (stdout.split(".")[1] >= "8") { | ||
| if (Number(stdout.split(".")[1]) >= 8) { | ||
| return cb(false); | ||
@@ -64,0 +66,0 @@ } |
+1
-1
| { | ||
| "name": "node-notifier", | ||
| "version": "3.0.1", | ||
| "version": "3.0.2", | ||
| "description": "A Node.js module for sending notifications on mac, windows and linux", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+3
-0
@@ -186,2 +186,5 @@ # node-notifier [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url] | ||
| ### `v3.0.1` | ||
| 1. Fixes version check for Mac OS X Yosemite | ||
| ### `v3.0.0` | ||
@@ -188,0 +191,0 @@ 1. Updates terminal-notifier to version 1.6.0; adding support for appIcon and contentImage |
@@ -10,2 +10,4 @@ var NotificationCenter = require('../').NotificationCenter | ||
| var originalUtils = utils.command; | ||
| var originalIsMacOsX = utils.isMacOSX; | ||
| var originalType = os.type; | ||
@@ -24,4 +26,9 @@ (function () { | ||
| }; | ||
| }) | ||
| }); | ||
| after(function () { | ||
| os.type = originalType; | ||
| utils.isMacOSX = originalIsMacOsX; | ||
| }); | ||
| describe('#notify()', function(){ | ||
@@ -28,0 +35,0 @@ |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
492998
0.33%24
4.35%552
11.97%204
1.49%3
50%