Skip to content

test: add coverage for generateStatsFile and statsFilename - #735

Open
topdaily-dev wants to merge 1 commit into
webpack:mainfrom
topdaily-dev:test/cover-generate-stats-file
Open

test: add coverage for generateStatsFile and statsFilename#735
topdaily-dev wants to merge 1 commit into
webpack:mainfrom
topdaily-dev:test/cover-generate-stats-file

Conversation

@topdaily-dev

Copy link
Copy Markdown

What

Adds plugin-level test coverage for the generateStatsFile and statsFilename options.

Why

Both are documented public options, but neither had any coverage at the plugin level. The existing test/statsUtils.js only exercises the low-level writeStats helper, so the option wiring in BundleAnalyzerPlugin was never verified by CI — including the mkdir call that creates missing directories for a nested statsFilename.

What is covered

  • generateStatsFile: true writes the stats file (Webpack 4 and 5)
  • no stats file is written by default
  • a custom relative statsFilename
  • a nested statsFilename, which exercises the recursive directory creation
  • an absolute statsFilename

The tests use analyzerMode: "disabled" together with generateStatsFile: true, which is the combination described in the README for generating only the stats file.

Verification

npm run lint and the test suite both pass locally. I also confirmed the tests are meaningful by temporarily short-circuiting the generateStatsFile branch in BundleAnalyzerPlugin: the five positive tests fail and the negative one still passes.

No production code is changed in this PR.

@changeset-bot

changeset-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f199df2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 24, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: topdaily-dev / name: TopDaily Dev (f199df2)

@topdaily-dev
topdaily-dev force-pushed the test/cover-generate-stats-file branch from 6f3c22c to f199df2 Compare August 24, 2026 17:46
@valscion

Copy link
Copy Markdown
Collaborator

Please fill the pull request template as it was.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.52%. Comparing base (a4d4123) to head (f199df2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #735      +/-   ##
==========================================
+ Coverage   78.58%   79.52%   +0.94%     
==========================================
  Files          17       17              
  Lines        1060     1060              
  Branches      383      383              
==========================================
+ Hits          833      843      +10     
+ Misses        199      189      -10     
  Partials       28       28              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants