before(async function () {
this.timeout(30000)
- server = await createSingleServer(1, {}, [ '--no-client' ])
+ server = await createSingleServer(1, {}, { peertubeArgs: [ '--no-client' ] })
})
it('Should fail getting the client', function () {
console.log('Starting server.')
- const server = await createSingleServer(1, {}, [], { hideLogs: false, execArgv: [ '--inspect' ] })
+ const server = await createSingleServer(1, {}, { hideLogs: false, nodeArgs: [ '--inspect' ] })
const cleanup = async () => {
console.log('Killing server')
export type RunServerOptions = {
hideLogs?: boolean
- execArgv?: string[]
+ nodeArgs?: string[]
+ peertubeArgs?: string[]
}
export class PeerTubeServer {
this.port = parseInt(parsed.port)
}
- async flushAndRun (configOverride?: Object, args = [], options: RunServerOptions = {}) {
+ async flushAndRun (configOverride?: Object, options: RunServerOptions = {}) {
await ServersCommand.flushTests(this.internalServerNumber)
- return this.run(configOverride, args, options)
+ return this.run(configOverride, options)
}
- async run (configOverrideArg?: any, args = [], options: RunServerOptions = {}) {
+ async run (configOverrideArg?: any, options: RunServerOptions = {}) {
// These actions are async so we need to be sure that they have both been done
const serverRunString = {
'HTTP server listening': false
silent: true,
env,
detached: true,
- execArgv: options.execArgv || []
+ execArgv: options.nodeArgs || []
}
return new Promise<void>(res => {
const self = this
- this.app = fork(join(root(), 'dist', 'server.js'), args, forkOptions)
+ this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions)
this.app.stdout.on('data', function onStdout (data) {
let dontContinue = false
import { isGithubCI } from '../miscs'
import { PeerTubeServer, RunServerOptions } from './server'
-async function createSingleServer (serverNumber: number, configOverride?: Object, args = [], options: RunServerOptions = {}) {
+async function createSingleServer (serverNumber: number, configOverride?: Object, options: RunServerOptions = {}) {
const server = new PeerTubeServer({ serverNumber })
- await server.flushAndRun(configOverride, args, options)
+ await server.flushAndRun(configOverride, options)
return server
}