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); if(data.includes("Listening...")) test(); }); ls.stderr.on('data', (data) => { console.error(`stderr: ${data}`); }); 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() { if(startet) return; startet = true; console.log("Start testing"); let url = "localhost:7224"; await wsTester("wss://" + url + "/", kill); await postTester("https://" + url + "/", kill); kill(); }