From 53781b9b0de459cad779764db32daae38c2bbda8 Mon Sep 17 00:00:00 2001 From: Samuel Corsi-House Date: Tue, 8 Feb 2022 13:04:58 -0500 Subject: [PATCH 1/2] fix(run): no-cache flag --- cli/internal/run/run.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/internal/run/run.go b/cli/internal/run/run.go index a3b681ba8a4c7..699a6d497574e 100644 --- a/cli/internal/run/run.go +++ b/cli/internal/run/run.go @@ -785,7 +785,7 @@ func parseRunArgs(args []string, cwd string) (*RunOptions, error) { case strings.HasPrefix(arg, "--no-deps"): runOptions.includeDependents = false case strings.HasPrefix(arg, "--no-cache"): - runOptions.cache = true + runOptions.cache = false case strings.HasPrefix(arg, "--cacheFolder"): log.Printf("[WARNING] The --cacheFolder flag has been deprecated and will be removed in future versions of turbo. Please use `--cache-dir` instead") unresolvedCacheFolder = arg[len("--cacheFolder="):] From d81311665f337788ba9459f5173c671f12214cb2 Mon Sep 17 00:00:00 2001 From: Samuel Corsi-House Date: Sat, 19 Feb 2022 09:28:12 -0500 Subject: [PATCH 2/2] chore(e2e): add e2e tests --- cli/scripts/e2e/e2e.ts | 43 +++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/cli/scripts/e2e/e2e.ts b/cli/scripts/e2e/e2e.ts index 0e686fc974d93..1f67cd6dbd5f4 100644 --- a/cli/scripts/e2e/e2e.ts +++ b/cli/scripts/e2e/e2e.ts @@ -63,9 +63,9 @@ function runSmokeTests( }); suite( - `${npmClient} runs tests and logs ${ + `${npmClient} runs tests and logs${ options.cwd ? " from " + options.cwd : "" - } `, + }`, async () => { const results = repo.turbo("run", ["test", "--stream"], options); assert.equal(0, results.exitCode, "exit code should be 0"); @@ -85,15 +85,46 @@ function runSmokeTests( ); suite( - `${npmClient} handles filesystem changes ${ + `${npmClient} handles filesystem changes${ options.cwd ? " from " + options.cwd : "" - } `, + }`, async () => { repo.newBranch("my-feature-branch"); repo.commitFiles({ [path.join("packages", "a", "test.js")]: `console.log('testingz a');`, }); + const sinceCommandOutputNoCache = getCommandOutputAsArray( + repo.turbo( + "run", + ["test", "--since=main", "--stream", "--no-cache"], + options + ) + ); + assert.fixture( + `• Packages changed since main: a`, + sinceCommandOutputNoCache[0], + "Calculates changed packages (--since)" + ); + assert.fixture( + `• Packages in scope: a`, + sinceCommandOutputNoCache[1], + "Packages in scope" + ); + assert.fixture( + `• Running test in 1 packages`, + sinceCommandOutputNoCache[2], + "Runs only in changed packages" + ); + assert.fixture( + sinceCommandOutputNoCache[3], + `a:test: cache miss, executing ${getHashFromOutput( + sinceCommandOutputNoCache, + "a#test" + )}`, + "Cache miss in changed package" + ); + const sinceCommandOutput = getCommandOutputAsArray( repo.turbo("run", ["test", "--since=main", "--stream"], options) ); @@ -211,9 +242,7 @@ function runSmokeTests( // Test `turbo prune --scope=a` // @todo refactor with other package managers suite( - `${npmClient} + turbo prune ${ - options.cwd ? " from " + options.cwd : "" - } `, + `${npmClient} + turbo prune${options.cwd ? " from " + options.cwd : ""}`, async () => { const pruneCommandOutput = getCommandOutputAsArray( repo.turbo("prune", ["--scope=a"], options)