Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

test(tools): compare the oxfmt script path by components on every platform (#786)

arookieofc6184330876df
diff --git a/crates/ide-tools/src/formatter.rs b/crates/ide-tools/src/formatter.rs
index 95dd011b3..b6a7a692b 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::<Vec<_>>(),
+ root.join("node_modules/oxfmt/bin/oxfmt").components().collect::<Vec<_>>()
+ );
let config = FormatterConfig { tool: "prettier".into(), parser: "typescript".into(), range: true };
let args = arguments("oxfmt", &config, &file, 4, false, Some((3, 9)));