feat(web): add incremental modifier reader batch
This commit is contained in:
@@ -32,12 +32,25 @@ if (!coverageBindings.length) throw new Error(`task ${task} has no coverageBindi
|
||||
const production = json(productionPath);
|
||||
assert.equal(production.browser, "chromium");
|
||||
assert.equal(production.queueMutation, false);
|
||||
assert.equal(production.error, undefined);
|
||||
assert.equal(production.saveReopenExact, true);
|
||||
assert.equal(production.deterministicExact, true);
|
||||
const inventoryPath = "tests/golden/WBV2/dynamic-inventory.json";
|
||||
const inventory = json(inventoryPath);
|
||||
assert.equal(production.fixtureSha256, sha(production.fixture));
|
||||
const fixturePaths = Array.isArray(production.fixtures) ? production.fixtures : production.fixture ? [production.fixture] : [];
|
||||
assert.ok(fixturePaths.length, "production evidence has no fixture(s)");
|
||||
const fixtureEvidence = Array.isArray(production.fixtures)
|
||||
? fixturePaths.map((fixture) => production[fixture])
|
||||
: [production];
|
||||
for (const evidence of fixtureEvidence) {
|
||||
assert.ok(evidence && typeof evidence === "object", "fixture result is missing");
|
||||
assert.equal(evidence.error, undefined);
|
||||
assert.equal(evidence.saveReopenExact, true);
|
||||
assert.equal(evidence.deterministicExact, true);
|
||||
}
|
||||
if (Array.isArray(production.fixtures)) {
|
||||
assert.equal(typeof production.fixtureSha256, "object");
|
||||
for (const fixture of fixturePaths) assert.equal(production.fixtureSha256[fixture], sha(fixture), `fixture hash drift: ${fixture}`);
|
||||
} else {
|
||||
assert.equal(production.fixtureSha256, sha(production.fixture));
|
||||
}
|
||||
const bindingsPath = "tests/golden/WBV2/dynamic-coverage-bindings.json";
|
||||
const existing = fs.existsSync(abs(bindingsPath)) ? json(bindingsPath) : [];
|
||||
const byId = new Map(existing.map((binding) => [binding.unitId, binding]));
|
||||
|
||||
@@ -62,8 +62,15 @@ const reusableProductionEvidence = () => {
|
||||
try { evidence = json(evidencePath); }
|
||||
catch { return null; }
|
||||
if (evidence.task !== task || evidence.browser !== "chromium" || evidence.queueMutation !== false
|
||||
|| evidence.error !== undefined || evidence.saveReopenExact !== true || evidence.deterministicExact !== true) return null;
|
||||
if (!evidence.fixture || !fs.existsSync(abs(evidence.fixture)) || evidence.fixtureSha256 !== sha(evidence.fixture)) return null;
|
||||
|| evidence.error !== undefined) return null;
|
||||
const fixturePaths = Array.isArray(evidence.fixtures) ? evidence.fixtures : evidence.fixture ? [evidence.fixture] : [];
|
||||
if (!fixturePaths.length) return null;
|
||||
const fixtureEvidence = Array.isArray(evidence.fixtures) ? fixturePaths.map((fixture) => evidence[fixture]) : [evidence];
|
||||
if (fixtureEvidence.some((entry) => !entry || entry.error !== undefined || entry.saveReopenExact !== true || entry.deterministicExact !== true)) return null;
|
||||
if (Array.isArray(evidence.fixtures)) {
|
||||
if (!evidence.fixtureSha256 || typeof evidence.fixtureSha256 !== "object") return null;
|
||||
if (fixturePaths.some((fixture) => !fs.existsSync(abs(fixture)) || evidence.fixtureSha256[fixture] !== sha(fixture))) return null;
|
||||
} else if (!fs.existsSync(abs(evidence.fixture)) || evidence.fixtureSha256 !== sha(evidence.fixture)) return null;
|
||||
const expectedUnits = record.module.coverageBindings ?? [];
|
||||
if (expectedUnits.length && !sameIds(evidence.sourceUnits, expectedUnits)) return null;
|
||||
if (!fs.existsSync(abs(reportPath))) return null;
|
||||
|
||||
Reference in New Issue
Block a user