overleaf/services/document-updater/test/acceptance/coffee/helpers/DocUpdaterApp.coffee

21 lines
465 B
CoffeeScript
Raw Normal View History

2018-02-15 11:28:40 -05:00
app = require('../../../../app')
require("logger-sharelatex").logger.level("fatal")
module.exports =
running: false
initing: false
callbacks: []
ensureRunning: (callback = (error) ->) ->
if @running
return callback()
else if @initing
@callbacks.push callback
else
@initing = true
@callbacks.push callback
app.listen 3003, "localhost", (error) =>
2018-02-15 11:28:40 -05:00
throw error if error?
@running = true
for callback in @callbacks
callback()