按实测收回 cfd89ba57 顺手加宽的一处测试超时,并写明另一处保留的理由
- `prefetches only cards that are actually in view, and still fills the first screen` 的 `}, 30000)` 收回(回到 vitest 默认 5 s):实测 93 ms,约 54 倍余量,而且真正的时间门是内层 `waitFor` 自带的 1 s。cfd89ba57 那次只是给负载留余量,没有对应的结构性成本 —— 对照 `releases Blob URLs while continuously browsing beyond the cache limit`(79 轮串行读盘、实测 6120 ms、超默认 5 s)那条的预算属结构性必需,保持不动。 - `keeps a visible card cached when later loads push the cache over its limit` 的 `}, 60000)` **保留**并写明理由:它的职责是挂起护栏,必须大于内层 `waitFor` 的 20 s 断言预算,否则内层断言自己的失败信息永远不出现(vitest 会先在测试超时处中止,只剩笼统的 "test timed out")。用例实测 120 ms,20 s 与 60 s 都不是耗时预期;硬收会让内层预算变成不可达配置,是更差的诊断而不是更紧的门禁。 - 无功能改动。
This commit is contained in:
@@ -1950,6 +1950,10 @@ describe('冷启动首屏的放行范围与放行顺序', () => {
|
||||
};
|
||||
}
|
||||
|
||||
// 本用例不设显式测试超时:实测 **84 ms**,对 vitest 默认的 5 s 有约 60 倍余量,而且真正的时间门
|
||||
// 是下面那个 `waitFor` 自带的 1 s。`cfd89ba57` 曾顺手给它加 `}, 30000)` —— 那只是给负载留余量,
|
||||
// 没有对应的结构性成本(对比 `releases Blob URLs …` 那条:79 轮串行读盘实测 6120 ms,超默认 5 s,
|
||||
// 那条的预算是必需的),故按实测收回。
|
||||
it('prefetches only cards that are actually in view, and still fills the first screen', async () => {
|
||||
// A:热预取此前按投影顺序盲取前 12 张,条件里没有几何判断 —— 排在前面的视口外卡片
|
||||
// 先占满 3 个读取槽,屏幕里的卡反而排队,首屏就是"等图片"。
|
||||
@@ -1999,7 +2003,7 @@ describe('冷启动首屏的放行范围与放行顺序', () => {
|
||||
}
|
||||
// 首屏要保证有图可读:可见的 12 张一张都不能少。
|
||||
expect(readPathsSet.size).toBe(resources.length - offscreen.length);
|
||||
}, 30000);
|
||||
});
|
||||
|
||||
it('releases intersecting cards in two bands: viewport first, margin second', async () => {
|
||||
// B:一次 observer 回调可能同时报来 ~21 张相交卡,物理读取只有 3 个槽。
|
||||
@@ -2065,6 +2069,12 @@ describe('冷启动首屏的放行范围与放行顺序', () => {
|
||||
});
|
||||
|
||||
describe('预览缓存驱逐必须避开可见卡', () => {
|
||||
/**
|
||||
* 外层 `}, 60000)` **保留**,但它不是"给负载留余量"的耗时预期:它的职责是**挂起护栏**,
|
||||
* 必须大于上面那个 `waitFor` 的 20 s 断言预算 —— 否则断言自己的失败信息永远不会出现
|
||||
* (vitest 会先在测试超时处中止,只剩一句笼统的 "test timed out")。用例实测 150 ms,
|
||||
* 20 s 与 60 s 都不是耗时预期。
|
||||
*/
|
||||
it('keeps a visible card cached when later loads push the cache over its limit', async () => {
|
||||
// 现场:缓存条目顺序是「最近一次被请求」,而停在屏幕上不动的卡不会产生新请求 ——
|
||||
// 纯 LRU 会首选淘汰用户正看着的那张,图片"消失又回来"。
|
||||
|
||||
Reference in New Issue
Block a user