GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Normalize custom statistics versions in coverage by nk-batman21 · Pull Request #957 · browserslist/browserslist

Conversation

@nk-batman21

@nk-batman21 nk-batman21 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

browserslist.coverage() with custom statistics returns less than the queries select from the same statistics:

const stats = { and_chr: { 140: 40 }, chrome: { 140: 60 } }
const browsers = browserslist('> 1% in my stats', { stats }) // ['and_chr 154', 'chrome 140']
browserslist.coverage(browsers, stats)      // 60, expected 100
browserslist.coverage(browsers, 'my stats') // 60 with the same browserslist-stats.json

The CLI does the same: npx browserslist --coverage "cover 100% in my stats" --stats=browserslist-stats.json prints 60% for these stats. Users hit this when an analytics export records the real Chrome for Android version, or when a generated stats file gets older than the and_chr version in caniuse-lite. Chrome for Android is often the biggest entry, so the number can be off by a lot.

Queries read custom stats with getStat(opts, browserslist.data), and normalizeStats moves a single-version entry to the only version Can I Use has (and_chr, and_ff, and_uc, and_qq, baidu, op_mini). coverage() calls getStat(opts) without data for 'my stats' (since #608 that skips normalization instead of crashing) and does not normalize a stats object at all. This change passes browserslist.data in both branches, so coverage counts the versions the queries return. Entries with several versions and the client-side build are unchanged. A single and_chr: { 140: x } entry no longer matches an explicit and_chr 140 in the list, which is how > x% in my stats already reads it.

Ran: NODE_ENV=test c8 uvu test .test.js (328 passed, 100% lines), eslint ., size-limit (24.67 kB).
Checked: the new test fails without the change (0 instead of 4), separately for the object and the 'my stats' branch.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nk-batman21
Normalize custom statistics versions in coverage
cac8029
@ai
ai merged commit e80fabc into browserslist:main Oct 26, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ai

ai commented Oct 26, 2026

Copy link
Copy Markdown
Member

Thanks!

nk-batman21 reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ai

ai commented Oct 26, 2026

Copy link
Copy Markdown
Member

Fixed in 4.29.5

nk-batman21 reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@nk-batman21 @ai
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.