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

unexpected

Package Overview
Dependencies
Maintainers
3
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 10.10.12 to 10.11.0

.eslintignore

24

lib/createWrappedExpectProto.js

@@ -14,2 +14,16 @@ var createStandardErrorMessage = require('./createStandardErrorMessage');

function findSuffixAssertions(assertionString, assertions) {
if (assertions[assertionString]) {
return assertions[assertionString];
}
var tokens = assertionString.split(' ');
for (var n = tokens.length - 1 ; n > 0 ; n -= 1) {
var suffixAssertions = assertions[tokens.slice(n).join(' ')];
if (findSuffixAssertions(tokens.slice(0, n).join(' '), assertions) && suffixAssertions) {
return suffixAssertions;
}
}
return null;
}
module.exports = function createWrappedExpectProto(unexpected) {

@@ -178,8 +192,8 @@ var wrappedExpectProto = {

assertionIndices.push(offset + currentAssertionRule.args.length - 2);
var assertions = unexpected.assertions[args[offset + currentAssertionRule.args.length - 2]];
if (assertions) {
for (var i = 0 ; i < assertions.length ; i += 1) {
if (assertions[i].args.some(isAssertionArg)) {
var suffixAssertions = findSuffixAssertions(args[offset + currentAssertionRule.args.length - 2], unexpected.assertions);
if (suffixAssertions) {
for (var i = 0 ; i < suffixAssertions.length ; i += 1) {
if (suffixAssertions[i].args.some(isAssertionArg)) {
offset += currentAssertionRule.args.length - 1;
currentAssertionRule = assertions[i];
currentAssertionRule = suffixAssertions[i];
continue OUTER;

@@ -186,0 +200,0 @@ }

@@ -18,5 +18,6 @@ var Promise = require('unexpected-bluebird');

var resolvedValue;
var outerFunctionHasReturned = false;
function fulfillIfDone() {
if (runningTasks === 0) {
if (outerFunctionHasReturned && runningTasks === 0) {
resolve(resolvedValue);

@@ -36,14 +37,16 @@ }

runningTasks -= 1;
var result;
try {
var result = cb.apply(null, arguments);
result = oathbreaker(result);
if (isPromise(result)) {
runningTasks += 1;
result.then(function (value) {
noteResolvedValue(value);
runningTasks -= 1;
fulfillIfDone();
}, reject);
} else {
noteResolvedValue(result);
if (typeof cb === 'function') {
result = oathbreaker(cb.apply(null, arguments));
if (isPromise(result)) {
runningTasks += 1;
result.then(function (value) {
noteResolvedValue(value);
runningTasks -= 1;
fulfillIfDone();
}, reject);
} else {
noteResolvedValue(result);
}
}

@@ -54,2 +57,3 @@ } catch (e) {

fulfillIfDone();
return result;
};

@@ -73,2 +77,3 @@ };

}
outerFunctionHasReturned = true;
fulfillIfDone();

@@ -75,0 +80,0 @@ });

@@ -25,2 +25,3 @@ /*global afterEach, jasmine*/

var error;
var testPassed = true;
if (pendingPromisesForTheCurrentTest.some(function (promise) {return promise.isPending();})) {

@@ -30,4 +31,6 @@ var displayName;

// mocha
testPassed = this.currentTest.state === 'passed';
displayName = this.currentTest.title;
} else if (currentSpec) {
} else if (typeof currentSpec === 'object') {
testPassed = currentSpec.failedExpectations.length === 0;
displayName = currentSpec.fullName;

@@ -38,3 +41,3 @@ }

pendingPromisesForTheCurrentTest = [];
if (error) {
if (error && testPassed) {
throw error;

@@ -41,0 +44,0 @@ }

@@ -31,6 +31,4 @@ var workQueue = require('./workQueue');

var error;
var resolvedValue;
value.then(function (obj) {
evaluated = true;
resolvedValue = obj;
onResolve(value);

@@ -37,0 +35,0 @@ }, function (err) {

@@ -97,5 +97,3 @@ var utils = require('./utils');

var isSymbol;
/*jshint ignore:start*/
isSymbol = typeof key === 'symbol';
/*jshint ignore:end*/
if (isSymbol) {

@@ -140,13 +138,11 @@ this.text('[').sp().appendInspected(key).sp().text(']').text(':');

if (height > 0) {
this.block(function () {
for (var i = 0; i < height; i += 1) {
if (0 < i) {
this.nl();
}
this.error('//');
this.block(function () {
for (var i = 0; i < height; i += 1) {
if (0 < i) {
this.nl();
}
});
this.sp().block(pen);
}
this.error('//');
}
});
this.sp().block(pen);
});

@@ -158,13 +154,11 @@

if (height > 0) {
this.block(function () {
for (var i = 0; i < height; i += 1) {
if (0 < i) {
this.nl();
}
this.jsComment('//');
this.block(function () {
for (var i = 0; i < height; i += 1) {
if (0 < i) {
this.nl();
}
});
this.sp().block(pen);
}
this.jsComment('//');
}
});
this.sp().block(pen);
});

@@ -297,3 +291,3 @@

.jsFunctionName('block').text('(').jsKeyword('function').text(' () {');
if (lineEntry.args) {
if (lineEntry.args && lineEntry.args.length > 0 && lineEntry.args[0] && lineEntry.args[0].length > 0) {
this

@@ -300,0 +294,0 @@ .nl()

@@ -53,6 +53,3 @@ var utils = require('./utils');

identify: function (obj) {
// We're running jshint in es3 mode so it does not accept typeof x === 'symbol':
// jshint ignore:start
return typeof obj === 'symbol';
// jshint ignore:end
},

@@ -78,6 +75,4 @@ inspect: function (obj, depth, output, inspect) {

var bString = b;
// jshint ignore:start
aIsSymbol = typeof a === 'symbol';
bIsSymbol = typeof b === 'symbol';
// jshint ignore:end
if (aIsSymbol) {

@@ -113,3 +108,3 @@ if (bIsSymbol) {

var constructor = obj.constructor;
var constructorName = constructor && constructor !== Object && utils.getFunctionName(constructor);
var constructorName = constructor && typeof constructor === 'function' && constructor !== Object && utils.getFunctionName(constructor);
if (constructorName && constructorName !== 'Object') {

@@ -123,3 +118,3 @@ output.text(constructorName + '(');

var constructor = obj.constructor;
var constructorName = constructor && constructor !== Object && utils.getFunctionName(constructor);
var constructorName = constructor && typeof constructor === 'function' && constructor !== Object && utils.getFunctionName(constructor);
if (constructorName && constructorName !== 'Object') {

@@ -126,0 +121,0 @@ output.text(')');

@@ -171,8 +171,5 @@ var createStandardErrorMessage = require('./createStandardErrorMessage');

} else {
var style;
if (isRejected) {
style = 'error';
output.error('⨯ ');
} else {
style = 'success';
output.success('✓ ');

@@ -323,3 +320,3 @@ }

{ type: arg.type, minimum: 1, maximum: 1 },
{ type: that.typeByName['any'], minimum: 0, maximum: Infinity }
{ type: that.typeByName.any, minimum: 0, maximum: Infinity }
]);

@@ -472,3 +469,2 @@ result.push([

var error = new UnexpectedError(this.expect);
if (typeof arg === 'function') {

@@ -478,6 +474,5 @@ error.errorMode = 'bubble';

} else if (arg && typeof arg === 'object') {
if (arg.message !== 'undefined') {
if (typeof arg.message !== 'undefined') {
error.errorMode = 'bubble';
}
error.output = function (output) {

@@ -496,16 +491,9 @@ if (typeof arg.message !== 'undefined') {

};
var additionalProperties = {};
if (arg && typeof arg === 'object') {
Object.keys(arg).forEach(function (key) {
var value = arg[key];
if (key === 'diff') {
additionalProperties.createDiff = value;
} else if (key !== 'message') {
additionalProperties[key] = value;
}
});
}
Object.keys(additionalProperties).forEach(function (key) {
error[key] = additionalProperties[key];
Object.keys(arg).forEach(function (key) {
var value = arg[key];
if (key === 'diff') {
error.createDiff = value;
} else if (key !== 'message') {
error[key] = value;
}
});

@@ -598,3 +586,3 @@ } else {

assertionDeclarations.forEach(function (assertionDeclaration) {
ensureValidAssertionPattern(assertionDeclaration.assertion);
ensureValidUseOfParenthesesOrBrackets(assertionDeclaration.assertion);
var expandedAssertions = expandAssertion(assertionDeclaration.assertion);

@@ -1414,17 +1402,2 @@ expandedAssertions.forEach(function (expandedAssertion) {

function ensureValidAssertionPattern(pattern) {
if (typeof pattern !== 'string' || pattern === '') {
throw new Error("Assertion patterns must be a non-empty string");
}
if (/^\(?<[a-z.-]+>/.test(pattern)) {
throw new Error("Assertion patterns cannot use type signature syntax (reserved for future expansion), ^\\(?<[a-z.-]+>");
}
if (pattern.match(/^\s|\s$/)) {
throw new Error("Assertion patterns can't start or end with whitespace");
}
ensureValidUseOfParenthesesOrBrackets(pattern);
}
module.exports = Unexpected;

@@ -1,2 +0,2 @@

/* jshint proto:true */
/* eslint-disable no-proto */
var canSetPrototype = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array);

@@ -8,3 +8,3 @@

};
/* jshint proto:false */
/* eslint-enable no-proto */

@@ -132,3 +132,3 @@ var utils = module.exports = {

item.forEach(visit);
} else if (!index[item] && (!filterFn || filterFn(item))) {
} else if (!Object.prototype.hasOwnProperty.call(index, item) && (!filterFn || filterFn(item))) {
index[item] = true;

@@ -147,7 +147,3 @@ uniqueStringsAndSymbols.push(item);

return utils.uniqueStringsAndSymbols(function (stringOrSymbol) {
var isSymbol;
/*jshint ignore:start*/
isSymbol = typeof stringOrSymbol === 'symbol';
/*jshint ignore:end*/
return isSymbol || !utils.numericalRegExp.test(stringOrSymbol);
return typeof stringOrSymbol === 'symbol' || !utils.numericalRegExp.test(stringOrSymbol);
}, Array.prototype.slice.call(arguments));

@@ -154,0 +150,0 @@ },

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

@@ -18,2 +18,3 @@ "keywords": [

"test": "make test && make test-phantomjs",
"lint": "eslint .",
"generate-site": "generate-site --require ./bootstrap-unexpected-markdown.js",

@@ -29,4 +30,5 @@ "update-examples": "generate-site --require ./bootstrap-unexpected-markdown.js --update-examples",

"diff": "1.1.0",
"leven": "1.0.0",
"leven": "2.0.0",
"magicpen": "5.9.0",
"proxyquire": "1.7.4",
"unexpected-bluebird": "2.9.34"

@@ -38,8 +40,8 @@ },

"chewbacca": "1.8.1",
"coveralls": "2.11.1",
"coveralls": "^2.11.9",
"es5-shim": "4.0.5",
"eslint": "2.4.0",
"eslint-config-onelint": "1.0.2",
"istanbul": "0.3.16",
"jasmine": "2.2.1",
"jscs": "2.1.1",
"jshint": "2.9.1",
"minimist": "1.1.1",

@@ -49,2 +51,4 @@ "mocha": "2.4.5",

"mocha-slow-reporter": "*",
"nyc": "6.1.1",
"phantomjs": "2.1.3",
"phantomjs-prebuilt": "2.1.3",

@@ -60,3 +64,8 @@ "rsvp": "3.0.18",

"jspmPackage": true
},
"nyc": {
"include": [
"lib/**"
]
}
}

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

Sorry, the diff of this file is not supported yet

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