From 099f6cf4b6fedb32fcb66801d60253af09965635 Mon Sep 17 00:00:00 2001 From: ksraj123 Date: Wed, 29 Jul 2020 03:33:14 +0530 Subject: [PATCH] fixes EADDRINUSE while testing --- app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index f32a335..49c4f40 100644 --- a/app.js +++ b/app.js @@ -34,7 +34,9 @@ app.use(bodyParser.urlencoded(fileConstants.fileParameters)) const memoryStorage = multer.memoryStorage() app.use(multer({ storage: memoryStorage }).single('file')) -server.listen(process.env.SOCKET_PORT || 8810) +if (process.env.NODE_ENV !== 'testing') { + server.listen(process.env.SOCKET_PORT || 8810) +} // WARNING: app.listen(80) will NOT work here! const io = socket.listen(server)