From 5d0987c43309c064e31b89c3d55f73c196c4e853 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 18 May 2026 03:04:50 +0000 Subject: [PATCH] test(graph-hasher): make `node` a hard prerequisite for detect tests The two `detect_node_*` tests previously skipped silently when `node` was missing from `PATH`. `node` is a documented prerequisite of the test suite (see `pacquet/CONTRIBUTING.md`'s setup section), so a missing binary is a test-env bug to surface, not a condition to paper over. Switch the `let Some(...) = ... else { return }` skips to `expect` so a missing `node` fails loudly with a clear message. https://claude.ai/code/session_01D8WBTfQzTpsZsRknrzwNKL --- .../crates/graph-hasher/src/engine_name.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pacquet/crates/graph-hasher/src/engine_name.rs b/pacquet/crates/graph-hasher/src/engine_name.rs index 209e3f20fb..c34c9e3a64 100644 --- a/pacquet/crates/graph-hasher/src/engine_name.rs +++ b/pacquet/crates/graph-hasher/src/engine_name.rs @@ -238,15 +238,12 @@ mod tests { } /// `detect_node_version` returns the full version string with - /// the leading `v` stripped when `node --version` is reachable. - /// Skips silently when there is no `node` on `PATH` (we can't - /// assert presence in every test runner). + /// the leading `v` stripped. `node` is a hard prerequisite for + /// the test suite — if it isn't on `PATH` that's a test-env + /// bug, so we `expect` rather than skip. #[test] - fn detect_node_version_strips_leading_v_when_node_is_available() { - let Some(version) = detect_node_version() else { - eprintln!("`node` not on PATH; skipping version-detect test"); - return; - }; + fn detect_node_version_strips_leading_v() { + let version = detect_node_version().expect("`node` must be on PATH for the test suite"); assert!(!version.starts_with('v'), "leading `v` must be stripped: {version:?}"); let major = version.split('.').next().expect("at least one component"); assert!(major.parse::().is_ok(), "major must be numeric: {version:?}"); @@ -257,10 +254,8 @@ mod tests { /// matches the leading component of the full version string. #[test] fn detect_node_major_matches_detect_node_version_leading_component() { - let (Some(major), Some(version)) = (detect_node_major(), detect_node_version()) else { - eprintln!("`node` not on PATH; skipping version-detect test"); - return; - }; + let major = detect_node_major().expect("`node` must be on PATH for the test suite"); + let version = detect_node_version().expect("`node` must be on PATH for the test suite"); let leading: u32 = version.split('.').next().expect("non-empty version").parse().expect("major numeric"); assert_eq!(major, leading);