@@ -2,40 +2,30 @@ MODEL: GPT-5.4-codex
22REASONING: high
33
44COMMAND:
5- Create BUILD_PR_TEST_RUNNER_DRIFT_FIX as a docs-following, test-only patch.
6-
7- Inspect these files first:
8- - tests/run-tests.mjs
9- - tests/games/AsteroidsValidation.test.mjs
10- - games/Asteroids/index.js
11- - tests/tools/VectorNativeTemplate.test.mjs
12-
13- Then apply the minimum safe changes needed to restore ` npm test --ignore-scripts ` :
14-
15- 1 . Re-align ` tests/games/AsteroidsValidation.test.mjs ` with the runner contract:
16- - export a named ` run `
17- - remove any self-executing ` run().catch(...) ` block if present
18- - preserve existing assertions and structure
19-
20- 2 . Fix the Asteroids validation environment using a Node-safe local shim:
21- - do NOT use ` document.body.innerHTML `
22- - inspect the boot path and mock only the minimal globals actually touched
23- - likely candidates: ` globalThis.document ` , ` document.getElementById('game') ` , a minimal fake canvas/context, and possibly ` globalThis.window `
24- - restore original globals after the test
25-
26- 3 . Update ` tests/tools/VectorNativeTemplate.test.mjs ` so the expected template path matches the current repo output:
27- - ` tools/templates/vector-native-arcade/ `
28-
29- Constraints:
30- - no broad rewrites
31- - no stub file replacement
32- - no runtime behavior changes in game code unless absolutely required by an already-existing contract mismatch
33- - no new heavy dependencies
34-
35- Validate with:
36- - npm test --ignore-scripts
37-
38- If there is another failing test afterward, report it separately instead of rolling unrelated fixes into this PR.
39-
40- NEXT COMMAND:
41- npm test --ignore-scripts
5+ Create a small test-only patch for the current Asteroids failure.
6+
7+ Primary target:
8+ - ` tests/games/AsteroidsValidation.test.mjs `
9+
10+ Do the following:
11+ 1 . Inspect the real file around the current failing call:
12+ - stack shows ` tests/games/AsteroidsValidation.test.mjs:152:37 `
13+ 2 . Preserve the existing structure and assertions.
14+ 3 . Ensure the file exports the named ` run ` function expected by ` tests/run-tests.mjs ` .
15+ 4 . Immediately before the failing ` bootAsteroidsNew(...) ` path, install the minimum Node-safe DOM/canvas shim so:
16+ - ` globalThis.document ` exists for this test scope
17+ - ` document.getElementById('game') ` returns a canvas-like object
18+ - the returned object supports the canvas methods/properties Asteroids boot actually uses
19+ 5 . Restore globals after the test scope finishes.
20+ 6 . Do not use a browser-only approach that assumes a full DOM implementation.
21+ 7 . Do not edit ` games/Asteroids/index.js ` .
22+
23+ Secondary target, only if still failing in the current branch:
24+ - ` tests/tools/VectorNativeTemplate.test.mjs `
25+ - update expected path from ` templates/vector-native-arcade/ ` to ` tools/templates/vector-native-arcade/ `
26+
27+ Success criteria:
28+ - ` npm test --ignore-scripts > output.txt `
29+ - the first failure is no longer ` Missing #game canvas element `
30+ - ` PASS AsteroidsValidation ` appears
31+ - stop after the first new failure, if any, and report it
0 commit comments