From d9b4cb28cb927484a82bb2ff8b3aecffbe5f3bfc Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Fri, 2 Feb 2024 16:57:20 -0500 Subject: [PATCH] chore(misc): fix e2es for cache and run (#21561) --- e2e/nx-run/src/cache.test.ts | 11 ++++++----- e2e/nx-run/src/run.test.ts | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/e2e/nx-run/src/cache.test.ts b/e2e/nx-run/src/cache.test.ts index bead4d29bab9d..950415e7b3b7f 100644 --- a/e2e/nx-run/src/cache.test.ts +++ b/e2e/nx-run/src/cache.test.ts @@ -18,8 +18,7 @@ describe('cache', () => { afterEach(() => cleanupProject()); - // TODO(crystal, @Cammisuli): Investigate why this is failing - xit('should cache command execution', async () => { + it('should cache command execution', async () => { const myapp1 = uniq('myapp1'); const myapp2 = uniq('myapp2'); runCLI(`generate @nx/web:app ${myapp1}`); @@ -123,9 +122,11 @@ describe('cache', () => { const originalNxJson = readFile('nx.json'); updateFile('nx.json', (c) => { const nxJson = JSON.parse(c); - for (const key in nxJson.targetDefaults ?? {}) { - delete nxJson.targetDefaults[key].cache; - } + nxJson.targetDefaults = { + build: { + cache: false, + }, + }; return JSON.stringify(nxJson, null, 2); }); diff --git a/e2e/nx-run/src/run.test.ts b/e2e/nx-run/src/run.test.ts index 82429623ec4c3..02417680b415e 100644 --- a/e2e/nx-run/src/run.test.ts +++ b/e2e/nx-run/src/run.test.ts @@ -765,8 +765,7 @@ describe('Nx Running Tests', () => { expect(output).toContain('Nx read the output from the cache'); }); - // TODO(crystal, @Cammisuli): Investigate why this is failing - xit('should read outputs', () => { + it('should read outputs', () => { const nodeCommands = [ "const fs = require('fs')", "fs.mkdirSync('../../tmp/exec-outputs-test', {recursive: true})", @@ -783,6 +782,7 @@ describe('Nx Running Tests', () => { nx: { targets: { build: { + cache: true, outputs: ['{workspaceRoot}/tmp/exec-outputs-test'], }, },