This repository has been archived by the owner on May 9, 2024. It is now read-only.
The aggregate change percentage is NaN
if no files were mangled
#339
Labels
Package(s)
webmangler-cli (v0.1.8)
Description
The stats module of the CLI package returns the value
NaN
for the overall/aggregatechangePercentage
if 0 files were mangled (i.e.inFiles
.lenght === 0
).The impact on existing reporters is minimal (no impact on the
DefaultReporter
and limited impact on theJsonReporter
, see below).Actual Behaviour
Mangling 0 files with the CLI results in
stats.aggregate.changePercentage === NaN
.Expected Behaviour
Mangling 0 files with the CLI results in
stats.aggregate.changePercentage === 0
.The unit test suite for
compute.ts
should ideally be updated accordingly to test the values ofchangePercentage
,sizeBefore
, andsizeAfter
:webmangler/packages/cli/src/stats/__tests__/unit/compute.test.ts
Lines 183 to 187 in 57f6e70
Working Example
In
packages/cli
, create a file called.webmanglerrc.js
with the contents:In the project root, run:
Observe in the output the line
"changePercentage": null
.Workaround
No response
Notes
Originally posted in #333 (comment)
The text was updated successfully, but these errors were encountered: