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) {
2929 }
3030
3131 function onError ( error ) {
32+ if ( ! error ) {
33+ error = new Error ( 'Promise rejected without Error' ) ;
34+ }
3235 return done ( error ) ;
3336 }
3437
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ function failure() {
1414 return when . reject ( new Error ( 'Promise Error' ) ) ;
1515}
1616
17+ function rejectNoError ( ) {
18+ return when . reject ( ) ;
19+ }
20+
1721describe ( 'promises' , function ( ) {
1822
1923 it ( 'should handle a resolved promise' , function ( done ) {
@@ -29,4 +33,12 @@ describe('promises', function() {
2933 done ( ) ;
3034 } ) ;
3135 } ) ;
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+ } ) ;
3244} ) ;
You can’t perform that action at this time.
0 commit comments