MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / createServer

Function createServer

tests/e2e/helpers/app-launcher.test.js:16–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 }
15
16 function createServer() {
17 const behavior = plan[index++] || { type: 'success' }
18 const handlers = {}
19
20 return {
21 on(event, handler) {
22 handlers[event] = handler
23 },
24 listen(port, callback) {
25 state.listenPorts.push(port)
26 setImmediate(() => {
27 if (behavior.type === 'success') {
28 callback()
29 return
30 }
31 if (handlers.error) {
32 handlers.error({ code: behavior.code || 'EADDRINUSE' })
33 }
34 })
35 },
36 close() {
37 state.closeCount += 1
38 },
39 }
40 }
41
42 return { createServer, state }
43}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected