Skip to content

Commit eb9ca06

Browse files
committed
Stabilize remaining post-refactor tests by fixing one behavioral assertion failure and one sandbox-sensitive validator execution path without reopening stale-path migration work.
& Clean up shared extraction guard violations and restore pretest to a reliable repo signal with minimal, documented changes.
1 parent 6e99186 commit eb9ca06

51 files changed

Lines changed: 2229 additions & 122 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

scripts/run-node-tests.mjs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,22 @@ David Quesenberry
44
03/21/2026
55
run-node-tests.mjs
66
*/
7-
import '../tests/run-tests.mjs';
7+
import path from 'node:path';
8+
import { registerHooks } from 'node:module';
9+
import { fileURLToPath, pathToFileURL } from 'node:url';
10+
11+
const repoRoot = fileURLToPath(new URL('..', import.meta.url));
12+
const ROOT_ALIASES = ['/src/', '/games/', '/tools/', '/samples/'];
13+
14+
registerHooks({
15+
resolve(specifier, context, nextResolve) {
16+
if (ROOT_ALIASES.some((prefix) => specifier.startsWith(prefix))) {
17+
const resolved = pathToFileURL(path.join(repoRoot, specifier.slice(1))).href;
18+
return nextResolve(resolved, context);
19+
}
20+
21+
return nextResolve(specifier, context);
22+
},
23+
});
24+
25+
await import('../tests/run-tests.mjs');

scripts/validate-games-template-contract.mjs

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ async function validateTarget(target) {
141141
return { issues, notes };
142142
}
143143

144-
async function main() {
144+
export async function validateGamesTemplateContract({ emitLogs = true } = {}) {
145145
const issues = [];
146146
const notes = [];
147147

@@ -174,14 +174,40 @@ async function main() {
174174
await fs.writeFile(REPORT_PATH, `${reportLines.join("\n")}\n`, "utf8");
175175

176176
if (issues.length > 0) {
177-
console.error("GAMES_TEMPLATE_CONTRACT_INVALID");
178-
issues.forEach((issue) => console.error(`- ${issue}`));
179-
process.exitCode = 1;
180-
return;
177+
if (emitLogs) {
178+
console.error("GAMES_TEMPLATE_CONTRACT_INVALID");
179+
issues.forEach((issue) => console.error(`- ${issue}`));
180+
}
181+
return {
182+
status: "invalid",
183+
issues,
184+
notes,
185+
targets,
186+
reportPath: toRepoRelative(REPORT_PATH)
187+
};
181188
}
182189

183-
console.log("GAMES_TEMPLATE_CONTRACT_VALID");
184-
console.log(`Report: ${toRepoRelative(REPORT_PATH)}`);
190+
if (emitLogs) {
191+
console.log("GAMES_TEMPLATE_CONTRACT_VALID");
192+
console.log(`Report: ${toRepoRelative(REPORT_PATH)}`);
193+
}
194+
195+
return {
196+
status: "valid",
197+
issues,
198+
notes,
199+
targets,
200+
reportPath: toRepoRelative(REPORT_PATH)
201+
};
185202
}
186203

187-
await main();
204+
async function main() {
205+
const result = await validateGamesTemplateContract({ emitLogs: true });
206+
if (result.status !== "valid") {
207+
process.exitCode = 1;
208+
}
209+
}
210+
211+
if (process.argv[1] && path.resolve(process.argv[1]) === __filename) {
212+
await main();
213+
}

tests/ai/AIBehaviors.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
findGridPath,
1313
stepChaseBehavior,
1414
stepEvadeBehavior,
15-
} from '/src/engine/ai/index.js';
15+
} from '../../src/engine/ai/index.js';
1616

1717
export function run() {
1818
const grid = [

tests/assets/AssetLoaderSystem.test.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ David Quesenberry
55
AssetLoaderSystem.test.mjs
66
*/
77
import assert from 'node:assert/strict';
8-
import AssetRegistry from '/src/engine/assets/AssetRegistry.js';
9-
import ImageAssetLoader from '/src/engine/assets/ImageAssetLoader.js';
10-
import AssetLoaderSystem from '/src/engine/assets/AssetLoaderSystem.js';
8+
import AssetRegistry from '../../src/engine/assets/AssetRegistry.js';
9+
import ImageAssetLoader from '../../src/engine/assets/ImageAssetLoader.js';
10+
import AssetLoaderSystem from '../../src/engine/assets/AssetLoaderSystem.js';
1111

1212
export async function run() {
1313
const registry = new AssetRegistry();

tests/audio/AudioService.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ David Quesenberry
55
AudioService.test.mjs
66
*/
77
import assert from 'node:assert/strict';
8-
import { AudioService } from '/src/engine/audio/index.js';
8+
import { AudioService } from '../../src/engine/audio/index.js';
99

1010
function createTarget() {
1111
const listeners = new Map();

tests/combat/Combat.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
startAttack,
1515
updateAttackState,
1616
updateCombatant,
17-
} from '/src/engine/combat/index.js';
17+
} from '../../src/engine/combat/index.js';
1818

1919
export function run() {
2020
const attacker = createCombatant({ x: 100, y: 100, width: 30, height: 30, facing: 1 });

tests/config/ConfigStore.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ David Quesenberry
55
ConfigStore.test.mjs
66
*/
77
import assert from 'node:assert/strict';
8-
import ConfigStore from '/src/engine/config/ConfigStore.js';
8+
import ConfigStore from '../../src/engine/config/ConfigStore.js';
99

1010
export function run() {
1111
const store = new ConfigStore();

tests/core/EngineFullscreen.test.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
EngineFullscreen.test.mjs
66
*/
77
import assert from 'node:assert/strict';
8-
import Engine from '/src/engine/core/Engine.js';
9-
import { FullscreenService } from '/src/engine/runtime/index.js';
8+
import Engine from '../../src/engine/core/Engine.js';
9+
import { FullscreenService } from '../../src/engine/runtime/index.js';
1010

1111
function createCanvas() {
1212
const canvas = {

tests/core/EngineSceneLifecycle.test.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
EngineSceneLifecycle.test.mjs
66
*/
77
import assert from 'node:assert/strict';
8-
import Engine from '/src/engine/core/Engine.js';
9-
import SceneTransition from '/src/engine/scenes/SceneTransition.js';
10-
import TransitionScene from '/src/engine/scenes/TransitionScene.js';
8+
import Engine from '../../src/engine/core/Engine.js';
9+
import SceneTransition from '../../src/engine/scenes/SceneTransition.js';
10+
import TransitionScene from '../../src/engine/scenes/TransitionScene.js';
1111

1212
function createCanvas() {
1313
const canvas = {

tests/core/EngineTiming.test.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
EngineTiming.test.mjs
66
*/
77
import assert from 'node:assert/strict';
8-
import Engine from '/src/engine/core/Engine.js';
9-
import FrameClock from '/src/engine/core/FrameClock.js';
10-
import FixedTicker from '/src/engine/core/FixedTicker.js';
8+
import Engine from '../../src/engine/core/Engine.js';
9+
import FrameClock from '../../src/engine/core/FrameClock.js';
10+
import FixedTicker from '../../src/engine/core/FixedTicker.js';
1111

1212
function createCanvas() {
1313
const canvas = {

0 commit comments

Comments
 (0)