From 207eafd8175f24483af0a8dba5a3a9446f1b4926 Mon Sep 17 00:00:00 2001 From: adrianromanski Date: Fri, 3 Jan 2025 13:49:37 +0100 Subject: [PATCH] tests: use stubEnv instead of manual NX_CACHE_PROJECT_GRAPH setting --- projects/nx-verdaccio/src/plugin/caching.unit-test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/nx-verdaccio/src/plugin/caching.unit-test.ts b/projects/nx-verdaccio/src/plugin/caching.unit-test.ts index 182d0fa..92da088 100644 --- a/projects/nx-verdaccio/src/plugin/caching.unit-test.ts +++ b/projects/nx-verdaccio/src/plugin/caching.unit-test.ts @@ -148,14 +148,14 @@ describe('writeTargetsToCache', (): void => { }); it('should call writeJsonFile once with correct arguments if process.env.NX_CACHE_PROJECT_GRAPH !== false', (): void => { - process.env.NX_CACHE_PROJECT_GRAPH = 'true'; + vi.stubEnv('NX_CACHE_PROJECT_GRAPH', 'true'); writeTargetsToCache(path, MOCK_TARGETS_CACHE); expect(writeJsonFile).toHaveBeenCalledTimes(1); expect(writeJsonFile).toHaveBeenCalledWith(path, MOCK_TARGETS_CACHE); }); it('should not call writeJsonFile if process.env.NX_CACHE_PROJECT_GRAPH == false', (): void => { - process.env.NX_CACHE_PROJECT_GRAPH = 'false'; + vi.stubEnv('NX_CACHE_PROJECT_GRAPH', 'false'); writeTargetsToCache(path, MOCK_TARGETS_CACHE); expect(writeJsonFile).toHaveBeenCalledTimes(0); });