18 lines
884 B
JavaScript
18 lines
884 B
JavaScript
import { execFileSync } from "node:child_process";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
const probe = path.join(root, "tools/web/probe-topology-collapse.mjs");
|
|
const output = execFileSync(process.execPath, [probe], { cwd: root, encoding: "utf8" }).trim();
|
|
const results = JSON.parse(output.split("\n").at(-1) ?? "[]");
|
|
const expected = new Set(["mesh:OpenQuad", "mesh:OpenNgon", "mesh:NonManifold"]);
|
|
|
|
for (const result of results) {
|
|
if (!expected.delete(result.meshId) || result.result !== 0 || result.triangles <= 0) {
|
|
throw new Error(`Topology Collapse failed: ${output}`);
|
|
}
|
|
}
|
|
if (expected.size > 0) throw new Error(`Topology Collapse fixture missing meshes: ${[...expected].join(", ")}`);
|
|
console.log(`topology-collapse-ok ${JSON.stringify(results)}`);
|