File tree Expand file tree Collapse file tree 5 files changed +23
-14
lines changed
crates/vite_task_bin/tests/e2e_snapshots
fixtures/cache-miss-command-change Expand file tree Collapse file tree 5 files changed +23
-14
lines changed Original file line number Diff line number Diff line change 1- {
2- "scripts" : {
3- "task" : " print foo && print bar"
4- }
5- }
1+ {}
Original file line number Diff line number Diff line change 44name = " cache miss command change"
55steps = [
66 " vt run task # cache miss" ,
7- " json-edit package .json '_.scripts .task = \" print baz && print bar\" ' # change first subtask" ,
7+ " json-edit vite-task .json '_.tasks .task.command = \" print baz && print bar\" ' # change first subtask" ,
88 " vt run task # first: cache miss, second: cache hit" ,
9- " json-edit package .json '_.scripts .task = \" print bar\" ' # remove first subtask" ,
9+ " json-edit vite-task .json '_.tasks .task.command = \" print bar\" ' # remove first subtask" ,
1010 " vt run task # cache hit" ,
1111]
Original file line number Diff line number Diff line change 1111
1212-- -
1313vt run : 0 / 2 cache hit (0 % ). (Run ` vt run --last-details` for full details )
14- > json - edit package .json ' _.scripts .task = "print baz && print bar"' # change first subtask
14+ > json - edit vite - task .json ' _.tasks .task.command = "print baz && print bar"' # change first subtask
1515
1616> vt run task # first : cache miss , second : cache hit
1717$ print baz ○ cache miss : args changed , executing
2222
2323-- -
2424vt run : 1 / 2 cache hit (50 % ), <duration > saved. (Run `vt run --last-details` for full details)
25- > json-edit package .json '_.scripts .task = "print bar"' # remove first subtask
25+ > json-edit vite-task .json '_.tasks .task.command = "print bar"' # remove first subtask
2626
2727> vt run task # cache hit
2828$ print bar ◉ cache hit, replaying
Original file line number Diff line number Diff line change 11{
2- "cache" : true
2+ "tasks" : {
3+ "task" : {
4+ "command" : " print foo && print bar"
5+ }
6+ }
37}
Original file line number Diff line number Diff line change @@ -477,10 +477,19 @@ fn main() {
477477 clippy:: disallowed_types,
478478 reason = "Path required for CARGO_MANIFEST_DIR path traversal"
479479 ) ]
480- let fixtures_dir = std:: path:: PathBuf :: from ( std:: env:: var_os ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) )
481- . join ( "tests" )
482- . join ( "e2e_snapshots" )
483- . join ( "fixtures" ) ;
480+ let fixtures_dir = {
481+ let manifest_dir =
482+ std:: path:: PathBuf :: from ( std:: env:: var_os ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
483+
484+ // Copy .node-version to the tmp dir so version manager shims can resolve the correct
485+ // Node.js binary when running task commands.
486+ let repo_root = manifest_dir. join ( "../.." ) . canonicalize ( ) . unwrap ( ) ;
487+ std:: fs:: copy ( repo_root. join ( ".node-version" ) , tmp_dir. path ( ) . join ( ".node-version" ) )
488+ . unwrap ( ) ;
489+
490+ manifest_dir. join ( "tests/e2e_snapshots/fixtures" )
491+ } ;
492+
484493 let mut fixture_paths = std:: fs:: read_dir ( fixtures_dir)
485494 . unwrap ( )
486495 . map ( |entry| entry. unwrap ( ) . path ( ) )
You can’t perform that action at this time.
0 commit comments