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.1.0 to 1.1.2

9

lib/unexpected.js

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

Unexpected.prototype.installPlugin = function (plugin) {
plugin(this.expect);
};
Unexpected.prototype.expect = function (subject, testDescriptionString) {

@@ -159,2 +163,3 @@ if (arguments.length < 2) {

expect.assertions = unexpected.assertions;
expect.installPlugin = bind(unexpected.installPlugin, unexpected);
return expect;

@@ -628,5 +633,5 @@ }

var errors = [];
forEach(getKeys(obj), function (key) {
forEach(getKeys(obj), function (key, index) {
try {
callback(obj[key]);
callback(obj[key], index);
} catch (e) {

@@ -633,0 +638,0 @@ errors.push(' ' + key + ': ' + e.message.replace(/\n/g, '\n '));

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

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

@@ -310,3 +310,3 @@ # Unexpected

```js
expect([0, 1, 2, 3, 4], 'to be an array whose items satisfy', function (item) {
expect([0, 1, 2, 3, 4], 'to be an array whose items satisfy', function (item, index) {
expect(item, 'to be a number');

@@ -313,0 +313,0 @@ });

@@ -678,8 +678,10 @@ /*global describe, it, expect*/

it('asserts that the given callback does not throw for any items in the array', function () {
expect([0,1,2,3], 'to be an array whose items satisfy', function (item) {
expect([0,1,2,3], 'to be an array whose items satisfy', function (item, index) {
expect(item, 'to be a number');
expect(index, 'to be a number');
});
expect(['0','1','2','3'], 'to be an array whose items satisfy', function (item) {
expect(['0','1','2','3'], 'to be an array whose items satisfy', function (item, index) {
expect(item, 'not to be a number');
expect(index, 'to be a number');
});

@@ -694,2 +696,10 @@

it('provides the item index to the callback function', function () {
var arr = ['0','1','2','3'];
expect(arr, 'to be an array whose items satisfy', function (item, index) {
expect(index, 'to be a number');
expect(index, 'to be', arr.indexOf(item));
});
});
it('fails when the assertion fails', function () {

@@ -1099,2 +1109,12 @@ expect(function () {

});
describe('installPlugin', function () {
it('calls the given plugin with the expect instance as the paramenter', function (done) {
var plugin = function (expectInstance) {
expect(expectInstance, 'to be', expect);
done();
};
expect.installPlugin(plugin);
});
});
});
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