From 3d5c9760c37c6353a89c72a5e36237b0cc2a9921 Mon Sep 17 00:00:00 2001 From: Tamas Erdelyi Date: Mon, 23 Nov 2026 16:58:11 +0000 Subject: [PATCH] fix(cli): count package versions as the dashboard does --- src/cli.ts | 5 +++-- tests/bin-invocation.test.ts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 87c2659..847230d 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -953,8 +953,9 @@ async function runScan( return 0; } - const checked = `Checked ${plural(stats.uniqueNames, 'package', 'packages')}`; - report.checked = stats.uniqueNames; + // Name@version entries, the count the dashboard shows for the same manifest. + const checked = `Checked ${plural(payload.packages.length, 'package', 'packages')}`; + report.checked = payload.packages.length; if (response.stored) { report.done.unshift(checked); say(`Stored manifest #${response.manifest_id} (checksum ${response.checksum}).`); diff --git a/tests/bin-invocation.test.ts b/tests/bin-invocation.test.ts index e2748da..28a3793 100644 --- a/tests/bin-invocation.test.ts +++ b/tests/bin-invocation.test.ts @@ -485,6 +485,22 @@ describe.skipIf(!built)('the packaged bin, invoked as npm invokes it', () => { } }); + it('counts the package versions it sent, as the dashboard does, not the package names', async () => { + const server = await acceptingServer(); + const dir = freshProject(); + try { + const stdout = await scan(dir, server.endpoint, {}, ['--verbose']); + + const [, versions, names] = stdout.match(/Found (\d+) package versions across (\d+) packages/) ?? []; + expect(Number(versions)).toBeGreaterThan(Number(names)); + expect(stdout).toContain(`Checked ${versions} packages`); + expect(stdout).not.toContain(`Checked ${names} packages`); + } finally { + await server.close(); + rmSync(dir, { recursive: true, force: true }); + } + }); + it('marks the local sync done and names connecting as the one next step', async () => { const server = await acceptingServer(); const dir = freshProject();