Skip to content

Commit

Permalink
Fix previous added test by relaxing promise check.
Browse files Browse the repository at this point in the history
The previous incantation check specifically for a .caught() method
on promises, but this is something specific to bluebird. While the
standard method is .catch(), we now rely on await to unpack any
exceptions so this check should be sufficient.
  • Loading branch information
alexjeffburke committed Jan 2, 2020
1 parent 2c69813 commit 3c759d7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/evaluateSnippets.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ try {
}

function isPromise(value) {
return (
value &&
typeof value.then === 'function' &&
typeof value.caught === 'function'
);
return value && typeof value.then === 'function';
}

function getErrorMessage(expect, format, error) {
Expand Down Expand Up @@ -110,6 +106,7 @@ module.exports = async function(snippets, options) {
? snippet.code
: `(function () {${transpile(snippet.code)}})();`
);

if (!isPromise(promise)) {
throw new Error(
`Async code block did not return a promise or throw\n${snippet.code}`
Expand Down

0 comments on commit 3c759d7

Please sign in to comment.