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
7 changes: 4 additions & 3 deletions crates/vite_select/src/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,10 @@ pub fn run(
std::process::exit(130);
}
KeyCode::Enter => {
if let Some(idx) = state.selected_original_index() {
*selected_index = idx;
}
let Some(idx) = state.selected_original_index() else {
continue;
};
*selected_index = idx;
cleanup(&mut out, &state)?;
return Ok(());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ steps = [
{ command = "vp run", interactions = [{ "expect-milestone" = "task-select::0" }, { "write" = "t" }, { "expect-milestone" = "task-select:t:0" }, { "write-key" = "enter" }] },
]

# Interactive: Enter with no matching results does nothing
[[e2e]]
name = "interactive enter with no results does nothing"
cwd = "packages/app"
steps = [
{ command = "vp run", interactions = [{ "expect-milestone" = "task-select::0" }, { "write" = "zzzzz" }, { "expect-milestone" = "task-select:zzzzz:0" }, { "write-key" = "enter" }, { "write-key" = "escape" }, { "expect-milestone" = "task-select::0" }, { "write-key" = "enter" }] },
]

# Typo inside a task script should fail with an error, NOT show a list
[[e2e]]
name = "typo in task script fails without list"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
expression: e2e_outputs
---
> vp run
@ expect-milestone: task-select::0
Search task (↑/↓ to move, enter to select):
> build: echo build app
lint: echo lint app
test: echo test app
lib#build: echo build lib
lib#lint: echo lint lib
lib#test: echo test lib
lib#typecheck: echo typecheck lib
task-select-test#check: echo check root
task-select-test#clean: echo clean root
task-select-test#deploy: echo deploy root
task-select-test#docs: echo docs root
task-select-test#format: echo format root
(…3 more)
@ write: zzzzz
@ expect-milestone: task-select:zzzzz:0
Search task (↑/↓ to move, enter to select): zzzzz
No matching tasks.
@ write-key: enter
@ write-key: escape
@ expect-milestone: task-select::0
Search task (↑/↓ to move, enter to select):
> build: echo build app
lint: echo lint app
test: echo test app
lib#build: echo build lib
lib#lint: echo lint lib
lib#test: echo test lib
lib#typecheck: echo typecheck lib
task-select-test#check: echo check root
task-select-test#clean: echo clean root
task-select-test#deploy: echo deploy root
task-select-test#docs: echo docs root
task-select-test#format: echo format root
(…3 more)
@ write-key: enter
~/packages/app$ echo build app ⊘ cache disabled: built-in command
build app


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Vite+ Task Runner • Execution Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Statistics: 1 tasks • 0 cache hits • 0 cache misses • 1 cache disabled
Performance: 0% cache hit rate

Task Details:
────────────────────────────────────────────────
[1] app#build: ~/packages/app$ echo build app ✓
→ Cache disabled for built-in command
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━