From 6184330876df74b9c3eade84fedbedaa11f847ec Mon Sep 17 00:00:00 2001 From: arookieofc <2128194521@qq.com> Date: Mon, 2 Nov 2026 14:33:11 +0800 Subject: [PATCH] test(tools): compare the oxfmt script path by components on every platform (#786) package_bin joins the manifest's bin entry (bin/oxfmt) onto a platform path, so on Windows the separators differ from the expected path and the oxfmt formatter test failed. Compare path components instead. Co-authored-by: a-rookie-of-C-language <186315048+a-rookie-of-C-language@users.noreply.github.com> --- crates/ide-tools/src/formatter.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ide-tools/src/formatter.rs b/crates/ide-tools/src/formatter.rs index 95dd011b..b6a7a692 100644 --- a/crates/ide-tools/src/formatter.rs +++ b/crates/ide-tools/src/formatter.rs @@ -209,7 +209,12 @@ mod tests { let program = Path::new(command.get_program()).file_stem().unwrap().to_string_lossy().into_owned(); assert_eq!(program, "node"); let script: Vec<_> = command.get_args().collect(); - assert_eq!(script, [root.join("node_modules/oxfmt/bin/oxfmt").as_os_str()]); + // Compare components: `package_bin` joins the manifest's `bin` entry + // (`bin/oxfmt`) onto a platform path, so separators differ on Windows. + assert_eq!( + Path::new(&script[0]).components().collect::>(), + root.join("node_modules/oxfmt/bin/oxfmt").components().collect::>() + ); let config = FormatterConfig { tool: "prettier".into(), parser: "typescript".into(), range: true }; let args = arguments("oxfmt", &config, &file, 4, false, Some((3, 9)));