overleaf/services/chat/test/acceptance/js/helpers/ChatApp.js

21 lines
428 B
JavaScript
Raw Normal View History

import { server } from '../../../../app/js/server.js'
export { db } from '../../../../app/js/mongodb.js'
let serverPromise = null
function startServer(resolve, reject) {
server.listen(3010, 'localhost', error => {
if (error) {
return reject(error)
}
resolve()
})
}
export async function ensureRunning() {
if (!serverPromise) {
serverPromise = new Promise(startServer)
}
return serverPromise
}