From 29934d558c188fdc3406706da19921ca5a389383 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Tue, 23 Jul 2024 20:12:08 -0700 Subject: fix(node): Run node compat tests listed in the `ignore` field (and fix the ones that fail) (#24631) The intent is that those tests will be executed, but our check that the files are up to date won't overwrite the contents of the tests. This is useful when a test needs some manual edits to work. It turns out we weren't actually running them. --- This ended up turning into a couple of small bug fixes to get the tests passing: - We weren't canonicalizing the exec path properly (it sometimes still had `..` or `.` in it) - We weren't accepting strings in `process.exit` There was one failure I couldn't figure out quickly, so I disabled the test for now, and filed a follow up issue: #24694 --- runtime/ops/os/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'runtime/ops') diff --git a/runtime/ops/os/mod.rs b/runtime/ops/os/mod.rs index c2611f869..544031dd7 100644 --- a/runtime/ops/os/mod.rs +++ b/runtime/ops/os/mod.rs @@ -4,8 +4,8 @@ use super::utils::into_string; use crate::worker::ExitCode; use deno_core::error::type_error; use deno_core::error::AnyError; +use deno_core::normalize_path; use deno_core::op2; -use deno_core::url::Url; use deno_core::v8; use deno_core::OpState; use deno_node::NODE_ENV_VAR_ALLOWLIST; @@ -80,10 +80,8 @@ fn op_exec_path(state: &mut OpState) -> Result { state .borrow_mut::() .check_read_blind(¤t_exe, "exec_path", "Deno.execPath()")?; - // Now apply URL parser to current exe to get fully resolved path, otherwise - // we might get `./` and `../` bits in `exec_path` - let exe_url = Url::from_file_path(current_exe).unwrap(); - let path = exe_url.to_file_path().unwrap(); + // normalize path so it doesn't include '.' or '..' components + let path = normalize_path(current_exe); into_string(path.into_os_string()) } -- cgit v1.2.3