Skip to content

Commit

Permalink
tests: change manual NX_CACHE_PROJECT_GRAPH setting to stubEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianRomanski committed Jan 5, 2025
1 parent 3c52145 commit 8bfe583
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions projects/nx-verdaccio/src/plugin/caching.unit-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('readTargetsCache', (): void => {
});

it('should return empty object if NX_CACHE_PROJECT_GRAPH = false', (): void => {
process.env.NX_CACHE_PROJECT_GRAPH = 'false';
vi.stubEnv('NX_CACHE_PROJECT_GRAPH', 'false');
expect(readTargetsCache(path)).toEqual({});
});

Expand All @@ -130,7 +130,7 @@ describe('readTargetsCache', (): void => {

it('should return empty object if existsSync returns false, and NX_CACHE_PROJECT_GRAPH = false', (): void => {
existsSyncSpy.mockImplementation((): boolean => false);
process.env.NX_CACHE_PROJECT_GRAPH = 'false';
vi.stubEnv('NX_CACHE_PROJECT_GRAPH', 'false');
expect(readTargetsCache(path)).toEqual({});
});
});
Expand All @@ -145,7 +145,7 @@ describe('writeTargetsToCache', (): void => {

afterEach((): void => {
writeJsonFile.mockRestore();
delete process.env.NX_CACHE_PROJECT_GRAPH;
vi.clearAllMocks();
});

it('should call writeJsonFile once with correct arguments if process.env.NX_CACHE_PROJECT_GRAPH !== false', (): void => {
Expand Down

0 comments on commit 8bfe583

Please sign in to comment.