(vibe) Added testframework
This commit is contained in:
32
js/main.js
32
js/main.js
@@ -12,3 +12,35 @@ module.exports.loop = function () {
|
||||
if (mod !== undefined)
|
||||
mod.loop();
|
||||
}
|
||||
|
||||
// Expose runTests function for console testing
|
||||
module.exports.runTests = function () {
|
||||
if (mod !== undefined && typeof mod.runTests === 'function') {
|
||||
console.log("Running Douwco Hivemind tests...");
|
||||
mod.runTests();
|
||||
|
||||
// Get and display test results
|
||||
try {
|
||||
const results = mod.getTestResults();
|
||||
const passed = mod.getPassedCount();
|
||||
const failed = mod.getFailedCount();
|
||||
const total = mod.getTotalCount();
|
||||
|
||||
console.log(results);
|
||||
console.log(`Test Summary: ${passed}/${total} passed, ${failed} failed`);
|
||||
|
||||
return `Tests completed: ${passed} passed, ${failed} failed`;
|
||||
} catch (e) {
|
||||
console.log("Tests completed. Could not retrieve detailed results:", e.message);
|
||||
return "Tests completed. Check console for basic output.";
|
||||
}
|
||||
} else {
|
||||
console.log("ERROR: runTests function not available in WASM module");
|
||||
return "ERROR: Testing framework not available";
|
||||
}
|
||||
}
|
||||
|
||||
// Also expose globally for direct console access
|
||||
if (typeof global !== 'undefined') {
|
||||
global.runTests = module.exports.runTests;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user