Skip to content

Commit

Permalink
Run all tests for stopDaemon on all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
mantoni committed Sep 19, 2024
1 parent 3188cde commit 93771f4
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions lib/launcher.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});

Expand Down Expand Up @@ -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', () => {
Expand All @@ -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);
Expand Down

0 comments on commit 93771f4

Please sign in to comment.