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

unexpected

Package Overview
Dependencies
Maintainers
6
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 12.0.0 to 12.0.1

2

build/lib/createTopLevelExpect.js

@@ -1714,6 +1714,6 @@ var createStandardErrorMessage = require('./createStandardErrorMessage');

expectPrototype.outputFormat = function (format) {
this._assertTopLevelExpect();
if (typeof format === 'undefined') {
return this._outputFormat;
} else {
this._assertTopLevelExpect();
this._outputFormat = format;

@@ -1720,0 +1720,0 @@ return this;

@@ -123,42 +123,41 @@ var utils = require('./utils');

expect.addStyle('propertyForObject', function (
key,
inspectedValue,
isArrayLike
) {
var keyOmitted = false;
var isSymbol = typeof key === 'symbol';
if (isSymbol) {
this.text('[').appendInspected(key).text(']').text(':');
} else {
key = String(key);
if (/^[a-z$_][a-z0-9$_]*$/i.test(key)) {
this.text(key, 'jsKey').text(':');
} else if (/^(?:0|[1-9][0-9]*)$/.test(key)) {
if (isArrayLike) {
keyOmitted = true;
expect.addStyle(
'propertyForObject',
function (key, inspectedValue, isArrayLike) {
var keyOmitted = false;
var isSymbol = typeof key === 'symbol';
if (isSymbol) {
this.text('[').appendInspected(key).text(']').text(':');
} else {
key = String(key);
if (/^[a-z$_][a-z0-9$_]*$/i.test(key)) {
this.text(key, 'jsKey').text(':');
} else if (/^(?:0|[1-9][0-9]*)$/.test(key)) {
if (isArrayLike) {
keyOmitted = true;
} else {
this.jsNumber(key).text(':');
}
} else {
this.jsNumber(key).text(':');
this.singleQuotedString(key).text(':');
}
} else {
this.singleQuotedString(key).text(':');
}
}
if (!inspectedValue.isEmpty()) {
if (!keyOmitted) {
if (
key.length > 5 &&
inspectedValue.isBlock() &&
inspectedValue.isMultiline()
) {
this.indentLines();
this.nl().i();
} else {
this.sp();
if (!inspectedValue.isEmpty()) {
if (!keyOmitted) {
if (
key.length > 5 &&
inspectedValue.isBlock() &&
inspectedValue.isMultiline()
) {
this.indentLines();
this.nl().i();
} else {
this.sp();
}
}
this.append(inspectedValue);
}
this.append(inspectedValue);
}
});
);

@@ -313,60 +312,57 @@ // Intended to be redefined by a plugin that offers syntax highlighting:

expect.addStyle('stringDiffFragment', function (
ch,
text,
baseStyle,
markUpSpecialCharacters,
isAtEol
) {
var lines = text.split(/\n/);
lines.forEach(function (line, i) {
if (this.isAtStartOfLine()) {
this.alt({
text: ch,
fallback: function fallback() {
if (
line === '' &&
ch !== ' ' &&
(i === 0 || i !== lines.length - 1)
) {
expect.addStyle(
'stringDiffFragment',
function (ch, text, baseStyle, markUpSpecialCharacters, isAtEol) {
var lines = text.split(/\n/);
lines.forEach(function (line, i) {
if (this.isAtStartOfLine()) {
this.alt({
text: ch,
fallback: function fallback() {
if (
line === '' &&
ch !== ' ' &&
(i === 0 || i !== lines.length - 1)
) {
this[
ch === '+' ? 'diffAddedSpecialChar' : 'diffRemovedSpecialChar'
]('\\n');
}
},
});
}
var matchTrailingSpace =
(isAtEol || i < lines.length - 1) && line.match(/^(.*[^ ])?( +)$/);
if (matchTrailingSpace) {
line = matchTrailingSpace[1] || '';
}
if (markUpSpecialCharacters) {
line.split(specialCharRegExp).forEach(function (part) {
if (specialCharRegExp.test(part)) {
this[
ch === '+' ? 'diffAddedSpecialChar' : 'diffRemovedSpecialChar'
]('\\n');
{ '+': 'diffAddedSpecialChar', '-': 'diffRemovedSpecialChar' }[
ch
] || baseStyle
](utils.escapeChar(part));
} else {
this[baseStyle](part);
}
},
});
}
var matchTrailingSpace =
(isAtEol || i < lines.length - 1) && line.match(/^(.*[^ ])?( +)$/);
if (matchTrailingSpace) {
line = matchTrailingSpace[1] || '';
}
}, this);
} else {
this[baseStyle](line);
}
if (matchTrailingSpace) {
this[
{ '+': 'diffAddedHighlight', '-': 'diffRemovedHighlight' }[ch] ||
baseStyle
](matchTrailingSpace[2]);
}
if (i !== lines.length - 1) {
this.nl();
}
}, this);
}
);
if (markUpSpecialCharacters) {
line.split(specialCharRegExp).forEach(function (part) {
if (specialCharRegExp.test(part)) {
this[
{ '+': 'diffAddedSpecialChar', '-': 'diffRemovedSpecialChar' }[
ch
] || baseStyle
](utils.escapeChar(part));
} else {
this[baseStyle](part);
}
}, this);
} else {
this[baseStyle](line);
}
if (matchTrailingSpace) {
this[
{ '+': 'diffAddedHighlight', '-': 'diffRemovedHighlight' }[ch] ||
baseStyle
](matchTrailingSpace[2]);
}
if (i !== lines.length - 1) {
this.nl();
}
}, this);
});
expect.addStyle('stringDiff', function (actual, expected, options) {

@@ -620,56 +616,56 @@ if ( options === void 0 ) options = {};

expect.addStyle('arrowsAlongsideChangeOutputs', function (
packing,
changeOutputs
) {
if (packing) {
var topByChangeNumber = {};
var top = 0;
changeOutputs.forEach(function (changeOutput, index) {
topByChangeNumber[index] = top;
top += changeOutput.size().height;
});
var that = this;
expect.addStyle(
'arrowsAlongsideChangeOutputs',
function (packing, changeOutputs) {
if (packing) {
var topByChangeNumber = {};
var top = 0;
changeOutputs.forEach(function (changeOutput, index) {
topByChangeNumber[index] = top;
top += changeOutput.size().height;
});
var that = this;
var arrows = [];
packing.forEach(function (columnSet, i, ref) {
var length = ref.length;
var arrows = [];
packing.forEach(function (columnSet, i, ref) {
var length = ref.length;
columnSet.forEach(function (ref) {
var start = ref.start;
var end = ref.end;
var direction = ref.direction;
columnSet.forEach(function (ref) {
var start = ref.start;
var end = ref.end;
var direction = ref.direction;
arrows.push(
that.clone().arrow({
left: i * 2,
top: topByChangeNumber[start],
width: 1 + (length - i) * 2,
height: topByChangeNumber[end] - topByChangeNumber[start] + 1,
direction: direction,
})
);
arrows.push(
that.clone().arrow({
left: i * 2,
top: topByChangeNumber[start],
width: 1 + (length - i) * 2,
height: topByChangeNumber[end] - topByChangeNumber[start] + 1,
direction: direction,
})
);
});
});
});
if (arrows.length === 1) {
this.block(arrows[0]);
} else if (arrows.length > 1) {
this.block(function () {
this.merge(arrows);
});
if (arrows.length === 1) {
this.block(arrows[0]);
} else if (arrows.length > 1) {
this.block(function () {
this.merge(arrows);
});
}
} else {
this.i();
}
} else {
this.i();
this.block(function () {
changeOutputs.forEach(function (changeOutput, index) {
this.nl(index > 0 ? 1 : 0);
if (!changeOutput.isEmpty()) {
this.sp(packing ? 1 : 0).append(changeOutput);
}
}, this);
});
}
this.block(function () {
changeOutputs.forEach(function (changeOutput, index) {
this.nl(index > 0 ? 1 : 0);
if (!changeOutput.isEmpty()) {
this.sp(packing ? 1 : 0).append(changeOutput);
}
}, this);
});
});
);
};

@@ -776,3 +776,4 @@ var utils = require('./utils');

'__stackCleaned__',
'isOperational' ].reduce(function (result, prop) {
'isOperational', // added by the promise implementation,
'__callSiteEvals' ].reduce(function (result, prop) {
result[prop] = true;

@@ -779,0 +780,0 @@ return result;

@@ -1630,6 +1630,6 @@ const createStandardErrorMessage = require('./createStandardErrorMessage');

expectPrototype.outputFormat = function (format) {
this._assertTopLevelExpect();
if (typeof format === 'undefined') {
return this._outputFormat;
} else {
this._assertTopLevelExpect();
this._outputFormat = format;

@@ -1636,0 +1636,0 @@ return this;

@@ -125,42 +125,41 @@ const utils = require('./utils');

expect.addStyle('propertyForObject', function (
key,
inspectedValue,
isArrayLike
) {
let keyOmitted = false;
const isSymbol = typeof key === 'symbol';
if (isSymbol) {
this.text('[').appendInspected(key).text(']').text(':');
} else {
key = String(key);
if (/^[a-z$_][a-z0-9$_]*$/i.test(key)) {
this.text(key, 'jsKey').text(':');
} else if (/^(?:0|[1-9][0-9]*)$/.test(key)) {
if (isArrayLike) {
keyOmitted = true;
expect.addStyle(
'propertyForObject',
function (key, inspectedValue, isArrayLike) {
let keyOmitted = false;
const isSymbol = typeof key === 'symbol';
if (isSymbol) {
this.text('[').appendInspected(key).text(']').text(':');
} else {
key = String(key);
if (/^[a-z$_][a-z0-9$_]*$/i.test(key)) {
this.text(key, 'jsKey').text(':');
} else if (/^(?:0|[1-9][0-9]*)$/.test(key)) {
if (isArrayLike) {
keyOmitted = true;
} else {
this.jsNumber(key).text(':');
}
} else {
this.jsNumber(key).text(':');
this.singleQuotedString(key).text(':');
}
} else {
this.singleQuotedString(key).text(':');
}
}
if (!inspectedValue.isEmpty()) {
if (!keyOmitted) {
if (
key.length > 5 &&
inspectedValue.isBlock() &&
inspectedValue.isMultiline()
) {
this.indentLines();
this.nl().i();
} else {
this.sp();
if (!inspectedValue.isEmpty()) {
if (!keyOmitted) {
if (
key.length > 5 &&
inspectedValue.isBlock() &&
inspectedValue.isMultiline()
) {
this.indentLines();
this.nl().i();
} else {
this.sp();
}
}
this.append(inspectedValue);
}
this.append(inspectedValue);
}
});
);

@@ -304,60 +303,57 @@ // Intended to be redefined by a plugin that offers syntax highlighting:

expect.addStyle('stringDiffFragment', function (
ch,
text,
baseStyle,
markUpSpecialCharacters,
isAtEol
) {
const lines = text.split(/\n/);
lines.forEach(function (line, i) {
if (this.isAtStartOfLine()) {
this.alt({
text: ch,
fallback() {
if (
line === '' &&
ch !== ' ' &&
(i === 0 || i !== lines.length - 1)
) {
expect.addStyle(
'stringDiffFragment',
function (ch, text, baseStyle, markUpSpecialCharacters, isAtEol) {
const lines = text.split(/\n/);
lines.forEach(function (line, i) {
if (this.isAtStartOfLine()) {
this.alt({
text: ch,
fallback() {
if (
line === '' &&
ch !== ' ' &&
(i === 0 || i !== lines.length - 1)
) {
this[
ch === '+' ? 'diffAddedSpecialChar' : 'diffRemovedSpecialChar'
]('\\n');
}
},
});
}
const matchTrailingSpace =
(isAtEol || i < lines.length - 1) && line.match(/^(.*[^ ])?( +)$/);
if (matchTrailingSpace) {
line = matchTrailingSpace[1] || '';
}
if (markUpSpecialCharacters) {
line.split(specialCharRegExp).forEach(function (part) {
if (specialCharRegExp.test(part)) {
this[
ch === '+' ? 'diffAddedSpecialChar' : 'diffRemovedSpecialChar'
]('\\n');
{ '+': 'diffAddedSpecialChar', '-': 'diffRemovedSpecialChar' }[
ch
] || baseStyle
](utils.escapeChar(part));
} else {
this[baseStyle](part);
}
},
});
}
const matchTrailingSpace =
(isAtEol || i < lines.length - 1) && line.match(/^(.*[^ ])?( +)$/);
if (matchTrailingSpace) {
line = matchTrailingSpace[1] || '';
}
}, this);
} else {
this[baseStyle](line);
}
if (matchTrailingSpace) {
this[
{ '+': 'diffAddedHighlight', '-': 'diffRemovedHighlight' }[ch] ||
baseStyle
](matchTrailingSpace[2]);
}
if (i !== lines.length - 1) {
this.nl();
}
}, this);
}
);
if (markUpSpecialCharacters) {
line.split(specialCharRegExp).forEach(function (part) {
if (specialCharRegExp.test(part)) {
this[
{ '+': 'diffAddedSpecialChar', '-': 'diffRemovedSpecialChar' }[
ch
] || baseStyle
](utils.escapeChar(part));
} else {
this[baseStyle](part);
}
}, this);
} else {
this[baseStyle](line);
}
if (matchTrailingSpace) {
this[
{ '+': 'diffAddedHighlight', '-': 'diffRemovedHighlight' }[ch] ||
baseStyle
](matchTrailingSpace[2]);
}
if (i !== lines.length - 1) {
this.nl();
}
}, this);
});
expect.addStyle('stringDiff', function (actual, expected, options = {}) {

@@ -595,50 +591,50 @@ const type = options.type || 'WordsWithSpace';

expect.addStyle('arrowsAlongsideChangeOutputs', function (
packing,
changeOutputs
) {
if (packing) {
const topByChangeNumber = {};
let top = 0;
changeOutputs.forEach((changeOutput, index) => {
topByChangeNumber[index] = top;
top += changeOutput.size().height;
});
const that = this;
expect.addStyle(
'arrowsAlongsideChangeOutputs',
function (packing, changeOutputs) {
if (packing) {
const topByChangeNumber = {};
let top = 0;
changeOutputs.forEach((changeOutput, index) => {
topByChangeNumber[index] = top;
top += changeOutput.size().height;
});
const that = this;
const arrows = [];
packing.forEach((columnSet, i, { length }) => {
columnSet.forEach(({ start, end, direction }) => {
arrows.push(
that.clone().arrow({
left: i * 2,
top: topByChangeNumber[start],
width: 1 + (length - i) * 2,
height: topByChangeNumber[end] - topByChangeNumber[start] + 1,
direction,
})
);
const arrows = [];
packing.forEach((columnSet, i, { length }) => {
columnSet.forEach(({ start, end, direction }) => {
arrows.push(
that.clone().arrow({
left: i * 2,
top: topByChangeNumber[start],
width: 1 + (length - i) * 2,
height: topByChangeNumber[end] - topByChangeNumber[start] + 1,
direction,
})
);
});
});
});
if (arrows.length === 1) {
this.block(arrows[0]);
} else if (arrows.length > 1) {
this.block(function () {
this.merge(arrows);
});
if (arrows.length === 1) {
this.block(arrows[0]);
} else if (arrows.length > 1) {
this.block(function () {
this.merge(arrows);
});
}
} else {
this.i();
}
} else {
this.i();
this.block(function () {
changeOutputs.forEach(function (changeOutput, index) {
this.nl(index > 0 ? 1 : 0);
if (!changeOutput.isEmpty()) {
this.sp(packing ? 1 : 0).append(changeOutput);
}
}, this);
});
}
this.block(function () {
changeOutputs.forEach(function (changeOutput, index) {
this.nl(index > 0 ? 1 : 0);
if (!changeOutput.isEmpty()) {
this.sp(packing ? 1 : 0).append(changeOutput);
}
}, this);
});
});
);
};

@@ -769,3 +769,4 @@ const utils = require('./utils');

'__stackCleaned__',
'isOperational', // added by the promise implementation
'isOperational', // added by the promise implementation,
'__callSiteEvals', // attached by deno
].reduce((result, prop) => {

@@ -772,0 +773,0 @@ result[prop] = true;

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

@@ -31,3 +31,3 @@ "keywords": [

"greedy-interval-packer": "1.2.0",
"magicpen": "^6.2.1",
"magicpen": "^6.2.2",
"ukkonen": "^1.4.0",

@@ -38,5 +38,4 @@ "unexpected-bluebird": "2.9.34-longstack2"

"buble": "^0.20.0",
"coveralls": "^3.0.0",
"eslint": "^7.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-config-prettier": "^8.2.0",
"eslint-config-standard": "^16.0.2",

@@ -47,14 +46,13 @@ "eslint-plugin-import": "^2.14.0",

"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-promise": "^5.1.0",
"evaldown": "^1.3.0",
"find-node-modules": "^2.0.0",
"fugl": "^1.0.0",
"fugl": "^2.0.0",
"gh-pages": "^3.0.0",
"hyperlink": "^4.3.2",
"istanbul": "^0.4.5",
"jasmine": "~3.6.1",
"jasmine": "~3.7.0",
"jasmine-core": "^3.1.0",
"jest": "^26.6.3",
"karma": "5.2.3",
"karma": "6.3.2",
"karma-browserstack-launcher": "1.6.0",

@@ -68,4 +66,4 @@ "karma-chrome-launcher": "3.1.0",

"nyc": "^15.0.0",
"offline-github-changelog": "^2.0.0",
"prettier": "~2.1.0",
"offline-github-changelog": "^1.6.1",
"prettier": "~2.2.0",
"rollup": "^2.0.3",

@@ -81,3 +79,3 @@ "rollup-plugin-commonjs": "^10.0.0",

"unexpected-documentation-site-generator": "^7.0.1",
"unexpected-magicpen": "^2.1.0"
"unexpected-magicpen": "^3.0.0"
},

@@ -84,0 +82,0 @@ "files": [

@@ -8,3 +8,2 @@ # Unexpected

[![Coverage Status](https://coveralls.io/repos/unexpectedjs/unexpected/badge.svg)](https://coveralls.io/r/unexpectedjs/unexpected)
[![Dependency Status](https://david-dm.org/unexpectedjs/unexpected.svg)](https://david-dm.org/unexpectedjs/unexpected)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/unexpectedjs/unexpected?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

@@ -11,0 +10,0 @@ [![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=cjVWSDFIaERKWVdxc2s5bStaY08vMUFwbW1NbTdzZHJmVXBCUjBlemo3Yz0tLU5iL3I0L3Z4elVhZjBTbWtvbmpHRnc9PQ==--692805fea09bec4c4ea7c898fa9208a0fa61283e)](https://www.browserstack.com/automate/public-build/cjVWSDFIaERKWVdxc2s5bStaY08vMUFwbW1NbTdzZHJmVXBCUjBlemo3Yz0tLU5iL3I0L3Z4elVhZjBTbWtvbmpHRnc9PQ==--692805fea09bec4c4ea7c898fa9208a0fa61283e)

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

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

Sorry, the diff of this file is not supported yet

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