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.13.3 to 10.14.0

2

lib/makePromise.js

@@ -8,3 +8,3 @@ var Promise = require('unexpected-bluebird');

throw new TypeError('expect.promise(...) requires a function argument to be supplied.\n' +
'See http://unexpectedjs.github.io/api/promise/ for more details.');
'See http://unexpected.js.org/api/promise/ for more details.');
}

@@ -11,0 +11,0 @@

@@ -19,2 +19,6 @@ /*global afterEach, jasmine*/

function isPendingOrHasUnhandledRejection(promise) {
return promise.isPending() || (promise.isRejected() && promise.reason().uncaught);
}
function registerAfterEachHook() {

@@ -27,3 +31,3 @@ if (typeof afterEach === 'function' && !afterEachRegistered) {

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

@@ -30,0 +34,0 @@ if (this.currentTest) {

@@ -248,101 +248,2 @@ var utils = require('./utils');

expect.addStyle('magicPenLine', function (line, pen) {
line.forEach(function (lineEntry, j) {
if (j > 0) {
this.nl();
}
if (lineEntry.style === 'text') {
var styles = lineEntry.args.styles;
if (pen && styles.length === 1 && typeof pen[styles[0]] === 'function') {
// Text with a single style also available as a method on the pen being inspected:
this
.text('.')
.jsFunctionName(styles[0])
.text('(')
.singleQuotedString(lineEntry.args.content)
.text(')');
} else {
this
.text('.')
.jsFunctionName('text')
.text('(')
.singleQuotedString(lineEntry.args.content);
if (styles.length > 0) {
this
.text(', ')
.appendInspected(styles.length === 1 && Array.isArray(styles[0]) ? styles[0] : styles);
}
this.text(')');
}
} else if (lineEntry.style === 'raw') {
this
.text('.')
.jsFunctionName('raw')
.text('(')
.appendInspected(lineEntry.args.content())
.text(')');
} else {
// lineEntry.style === 'block'
this
.text('.')
.jsFunctionName('block').text('(').jsKeyword('function').text(' () {');
if (lineEntry.args && lineEntry.args.length > 0 && lineEntry.args[0] && lineEntry.args[0].length > 0) {
this
.nl()
.indentLines()
.i()
.magicPen(pen, lineEntry.args)
.outdentLines()
.nl();
}
this.text('})');
}
}, this);
});
expect.addStyle('magicPen', function (pen, lines) {
var isTopLevel = !lines;
lines = lines || pen.output;
this.block(function () {
if (isTopLevel) {
this.jsFunctionName('magicpen').text('(');
if (pen.format) {
this.singleQuotedString(pen.format);
}
this.text(')');
} else {
this.jsKeyword('this');
}
if (!pen.isEmpty()) {
var inspectOnMultipleLines = lines.length > 1 || lines[0].length > 1;
if (inspectOnMultipleLines) {
this
.nl()
.indentLines()
.i();
}
this.block(function () {
lines.forEach(function (line, i) {
if (i > 0) {
this.text('.').jsFunctionName('nl').text('()').nl();
}
this.magicPenLine(line, pen);
}, this);
if (!isTopLevel) {
this.text(';');
}
});
if (inspectOnMultipleLines) {
this.outdentLines();
}
}
});
// If we're at the top level of a non-empty pen compatible with the current output,
// render the output of the pen in a comment:
if (isTopLevel && !pen.isEmpty() && (pen.format === this.format || !pen.format)) {
this.sp().commentBlock(pen);
}
});
expect.addStyle('stringDiffFragment', function (ch, text, baseStyle, markUpSpecialCharacters) {

@@ -349,0 +250,0 @@ text.split(/\n/).forEach(function (line, i, lines) {

@@ -399,26 +399,2 @@ var utils = require('./utils');

expect.addType({
name: 'magicpen',
identify: function (obj) {
return obj && obj.isMagicPen;
},
inspect: function (pen, depth, output) {
output.magicPen(pen);
},
equal: function (a, b) {
if (a.format !== b.format) {
return false;
}
if (a.format) {
// Both have the same format
return a.toString() === b.toString();
} else {
// Neither have a format, test all serializations
return a.toString() === b.toString() &&
a.toString('ansi') === b.toString('ansi') &&
a.toString('html') === b.toString('html');
}
}
});
expect.addType({
name: 'array-like',

@@ -425,0 +401,0 @@ base: 'object',

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

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

"unexpected-documentation-site-generator": "^4.0.0",
"unexpected-magicpen": "0.2.1",
"unexpected-markdown": "^1.4.0"

@@ -54,0 +55,0 @@ },

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