@quake2ts/test-utils 0.0.853 → 0.0.855

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quake2ts/test-utils",
3
- "version": "0.0.853",
3
+ "version": "0.0.855",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -55,10 +55,10 @@
55
55
  "serve-handler": "^6.1.6",
56
56
  "vitest": "^1.6.0",
57
57
  "webgpu": "^0.3.8",
58
- "@quake2ts/engine": "^0.0.853",
59
- "@quake2ts/game": "0.0.853",
60
- "@quake2ts/shared": "0.0.853",
61
- "@quake2ts/server": "0.0.853"
58
+ "@quake2ts/engine": "^0.0.855",
59
+ "@quake2ts/server": "0.0.855",
60
+ "@quake2ts/game": "0.0.855",
61
+ "@quake2ts/shared": "0.0.855"
62
62
  },
63
63
  "peerDependenciesMeta": {
64
64
  "@quake2ts/engine": {
@@ -114,10 +114,10 @@
114
114
  "typescript": "^5.9.3",
115
115
  "vitest": "^4.0.16",
116
116
  "webgpu": "^0.3.8",
117
- "@quake2ts/engine": "^0.0.853",
118
- "@quake2ts/game": "0.0.853",
119
- "@quake2ts/server": "0.0.853",
120
- "@quake2ts/shared": "0.0.853"
117
+ "@quake2ts/game": "0.0.855",
118
+ "@quake2ts/engine": "^0.0.855",
119
+ "@quake2ts/shared": "0.0.855",
120
+ "@quake2ts/server": "0.0.855"
121
121
  },
122
122
  "dependencies": {
123
123
  "upng-js": "^2.1.0"
@@ -122,14 +122,35 @@ export async function expectAnimationSnapshot(
122
122
  }
123
123
  }
124
124
 
125
- // 3. Save Baseline if needed
125
+ // 3. Verify animation actually changes (sanity check)
126
+ if (actualFrames.length > 1) {
127
+ const firstFrame = actualFrames[0];
128
+ const lastFrame = actualFrames[actualFrames.length - 1];
129
+ let differentPixels = 0;
130
+ for (let i = 0; i < firstFrame.length; i += 4) {
131
+ if (firstFrame[i] !== lastFrame[i] ||
132
+ firstFrame[i+1] !== lastFrame[i+1] ||
133
+ firstFrame[i+2] !== lastFrame[i+2]) {
134
+ differentPixels++;
135
+ }
136
+ }
137
+ const percentDiff = (differentPixels / (width * height)) * 100;
138
+ if (percentDiff < 0.1) {
139
+ console.warn(`WARNING: Animation '${name}' has minimal changes (${percentDiff.toFixed(2)}% pixels different). ` +
140
+ `First and last frames are nearly identical - animation may not be working!`);
141
+ } else {
142
+ console.log(`Animation '${name}': ${percentDiff.toFixed(2)}% of pixels changed from first to last frame`);
143
+ }
144
+ }
145
+
146
+ // 4. Save Baseline if needed
126
147
  if (shouldUpdateBaseline) {
127
148
  console.log(`Creating/Updating baseline for ${name} at ${baselinePath}`);
128
149
  await saveAPNG(baselinePath, actualFrames, width, height, delayMs);
129
150
  return;
130
151
  }
131
152
 
132
- // 4. Compare
153
+ // 5. Compare
133
154
  if (!baselineFrames) {
134
155
  throw new Error("Baseline frames missing despite checks.");
135
156
  }
@@ -165,7 +186,7 @@ export async function expectAnimationSnapshot(
165
186
  frameStats
166
187
  };
167
188
 
168
- // 5. Save Stats
189
+ // 6. Save Stats
169
190
  const statsPath = path.join(snapshotDir, 'stats', `${name}.json`);
170
191
  await fs.mkdir(path.dirname(statsPath), { recursive: true });
171
192
  await fs.writeFile(statsPath, JSON.stringify({
@@ -178,7 +199,7 @@ export async function expectAnimationSnapshot(
178
199
  frameCount: frameCount
179
200
  }, null, 2));
180
201
 
181
- // 6. Save Actual and Diff if failed or always save
202
+ // 7. Save Actual and Diff if failed or always save
182
203
  if (!passed || alwaysSave) {
183
204
  await saveAPNG(actualPath, actualFrames, width, height, delayMs);
184
205
  await saveAPNG(diffPath, diffFrames, width, height, delayMs);