test: add coverage for generateStatsFile and statsFilename - #735
topdaily-dev wants to merge 1 commit into
Conversation
|
|
|
6f3c22c to
f199df2
Compare
|
Please fill the pull request template as it was. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
@valscion I've restored and filled in the pull request template, including the Use of AI section. The template is set at the org level in |
Summary
Adds plugin-level test coverage for the
generateStatsFileandstatsFilenameoptions.Both are documented public options, but neither had coverage at the plugin level.
test/statsUtils.jsonly exercises the low-levelwriteStatshelper, so the option wiring inBundleAnalyzerPluginwas never verified by CI — including themkdircall that creates missing directories for a nestedstatsFilename.The tests use
analyzerMode: "disabled"together withgenerateStatsFile: true, which is the combination the README describes for generating only the stats file.Covered:
generateStatsFile: truewrites the stats file (webpack 4 and 5)statsFilenamestatsFilename, exercising the recursive directory creationstatsFilenameWhat kind of change does this PR introduce?
test. No production code is modified; the only changed file is
test/plugin.js.Did you add tests for your changes?
The change is entirely tests. I confirmed they are meaningful rather than vacuous by temporarily short-circuiting the
generateStatsFilebranch inBundleAnalyzerPlugin: the five positive tests fail and the negative test still passes. I reverted that local experiment before pushing.npm run lintand the full suite pass locally. The suite requiresnpm run buildfirst, since the viewer bundle must exist forgetAssetContent.Does this PR introduce a breaking change?
No. No runtime behaviour changes, so no changeset is included — merging this will not require a version bump.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Nothing. The options are already documented in the README; this only adds coverage for the documented behaviour.
Use of AI
Yes, disclosed per the AI policy. I used an AI coding assistant to help explore the test suite, identify which documented options lacked plugin-level coverage, and draft the test cases. I reviewed the full diff myself before requesting review, and designed and ran the verification described above — short-circuiting the
generateStatsFilebranch to confirm the tests fail without the feature — specifically to satisfy myself that the coverage is real and not just passing by construction. I understand the change and can answer questions about it.