1
1
import './mocker' ;
2
2
import { vi } from 'vitest' ;
3
- import { main } from '../lib/run-cli' ;
3
+ import { parseOptionsAndRunCLI } from '../lib/run-cli' ;
4
4
import { logger , LogSeverity } from '@php-wasm/logger' ;
5
5
import { startBridge } from '../lib/start-bridge' ;
6
6
import type { XdebugCDPBridge } from '../lib/xdebug-cdp-bridge' ;
@@ -26,7 +26,7 @@ describe('CLI', () => {
26
26
} ) ;
27
27
28
28
it ( 'calls startBridge with default arguments' , async ( ) => {
29
- await main ( ) ;
29
+ await parseOptionsAndRunCLI ( ) ;
30
30
31
31
expect ( startBridge ) . toHaveBeenCalledWith ( {
32
32
cdpPort : 9229 ,
@@ -48,7 +48,7 @@ describe('CLI', () => {
48
48
'/var/www'
49
49
) ;
50
50
51
- await main ( ) ;
51
+ await parseOptionsAndRunCLI ( ) ;
52
52
53
53
expect ( startBridge ) . toHaveBeenCalledWith ( {
54
54
cdpPort : 9229 ,
@@ -62,7 +62,7 @@ describe('CLI', () => {
62
62
process . argv . push ( '--help' ) ;
63
63
64
64
try {
65
- await main ( ) ;
65
+ await parseOptionsAndRunCLI ( ) ;
66
66
} catch ( e : any ) {
67
67
expect ( e . message ) . toBe ( 'process.exit unexpectedly called with "0"' ) ;
68
68
}
@@ -73,7 +73,7 @@ describe('CLI', () => {
73
73
it ( 'runs cli with verbosity option set to quiet' , async ( ) => {
74
74
process . argv . push ( '--verbosity' , 'quiet' ) ;
75
75
76
- await main ( ) ;
76
+ await parseOptionsAndRunCLI ( ) ;
77
77
78
78
expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
79
79
LogSeverity . Fatal
@@ -83,7 +83,7 @@ describe('CLI', () => {
83
83
it ( 'runs cli with verbosity option set to normal' , async ( ) => {
84
84
process . argv . push ( '--verbosity' , 'normal' ) ;
85
85
86
- await main ( ) ;
86
+ await parseOptionsAndRunCLI ( ) ;
87
87
88
88
expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
89
89
LogSeverity . Info
@@ -93,7 +93,7 @@ describe('CLI', () => {
93
93
it ( 'runs cli with verbosity option set to debug' , async ( ) => {
94
94
process . argv . push ( '--verbosity' , 'debug' ) ;
95
95
96
- await main ( ) ;
96
+ await parseOptionsAndRunCLI ( ) ;
97
97
98
98
expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
99
99
LogSeverity . Debug
0 commit comments