diff --git a/index.js b/index.js index 30cc1f0..8f842b6 100644 --- a/index.js +++ b/index.js @@ -245,11 +245,14 @@ if(Util.getPromiseDetails){ return Util.getPromiseDetails(promise)[0] } } else{ + const RejectedPromise = new RegExp("\\{[\\s\n\r]+") + const PendingPromise = new RegExp("\\{[\\s\n\r]+") + _promiseState = function(promise){ const p = util.inspect(promise) - if(p.includes('{ ')){ + if(RejectedPromise.test(p)){ return 2 - } else if(p.includes('{ ')){ + } else if(PendingPromise.test(p)){ return 0 } else{ return 1