11import process from 'node:process' ;
22import { afterEach , beforeEach , describe , expect , it , vi } from 'vitest' ;
3- import { installExitHandlers } from './exit-process.js' ;
3+ import { SIGNAL_EXIT_CODES , installExitHandlers } from './exit-process.js' ;
44
55describe ( 'installExitHandlers' , ( ) => {
66 const onError = vi . fn ( ) ;
@@ -72,7 +72,7 @@ describe('installExitHandlers', () => {
7272 ( process as any ) . emit ( 'SIGINT' ) ;
7373
7474 expect ( onClose ) . toHaveBeenCalledTimes ( 1 ) ;
75- expect ( onClose ) . toHaveBeenCalledWith ( 130 , {
75+ expect ( onClose ) . toHaveBeenCalledWith ( SIGNAL_EXIT_CODES ( ) . SIGINT , {
7676 kind : 'signal' ,
7777 signal : 'SIGINT' ,
7878 } ) ;
@@ -85,7 +85,7 @@ describe('installExitHandlers', () => {
8585 ( process as any ) . emit ( 'SIGTERM' ) ;
8686
8787 expect ( onClose ) . toHaveBeenCalledTimes ( 1 ) ;
88- expect ( onClose ) . toHaveBeenCalledWith ( 143 , {
88+ expect ( onClose ) . toHaveBeenCalledWith ( SIGNAL_EXIT_CODES ( ) . SIGTERM , {
8989 kind : 'signal' ,
9090 signal : 'SIGTERM' ,
9191 } ) ;
@@ -98,7 +98,7 @@ describe('installExitHandlers', () => {
9898 ( process as any ) . emit ( 'SIGQUIT' ) ;
9999
100100 expect ( onClose ) . toHaveBeenCalledTimes ( 1 ) ;
101- expect ( onClose ) . toHaveBeenCalledWith ( 131 , {
101+ expect ( onClose ) . toHaveBeenCalledWith ( SIGNAL_EXIT_CODES ( ) . SIGQUIT , {
102102 kind : 'signal' ,
103103 signal : 'SIGQUIT' ,
104104 } ) ;
0 commit comments