diff --git a/cli/internal/run/run.go b/cli/internal/run/run.go index b8f8ce925a941..599a05d44d6d9 100644 --- a/cli/internal/run/run.go +++ b/cli/internal/run/run.go @@ -853,7 +853,7 @@ func parseRunArgs(args []string, cwd string, output cli.Ui) (*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"): output.Warn("[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="):] 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)