Scene sky-change sweep: bake each state's sky once so the test stays inside its timeout under load
Some checks failed
Build pull request / Build pull request (pull_request) Has been cancelled
Some checks failed
Build pull request / Build pull request (pull_request) Has been cancelled
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b13080ebd2
commit
1b101c2889
1 changed files with 15 additions and 0 deletions
|
|
@ -11,6 +11,21 @@ const { createRidgeScene, createScene } = vi.hoisted(() => ({
|
|||
}));
|
||||
vi.mock('./ridge/Ridge', () => ({ createRidgeScene }));
|
||||
vi.mock('./Scene', () => ({ createScene }));
|
||||
// The physical sky is baked per call (tens of ms: atmosphere LUTs) and the clock here is fixed, so a state always
|
||||
// draws the same sky. Baking once per state keeps the 21-offset sweep under the default timeout when the machine is
|
||||
// loaded; the sky each build receives is still the one `ridgeSkyFor` makes for that state.
|
||||
vi.mock('./skyForState', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('./skyForState')>();
|
||||
const baked = new Map<string, ReturnType<typeof actual.ridgeSkyFor>>();
|
||||
return {
|
||||
...actual,
|
||||
ridgeSkyFor: (...args: Parameters<typeof actual.ridgeSkyFor>) => {
|
||||
if (args.length !== 1) return actual.ridgeSkyFor(...args);
|
||||
if (!baked.has(args[0])) baked.set(args[0], actual.ridgeSkyFor(args[0]));
|
||||
return baked.get(args[0]) as ReturnType<typeof actual.ridgeSkyFor>;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const canvas = {} as HTMLCanvasElement;
|
||||
const config = { tier: 'low' as const };
|
||||
|
|
|
|||
Loading…
Reference in a new issue