From c3082661113b4b55534f25da86e3b261d3952953 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Tue, 11 Jul 2023 09:38:17 +0200 Subject: [PATCH] fix: correctly parse the default buildId (#10535) --- packages/browsers/src/CLI.ts | 3 ++- packages/browsers/test/src/firefox/cli.spec.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/browsers/src/CLI.ts b/packages/browsers/src/CLI.ts index 67670022699..688205b1833 100644 --- a/packages/browsers/src/CLI.ts +++ b/packages/browsers/src/CLI.ts @@ -274,7 +274,8 @@ export class CLI { } #parseBuildId(version: string): string { - return version.split('@').pop() ?? 'latest'; + const parts = version.split('@'); + return parts.length === 2 ? parts[1]! : 'latest'; } } diff --git a/packages/browsers/test/src/firefox/cli.spec.ts b/packages/browsers/test/src/firefox/cli.spec.ts index ec93e0c3538..004f8979c79 100644 --- a/packages/browsers/test/src/firefox/cli.spec.ts +++ b/packages/browsers/test/src/firefox/cli.spec.ts @@ -75,5 +75,15 @@ describe('Firefox CLI', function () { '--platform=linux', `--base-url=${getServerUrl()}`, ]); + + await new CLI(tmpDir).run([ + 'npx', + '@puppeteer/browsers', + 'install', + `firefox`, + `--path=${tmpDir}`, + '--platform=linux', + `--base-url=${getServerUrl()}`, + ]); }); });