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
Empty file added a.js
Empty file.
35 changes: 16 additions & 19 deletions crates/vite_task/src/session/reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,26 +152,8 @@ impl<W: Write> LabeledReporter<W> {
}

// 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,
Expand Down Expand Up @@ -257,6 +239,21 @@ impl<W: Write> LabeledReporter<W> {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Finished in <duration> on 1 file with 90 rules using <n> 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]
Expand All @@ -44,9 +43,9 @@ Finished in <duration> on 1 file with 90 rules using <n> threads.

Found 1 warning and 0 errors.
Finished in <duration> on 1 file with 90 rules using <n> 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 <duration> on 1 file with 90 rules using <n> threads.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Finished in <duration> on 0 files with 90 rules using <n> 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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Finished in <duration> on 1 file with 90 rules using <n> 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]
Expand All @@ -33,3 +32,4 @@ Finished in <duration> on 1 file with 90 rules using <n> threads.

Found 1 warning and 0 errors.
Finished in <duration> on 1 file with 90 rules using <n> threads.
✓ cache hit, logs replayed
Original file line number Diff line number Diff line change
Expand Up @@ -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 <duration> on 1 file with 90 rules using <n> threads.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prepare": "husky",
"hello": "echo Hello, Vite Task Monorepo!",
"a": "vite foo"
"lint": "vite lint"
},
"devDependencies": {
"@types/node": "catalog:",
Expand Down