File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 486
486
}
487
487
488
488
function nextTick ( callback ) {
489
+ if ( typeof callback !== 'function' )
490
+ throw new TypeError ( 'callback is not a function' ) ;
489
491
// on the way out, don't bother. it won't get fired anyway.
490
492
if ( process . _exiting )
491
493
return ;
Original file line number Diff line number Diff line change @@ -20,6 +20,22 @@ process.nextTick(function() {
20
20
order . push ( 'C' ) ;
21
21
} ) ;
22
22
23
+ function testNextTickWith ( val ) {
24
+ assert . throws (
25
+ function ( ) {
26
+ process . nextTick ( val ) ;
27
+ } ,
28
+ TypeError
29
+ ) ;
30
+ }
31
+
32
+ testNextTickWith ( false ) ;
33
+ testNextTickWith ( true ) ;
34
+ testNextTickWith ( 1 ) ;
35
+ testNextTickWith ( 'str' ) ;
36
+ testNextTickWith ( { } ) ;
37
+ testNextTickWith ( [ ] ) ;
38
+
23
39
process . on ( 'uncaughtException' , function ( ) {
24
40
if ( ! exceptionHandled ) {
25
41
exceptionHandled = true ;
You can’t perform that action at this time.
0 commit comments