11import './mocker' ;
22import { vi } from 'vitest' ;
3- import { main } from '../lib/run-cli' ;
3+ import { parseOptionsAndRunCLI } from '../lib/run-cli' ;
44import { logger , LogSeverity } from '@php-wasm/logger' ;
55import { startBridge } from '../lib/start-bridge' ;
66import type { XdebugCDPBridge } from '../lib/xdebug-cdp-bridge' ;
@@ -26,7 +26,7 @@ describe('CLI', () => {
2626 } ) ;
2727
2828 it ( 'calls startBridge with default arguments' , async ( ) => {
29- await main ( ) ;
29+ await parseOptionsAndRunCLI ( ) ;
3030
3131 expect ( startBridge ) . toHaveBeenCalledWith ( {
3232 cdpPort : 9229 ,
@@ -49,7 +49,7 @@ describe('CLI', () => {
4949 '/var/www'
5050 ) ;
5151
52- await main ( ) ;
52+ await parseOptionsAndRunCLI ( ) ;
5353
5454 expect ( startBridge ) . toHaveBeenCalledWith ( {
5555 cdpPort : 9229 ,
@@ -63,7 +63,7 @@ describe('CLI', () => {
6363 process . argv . push ( '--help' ) ;
6464
6565 try {
66- await main ( ) ;
66+ await parseOptionsAndRunCLI ( ) ;
6767 } catch ( e : any ) {
6868 expect ( e . message ) . toBe ( 'process.exit unexpectedly called with "0"' ) ;
6969 }
@@ -74,7 +74,7 @@ describe('CLI', () => {
7474 it ( 'runs cli with verbosity option set to quiet' , async ( ) => {
7575 process . argv . push ( '--verbosity' , 'quiet' ) ;
7676
77- await main ( ) ;
77+ await parseOptionsAndRunCLI ( ) ;
7878
7979 expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
8080 LogSeverity . Fatal
@@ -84,7 +84,7 @@ describe('CLI', () => {
8484 it ( 'runs cli with verbosity option set to normal' , async ( ) => {
8585 process . argv . push ( '--verbosity' , 'normal' ) ;
8686
87- await main ( ) ;
87+ await parseOptionsAndRunCLI ( ) ;
8888
8989 expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
9090 LogSeverity . Info
@@ -94,7 +94,7 @@ describe('CLI', () => {
9494 it ( 'runs cli with verbosity option set to debug' , async ( ) => {
9595 process . argv . push ( '--verbosity' , 'debug' ) ;
9696
97- await main ( ) ;
97+ await parseOptionsAndRunCLI ( ) ;
9898
9999 expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
100100 LogSeverity . Debug
0 commit comments