mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
test(performance): fail an iteration whose performance observers were unavailable
Codex follow-up on #1698: a renderer that cannot observe layout-shift or longtask entries used to pass the probe with zero counters, which a ratchet could not tell apart from a genuine zero. The probe assertion now rejects such an iteration and names the missing observer. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
0de396197b
commit
b7de3e47ac
2 files changed
+31
No files matched your search
@@ -378,6 +378,26 @@ test('rejects a probe that was installed after the document started', async () =
|
||||
);
|
||||
});
|
||||
|
||||
test('rejects a probe whose performance observers were unavailable instead of reporting zeros', async () => {
|
||||
const fixture = createFixture();
|
||||
const state = fixture.rawState() as {
|
||||
capabilities: { layoutShift: boolean; longTask: boolean };
|
||||
};
|
||||
state.capabilities.longTask = false;
|
||||
renderFirstCard(fixture);
|
||||
await settle();
|
||||
assert.equal(fixture.state().counters.longTasks, 0);
|
||||
assert.throws(
|
||||
() => assertJourneyRendererProbeState(fixture.state()),
|
||||
/observer-unavailable: longTask/
|
||||
);
|
||||
state.capabilities.layoutShift = false;
|
||||
assert.throws(
|
||||
() => assertJourneyRendererProbeState(fixture.state()),
|
||||
/observer-unavailable: layoutShift, longTask/
|
||||
);
|
||||
});
|
||||
|
||||
test('launch options target the workspace source cards and the shared sentinel', () => {
|
||||
const options = createLaunchJourneyProbeOptions();
|
||||
assert.equal(options.stateKey, JOURNEY_PROBE_STATE_KEY);
|
||||
|
||||
@@ -363,5 +363,16 @@ export function assertJourneyRendererProbeState(
|
||||
`journey-renderer-probe-sentinel-${state.sentinel.status}`
|
||||
);
|
||||
}
|
||||
// A zero from an observer that never ran is not a measurement; a build
|
||||
// without these entry types must fail the iteration, never lower a
|
||||
// baseline.
|
||||
const missing = (['layoutShift', 'longTask'] as const).filter(
|
||||
(capability) => !state.capabilities[capability]
|
||||
);
|
||||
if (missing.length > 0) {
|
||||
throw new Error(
|
||||
`journey-renderer-probe-observer-unavailable: ${missing.join(', ')}`
|
||||
);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
Reference in new issue
Block a user