fix(node): Implement os.userInfo properly, add missing toPrimitive (#24702)

Fixes the implementation of `os.userInfo`, and adds a missing
`toPrimitive` for `tmpdir`. This allows us to enable the corresponding
node_compat test.
This commit is contained in:
Nathan Whitaker 2024-10-31 22:18:33 -07:00 committed by GitHub
parent 6d44952d4d
commit 6c6bbeb974
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 469 additions and 54 deletions

View file

@ -1368,8 +1368,12 @@ impl SysDescriptor {
match kind.as_str() {
"hostname" | "osRelease" | "osUptime" | "loadavg"
| "networkInterfaces" | "systemMemoryInfo" | "uid" | "gid" | "cpus"
| "homedir" | "getegid" | "username" | "statfs" | "getPriority"
| "setPriority" => Ok(Self(kind)),
| "homedir" | "getegid" | "statfs" | "getPriority" | "setPriority"
| "userInfo" => Ok(Self(kind)),
// the underlying permission check changed to `userInfo` to better match the API,
// alias this to avoid breaking existing projects with `--allow-sys=username`
"username" => Ok(Self("userInfo".into())),
_ => Err(type_error(format!("unknown system info kind \"{kind}\""))),
}
}