deno.land / x / alosaur@v1.1.1 / e2e / test.utils.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
import { delay } from "../examples/_utils/test.utils.ts";import { assert } from "../src/deps_test.ts";
export async function startServer(serverPath: string): Promise<Deno.Process> { let process: Deno.Process;
process = Deno.run({ cmd: [ Deno.execPath(), "run", "-A", "--importmap=imports.json", "--unstable", "--config", "deno.json", serverPath, ], stdout: "piped", stderr: "inherit", }); // Once server is ready it will write to its stdout. assert(process.stdout != null);
// const r = new TextProtoReader(new BufReader(process.stdout as any)); const r = process.stdout.readable.getReader(); let s = await r.read();
// assert(s !== null && s.includes("Server start in")); assert(s !== null);
// TODO delete, need for run other tests, bug in Deno 1.40.4 await delay(1);
return Promise.resolve(process);}
export function killServer(process: Deno.Process): void { process.close(); (process.stdout as any)?.close();}
alosaur

Version Info

Tagged at
2 months ago