Skip to content

Commit b2c803c

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

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/utils.js

Lines changed: 3 additions & 2 deletions
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 = [
@@ -219,7 +220,7 @@ export function diffTable(files, { showTotal, collapseUnchanged, omitUnchanged,
219220
}
220221

221222
let out = '';
222-
223+
223224
if (changedRows.length !== 0) {
224225
const outChanged = markdownTable(changedRows);
225226
out = `<details open><summary>📦 <strong>View Changed</strong></summary>\n\n${outChanged}\n\n</details>`;

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)