mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Boot the whole application on the stub renderer, headless, in CI
- dev/stub-app/main.js starts the standalone application on the stub renderer with only the contract's required members (?capabilities=all gives it every capability) and steps its frames. - npm run qa:stub-boot serves the application's own page with that entry, and fails when any Cesium module or asset is requested (the stylesheet the build's Cesium plugin links into every page is reported), on a page or console error, or when a data layer fails to turn on or off. A feed's failed response and the dev server client's own errors are reported; --strict also fails a layer that drew nothing. - The browser CI job runs it. - RENDERER-CONTRACT.md and CURRENT-STATE.md describe the application on the stub and the boot check.
This commit is contained in:
1 parent
ae4fbb5053
commit
8a4867b1b7
7 files changed
+524
-9
No files matched your search
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* The whole application on the stub renderer (`src/render/stub`), with only
|
||||
* the contract's required members: the proof that the application runs on
|
||||
* those members alone, and needs no code that knows which renderer it is.
|
||||
* `scripts/qa-stub-boot.mjs` serves the application's page with this entry
|
||||
* in place of `src/main.js`, boots it headless, runs its data layers and
|
||||
* checks that no Cesium module loads.
|
||||
*
|
||||
* The stub runs nothing on its own: each animation frame here ticks it once.
|
||||
* `window.__stubBoot` exposes the application and the renderer it made.
|
||||
*/
|
||||
import { createStandaloneApplication } from '../../src/standalone/application.js';
|
||||
import { createStubRendererPlugin } from '../../src/render/stub/index.js';
|
||||
|
||||
const renderers = [];
|
||||
|
||||
/** Tick a renderer once per animation frame until it is destroyed. */
|
||||
function drive(renderer) {
|
||||
const step = () => {
|
||||
if (!renderers.includes(renderer)) return;
|
||||
renderer.testing.tick();
|
||||
requestAnimationFrame(step);
|
||||
};
|
||||
requestAnimationFrame(step);
|
||||
}
|
||||
|
||||
// The required tier, no capability at all; `?capabilities=all` gives the
|
||||
// stub every capability, to see what the layers draw with them.
|
||||
const allCapabilities =
|
||||
new URLSearchParams(location.search).get('capabilities') === 'all';
|
||||
|
||||
const plugin = createStubRendererPlugin(
|
||||
allCapabilities ? {} : { capabilities: [] },
|
||||
(renderer) => {
|
||||
renderers.push(renderer);
|
||||
const destroy = renderer.destroy.bind(renderer);
|
||||
renderer.destroy = () => {
|
||||
renderers.splice(renderers.indexOf(renderer), 1);
|
||||
destroy();
|
||||
};
|
||||
drive(renderer);
|
||||
},
|
||||
);
|
||||
|
||||
const application = createStandaloneApplication({
|
||||
renderer: plugin,
|
||||
allowQaRegistration: true,
|
||||
});
|
||||
|
||||
window.__stubBoot = {
|
||||
application,
|
||||
renderers,
|
||||
started: application.start().then(
|
||||
() => ({ ok: true }),
|
||||
(error) => {
|
||||
console.error('Stub application failed to start:', error);
|
||||
return { ok: false, error: String(error?.stack || error) };
|
||||
},
|
||||
),
|
||||
};
|
||||
Reference in new issue
Block a user