diff --git a/lib/evaluateSnippets.js b/lib/evaluateSnippets.js index 6576ffa..8ee3863 100644 --- a/lib/evaluateSnippets.js +++ b/lib/evaluateSnippets.js @@ -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) { @@ -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}`