From 93771f48c9d82bb2dc53e5737ec761468c1c5238 Mon Sep 17 00:00:00 2001 From: Maximilian Antoni Date: Thu, 19 Sep 2024 09:22:19 +0200 Subject: [PATCH] Run all tests for stopDaemon on all platforms --- lib/launcher.test.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/launcher.test.js b/lib/launcher.test.js index 2040480..1e6e008 100644 --- a/lib/launcher.test.js +++ b/lib/launcher.test.js @@ -190,13 +190,10 @@ describe('lib/launcher', () => { }); context('unix: stopDaemon', () => { - if (os.platform() === 'win32') { - return; - } - const config = { token: 'token', port: 123, pid: 456, hash: 'hash' }; beforeEach(() => { + sinon.replace(os, 'platform', sinon.fake.returns('darwin')); sinon.replace(fs_promises, 'unlink', sinon.fake.resolves()); }); @@ -257,14 +254,13 @@ describe('lib/launcher', () => { }); context('win32: stopDaemon', () => { - if (os.platform() !== 'win32') { - return; - } - + const sockets = []; let server; let config; - const sockets = []; + beforeEach((done) => { + sinon.replace(os, 'platform', sinon.fake.returns('win32')); + sinon.replace(fs_promises, 'unlink', sinon.fake.resolves()); server = net.createServer(); server.on('connection', (socket) => sockets.push(socket)); server.listen(0, '127.0.0.1', () => { @@ -279,10 +275,6 @@ describe('lib/launcher', () => { server.close(done); }); - beforeEach(() => { - sinon.replace(fs_promises, 'unlink', sinon.fake.resolves()); - }); - context('without exception', () => { it('send stop command to server listening on port from config', (done) => { stopDaemon(resolver, config);