Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sinonjs/commons

Package Overview
Dependencies
Maintainers
5
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sinonjs/commons - npm Package Compare versions

Comparing version 1.7.2 to 1.8.0

7

CHANGES.md
# Changes
## 1.8.0
- [`4282205`](https://github.com/sinonjs/commons/commit/4282205343a4dcde2a35ccf2a8c2094300dad369)
Emit deprecationg warnings in node, and keep console info in browsers (mshaaban0)
_Released on 2020-05-20._
## 1.7.2

@@ -4,0 +11,0 @@

14

lib/deprecated.js

@@ -49,11 +49,11 @@ /* eslint-disable no-console */

exports.printWarning = function(msg) {
// Watch out for IE7 and below! :(
/* istanbul ignore next */
if (typeof console !== "undefined") {
if (console.info) {
console.info(msg);
} else {
console.log(msg);
}
if (typeof process === "object" && process.emitWarning) {
// Emit Warnings in Node
process.emitWarning(msg);
} else if (console.info) {
console.info(msg);
} else {
console.log(msg);
}
};

@@ -22,6 +22,20 @@ /* eslint-disable no-console */

describe("printWarning", function() {
describe("when `console` is defined", function() {
beforeEach(function() {
sinon.replace(process, "emitWarning", sinon.fake());
});
afterEach(sinon.restore);
describe("when `process.emitWarning` is defined", function() {
it("should call process.emitWarning with a msg", function() {
deprecated.printWarning(msg);
assert.calledOnceWith(process.emitWarning, msg);
});
});
describe("when `process.emitWarning` is undefined", function() {
beforeEach(function() {
sinon.replace(console, "info", sinon.fake());
sinon.replace(console, "log", sinon.fake());
process.emitWarning = undefined;
});

@@ -32,3 +46,3 @@

describe("when `console.info` is defined", function() {
it("shoudl call `console.info` with a message", function() {
it("should call `console.info` with a message", function() {
deprecated.printWarning(msg);

@@ -35,0 +49,0 @@ assert.calledOnceWith(console.info, msg);

{
"name": "@sinonjs/commons",
"version": "1.7.2",
"version": "1.8.0",
"description": "Simple functions shared among the sinon end user libraries",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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