profiler: list matching record numbers when only the record count differs

The 'matching records: N-M' note was suppressed when every compared record
matched but the record count differed (e.g. 30 expected vs 10 read): the
renderer only looked for failed per-record checks, so the report showed
just the count lines. profilerRunRule now sets res.recordsMismatch whenever
the count or any record differs, and the renderer uses it (with the old
per-record check as fallback), so the matching-record ranges are listed in
that case too. Tests cover the count-only mismatch and the per-record case.
SW cache v65 -> v66.
This commit is contained in:
2026-09-11 00:45:17 +03:00
parent 26ee8974cc
commit 74741a37cd
3 changed files with 13 additions and 3 deletions
+8
View File
@@ -471,6 +471,7 @@ test('profilerRunRule records which records matched on a record mismatch', async
content: { mode: 'exact', kind: 'record', records: [{ num: 1, data: 'AA' }, { num: 2, data: 'BB' }, { num: 3, data: 'CC' }] },
});
assert.strictEqual(res.status, 'fail');
assert.strictEqual(res.recordsMismatch, true);
assert.deepStrictEqual(res.recordsMatched, [1, 3]);
});
@@ -487,6 +488,13 @@ test('record count mismatch is reported once when numRecords is checked', async
assert.strictEqual(res.status, 'fail');
assert.ok(res.checks.some(c => c.label === 'numRecords' && c.ok === false));
assert.ok(!res.checks.some(c => c.label === 'content.records'));
assert.strictEqual(res.recordsMismatch, true);
assert.deepStrictEqual(res.recordsMatched, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
global.t = s => s;
global.pysimCustomFiles = [];
const report = profilerRenderReport([res]);
assert.ok(report.includes('matching records: 1-10'), report);
delete global.t;
});
test('record count mismatch keeps content.records when numRecords is not checked (type mode)', async () => {