2023-03-10 12:44:23 +01:00
|
|
|
import { spawn } from "child_process";
|
|
|
|
import { postTester } from "./post.js";
|
|
|
|
import { wsTester } from "./ws.js";
|
|
|
|
|
|
|
|
let inCI = process.argv.includes("ci");
|
|
|
|
|
|
|
|
const ls = spawn('node', ['.', '-c', inCI ? 'test.juml' : 'testLocal.juml', '-d']);
|
|
|
|
|
|
|
|
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
|
|
|
|
|
|
|
|
ls.stdout.on('data', (data) => {
|
|
|
|
process.stdout.write(data);
|
2023-03-10 16:28:24 +01:00
|
|
|
if (data.includes("Listening...")) test();
|
2023-03-10 12:44:23 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
ls.stderr.on('data', (data) => {
|
|
|
|
console.error(`stderr: ${data}`);
|
2023-03-10 16:28:24 +01:00
|
|
|
|
2023-03-10 12:44:23 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
ls.on('close', (code) => {
|
|
|
|
console.log(`child process exited with code ${code}`);
|
|
|
|
process.exit(code);
|
|
|
|
});
|
|
|
|
|
|
|
|
function kill() {
|
|
|
|
ls.kill('SIGINT');
|
|
|
|
}
|
|
|
|
|
|
|
|
let startet = false;
|
|
|
|
|
|
|
|
async function test() {
|
2023-03-10 16:28:24 +01:00
|
|
|
if (startet) return;
|
2023-03-10 12:44:23 +01:00
|
|
|
startet = true;
|
|
|
|
console.log("Start testing");
|
|
|
|
let url = "localhost:7224";
|
|
|
|
await wsTester("wss://" + url + "/", kill);
|
|
|
|
await postTester("https://" + url + "/", kill);
|
|
|
|
kill();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|