@@ -45,16 +45,21 @@ describe('a test that throws', function () {
45
45
46
46
it ( 'should not pass if throwing async and test is async' , function ( done ) {
47
47
var test = new Test ( 'im async and throw undefined async' , function ( done2 ) {
48
- process . nexTick ( function ( ) {
48
+ process . nextTick ( function ( ) {
49
49
throw undefined ;
50
50
} ) ;
51
51
} ) ;
52
52
suite . addTest ( test ) ;
53
53
runner = new Runner ( suite ) ;
54
+ var uncaught = Runner . prototype . uncaught ;
55
+ Runner . prototype . uncaught = function ( ) {
56
+ Runner . prototype . uncaught = uncaught ;
57
+ done ( ) ;
58
+ } ;
54
59
runner . on ( 'end' , function ( ) {
55
60
expect ( runner . failures ) . to . equal ( 1 ) ;
56
61
expect ( test . state ) . to . equal ( 'failed' ) ;
57
- done ( ) ;
62
+ expect ( runner . uncaught ) . toBeCalled ( ) ;
58
63
} ) ;
59
64
runner . run ( ) ;
60
65
} ) ;
@@ -91,16 +96,21 @@ describe('a test that throws', function () {
91
96
92
97
it ( 'should not pass if throwing async and test is async' , function ( done ) {
93
98
var test = new Test ( 'im async and throw null async' , function ( done2 ) {
94
- process . nexTick ( function ( ) {
99
+ process . nextTick ( function ( ) {
95
100
throw null ;
96
101
} ) ;
97
102
} ) ;
98
103
suite . addTest ( test ) ;
99
104
runner = new Runner ( suite ) ;
105
+ var uncaught = Runner . prototype . uncaught ;
106
+ Runner . prototype . uncaught = function ( ) {
107
+ Runner . prototype . uncaught = uncaught ;
108
+ done ( ) ;
109
+ } ;
100
110
runner . on ( 'end' , function ( ) {
101
111
expect ( runner . failures ) . to . equal ( 1 ) ;
102
112
expect ( test . state ) . to . equal ( 'failed' ) ;
103
- done ( ) ;
113
+ expect ( runner . uncaught ) . toBeCalled ( ) ;
104
114
} ) ;
105
115
runner . run ( ) ;
106
116
} ) ;
0 commit comments