Skip to content

Commit 6c2de1f

Browse files
committed
fix: Ignore unchanged files when calculating delta
1 parent 998e2ac commit 6c2de1f

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,12 @@ export function diffTable(files, { showTotal, collapseUnchanged, omitUnchanged,
198198
for (const file of files) {
199199
const { filename, size, delta } = file;
200200
totalSize += size;
201-
totalDelta += delta;
202201

203202
const originalSize = size - delta;
204203
const isUnchanged = Math.abs(delta) < minimumChangeThreshold;
205204

205+
if (!isUnchanged) totalDelta += delta;
206+
206207
if (isUnchanged && omitUnchanged) continue;
207208

208209
const row = [

tests/__snapshots__/utils.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ exports[`diffTable 4`] = `
8585
`;
8686

8787
exports[`diffTable 5`] = `
88-
"**Size Change:** +9 B (+0.04%)
88+
"**Size Change:** 0 B
8989
9090
**Total Size:** 21.3 kB
9191

0 commit comments

Comments
 (0)