@@ -10,6 +10,7 @@ import { tmpdir } from "node:os";
1010import path from "node:path" ;
1111import { pathToFileURL } from "node:url" ;
1212import { gunzipSync } from "node:zlib" ;
13+ import { stripLeadingPackageManagerSeparator } from "./lib/arg-utils.mjs" ;
1314
1415type CollectorMode = "local" | "docker" ;
1516
@@ -169,6 +170,7 @@ Collector container in front of the receiver.
169170}
170171
171172function parseArgs ( argv : string [ ] ) : CliOptions {
173+ const args = stripLeadingPackageManagerSeparator ( argv ) ;
172174 const options : CliOptions = {
173175 collectorMode : "local" ,
174176 outputDir : path . join ( ".artifacts" , "qa-e2e" , `otel-smoke-${ Date . now ( ) . toString ( 36 ) } ` ) ,
@@ -177,14 +179,14 @@ function parseArgs(argv: string[]): CliOptions {
177179 help : false ,
178180 } ;
179181
180- for ( let index = 0 ; index < argv . length ; index += 1 ) {
181- const arg = argv [ index ] ;
182+ for ( let index = 0 ; index < args . length ; index += 1 ) {
183+ const arg = args [ index ] ;
182184 if ( arg === "--help" || arg === "-h" ) {
183185 options . help = true ;
184186 continue ;
185187 }
186188 const readValue = ( ) => {
187- const value = argv [ index + 1 ] ?. trim ( ) ;
189+ const value = args [ index + 1 ] ?. trim ( ) ;
188190 if ( ! value ) {
189191 throw new Error ( `${ arg } requires a value` ) ;
190192 }
@@ -1334,6 +1336,7 @@ async function main() {
13341336export const testing = {
13351337 appendCapturedBodyText,
13361338 decodeRequestBody,
1339+ parseArgs,
13371340 readPositiveIntegerEnv,
13381341 readRequestBody,
13391342} ;
0 commit comments