From ca8146413a81c8fa83cd42178777ac34ed2ee8c7 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Mon, 20 Jan 2025 18:57:43 +0100 Subject: [PATCH] test(data_dir): fix flaky getPlatformAppDataDir test on Windows Delete the provided process.env.APPDATA on Windows, so that we can use our own values (one of which is "undefined", which was causing the getPlatformAppDataDir to fallback to the "real" process.env.APPDATA -> causing failing test, when run on Windows --- src/services/data_dir.spec.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/data_dir.spec.ts b/src/services/data_dir.spec.ts index 37958b185..4c94cbe94 100644 --- a/src/services/data_dir.spec.ts +++ b/src/services/data_dir.spec.ts @@ -77,6 +77,11 @@ describe("data_dir.ts unit tests", async () => { ["w/ darwin it should return '~/Library/Application Support'", ["darwin", undefined], "/Users/mock/Library/Application Support", "/Users/mock"] ]; + beforeEach(() => { + // make sure OS does not set its own process.env.APPDATA, so that we can use our own supplied value + delete process.env.APPDATA; + }); + testCases.forEach((testCase) => { const [testDescription, fnValues, expected, osHomedirMockValue] = testCase; return it(testDescription, () => {