chai-as-promised
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -24,2 +24,8 @@ (function (chaiAsPromised) { | ||
// Chai as Promised needs a way to detect that chaining-time is over and it should return a promise resolved with | ||
// `undefined`, instead of with a chainable assertion. All function asserts make this assumption, but most | ||
// properties exist only for chaining purposes, so we keep a list of the ones that signal "done"ness here. TODO: | ||
// make this less of a hack. | ||
var capstoneProperties = ["arguments", "empty", "exist", "false", "ok", "true"]; | ||
function property(name, asserter) { | ||
@@ -214,3 +220,4 @@ Object.defineProperty(Assertion.prototype, name, { | ||
return promiseToDoAsserter(function (assertion) { | ||
return assertion[asserterName].apply(assertion, args); | ||
// Don't pass through the result: this is the end of the chain | ||
assertion[asserterName].apply(assertion, args); | ||
}); | ||
@@ -221,3 +228,8 @@ }; | ||
return promiseToDoAsserter(function (assertion) { | ||
return assertion[asserterName]; | ||
var result = assertion[asserterName]; | ||
// Only pass through the result if we want to continue chaining. | ||
if (capstoneProperties.indexOf(asserterName) === -1) { | ||
return result; | ||
} | ||
}); | ||
@@ -224,0 +236,0 @@ }; |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"author": "Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)", | ||
@@ -12,0 +12,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
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
27952
222