这是indexloc提供的服务,不要输入任何密码
Skip to content

fix(run): no-cache flag #699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Feb 19, 2022
2 changes: 1 addition & 1 deletion cli/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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="):]
Expand Down
43 changes: 36 additions & 7 deletions cli/scripts/e2e/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ function runSmokeTests<T>(
});

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");
Expand All @@ -85,15 +85,46 @@ function runSmokeTests<T>(
);

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)
);
Expand Down Expand Up @@ -211,9 +242,7 @@ function runSmokeTests<T>(
// 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)
Expand Down