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 ,
@@ -48,7 +48,7 @@ describe('CLI', () => {
4848 '/var/www'
4949 ) ;
5050
51- await main ( ) ;
51+ await parseOptionsAndRunCLI ( ) ;
5252
5353 expect ( startBridge ) . toHaveBeenCalledWith ( {
5454 cdpPort : 9229 ,
@@ -62,7 +62,7 @@ describe('CLI', () => {
6262 process . argv . push ( '--help' ) ;
6363
6464 try {
65- await main ( ) ;
65+ await parseOptionsAndRunCLI ( ) ;
6666 } catch ( e : any ) {
6767 expect ( e . message ) . toBe ( 'process.exit unexpectedly called with "0"' ) ;
6868 }
@@ -73,7 +73,7 @@ describe('CLI', () => {
7373 it ( 'runs cli with verbosity option set to quiet' , async ( ) => {
7474 process . argv . push ( '--verbosity' , 'quiet' ) ;
7575
76- await main ( ) ;
76+ await parseOptionsAndRunCLI ( ) ;
7777
7878 expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
7979 LogSeverity . Fatal
@@ -83,7 +83,7 @@ describe('CLI', () => {
8383 it ( 'runs cli with verbosity option set to normal' , async ( ) => {
8484 process . argv . push ( '--verbosity' , 'normal' ) ;
8585
86- await main ( ) ;
86+ await parseOptionsAndRunCLI ( ) ;
8787
8888 expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
8989 LogSeverity . Info
@@ -93,7 +93,7 @@ describe('CLI', () => {
9393 it ( 'runs cli with verbosity option set to debug' , async ( ) => {
9494 process . argv . push ( '--verbosity' , 'debug' ) ;
9595
96- await main ( ) ;
96+ await parseOptionsAndRunCLI ( ) ;
9797
9898 expect ( logger . setSeverityFilterLevel ) . toHaveBeenCalledWith (
9999 LogSeverity . Debug
0 commit comments