diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/core_module_identity/vite.config.ts b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/core_module_identity/vite.config.ts
index ac0bb7cb68..b1bfd8b0aa 100644
--- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/core_module_identity/vite.config.ts
+++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/core_module_identity/vite.config.ts
@@ -4,6 +4,8 @@ import { isRunnableDevEnvironment } from 'vite';
import { defineConfig, isRunnableDevEnvironment as fromVitePlus } from 'vite-plus';
export default defineConfig({
+ // This fixture serves SSR middleware only; dependency scanning adds timing-dependent logs.
+ optimizeDeps: { noDiscovery: true },
server: { host: '127.0.0.1', port: 0 },
plugins: [
{
diff --git a/crates/vp_migration/src/import_rewriter.rs b/crates/vp_migration/src/import_rewriter.rs
index f731e937a2..fd272760b5 100644
--- a/crates/vp_migration/src/import_rewriter.rs
+++ b/crates/vp_migration/src/import_rewriter.rs
@@ -2878,26 +2878,6 @@ mod tests {
assert!(rewrite_imports_in_directory(temp.path()).unwrap().modified_files.is_empty());
}
- #[test]
- fn test_rewrite_import_content_vite() {
- let vite_config = r#"import { defineConfig } from 'vite'
-
-export default defineConfig({
- plugins: [],
-});"#;
-
- let result = rewrite_import_content(vite_config, &SkipPackages::default()).unwrap();
- assert!(result.updated);
- assert_eq!(
- result.content,
- r#"import { defineConfig } from 'vite-plus'
-
-export default defineConfig({
- plugins: [],
-});"#
- );
- }
-
#[test]
fn test_rewrite_import_content_vite_double_quotes() {
let vite_config = r#"import { defineConfig } from "vite";
@@ -5607,14 +5587,6 @@ const { defineConfig } = require('vite-plus');"#
// Reference Types Rewriting Tests
// ====================================
- #[test]
- fn test_rewrite_reference_types_vite_client() {
- let content = r#"/// "#;
- let result = rewrite_import_content(content, &SkipPackages::default()).unwrap();
- assert!(result.updated);
- assert_eq!(result.content, r#"/// "#);
- }
-
#[test]
fn test_rewrite_reference_types_vite_client_single_quotes() {
let content = r#"/// "#;
@@ -5631,30 +5603,6 @@ const { defineConfig } = require('vite-plus');"#
assert_eq!(result.content, r#"/// "#);
}
- #[test]
- fn test_rewrite_reference_types_bare_vitest() {
- let content = r#"/// "#;
- let result = rewrite_import_content(content, &SkipPackages::default()).unwrap();
- assert!(result.updated);
- assert_eq!(result.content, r#"/// "#);
- }
-
- #[test]
- fn test_rewrite_reference_types_vitest_globals() {
- let content = r#"/// "#;
- let result = rewrite_import_content(content, &SkipPackages::default()).unwrap();
- assert!(result.updated);
- assert_eq!(result.content, r#"/// "#);
- }
-
- #[test]
- fn test_rewrite_reference_types_vitest_config() {
- let content = r#"/// "#;
- let result = rewrite_import_content(content, &SkipPackages::default()).unwrap();
- assert!(result.updated);
- assert_eq!(result.content, r#"/// "#);
- }
-
#[test]
fn test_rewrite_reference_types_vitest_browser() {
let content = r#"/// "#;
@@ -5680,14 +5628,6 @@ const { defineConfig } = require('vite-plus');"#
}
}
- #[test]
- fn test_rewrite_reference_types_vitest_scoped_browser_context() {
- let content = r#"/// "#;
- let result = rewrite_import_content(content, &SkipPackages::default()).unwrap();
- assert!(result.updated);
- assert_eq!(result.content, r#"/// "#);
- }
-
#[test]
fn test_rewrite_reference_types_vitest_scoped_browser_playwright() {
let content = r#"/// "#;
diff --git a/crates/vp_pm_cli/src/request.rs b/crates/vp_pm_cli/src/request.rs
index ff21f42134..0d690fe8e4 100644
--- a/crates/vp_pm_cli/src/request.rs
+++ b/crates/vp_pm_cli/src/request.rs
@@ -1229,7 +1229,7 @@ mod tests {
let temp_dir = TempDir::new().unwrap();
let target_file = temp_dir.path().join("test.txt");
- server.mock(|when, then| {
+ let mock = server.mock(|when, then| {
when.method(GET).path("/server_error");
then.status(500).body("Internal Server Error");
});
@@ -1239,8 +1239,10 @@ mod tests {
// Should fail after retries
let result = client.download_file(&url, &target_file, None).await;
- // println!("result: {:?}", result);
assert!(result.is_err(), "Expected download to fail with 500 after retries");
+
+ // Should try 3 times, 1 for first request, 2 for retries
+ mock.assert_hits(3);
}
#[tokio::test]
@@ -1409,7 +1411,6 @@ mod tests {
}
#[tokio::test]
- #[ignore] // Flaky on musl/Alpine — temp file race condition
async fn test_verify_file_hash_sha1() {
use sha1::Sha1;
use sha2::Digest;
@@ -1422,6 +1423,8 @@ mod tests {
let content = b"Hello, World!";
let mut file = tokio::fs::File::create(&test_file).await.unwrap();
file.write_all(content).await.unwrap();
+ // Finish the background write before hashing through another file handle.
+ file.flush().await.unwrap();
// Calculate expected SHA1
let mut hasher = Sha1::new();
@@ -1430,12 +1433,12 @@ mod tests {
// Test successful verification
let result = verify_file_hash(&test_file, &expected_hash).await;
- assert!(result.is_ok());
+ assert!(result.is_ok(), "{result:?}");
// Test failed verification
let wrong_hash = "sha1.0000000000000000000000000000000000000000";
let result = verify_file_hash(&test_file, wrong_hash).await;
- assert!(result.is_err());
+ assert!(matches!(result, Err(Error::HashMismatch { .. })), "{result:?}");
}
#[tokio::test]
@@ -1470,7 +1473,6 @@ mod tests {
}
#[tokio::test]
- #[ignore] // Flaky on musl/Alpine — temp file race condition
async fn test_verify_file_hash_sha224() {
use sha2::{Digest, Sha224};
use tokio::io::AsyncWriteExt;
@@ -1482,6 +1484,8 @@ mod tests {
let content = b"Test content for SHA224";
let mut file = tokio::fs::File::create(&test_file).await.unwrap();
file.write_all(content).await.unwrap();
+ // Finish the background write before hashing through another file handle.
+ file.flush().await.unwrap();
// Calculate expected SHA224
let mut hasher = Sha224::new();
@@ -1490,12 +1494,12 @@ mod tests {
// Test successful verification
let result = verify_file_hash(&test_file, &expected_hash).await;
- assert!(result.is_ok());
+ assert!(result.is_ok(), "{result:?}");
// Test failed verification
let wrong_hash = "sha224.00000000000000000000000000000000000000000000000000000000";
let result = verify_file_hash(&test_file, wrong_hash).await;
- assert!(result.is_err());
+ assert!(matches!(result, Err(Error::HashMismatch { .. })), "{result:?}");
}
#[tokio::test]
diff --git a/crates/vp_pm_cli/src/resolution/commands/link.rs b/crates/vp_pm_cli/src/resolution/commands/link.rs
index feea29e298..79bf0f74d4 100644
--- a/crates/vp_pm_cli/src/resolution/commands/link.rs
+++ b/crates/vp_pm_cli/src/resolution/commands/link.rs
@@ -79,33 +79,6 @@ mod tests {
assert_eq!(command.args, vec!["link", "react"]);
}
- #[test]
- fn test_pnpm_link_directory() {
- let resolution = resolve(
- &pnpm("10.0.0"),
- LinkArgs { package: Some("./packages/utils".to_string()), ..Default::default() },
- );
- let command = expect_run(resolution.outcome);
-
- assert_eq!(command.program, "pnpm");
- assert_eq!(command.args, vec!["link", "./packages/utils"]);
- }
-
- #[test]
- fn test_pnpm_link_absolute_directory() {
- let resolution = resolve(
- &pnpm("10.0.0"),
- LinkArgs {
- package: Some("/absolute/path/to/package".to_string()),
- ..Default::default()
- },
- );
- let command = expect_run(resolution.outcome);
-
- assert_eq!(command.program, "pnpm");
- assert_eq!(command.args, vec!["link", "/absolute/path/to/package"]);
- }
-
#[test]
fn test_yarn_link_basic() {
let resolution = resolve(&yarn("4.0.0"), LinkArgs::default());
@@ -127,18 +100,6 @@ mod tests {
assert_eq!(command.args, vec!["link", "react"]);
}
- #[test]
- fn test_yarn_classic_link_package() {
- let resolution = resolve(
- &yarn("1.22.0"),
- LinkArgs { package: Some("react".to_string()), ..Default::default() },
- );
- let command = expect_run(resolution.outcome);
-
- assert_eq!(command.program, "yarn");
- assert_eq!(command.args, vec!["link", "react"]);
- }
-
#[test]
fn test_npm_link_basic() {
let resolution = resolve(&npm("11.0.0"), LinkArgs::default());
diff --git a/crates/vp_pm_cli/src/resolution/commands/ping.rs b/crates/vp_pm_cli/src/resolution/commands/ping.rs
index fbdfac5946..cc3c4e39e3 100644
--- a/crates/vp_pm_cli/src/resolution/commands/ping.rs
+++ b/crates/vp_pm_cli/src/resolution/commands/ping.rs
@@ -138,13 +138,4 @@ mod tests {
assert_eq!(command.program, "npm");
assert_eq!(command.args, vec!["ping"]);
}
-
- #[test]
- fn test_yarn_classic_ping_uses_npm() {
- let resolution = resolve(&yarn("1.22.0"), PingArgs::default());
- let command = expect_run(resolution.outcome);
-
- assert_eq!(command.program, "npm");
- assert_eq!(command.args, vec!["ping"]);
- }
}
diff --git a/crates/vp_pm_cli/src/resolution/commands/unlink.rs b/crates/vp_pm_cli/src/resolution/commands/unlink.rs
index 3ccc6aa2a8..9b1575779e 100644
--- a/crates/vp_pm_cli/src/resolution/commands/unlink.rs
+++ b/crates/vp_pm_cli/src/resolution/commands/unlink.rs
@@ -147,20 +147,6 @@ mod tests {
assert_eq!(command.args, vec!["unlink", "react"]);
}
- #[test]
- fn test_yarn_classic_unlink_package() {
- let command = expect_run(
- resolve(
- &yarn("1.22.0"),
- UnlinkArgs { package: Some("react".to_string()), ..Default::default() },
- )
- .outcome,
- );
-
- assert_eq!(command.program, "yarn");
- assert_eq!(command.args, vec!["unlink", "react"]);
- }
-
#[test]
fn test_yarn_unlink_recursive() {
for version in ["3.0.0", "3.6.0", "4.18.0"] {
diff --git a/crates/vp_setup/src/registry.rs b/crates/vp_setup/src/registry.rs
index 62d8697702..36198ed549 100644
--- a/crates/vp_setup/src/registry.rs
+++ b/crates/vp_setup/src/registry.rs
@@ -188,13 +188,6 @@ mod tests {
})
}
- #[test]
- fn test_cli_package_name_construction() {
- let suffix = "darwin-arm64";
- let name = format!("{PLATFORM_PACKAGE_SCOPE}/{CLI_PACKAGE_NAME_PREFIX}-{suffix}");
- assert_eq!(name, "@voidzero-dev/vite-plus-cli-darwin-arm64");
- }
-
#[test]
fn test_platform_package_accepts_supported_provenance_predicates() {
for predicate_type in SUPPORTED_PROVENANCE_PREDICATE_TYPES {
@@ -374,47 +367,4 @@ mod tests {
assert!(error.to_string().contains(TEST_PACKAGE_NAME));
assert!(error.to_string().contains(TEST_VERSION));
}
-
- #[test]
- fn test_all_platform_suffixes_match_published_cli_packages() {
- // These are the actual published CLI package suffixes
- // (from packages/cli/publish-native-addons.ts RUST_TARGETS keys)
- let published_suffixes = [
- "darwin-arm64",
- "darwin-x64",
- "linux-arm64-gnu",
- "linux-arm64-musl",
- "linux-x64-gnu",
- "linux-x64-musl",
- "win32-arm64-msvc",
- "win32-x64-msvc",
- ];
-
- let published_packages: Vec = published_suffixes
- .iter()
- .map(|s| format!("{PLATFORM_PACKAGE_SCOPE}/{CLI_PACKAGE_NAME_PREFIX}-{s}"))
- .collect();
-
- // All known platform suffixes that detect_platform_suffix() can return
- let detection_suffixes = [
- "darwin-arm64",
- "darwin-x64",
- "linux-arm64-gnu",
- "linux-x64-gnu",
- "linux-arm64-musl",
- "linux-x64-musl",
- "win32-arm64-msvc",
- "win32-x64-msvc",
- ];
-
- for suffix in &detection_suffixes {
- let package_name =
- format!("{PLATFORM_PACKAGE_SCOPE}/{CLI_PACKAGE_NAME_PREFIX}-{suffix}");
- assert!(
- published_packages.contains(&package_name),
- "Platform suffix '{suffix}' produces CLI package name '{package_name}' \
- which does not match any published CLI package"
- );
- }
- }
}
diff --git a/crates/vp_static_config/src/lib.rs b/crates/vp_static_config/src/lib.rs
index eb8eaa611b..1e79a3c7e3 100644
--- a/crates/vp_static_config/src/lib.rs
+++ b/crates/vp_static_config/src/lib.rs
@@ -586,24 +586,6 @@ mod tests {
// ── Config file resolution ──────────────────────────────────────────
- #[test]
- fn resolves_ts_config() {
- let dir = TempDir::new().unwrap();
- let dir_path = vt_path::AbsolutePathBuf::new(dir.path().to_path_buf()).unwrap();
- std::fs::write(dir.path().join("vite.config.ts"), "export default { run: {} }").unwrap();
- let result = resolve_static_config(&dir_path);
- assert!(result.get("run").is_some());
- }
-
- #[test]
- fn resolves_js_config() {
- let dir = TempDir::new().unwrap();
- let dir_path = vt_path::AbsolutePathBuf::new(dir.path().to_path_buf()).unwrap();
- std::fs::write(dir.path().join("vite.config.js"), "export default { run: {} }").unwrap();
- let result = resolve_static_config(&dir_path);
- assert!(result.get("run").is_some());
- }
-
#[test]
fn resolves_mts_config() {
let dir = TempDir::new().unwrap();