Fix memory leak in unit tests (#5597)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-06-13 11:00:07 -04:00
1 parent 2eb585e88e
commit 3058bea88f
37 files changed
+1502 -1777

No files matched your search

+4 -4
View File
@@ -41,8 +41,8 @@ import { broadcastMessage } from "../../common/ipc";
import type { ChildProcess } from "child_process";
import { spawn } from "child_process";
import { Kubectl } from "../kubectl/kubectl";
import type { MockProxy } from "jest-mock-extended";
import { mock } from "jest-mock-extended";
import type { DeepMockProxy } from "jest-mock-extended";
import { mockDeep, mock } from "jest-mock-extended";
import { waitUntilUsed } from "tcp-port-used";
import type { Readable } from "stream";
import { EventEmitter } from "stream";
@@ -140,12 +140,12 @@ describe("kube auth proxy tests", () => {
});
describe("spawn tests", () => {
let mockedCP: MockProxy<ChildProcess>;
let mockedCP: DeepMockProxy<ChildProcess>;
let listeners: EventEmitter;
let proxy: KubeAuthProxy;
beforeEach(async () => {
mockedCP = mock<ChildProcess>();
mockedCP = mockDeep<ChildProcess>();
listeners = new EventEmitter();
const stderr = mockedCP.stderr = mock<Readable>();
const stdout = mockedCP.stdout = mock<Readable>();