File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,14 @@ function registerAfterEachHook() {
23
23
afterEach ( function ( ) {
24
24
var error ;
25
25
var testPassed = true ;
26
- if ( pendingPromisesForTheCurrentTest . some ( function ( promise ) { return promise . isPending ( ) ; } ) ) {
26
+ var pendingPromise = null ;
27
+ pendingPromisesForTheCurrentTest . some ( function ( promise ) {
28
+ if ( promise . isPending ( ) ) {
29
+ pendingPromise = promise ;
30
+ return true ;
31
+ }
32
+ } ) ;
33
+ if ( pendingPromise ) {
27
34
var displayName ;
28
35
if ( this . currentTest ) {
29
36
// mocha
@@ -34,6 +41,9 @@ function registerAfterEachHook() {
34
41
displayName = currentSpec . fullName ;
35
42
}
36
43
error = new Error ( displayName + ': You have created a promise that was not returned from the it block' ) ;
44
+ if ( pendingPromise . trace && pendingPromise . trace . stack ) {
45
+ error . message += '\n\n' + pendingPromise . trace . stack ;
46
+ }
37
47
}
38
48
pendingPromisesForTheCurrentTest = [ ] ;
39
49
if ( error && testPassed ) {
You can’t perform that action at this time.
0 commit comments