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 4.1.4 to 4.1.5

30

lib/Unexpected.js

@@ -124,5 +124,6 @@ var Assertion = require('./Assertion');

var error = new Error();
var error = new Error();
error._isUnexpected = true;
error.output = output;
this.serializeOutputToMessage(error);
throw error;

@@ -274,3 +275,3 @@ };

case 'bubble':
return e;
return errorWithMessage(e, e.output);
default:

@@ -304,2 +305,11 @@ throw new Error("Unknown error mode: '" + assertion.errorMode + "'");

Unexpected.prototype.serializeOutputToMessage = function (err) {
var outputFormat = this.outputFormat();
if (outputFormat === 'html') {
outputFormat = 'text';
err.htmlMessage = err.output.toString('html');
}
err.message = err.output.toString(outputFormat);
};
Unexpected.prototype.expect = function expect(subject, testDescriptionString) {

@@ -329,8 +339,3 @@ var that = this;

var wrappedError = handleNestedExpects(e, assertion);
var outputFormat = that.outputFormat();
if (outputFormat === 'html') {
outputFormat = 'text';
wrappedError.htmlMessage = wrappedError.output.toString('html');
}
wrappedError.message = wrappedError.output.toString(outputFormat);
that.serializeOutputToMessage(wrappedError);
throw wrappedError;

@@ -376,6 +381,9 @@ }

} catch (e) {
if (e._isUnexpected) {
truncateStack(e, this.expect);
var err = e;
if (err._isUnexpected) {
err = errorWithMessage(err, err.output);
that.serializeOutputToMessage(err);
truncateStack(err, this.expect);
}
throw e;
throw err;
}

@@ -382,0 +390,0 @@ } else {

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

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

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

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