diff --git a/react-packager/src/SocketInterface/__tests__/SocketServer-test.js b/react-packager/src/SocketInterface/__tests__/SocketServer-test.js index e006d612..39c28d96 100644 --- a/react-packager/src/SocketInterface/__tests__/SocketServer-test.js +++ b/react-packager/src/SocketInterface/__tests__/SocketServer-test.js @@ -22,6 +22,7 @@ var net = require('net'); describe('SocketServer', () => { let netServer; let bunser; + let processOn; beforeEach(() => { const {EventEmitter} = require.requireActual('events'); @@ -32,6 +33,14 @@ describe('SocketServer', () => { bunser = new EventEmitter(); bser.BunserBuf.mockImpl(() => bunser); bser.dumpToBuffer.mockImpl((a) => a); + + // Don't attach `process.on('exit')` handlers directly from SocketServer + processOn = process.on; + process.on = jest.genMockFn(); + }); + + afterEach(() => { + process.on = processOn; }); pit('create a server', () => {