File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ function asyncDone(fn, cb) {
29
29
}
30
30
31
31
function onError ( error ) {
32
+ if ( ! error ) {
33
+ error = new Error ( 'Promise rejected without Error' ) ;
34
+ }
32
35
return done ( error ) ;
33
36
}
34
37
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ function failure() {
14
14
return when . reject ( new Error ( 'Promise Error' ) ) ;
15
15
}
16
16
17
+ function rejectNoError ( ) {
18
+ return when . reject ( ) ;
19
+ }
20
+
17
21
describe ( 'promises' , function ( ) {
18
22
19
23
it ( 'should handle a resolved promise' , function ( done ) {
@@ -29,4 +33,12 @@ describe('promises', function() {
29
33
done ( ) ;
30
34
} ) ;
31
35
} ) ;
36
+
37
+ it ( 'properly errors when rejected without an error' , function ( done ) {
38
+ asyncDone ( rejectNoError , function ( err ) {
39
+ expect ( err ) . toExist ( ) ;
40
+ expect ( err ) . toBeAn ( Error ) ;
41
+ done ( ) ;
42
+ } ) ;
43
+ } ) ;
32
44
} ) ;
You can’t perform that action at this time.
0 commit comments