-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathwebpack.ts
43 lines (40 loc) · 1.01 KB
/
webpack.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import cp from "child_process";
import { sleep_for } from "tstl";
import { MyConfiguration } from "../src/MyConfiguration";
import { MyGlobal } from "../src/MyGlobal";
import api from "../src/api";
import { TestAutomation } from "./TestAutomation";
const wait = async (): Promise<void> => {
const connection: api.IConnection = {
host: `http://localhost:${MyConfiguration.API_PORT()}`,
};
while (true)
try {
await api.functional.monitors.health.get(connection);
return;
} catch {
await sleep_for(100);
}
};
const main = async (): Promise<void> => {
MyGlobal.testing = true;
await TestAutomation.execute({
open: async () => {
const backend: cp.ChildProcess = cp.fork(
`${MyConfiguration.ROOT}/dist/server.js`,
{
cwd: `${MyConfiguration.ROOT}/dist`,
},
);
await wait();
return backend;
},
close: async (backend) => {
backend.kill();
},
});
};
main().catch((exp) => {
console.log(exp);
process.exit(-1);
});