mirror of https://github.com/Chocobozzz/PeerTube
Add inspect to test script
parent
f45c7cc770
commit
bd2e2f11d0
|
@ -39,7 +39,7 @@ async function run () {
|
|||
|
||||
console.log('Starting server.')
|
||||
|
||||
const server = await flushAndRunServer(1, {}, [], false)
|
||||
const server = await flushAndRunServer(1, {}, [], { hideLogs: false, execArgv: [ '--inspect' ] })
|
||||
|
||||
const cleanup = () => {
|
||||
console.log('Killing server')
|
||||
|
|
|
@ -104,7 +104,12 @@ function randomRTMP () {
|
|||
return randomInt(low, high)
|
||||
}
|
||||
|
||||
async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = [], silent = true) {
|
||||
type RunServerOptions = {
|
||||
hideLogs?: boolean
|
||||
execArgv?: string[]
|
||||
}
|
||||
|
||||
async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = [], options: RunServerOptions = {}) {
|
||||
const parallel = parallelTests()
|
||||
|
||||
const internalServerNumber = parallel ? randomServer() : serverNumber
|
||||
|
@ -133,10 +138,10 @@ async function flushAndRunServer (serverNumber: number, configOverride?: Object,
|
|||
}
|
||||
}
|
||||
|
||||
return runServer(server, configOverride, args, silent)
|
||||
return runServer(server, configOverride, args, options)
|
||||
}
|
||||
|
||||
async function runServer (server: ServerInfo, configOverrideArg?: any, args = [], silent?: boolean) {
|
||||
async function runServer (server: ServerInfo, configOverrideArg?: any, args = [], options: RunServerOptions = {}) {
|
||||
// These actions are async so we need to be sure that they have both been done
|
||||
const serverRunString = {
|
||||
'Server listening': false
|
||||
|
@ -208,14 +213,15 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []
|
|||
env['NODE_APP_INSTANCE'] = server.internalServerNumber.toString()
|
||||
env['NODE_CONFIG'] = JSON.stringify(configOverride)
|
||||
|
||||
const options = {
|
||||
const forkOptions = {
|
||||
silent: true,
|
||||
env,
|
||||
detached: true
|
||||
detached: true,
|
||||
execArgv: options.execArgv || []
|
||||
}
|
||||
|
||||
return new Promise<ServerInfo>(res => {
|
||||
server.app = fork(join(root(), 'dist', 'server.js'), args, options)
|
||||
server.app = fork(join(root(), 'dist', 'server.js'), args, forkOptions)
|
||||
server.app.stdout.on('data', function onStdout (data) {
|
||||
let dontContinue = false
|
||||
|
||||
|
@ -240,7 +246,7 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []
|
|||
// If no, there is maybe one thing not already initialized (client/user credentials generation...)
|
||||
if (dontContinue === true) return
|
||||
|
||||
if (silent === false) {
|
||||
if (options.hideLogs === false) {
|
||||
console.log(data.toString())
|
||||
} else {
|
||||
server.app.stdout.removeListener('data', onStdout)
|
||||
|
|
Loading…
Reference in New Issue