File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
test/integration/connection Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 1
1
var common = require ( '../../common' ) ;
2
2
var assert = require ( 'assert' ) ;
3
3
4
+ var callCount = 0 ;
5
+ var exceptionCount = 0 ;
6
+
4
7
process . on ( 'uncaughtException' , function ( err ) {
5
8
assert . ifError ( err ) ;
9
+ exceptionCount ++ ;
6
10
} ) ;
7
11
8
12
var connection1 = common . createConnection ( {
9
- username : 'wtf' ,
10
13
password : 'lol'
11
14
} ) ;
12
15
13
16
// error will NOT bubble up to process level if `on` is used
14
- connection1 . on ( 'error' , function ( err ) {
15
- assert . ok ( err ) ;
17
+ connection1 . on ( 'error' , function ( ) {
18
+ callCount ++ ;
16
19
} ) ;
17
20
18
21
var connection2 = common . createConnection ( {
19
- username : 'wtf' ,
20
22
password : 'lol'
21
23
} ) ;
22
24
23
25
// error will bubble up to process level if `once` is used
24
- connection2 . once ( 'error' , function ( err ) {
25
- assert . ok ( err ) ;
26
+ connection2 . once ( 'error' , function ( ) {
27
+ callCount ++ ;
28
+ } ) ;
29
+
30
+ process . on ( 'exit' , function ( ) {
31
+ assert . equal ( callCount , 2 ) ;
32
+ assert . equal ( exceptionCount , 0 ) ;
26
33
} ) ;
You can’t perform that action at this time.
0 commit comments