unexpected
Advanced tools
Comparing version 11.5.1 to 11.6.0
@@ -89,3 +89,3 @@ var createStandardErrorMessage = require('./createStandardErrorMessage'); | ||
function evaluateGroup(unexpected, context, subject, orGroup) { | ||
function evaluateGroup(unexpected, context, subject, orGroup, forwardedFlags) { | ||
return orGroup.map(function (expectation) { | ||
@@ -107,3 +107,3 @@ var args = Array.prototype.slice.call(expectation); | ||
} else { | ||
return unexpected._expect(context.child(), args); | ||
return unexpected._expect(context.child(), args, forwardedFlags); | ||
} | ||
@@ -182,3 +182,3 @@ }) | ||
function createExpectIt(expect, expectations) { | ||
function createExpectIt(expect, expectations, forwardedFlags) { | ||
var orGroups = getOrGroups(expectations); | ||
@@ -205,3 +205,9 @@ | ||
orGroups.forEach(function (orGroup) { | ||
var evaluations = evaluateGroup(expect, context, subject, orGroup); | ||
var evaluations = evaluateGroup( | ||
expect, | ||
context, | ||
subject, | ||
orGroup, | ||
forwardedFlags | ||
); | ||
evaluations.forEach(function (ref) { | ||
@@ -254,3 +260,3 @@ var promise = ref.promise; | ||
copiedExpectations.push(args); | ||
return createExpectIt(expect, copiedExpectations); | ||
return createExpectIt(expect, copiedExpectations, forwardedFlags); | ||
}; | ||
@@ -263,3 +269,3 @@ expectIt.or = function() { | ||
copiedExpectations.push(OR, args); | ||
return createExpectIt(expect, copiedExpectations); | ||
return createExpectIt(expect, copiedExpectations, forwardedFlags); | ||
}; | ||
@@ -280,6 +286,3 @@ return expectIt; | ||
if (this.flags && typeof args[0] === 'string') { | ||
args[0] = utils.forwardFlags(args[0], this.flags); | ||
} | ||
return createExpectIt(this._topLevelExpect, [args]); | ||
return createExpectIt(this._topLevelExpect, [args], this.flags); | ||
}; | ||
@@ -1401,5 +1404,6 @@ | ||
testDescriptionString, | ||
context | ||
context, | ||
forwardedFlags | ||
) { | ||
var flags = extend({}, assertionRule.flags); | ||
var flags = extend({}, forwardedFlags, assertionRule.flags); | ||
var parentExpect = this; | ||
@@ -1437,3 +1441,4 @@ | ||
testDescriptionString, | ||
args | ||
args, | ||
wrappedExpect.flags | ||
); } | ||
@@ -1464,3 +1469,3 @@ ); | ||
) { | ||
return new AssertionString(arg); | ||
return new AssertionString(utils.forwardFlags(arg, flags)); | ||
} | ||
@@ -1480,4 +1485,11 @@ | ||
testDescriptionString, | ||
args | ||
args, | ||
forwardedFlags | ||
) { | ||
if (forwardedFlags) { | ||
testDescriptionString = utils.forwardFlags( | ||
testDescriptionString, | ||
forwardedFlags | ||
); | ||
} | ||
var assertionRule = this.lookupAssertionRule( | ||
@@ -1536,3 +1548,4 @@ subject, | ||
testDescriptionString, | ||
context | ||
context, | ||
forwardedFlags | ||
); | ||
@@ -1543,3 +1556,3 @@ | ||
expectPrototype._expect = function expect(context, args) { | ||
expectPrototype._expect = function expect(context, args, forwardedFlags) { | ||
var this$1 = this; | ||
@@ -1566,3 +1579,4 @@ | ||
testDescriptionString, | ||
Array.prototype.slice.call(args, 2) | ||
Array.prototype.slice.call(args, 2), | ||
forwardedFlags | ||
); | ||
@@ -1569,0 +1583,0 @@ if (utils.isPromise(result)) { |
@@ -87,3 +87,3 @@ const createStandardErrorMessage = require('./createStandardErrorMessage'); | ||
function evaluateGroup(unexpected, context, subject, orGroup) { | ||
function evaluateGroup(unexpected, context, subject, orGroup, forwardedFlags) { | ||
return orGroup.map(expectation => { | ||
@@ -105,3 +105,3 @@ const args = Array.prototype.slice.call(expectation); | ||
} else { | ||
return unexpected._expect(context.child(), args); | ||
return unexpected._expect(context.child(), args, forwardedFlags); | ||
} | ||
@@ -176,3 +176,3 @@ }) | ||
function createExpectIt(expect, expectations) { | ||
function createExpectIt(expect, expectations, forwardedFlags) { | ||
const orGroups = getOrGroups(expectations); | ||
@@ -199,3 +199,9 @@ | ||
orGroups.forEach(orGroup => { | ||
const evaluations = evaluateGroup(expect, context, subject, orGroup); | ||
const evaluations = evaluateGroup( | ||
expect, | ||
context, | ||
subject, | ||
orGroup, | ||
forwardedFlags | ||
); | ||
evaluations.forEach(({ promise }) => { | ||
@@ -238,3 +244,3 @@ promises.push(promise); | ||
copiedExpectations.push(args); | ||
return createExpectIt(expect, copiedExpectations); | ||
return createExpectIt(expect, copiedExpectations, forwardedFlags); | ||
}; | ||
@@ -244,3 +250,3 @@ expectIt.or = function(...args) { | ||
copiedExpectations.push(OR, args); | ||
return createExpectIt(expect, copiedExpectations); | ||
return createExpectIt(expect, copiedExpectations, forwardedFlags); | ||
}; | ||
@@ -258,6 +264,3 @@ return expectIt; | ||
expectPrototype.it = function(...args) { | ||
if (this.flags && typeof args[0] === 'string') { | ||
args[0] = utils.forwardFlags(args[0], this.flags); | ||
} | ||
return createExpectIt(this._topLevelExpect, [args]); | ||
return createExpectIt(this._topLevelExpect, [args], this.flags); | ||
}; | ||
@@ -1320,5 +1323,6 @@ | ||
testDescriptionString, | ||
context | ||
context, | ||
forwardedFlags | ||
) { | ||
const flags = extend({}, assertionRule.flags); | ||
const flags = extend({}, forwardedFlags, assertionRule.flags); | ||
const parentExpect = this; | ||
@@ -1355,3 +1359,4 @@ | ||
testDescriptionString, | ||
args | ||
args, | ||
wrappedExpect.flags | ||
) | ||
@@ -1382,3 +1387,3 @@ ); | ||
) { | ||
return new AssertionString(arg); | ||
return new AssertionString(utils.forwardFlags(arg, flags)); | ||
} | ||
@@ -1398,4 +1403,11 @@ | ||
testDescriptionString, | ||
args | ||
args, | ||
forwardedFlags | ||
) { | ||
if (forwardedFlags) { | ||
testDescriptionString = utils.forwardFlags( | ||
testDescriptionString, | ||
forwardedFlags | ||
); | ||
} | ||
let assertionRule = this.lookupAssertionRule( | ||
@@ -1454,3 +1466,4 @@ subject, | ||
testDescriptionString, | ||
context | ||
context, | ||
forwardedFlags | ||
); | ||
@@ -1461,3 +1474,3 @@ | ||
expectPrototype._expect = function expect(context, args) { | ||
expectPrototype._expect = function expect(context, args, forwardedFlags) { | ||
const subject = args[0]; | ||
@@ -1482,3 +1495,4 @@ const testDescriptionString = args[1]; | ||
testDescriptionString, | ||
Array.prototype.slice.call(args, 2) | ||
Array.prototype.slice.call(args, 2), | ||
forwardedFlags | ||
); | ||
@@ -1485,0 +1499,0 @@ if (utils.isPromise(result)) { |
{ | ||
"name": "unexpected", | ||
"version": "11.5.1", | ||
"version": "11.6.0", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -65,3 +65,3 @@ "keywords": [ | ||
"rollup": "^1.0.1", | ||
"rollup-plugin-commonjs": "^9.1.0", | ||
"rollup-plugin-commonjs": "^10.0.0", | ||
"rollup-plugin-node-globals": "^1.1.0", | ||
@@ -72,2 +72,3 @@ "rollup-plugin-node-resolve": "^4.0.0", | ||
"serve": "*", | ||
"uglify-js": "3.5.12", | ||
"unexpected-documentation-site-generator": "^6.0.0", | ||
@@ -74,0 +75,0 @@ "unexpected-magicpen": "^1.0.0", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1890735
15731
40