@@ -3,20 +3,9 @@ import { NeovimClient } from './api/client';
33import { attach } from './attach' ;
44import { findNvim } from './utils/findNvim' ;
55
6- let proc : cp . ChildProcessWithoutNullStreams ;
7- let nvim : NeovimClient ;
8-
9- /**
10- * Gets the current Nvim client being used in the current test.
11- */
12- export function getNvim ( ) : NeovimClient {
13- return nvim ;
14- }
15-
16- export function getNvimProc ( ) : cp . ChildProcessWithoutNullStreams {
17- return proc ;
18- }
19-
6+ export function startNvim ( ) : [ cp . ChildProcessWithoutNullStreams , NeovimClient ]
7+ export function startNvim ( doAttach : false ) : [ cp . ChildProcessWithoutNullStreams , undefined ]
8+ export function startNvim ( doAttach : true ) : [ cp . ChildProcessWithoutNullStreams , NeovimClient ]
209export function startNvim (
2110 doAttach : boolean = true
2211) : [ cp . ChildProcessWithoutNullStreams , NeovimClient | undefined ] {
@@ -33,23 +22,15 @@ export function startNvim(
3322export function stopNvim (
3423 proc_ : cp . ChildProcessWithoutNullStreams | NeovimClient
3524) {
36- if ( proc_ instanceof NeovimClient ) {
25+ if ( ! proc_ ) {
26+ return ;
27+ } else if ( proc_ instanceof NeovimClient ) {
3728 proc_ . quit ( ) ;
3829 } else if ( proc_ && proc_ . connected ) {
3930 proc_ . disconnect ( ) ;
4031 }
4132}
4233
43- export function startNvim2 ( ) : void {
44- [ proc , nvim ] = startNvim ( ) ;
45- }
46-
47- // TODO: use jest beforeAll/afterAll instead of requiring the tests to do this explicitly.
48- export function stopNvim2 ( ) : void {
49- stopNvim ( proc ) ;
50- stopNvim ( nvim ) ;
51- }
52-
5334export function findNvimOrFail ( ) {
5435 const minVersion = '0.9.5' ;
5536 const found = findNvim ( { minVersion } ) ;
@@ -58,7 +39,3 @@ export function findNvimOrFail() {
5839 }
5940 return found . matches [ 0 ] . path ;
6041}
61-
62- // beforeAll(async () => {
63- // [proc, nvim] = testUtil.startNvim();
64- // });
0 commit comments