Skip to content

Build the split simulator and run headless tests in CI - #7780

Draft
Eric Anderson (humanapp) wants to merge 4 commits into
microsoft:masterfrom
humanapp:humanapp/feat/boardRefactor
Draft

Eric Anderson (humanapp) wants to merge 4 commits into
microsoft:masterfrom
humanapp:humanapp/feat/boardRefactor

Conversation

@humanapp

Copy link
Copy Markdown

Arcade target changes for the DOM-free simulator split.

Vendoring the split simulator

scripts/copyArcadeSim.js copies the simulator's core/ and visuals/ folders alongside its root and public files, and strips the node_modules include entries from both tsconfig.core.json and tsconfig.json, so a local checkout builds the DOM-free and browser bundles from the sibling sim clone.

Headless tests

tests/sim holds ten programs that pxt simtest runs on top of libs/blocksprj, each asserting its own serial output: controller button events, a sprite's position and an overlap at a predicted frame, a stop against a tilemap wall, a countdown beside an update interval, a sprite's lifespan and the life-zero event, screen pixel readback across a palette change, a tone on the silent audio host, a settings round trip, and the text prompt falling back to the on-screen keyboard. The buildpush job runs the folder after pxt ci whenever the simulator checkout runs.

Generated declarations

The shims.d.ts files are regenerated, so I committed them.

copyArcadeSim.js copies the sim clone's core, visuals and visuals/components folders into node_modules/pxt-arcade-sim beside the root and public files, and removes the node_modules include entries from both tsconfig.json and tsconfig.core.json in the copy, so the vendored simulator builds its DOM-free core bundle and its browser bundle from the sibling clone's sources.
tests/sim holds six programs that pxt simtest runs on top of libs/blocksprj, each asserting its serial output: controller button events raised from the program, a sprite's position after a fixed span of virtual time, screen pixel readback across a palette change, music.playTone completing on the silent audio host, a settings round trip, and the text prompt falling back to the on-screen keyboard; the buildpush job runs the folder after pxt ci whenever the simulator checkout runs.
tests/sim gains four pxt simtest programs that drive themselves and assert through their own console output: the frame in which a sprite overlap fires, the stop position of a sprite against a tilemap wall with the hit-wall event, a countdown's end beside an update interval's tick count, and a sprite destroyed by its lifespan followed by the life-zero event, every value derived from the 20 ms frame loop and the game library's physics, with identical output across runs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant