diff --git a/a.js b/a.js new file mode 100644 index 00000000..e69de29b diff --git a/crates/vite_task/src/session/reporter.rs b/crates/vite_task/src/session/reporter.rs index d2ebe3b0..cb934709 100644 --- a/crates/vite_task/src/session/reporter.rs +++ b/crates/vite_task/src/session/reporter.rs @@ -152,26 +152,8 @@ impl LabeledReporter { } // Handle None display case - direct synthetic execution (e.g., `vite lint`) - // Print inline cache status before command output for consistency + // Don't print cache status here - will be printed at finish for cache hits only let Some(display) = display else { - // Print inline cache status (e.g., "✓ cache hit, replaying") before output - // Skip if silent_if_cache_hit is enabled and this is a cache hit - let should_print = - !self.silent_if_cache_hit || !matches!(cache_status, CacheStatus::Hit { .. }); - if should_print { - if let Some(inline_status) = format_cache_status_inline(&cache_status) { - let styled_status = match &cache_status { - CacheStatus::Hit { .. } => { - inline_status.style(Style::new().green().dimmed()) - } - CacheStatus::Miss(_) => inline_status.style(CACHE_MISS_STYLE.dimmed()), - CacheStatus::Disabled(_) => { - inline_status.style(Style::new().bright_black()) - } - }; - let _ = writeln!(self.writer, "{}", styled_status); - } - } self.executions.push(ExecutionInfo { display: None, cache_status, @@ -257,6 +239,21 @@ impl LabeledReporter { exec.exit_status = status; } + // For direct synthetic execution with cache hit, print message at the bottom + if let Some(exec) = self.executions.last() { + if exec.display.is_none() && matches!(exec.cache_status, CacheStatus::Hit { .. }) { + let should_print = + !self.silent_if_cache_hit || !self.cache_hit_executions.contains(&execution_id); + if should_print { + let _ = writeln!( + self.writer, + "{}", + "✓ cache hit, logs replayed".style(Style::new().green().dimmed()) + ); + } + } + } + // Add a line break after each task's output for better readability // Skip if silent_if_cache_hit is enabled and this execution is a cache hit if !self.silent_if_cache_hit || !self.cache_hit_executions.contains(&execution_id) { diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/builtin-different-cwd/snapshots/builtin different cwd.snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/builtin-different-cwd/snapshots/builtin different cwd.snap index a049bf4b..b40f307a 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/builtin-different-cwd/snapshots/builtin different cwd.snap +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/builtin-different-cwd/snapshots/builtin different cwd.snap @@ -33,7 +33,6 @@ Finished in on 1 file with 90 rules using threads. > echo 'console.log(1);' > folder2/a.js # modify folder2 > cd folder1 && vite lint # cache hit -✓ cache hit, replaying ! eslint-plugin-unicorn(no-empty-file): Empty files are not allowed. ,-[a.js:1:1] @@ -44,9 +43,9 @@ Finished in on 1 file with 90 rules using threads. Found 1 warning and 0 errors. Finished in on 1 file with 90 rules using threads. +✓ cache hit, logs replayed > cd folder2 && vite lint # cache miss -✗ cache miss: content of input 'folder2/a.js' changed, executing Found 0 warnings and 0 errors. Finished in on 1 file with 90 rules using threads. diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/e2e-lint-cache/snapshots/direct lint.snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/e2e-lint-cache/snapshots/direct lint.snap index 74f9c786..5fafaefe 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/e2e-lint-cache/snapshots/direct lint.snap +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/e2e-lint-cache/snapshots/direct lint.snap @@ -12,7 +12,6 @@ Finished in on 0 files with 90 rules using threads. > echo debugger > main.js # add lint error > vite lint # cache miss, lint fails -✗ cache miss: content of input '' changed, executing ! eslint(no-debugger): `debugger` statement is not allowed ,-[main.js:1:1] diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/error_cycle_dependency/snapshots/cycle dependency error.snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/error_cycle_dependency/snapshots/cycle dependency error.snap index 5b49aab8..61b18b97 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/error_cycle_dependency/snapshots/cycle dependency error.snap +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/error_cycle_dependency/snapshots/cycle dependency error.snap @@ -5,7 +5,6 @@ expression: e2e_outputs input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/error_cycle_dependency --- [1]> vite run task-a # task-a -> task-b -> task-a cycle -⊘ cache disabled: cycle detected ✗ Cycle dependencies detected: Cycle(NodeIndex(ExecutionIx(1))) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/lint-dot-git/snapshots/lint dot git.snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/lint-dot-git/snapshots/lint dot git.snap index e3b0d98d..5ced85d4 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/lint-dot-git/snapshots/lint dot git.snap +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/lint-dot-git/snapshots/lint dot git.snap @@ -22,7 +22,6 @@ Finished in on 1 file with 90 rules using threads. > echo hello > .git/foo.txt # add file inside .git > vite lint # cache hit, .git is ignored -✓ cache hit, replaying ! eslint-plugin-unicorn(no-empty-file): Empty files are not allowed. ,-[a.js:1:1] @@ -33,3 +32,4 @@ Finished in on 1 file with 90 rules using threads. Found 1 warning and 0 errors. Finished in on 1 file with 90 rules using threads. +✓ cache hit, logs replayed diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/same-name-as-builtin/snapshots/same name as builtin.snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/same-name-as-builtin/snapshots/same name as builtin.snap index fadad306..08376497 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/same-name-as-builtin/snapshots/same name as builtin.snap +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/same-name-as-builtin/snapshots/same name as builtin.snap @@ -38,7 +38,6 @@ Task Details: > echo 'console.log(1);' > a.js # add valid JS file > vite lint # builtin lint: cache miss -✗ cache miss: content of input 'a.js' changed, executing Found 0 warnings and 0 errors. Finished in on 1 file with 90 rules using threads. diff --git a/package.json b/package.json index 59dc724f..2ee4c785 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "scripts": { "prepare": "husky", "hello": "echo Hello, Vite Task Monorepo!", - "a": "vite foo" + "lint": "vite lint" }, "devDependencies": { "@types/node": "catalog:",