1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Add tests for npm run scripts

This commit is contained in:
Chocobozzz 2017-09-07 15:27:35 +02:00
parent 04de542abd
commit fdbda9e3d6
25 changed files with 223 additions and 39 deletions

24
server/tests/utils/cli.ts Normal file
View file

@ -0,0 +1,24 @@
import { exec } from 'child_process'
import { ServerInfo } from './servers'
function getEnvCli (server?: ServerInfo) {
return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}`
}
async function execCLI (command: string) {
return new Promise((res, rej) => {
exec(command, (err, stdout, stderr) => {
if (err) return rej(err)
return res(stdout)
})
})
}
// ---------------------------------------------------------------------------
export {
execCLI,
getEnvCli
}