From 79cbbe0209675a9638fd15397bd0226b220ea051 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Wed, 16 Aug 2023 23:51:26 +0000 Subject: [PATCH] Change how we use readFileSync to renable mockfs to work. --- src/config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.ts b/src/config.ts index 2ec81d364a..92a4292f38 100644 --- a/src/config.ts +++ b/src/config.ts @@ -142,7 +142,7 @@ export class KubeConfig implements SecurityAuthentication { public loadFromFile(file: string, opts?: Partial): void { const rootDirectory = path.dirname(file); - this.loadFromString(fs.readFileSync(file, 'utf8'), opts); + this.loadFromString(fs.readFileSync(file).toString('utf-8'), opts); this.makePathsAbsolute(rootDirectory); } @@ -323,7 +323,7 @@ export class KubeConfig implements SecurityAuthentication { const namespaceFile = `${pathPrefix}${SERVICEACCOUNT_NAMESPACE_PATH}`; let namespace: string | undefined; if (fileExists(namespaceFile)) { - namespace = fs.readFileSync(namespaceFile, 'utf8'); + namespace = fs.readFileSync(namespaceFile).toString('utf-8'); } this.contexts = [ {