@quake2ts/test-utils 0.0.814 → 0.0.816
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/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/visual/animation-snapshots.ts +4 -1
- package/src/visual/snapshots.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quake2ts/test-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.816",
|
|
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.
|
|
59
|
-
"@quake2ts/game": "0.0.
|
|
60
|
-
"@quake2ts/
|
|
61
|
-
"@quake2ts/
|
|
58
|
+
"@quake2ts/engine": "^0.0.816",
|
|
59
|
+
"@quake2ts/game": "0.0.816",
|
|
60
|
+
"@quake2ts/shared": "0.0.816",
|
|
61
|
+
"@quake2ts/server": "0.0.816"
|
|
62
62
|
},
|
|
63
63
|
"peerDependenciesMeta": {
|
|
64
64
|
"@quake2ts/engine": {
|
|
@@ -114,10 +114,10 @@
|
|
|
114
114
|
"vitest": "^4.0.16",
|
|
115
115
|
"serve-handler": "^6.1.6",
|
|
116
116
|
"webgpu": "^0.3.8",
|
|
117
|
-
"@quake2ts/engine": "^0.0.
|
|
118
|
-
"@quake2ts/game": "0.0.
|
|
119
|
-
"@quake2ts/shared": "0.0.
|
|
120
|
-
"@quake2ts/server": "0.0.
|
|
117
|
+
"@quake2ts/engine": "^0.0.816",
|
|
118
|
+
"@quake2ts/game": "0.0.816",
|
|
119
|
+
"@quake2ts/shared": "0.0.816",
|
|
120
|
+
"@quake2ts/server": "0.0.816"
|
|
121
121
|
},
|
|
122
122
|
"dependencies": {
|
|
123
123
|
"upng-js": "^2.1.0"
|
|
@@ -70,7 +70,7 @@ export async function expectAnimationSnapshot(
|
|
|
70
70
|
height,
|
|
71
71
|
frameCount,
|
|
72
72
|
fps = 10,
|
|
73
|
-
updateBaseline = false,
|
|
73
|
+
updateBaseline: updateBaselineOption = false,
|
|
74
74
|
snapshotDir = path.join(process.cwd(), 'tests', '__snapshots__'),
|
|
75
75
|
threshold = 0.1,
|
|
76
76
|
maxDifferencePercent = 0.1
|
|
@@ -85,6 +85,9 @@ export async function expectAnimationSnapshot(
|
|
|
85
85
|
const diffPath = getSnapshotPath(name, 'diff', snapshotDir);
|
|
86
86
|
const alwaysSave = process.env.ALWAYS_SAVE_SNAPSHOTS === '1';
|
|
87
87
|
|
|
88
|
+
// Check global env var for updating snapshots
|
|
89
|
+
const updateBaseline = updateBaselineOption || process.env.UPDATE_SNAPSHOTS === '1';
|
|
90
|
+
|
|
88
91
|
// 1. Capture all frames
|
|
89
92
|
const actualFrames: Uint8ClampedArray[] = [];
|
|
90
93
|
for (let i = 0; i < frameCount; i++) {
|
package/src/visual/snapshots.ts
CHANGED
|
@@ -212,7 +212,7 @@ export async function expectSnapshot(
|
|
|
212
212
|
name,
|
|
213
213
|
width,
|
|
214
214
|
height,
|
|
215
|
-
updateBaseline = false,
|
|
215
|
+
updateBaseline: updateBaselineOption = false,
|
|
216
216
|
snapshotDir = path.join(process.cwd(), 'tests', '__snapshots__') // Default to current working dir/tests/__snapshots__
|
|
217
217
|
} = options;
|
|
218
218
|
|
|
@@ -225,6 +225,8 @@ export async function expectSnapshot(
|
|
|
225
225
|
const diffPath = getSnapshotPath(name, 'diff', snapshotDir);
|
|
226
226
|
|
|
227
227
|
const alwaysSave = process.env.ALWAYS_SAVE_SNAPSHOTS === '1';
|
|
228
|
+
// Check global env var for updating snapshots
|
|
229
|
+
const updateBaseline = updateBaselineOption || process.env.UPDATE_SNAPSHOTS === '1';
|
|
228
230
|
|
|
229
231
|
// If update baseline is requested or baseline doesn't exist, save as baseline and return
|
|
230
232
|
if (updateBaseline || !existsSync(baselinePath)) {
|