mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-05 07:13:11 +00:00
* update empty payload light push tests response * bump up nwaku version * remove only * remove diff between gowaku and nwaku
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
import { exec, spawn } from "child_process";
|
|
import { promisify } from "util";
|
|
|
|
const execAsync = promisify(exec);
|
|
|
|
const WAKUNODE_IMAGE = process.env.WAKUNODE_IMAGE || "wakuorg/nwaku:v0.21.0";
|
|
|
|
async function main() {
|
|
try {
|
|
await execAsync(`docker inspect ${WAKUNODE_IMAGE}`);
|
|
console.log(`Using local image ${WAKUNODE_IMAGE}`);
|
|
} catch (error) {
|
|
console.log(`Pulling image ${WAKUNODE_IMAGE}`);
|
|
await execAsync(`docker pull ${WAKUNODE_IMAGE}`);
|
|
console.log("Image pulled");
|
|
}
|
|
|
|
const mochaArgs = [
|
|
"mocha",
|
|
"--require",
|
|
"ts-node/register",
|
|
"--project",
|
|
"./tsconfig.dev.json",
|
|
...process.argv.slice(2)
|
|
];
|
|
|
|
// If in CI, add --parallel
|
|
if (process.env.CI) {
|
|
mochaArgs.push("--parallel");
|
|
console.log("Running tests in parallel");
|
|
} else {
|
|
console.log(
|
|
"Running tests serially. To enable parallel execution update mocha config"
|
|
);
|
|
}
|
|
|
|
// Run mocha tests
|
|
const mocha = spawn("npx", mochaArgs, {
|
|
stdio: "inherit"
|
|
});
|
|
|
|
mocha.on("error", (error) => {
|
|
console.log(`Error running mocha tests: ${error.message}`);
|
|
process.exit(1);
|
|
});
|
|
|
|
mocha.on("exit", (code) => {
|
|
console.log(`Mocha tests exited with code ${code}`);
|
|
process.exit(code || 0);
|
|
});
|
|
}
|
|
|
|
main().catch((error) => {
|
|
console.log(error);
|
|
process.exit(1);
|
|
});
|