Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"scripts": {
"task": "print foo && print bar"
}
}
{}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
name = "cache miss command change"
steps = [
"vt run task # cache miss",
"json-edit package.json '_.scripts.task = \"print baz && print bar\"' # change first subtask",
"json-edit vite-task.json '_.tasks.task.command = \"print baz && print bar\"' # change first subtask",
"vt run task # first: cache miss, second: cache hit",
"json-edit package.json '_.scripts.task = \"print bar\"' # remove first subtask",
"json-edit vite-task.json '_.tasks.task.command = \"print bar\"' # remove first subtask",
"vt run task # cache hit",
]
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bar

---
vt run: 0/2 cache hit (0%). (Run `vt run --last-details` for full details)
> json-edit package.json '_.scripts.task = "print baz && print bar"' # change first subtask
> json-edit vite-task.json '_.tasks.task.command = "print baz && print bar"' # change first subtask

> vt run task # first: cache miss, second: cache hit
$ print baz ○ cache miss: args changed, executing
Expand All @@ -22,7 +22,7 @@ bar

---
vt run: 1/2 cache hit (50%), <duration> saved. (Run `vt run --last-details` for full details)
> json-edit package.json '_.scripts.task = "print bar"' # remove first subtask
> json-edit vite-task.json '_.tasks.task.command = "print bar"' # remove first subtask

> vt run task # cache hit
$ print bar ◉ cache hit, replaying
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"cache": true
"tasks": {
"task": {
"command": "print foo && print bar"
}
}
}
17 changes: 13 additions & 4 deletions crates/vite_task_bin/tests/e2e_snapshots/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,19 @@ fn main() {
clippy::disallowed_types,
reason = "Path required for CARGO_MANIFEST_DIR path traversal"
)]
let fixtures_dir = std::path::PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap())
.join("tests")
.join("e2e_snapshots")
.join("fixtures");
let fixtures_dir = {
let manifest_dir =
std::path::PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap());

// Copy .node-version to the tmp dir so version manager shims can resolve the correct
// Node.js binary when running task commands.
let repo_root = manifest_dir.join("../..").canonicalize().unwrap();
std::fs::copy(repo_root.join(".node-version"), tmp_dir.path().join(".node-version"))
.unwrap();

manifest_dir.join("tests/e2e_snapshots/fixtures")
};

let mut fixture_paths = std::fs::read_dir(fixtures_dir)
.unwrap()
.map(|entry| entry.unwrap().path())
Expand Down
Loading