testing.FakeSession.script ​

Contract 2.0.0 · package sha256 a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e · generated from testing.d.ts by services/onsite-scripter/scripts/build-contract-docs.mjs; edit the source, not this file.

Method of testing.FakeSession · stable · since 2.0.0

ts
script(member: string, result: {
  fail?: boolean;
  delayMs?: number;
  problem?: ProblemCode;
  collection?: string;
  cancel?: boolean;
}): void;

Forces a member's next outcome, e.g. a load failure. member is named as TraceEntry.member names it ('session.setSceneModel', 'collection.set', 'part.set'), and its next call through any writer and any handle of that kind is forced, unless collection names one. 'runtime.input' forces the next drag release's runtime commit and 'runtime.restore' the next 'restore' commit; their only row is 'sync-failed', their default problem. With fail, problem picks the spec's section 6.4 row: 'sync-failed' is the internal-failure row (a state write rolls back with reason 'internal-error'; a 'collection.load' resolves, then its commit drops the item), 'asset-failed' the asset rows (a declarative write commits without it, an imperative load rejects HoloAssetError): every asset that write fetches fails once, assets already loaded stay drawn, and no failure window starts. A failure that records no Problem takes its row's error: session.capture rejects DOMException 'EncodingError'. 'session.applyDocument' has one row, 'apply-failed' (its default problem): it resolves ok: false with one 'apply-failed' problem, and delayMs holds the apply unfinished, so a newer apply supersedes it or a signal aborts it. 'session.activateAR' has two rows; neither records a Problem. A failed launch (fail, no problem) is timed as the viewer the call opens (spec section 5.11): for Scene Viewer, with delayMs under 2000 it resolves { launched: false, reason: 'error' } with 'ar:status' 'error' then, else it resolves launched: true at 2000 ms and fires 'ar:status' 'error' at delayMs; for the in-page route ('webxr') it resolves 'error' at delayMs; for Quick Look, which fails only when its USDZ export does, it resolves 'error' at delayMs with that message ('the USDZ export failed'). A cancel (cancel: true) resolves { launched: false, reason: 'cancelled' } at delayMs with 'ar:status' 'error', as the in-page route answers a declined prompt or a close before the start; Scene Viewer and Quick Look report no cancel, so a call that opens one of them resolves launched: true at delayMs instead. delayMs alone holds the launch, and a call meanwhile returns the pending call's Promise. As on the runtime, destroy() and detach() reject a held launch with AbortError and close an open tryOn() (it resolves at once), and endAR() resolves a held in-page launch { launched: false, reason: 'cancelled' } with 'ar:status' 'error'. A problem the member has no row for throws HoloInputError at this call.

Generic-API test (spec 3.1) ​

Rule Result
1. Neutral name pass: script names no product
2. A precedent not recorded: no ledger row (coverage.json) names this member or its owner
3. Two apps, or labs not recorded: no ledger row names this member or its owner
4. The cheaper fix first not recorded per member (Appendix B decides it per need)