Skip to content

Commit

Permalink
Add better control for killing nvim process
Browse files Browse the repository at this point in the history
  • Loading branch information
Billy Vong committed Jun 12, 2017
1 parent 6ae98c7 commit c9a3dd0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/attach.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ describe('Nvim Promise API', () => {
done();
});

afterAll(() => {
if (proc) {
proc.kill();
}
});

beforeEach(() => {
requests = [];
notifications = [];
Expand Down Expand Up @@ -96,8 +102,15 @@ describe('Nvim Promise API', () => {
});

it('emits "disconnect" after quit', done => {
nvim.on('disconnect', done);
const disconnectMock = jest.fn();
nvim.on('disconnect', disconnectMock);
nvim.quit();

proc.on('close', () => {
expect(disconnectMock.mock.calls.length).toBe(1);
done();
});

// Event doesn't actually emit when we quit nvim, but when the child process is killed
proc.kill();
});
Expand Down

0 comments on commit c9a3dd0

Please sign in to comment.