diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-28 13:59:22 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-28 13:59:22 +0100 |
commit | c5d31dba56d669c0df0209761c43c5a6ac7cec4a (patch) | |
tree | fe72b56a1c0e7beb6e092c393a00ddfe93a5d71f /server/tests/utils/cli/cli.ts | |
parent | db799da3d2b2ea465165df78ff71effa653b6309 (diff) | |
download | PeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.tar.gz PeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.tar.zst PeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.zip |
Tests directories refractor
Diffstat (limited to 'server/tests/utils/cli/cli.ts')
-rw-r--r-- | server/tests/utils/cli/cli.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/server/tests/utils/cli/cli.ts b/server/tests/utils/cli/cli.ts new file mode 100644 index 000000000..54d05e9c6 --- /dev/null +++ b/server/tests/utils/cli/cli.ts | |||
@@ -0,0 +1,24 @@ | |||
1 | import { exec } from 'child_process' | ||
2 | |||
3 | import { ServerInfo } from '../server/servers' | ||
4 | |||
5 | function getEnvCli (server?: ServerInfo) { | ||
6 | return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}` | ||
7 | } | ||
8 | |||
9 | async function execCLI (command: string) { | ||
10 | return new Promise<string>((res, rej) => { | ||
11 | exec(command, (err, stdout, stderr) => { | ||
12 | if (err) return rej(err) | ||
13 | |||
14 | return res(stdout) | ||
15 | }) | ||
16 | }) | ||
17 | } | ||
18 | |||
19 | // --------------------------------------------------------------------------- | ||
20 | |||
21 | export { | ||
22 | execCLI, | ||
23 | getEnvCli | ||
24 | } | ||