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 ,
@@ -49,7 +49,7 @@ describe('CLI', () => {
49
49
'/var/www'
50
50
) ;
51
51
52
- await main ( ) ;
52
+ await parseOptionsAndRunCLI ( ) ;
53
53
54
54
expect ( startBridge ) . toHaveBeenCalledWith ( {
55
55
cdpPort : 9229 ,
@@ -63,7 +63,7 @@ describe('CLI', () => {
63
63
process . argv . push ( '--help' ) ;
64
64
65
65
try {
66
- await main ( ) ;
66
+ await parseOptionsAndRunCLI ( ) ;
67
67
} catch ( e : any ) {
68
68
expect ( e . message ) . toBe ( 'process.exit unexpectedly called with "0"' ) ;
69
69
}
@@ -74,7 +74,7 @@ describe('CLI', () => {
74
74
it ( 'runs cli with verbosity option set to quiet' , async ( ) => {
75
75
process . argv . push ( '--verbosity' , 'quiet' ) ;
76
76
77
- await main ( ) ;
77
+ await parseOptionsAndRunCLI ( ) ;
78
78
79
79
expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
80
80
LogSeverity . Fatal
@@ -84,7 +84,7 @@ describe('CLI', () => {
84
84
it ( 'runs cli with verbosity option set to normal' , async ( ) => {
85
85
process . argv . push ( '--verbosity' , 'normal' ) ;
86
86
87
- await main ( ) ;
87
+ await parseOptionsAndRunCLI ( ) ;
88
88
89
89
expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
90
90
LogSeverity . Info
@@ -94,7 +94,7 @@ describe('CLI', () => {
94
94
it ( 'runs cli with verbosity option set to debug' , async ( ) => {
95
95
process . argv . push ( '--verbosity' , 'debug' ) ;
96
96
97
- await main ( ) ;
97
+ await parseOptionsAndRunCLI ( ) ;
98
98
99
99
expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
100
100
LogSeverity . Debug
0 commit comments