beforeEach(async () => { child = (await createTestProcess()).child comm = new Comm(child.pid, undefined) await comm.connect() })
describe('InspectWorker', () => { it( 'should open an inspect port for workers', async () => { const child = (await createTestProcess('thread')).child const comm = new Comm(child.pid, undefined) await comm.connect() const workers = await comm.getWorkers() expect(workers.length).toBe(2) await comm.inspectWorker(workers[0].sessionId) await comm.disconnect() child.kill() }, kTimeout ) })
it('should work with address of the inspector server', async () => { const child = (await createTestProcess(undefined, ['--inspect=9230'])) .child const comm = new Comm(undefined, '127.0.0.1:9230') await comm.connect() const ret = await comm.openInspect() expect(ret).toEqual({ host: expect.anything(), address: expect.anything(), family: expect.anything(), port: expect.anything(), tcpProxy: expect.anything(), }) await comm.disconnect() child.kill() await wait(100) })
'should open inspect port with specified port', async () => { const child = (await createTestProcess()).child ;(process as any)._debugProcess(child.pid) await wait(200)
child = (await createTestProcess('net_socket_server')).child; comm = new Comm(child.pid, undefined); await comm.connect();
'should work with net.Socket and net.Server', async () => { child = (await createTestProcess('net_socket_server')).child comm = new Comm(child.pid, undefined) await comm.connect() 'should work with dgram.Socket', async () => { child = (await createTestProcess('udp_socket')).child comm = new Comm(child.pid, undefined) await comm.connect() child = (await createTestProcess('childprocess')).child comm = new Comm(child.pid, undefined) await comm.connect()
beforeEach(async () => { child = (await createTestProcess()).child comm = new Comm(child.pid, undefined) await comm.connect() })
describe('InspectWorker', () => { it( 'should open an inspect port for workers', async () => { const child = (await createTestProcess('thread')).child const comm = new Comm(child.pid, undefined) await comm.connect() const workers = await comm.getWorkers() expect(workers.length).toBe(2) await comm.inspectWorker(workers[0].sessionId) await comm.disconnect() child.kill() }, kTimeout ) })
it('should work with address of the inspector server', async () => { const child = (await createTestProcess(undefined, ['--inspect=9230'])) .child const comm = new Comm(undefined, '127.0.0.1:9230') await comm.connect() const ret = await comm.openInspect() expect(ret).toEqual({ host: expect.anything(), address: expect.anything(), family: expect.anything(), port: expect.anything(), tcpProxy: expect.anything(), }) await comm.disconnect() child.kill() await wait(100) })
'should open inspect port with specified port', async () => { const child = (await createTestProcess()).child ;(process as any)._debugProcess(child.pid) await wait(200)
child = (await createTestProcess('net_socket_server')).child; comm = new Comm(child.pid, undefined); await comm.connect();
'should work with net.Socket and net.Server', async () => { child = (await createTestProcess('net_socket_server')).child comm = new Comm(child.pid, undefined) await comm.connect() 'should work with dgram.Socket', async () => { child = (await createTestProcess('udp_socket')).child comm = new Comm(child.pid, undefined) await comm.connect() child = (await createTestProcess('childprocess')).child comm = new Comm(child.pid, undefined) await comm.connect()