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 1.0.11 to 1.0.12

4

lib/unexpected.js

@@ -551,2 +551,6 @@ // Copyright (c) 2013 Sune Simonsen <sune@we-knowhow.dk>

e.actual = this.obj;
// Explicitly tell mocha to stringify and diff arrays and objects, but only when the types are identical and non-primitive:
if (e.actual && e.expected && typeof e.actual === 'object' && typeof e.expected === 'object' && isArray(e.actual) === isArray(e.expected)) {
e.showDiff = true;
}
}

@@ -553,0 +557,0 @@ throw e;

2

package.json
{
"name": "unexpected",
"version": "1.0.11",
"version": "1.0.12",
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>",

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

@@ -316,3 +316,4 @@ # Unexpected

expect([[1], [2]], 'to be an array whose items satisfy', 'to be an array whose items satisfy', 'to be a number');
expect([[1], [2]], 'to be an array whose items satisfy',
'to be an array whose items satisfy', 'to be a number');

@@ -319,0 +320,0 @@ expect([[], []], 'to be a non-empty array whose items satisfy', function (item) {

@@ -188,2 +188,34 @@ /*global describe, it, expect*/

});
it("throws an error with showDiff:true when comparing arrays and not negated", function () {
expect(function () {
expect([1], 'to equal', [2]);
}, 'to throw exception', function (e) {
expect(e.showDiff, 'to be ok');
});
});
it("throws an error with showDiff:true when comparing objects and not negated", function () {
expect(function () {
expect({foo: 1}, 'to equal', {foo: 2});
}, 'to throw exception', function (e) {
expect(e.showDiff, 'to be ok');
});
});
it("throws an error with showDiff:true when comparing an object to an array", function () {
expect(function () {
expect({foo: 1}, 'to equal', []);
}, 'to throw exception', function (e) {
expect(e.showDiff, 'not to be ok');
});
});
it("throws an error without showDiff:true when negated", function () {
expect(function () {
expect({foo: 1}, 'not to equal', {foo: 1});
}, 'to throw exception', function (e) {
expect(e.showDiff, 'not to be ok');
});
});
});

@@ -190,0 +222,0 @@

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