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

unexpected

Package Overview
Dependencies
Maintainers
2
Versions
330
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unexpected - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

24

lib/unexpected-core.js

@@ -256,13 +256,25 @@ /*global namespace*/

var errorMethodBlacklist = reduce(['message', 'line', 'sourceId', 'sourceURL', 'stack', 'stackArray'], function (result, prop) {
result[prop] = true;
return result;
}, {});
function errorWithMessage(e, message) {
var newError = new Error(message);
forEach(getKeys(e), function (key) {
if (!errorMethodBlacklist[key]) {
newError[key] = e[key];
}
});
return newError;
}
function handleNestedExpects(e, assertion) {
switch (assertion.errorMode) {
case 'nested':
e.message = assertion.standardErrorMessage() + '\n ' + e.message.replace(/\n/g, '\n ');
break;
return errorWithMessage(e, assertion.standardErrorMessage() + '\n ' + e.message.replace(/\n/g, '\n '));
case 'default':
e.message = assertion.standardErrorMessage();
break;
return errorWithMessage(e, assertion.standardErrorMessage());
case 'bubble':
break;
return e;
default:

@@ -322,3 +334,3 @@ throw new Error("Unknown error mode: '" + assertion.errorMode + "'");

if (nestingLevel === 0) {
handleNestedExpects(e, assertion);
throw handleNestedExpects(e, assertion);
}

@@ -325,0 +337,0 @@ }

{
"name": "unexpected",
"version": "3.2.0",
"version": "3.2.1",
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>",

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

@@ -489,13 +489,25 @@ (function () {

var errorMethodBlacklist = reduce(['message', 'line', 'sourceId', 'sourceURL', 'stack', 'stackArray'], function (result, prop) {
result[prop] = true;
return result;
}, {});
function errorWithMessage(e, message) {
var newError = new Error(message);
forEach(getKeys(e), function (key) {
if (!errorMethodBlacklist[key]) {
newError[key] = e[key];
}
});
return newError;
}
function handleNestedExpects(e, assertion) {
switch (assertion.errorMode) {
case 'nested':
e.message = assertion.standardErrorMessage() + '\n ' + e.message.replace(/\n/g, '\n ');
break;
return errorWithMessage(e, assertion.standardErrorMessage() + '\n ' + e.message.replace(/\n/g, '\n '));
case 'default':
e.message = assertion.standardErrorMessage();
break;
return errorWithMessage(e, assertion.standardErrorMessage());
case 'bubble':
break;
return e;
default:

@@ -555,3 +567,3 @@ throw new Error("Unknown error mode: '" + assertion.errorMode + "'");

if (nestingLevel === 0) {
handleNestedExpects(e, assertion);
throw handleNestedExpects(e, assertion);
}

@@ -558,0 +570,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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