Publishes a game's inspectable state on window.__mwg_test__[name], where a browser test (BrowserDriver.evaluate) can reach it. One fixed place replaces a hook each game invents; a no-op outside a browser.
window.__mwg_test__[name]
BrowserDriver.evaluate
import { exposeForTests } from '@datamoc/mwg/testing';declare const scene: unknown;declare const hitSound: unknown;exposeForTests('game', { scene, hitSound });// in the test: await driver.evaluate(() => window.__mwg_test__.game.hitSound.plays); Copy
import { exposeForTests } from '@datamoc/mwg/testing';declare const scene: unknown;declare const hitSound: unknown;exposeForTests('game', { scene, hitSound });// in the test: await driver.evaluate(() => window.__mwg_test__.game.hitSound.plays);
Publishes a game's inspectable state on
window.__mwg_test__[name], where a browser test (BrowserDriver.evaluate) can reach it. One fixed place replaces a hook each game invents; a no-op outside a browser.