miaoda-game-devkit 0.2.16 → 0.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -251,14 +251,14 @@ function auditGameplayCollection(options, file, tests) {
251
251
  function getGameplayEvidenceIssues(id, requirements, evidence) {
252
252
  const issues = [];
253
253
  const inputEvents = evidence.mouseEvents + evidence.keyboardEvents + evidence.touchEvents;
254
- if (requirements.requireInput && inputEvents === 0) {
255
- issues.push(`contract "${id}" \u672A\u8BB0\u5F55\u771F\u5B9E DOM \u8F93\u5165\u3002`);
254
+ if (requirements.requireInput && (inputEvents === 0 || evidence.consumedInputEvents === 0)) {
255
+ issues.push(`contract "${id}" \u672A\u8BB0\u5F55\u88AB Phaser InputPlugin \u6D88\u8D39\u7684 DOM \u8F93\u5165\u3002`);
256
256
  }
257
- if (requirements.requireFrameAdvance && evidence.frames === 0) {
258
- issues.push(`contract "${id}" \u672A\u63A8\u8FDB\u5B8C\u6574 Phaser \u5E27\u3002`);
257
+ if (requirements.requireFrameAdvance && (evidence.frames === 0 || evidence.observedFrames === 0)) {
258
+ issues.push(`contract "${id}" \u672A\u8BB0\u5F55\u7531\u6D3B\u52A8 Scene \u5B9E\u9645\u6267\u884C\u7684\u5B8C\u6574 Phaser \u5E27\u3002`);
259
259
  }
260
- if (requirements.requirePhysicsStep && evidence.physicsSteps === 0) {
261
- issues.push(`contract "${id}" \u672A\u63A8\u8FDB Arcade Physics\u3002`);
260
+ if (requirements.requirePhysicsStep && (evidence.physicsSteps === 0 || evidence.observedPhysicsSteps === 0)) {
261
+ issues.push(`contract "${id}" \u672A\u8BB0\u5F55 Arcade WORLD_STEP\u3002`);
262
262
  }
263
263
  for (const target of normalizeList(requirements.requireTransition)) {
264
264
  if (!evidence.transitions.some((transition) => transition.to === target)) {
@@ -431,9 +431,9 @@ function formatGameplayIssues(issues) {
431
431
  unhandled: "\u5F02\u6B65\u9519\u8BEF\uFF1A\u5148\u4FEE\u590D\u4E0A\u65B9\u663E\u793A\u7684\u7B2C\u4E00\u6761\u9519\u8BEF\uFF1B\u8F93\u5165\u3001\u5E27\u63A8\u8FDB\u548C\u751F\u547D\u5468\u671F\u64CD\u4F5C\u90FD\u8981\u5728\u6B63\u786E\u7684 host \u751F\u547D\u5468\u671F\u5185\u5E76\u4F7F\u7528 await\u3002"
432
432
  };
433
433
  const getCategory = (issue) => {
434
- if (issue.includes("\u672A\u8BB0\u5F55\u771F\u5B9E DOM \u8F93\u5165")) return { category: "input", key: "input" };
435
- if (issue.includes("\u672A\u63A8\u8FDB\u5B8C\u6574 Phaser \u5E27")) return { category: "frames", key: "frames" };
436
- if (issue.includes("\u672A\u63A8\u8FDB Arcade Physics")) return { category: "physics", key: "physics" };
434
+ if (issue.includes("\u672A\u8BB0\u5F55\u771F\u5B9E DOM \u8F93\u5165") || issue.includes("Phaser InputPlugin \u6D88\u8D39\u7684 DOM \u8F93\u5165")) return { category: "input", key: "input" };
435
+ if (issue.includes("\u672A\u63A8\u8FDB\u5B8C\u6574 Phaser \u5E27") || issue.includes("\u6D3B\u52A8 Scene \u5B9E\u9645\u6267\u884C\u7684\u5B8C\u6574 Phaser \u5E27")) return { category: "frames", key: "frames" };
436
+ if (issue.includes("\u672A\u63A8\u8FDB Arcade Physics") || issue.includes("\u672A\u8BB0\u5F55 Arcade WORLD_STEP")) return { category: "physics", key: "physics" };
437
437
  if (issue.includes("\u672A\u8BB0\u5F55\u5230 ") && issue.includes("Scene \u8F6C\u573A")) {
438
438
  const target = issue.match(/未记录到 (.+?) 的 Scene 转场/)?.[1] ?? "unknown";
439
439
  return { category: "transition", key: `transition:${target}` };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miaoda-game-devkit",
3
- "version": "0.2.16",
3
+ "version": "0.2.19",
4
4
  "description": "Shared React and Phaser game lint plus deterministic testing tools for Miaoda games",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -126,6 +126,7 @@
126
126
  "peerDependencies": {
127
127
  "@testing-library/jest-dom": ">=6 <8",
128
128
  "@testing-library/react": ">=16 <17",
129
+ "@testing-library/user-event": ">=14 <15",
129
130
  "phaser": ">=4.0.0 <5",
130
131
  "phaser4-rex-plugins": ">=4.0.0 <5",
131
132
  "react": ">=19 <20",
@@ -139,6 +140,9 @@
139
140
  "@testing-library/react": {
140
141
  "optional": true
141
142
  },
143
+ "@testing-library/user-event": {
144
+ "optional": true
145
+ },
142
146
  "phaser": {
143
147
  "optional": true
144
148
  },