Skip to content

Commit 79b7b85

Browse files
committed
ci(test): keep coverage in scope, drop VT_SKIP_E2E
The non-e2e Windows scope is now `--workspace --exclude vite_task_bin` and the e2e scope stays `-p vite_task_bin --test e2e_snapshots`. Together they cover the whole workspace, looking only at the scope fields. The risk that --exclude vite_task_bin silently drops future tests is closed by tightening vite_task_bin's Cargo.toml: lib/doc were already test=false, and the two [[bin]] entries now set test=false too. A comment on [[test]] flags that adding another test target there would escape CI, so any future contributor has to either update the workflow or add the test to a different crate.
1 parent a1be974 commit 79b7b85

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ jobs:
9696
run_env: ''
9797
# Windows e2e fixtures dominate wall-clock (60s per PTY step vs 20s on
9898
# Unix). Sharded 5 ways at the trial level by the e2e harness via
99-
# VT_SHARD_INDEX/VT_SHARD_TOTAL. The non-e2e shard uses --workspace
100-
# (self-evidently covers everything) and relies on VT_SKIP_E2E in the
101-
# e2e harness to suppress the already-sharded work.
99+
# VT_SHARD_INDEX/VT_SHARD_TOTAL. Coverage is partitioned by scope:
100+
# the e2e shards select only `-p vite_task_bin --test e2e_snapshots`,
101+
# and the non-e2e shard runs `--workspace --exclude vite_task_bin`.
102+
# vite_task_bin's Cargo.toml disables lib/doc/bin tests so the only
103+
# test in the excluded crate is e2e_snapshots itself.
102104
- os: windows-latest
103105
target: x86_64-pc-windows-msvc
104106
cargo_cmd: cargo
@@ -139,8 +141,8 @@ jobs:
139141
cargo_cmd: cargo
140142
build_target: x86_64-pc-windows-msvc
141143
shard: windows-non-e2e
142-
scope: ''
143-
run_env: 'VT_SKIP_E2E=1'
144+
scope: '--workspace --exclude vite_task_bin'
145+
run_env: ''
144146
runs-on: ${{ matrix.os }}
145147
steps:
146148
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2

crates/vite_task_bin/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ rust-version.workspace = true
1010
[[bin]]
1111
name = "vt"
1212
path = "src/main.rs"
13+
# This crate is excluded from CI's non-e2e Windows shard via
14+
# `cargo test --workspace --exclude vite_task_bin`, so any unit tests
15+
# here would be silently dropped. Keep them out.
16+
test = false
1317

1418
[[bin]]
1519
name = "vtt"
1620
path = "src/vtt/main.rs"
21+
test = false
1722

1823
[dependencies]
1924
anyhow = { workspace = true }
@@ -58,6 +63,10 @@ ignored = ["preload_test_lib"]
5863
[lints]
5964
workspace = true
6065

66+
# Only one [[test]] should live in this crate. CI shards the e2e
67+
# binary across 5 Windows jobs and runs `--workspace --exclude
68+
# vite_task_bin` everywhere else, so any additional [[test]] here
69+
# would be silently dropped from non-Windows-e2e jobs.
6170
[[test]]
6271
name = "e2e_snapshots"
6372
harness = false

crates/vite_task_bin/tests/e2e_snapshots/main.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,6 @@ fn parse_shard_env() -> Option<(usize, usize)> {
571571

572572
#[expect(clippy::disallowed_types, reason = "Path required for CARGO_MANIFEST_DIR path traversal")]
573573
fn main() {
574-
// Bypass for the non-e2e Windows shard: cargo still launches this binary
575-
// as part of `cargo test --workspace`, but the e2e cases are sharded by
576-
// the windows-e2e-* jobs, so we exit immediately.
577-
if std::env::var_os("VT_SKIP_E2E").is_some() {
578-
return;
579-
}
580-
581574
let tmp_dir = tempfile::tempdir().unwrap();
582575
let tmp_dir_path = AbsolutePathBuf::new(tmp_dir.path().canonicalize().unwrap()).unwrap();
583576

0 commit comments

Comments
 (0)