20 lines
1.6 KiB
JavaScript
20 lines
1.6 KiB
JavaScript
import fs from "node:fs";
|
|
import { createRequire } from "node:module";
|
|
import { pathToFileURL } from "node:url";
|
|
const build = "/home/mes123456/FreeCADWasmDev/working/FreeCAD/freecad-source/build-web/configure/bin";
|
|
globalThis.require = createRequire(import.meta.url);
|
|
globalThis.__dirname = `${build}/`;
|
|
const loader = await import(pathToFileURL(`${build}/FreeCADWebPartDesignRuntimeProbe.js`));
|
|
const kernel = await loader.default({ wasmBinary: fs.readFileSync(`${build}/FreeCADWebPartDesignRuntimeProbe.wasm`), locateFile: file => file.endsWith(".worker.js") ? `${build}/FreeCADWebPartDesignRuntimeProbe.worker.cjs` : `${build}/${file}`, print: () => {}, printErr: () => {} });
|
|
const records = [
|
|
{ apiId: "py:PartDesign:method:Body.insertObject", name: "Body.insertObject", family: "document-graph", sourcePath: "src/Mod/PartDesign/App/Body.pyi", disposition: "not_implemented" },
|
|
{ apiId: "py:PartDesign:method:Feature.getBaseObject", name: "Feature.getBaseObject", family: "document-graph", sourcePath: "src/Mod/PartDesign/App/Feature.pyi", disposition: "not_implemented" },
|
|
];
|
|
const request = { cmd: "partdesign.pythonFamilyBatch", args: { tier: "tier-3-stateful", records } };
|
|
const call = () => JSON.parse(String(kernel.ccall("fc_web_dispatch_json", "string", ["string"], [JSON.stringify(request)])));
|
|
const result = call();
|
|
const repeat = call();
|
|
if (result.count !== 2 || result.records.some(row => row.status !== "exposed") || JSON.stringify(result) !== JSON.stringify(repeat) || result.resourcesReleased !== true) throw new Error(JSON.stringify({ result, repeat }));
|
|
console.log(JSON.stringify({ status: "pass", result, replayEqual: true }));
|
|
process.exit(0);
|