unexpected
Advanced tools
Comparing version 5.0.0-beta21 to 5.0.0-beta22
@@ -306,3 +306,3 @@ var utils = require('./utils'); | ||
try { | ||
expect(expect.equal(value, subject), '[not] to be true'); | ||
expect(expect.equal(value, subject), '[not] to be truthy'); | ||
} catch (e) { | ||
@@ -309,0 +309,0 @@ if (e._isUnexpected) { |
@@ -380,2 +380,3 @@ /*global window*/ | ||
function errorWithMessage(e, message) { | ||
delete e._hasSerializedErrorMessage; | ||
var newError = cloneError(e); | ||
@@ -407,3 +408,3 @@ newError.output = message; | ||
case 'bubble': | ||
return errorWithMessage(e, e.output); | ||
return e; | ||
case 'diff': | ||
@@ -451,16 +452,19 @@ return errorWithMessage(e, e.output.clone().append(function (output) { | ||
Unexpected.prototype.setErrorMessage = function (err) { | ||
var outputFormat = this.outputFormat(); | ||
var message = err.output.clone().append(err.output); | ||
if (!err._hasSerializedErrorMessage) { | ||
var outputFormat = this.outputFormat(); | ||
var message = err.output.clone().append(err.output); | ||
var comparison = buildDiff(this.expect, err); | ||
if (comparison) { | ||
message.nl(2).append(comparison.diff); | ||
} | ||
var comparison = buildDiff(this.expect, err); | ||
if (comparison) { | ||
message.nl(2).append(comparison.diff); | ||
} | ||
if (outputFormat === 'html') { | ||
outputFormat = typeof window !== 'undefined' && window.mochaPhantomJS ? 'ansi' : 'text'; | ||
err.htmlMessage = message.toString('html'); | ||
if (outputFormat === 'html') { | ||
outputFormat = typeof window !== 'undefined' && window.mochaPhantomJS ? 'ansi' : 'text'; | ||
err.htmlMessage = message.toString('html'); | ||
} | ||
err.output = message; | ||
err.message = '\n' + message.toString(outputFormat); | ||
err._hasSerializedErrorMessage = true; | ||
} | ||
err.output = message; | ||
err.message = '\n' + message.toString(outputFormat); | ||
}; | ||
@@ -487,17 +491,11 @@ | ||
var nestingLevel = 0; | ||
var callInNestedContext = function (callback) { | ||
nestingLevel += 1; | ||
try { | ||
callback(); | ||
nestingLevel -= 1; | ||
} catch (e) { | ||
nestingLevel -= 1; | ||
if (e._isUnexpected) { | ||
truncateStack(e, wrappedExpect); | ||
if (nestingLevel === 0) { | ||
var wrappedError = handleNestedExpects(wrappedExpect, e, assertion); | ||
that.setErrorMessage(wrappedError); | ||
throw wrappedError; | ||
} | ||
var wrappedError = handleNestedExpects(wrappedExpect, e, assertion); | ||
that.setErrorMessage(wrappedError); | ||
throw wrappedError; | ||
} | ||
@@ -504,0 +502,0 @@ throw e; |
{ | ||
"name": "unexpected", | ||
"version": "5.0.0-beta21", | ||
"version": "5.0.0-beta22", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
1228974
35
11022
6