fix(windows): close native coverage review gaps

This commit is contained in:
Tianyi Cui
2026-08-09 13:59:49 +08:00
parent 02ea70cce0
commit 03fafca0e0
15 changed files with 111 additions and 120 deletions
@@ -100,15 +100,6 @@ const GROUP_OTHER_BITS = 0o077
* @throws when the path hierarchy is invalid or the file exists with group or other permission bits set.
*/
async function assertOwnerOnly(filename: string): Promise<void> {
/* v8 ignore start -- native Windows coverage exercises this path; POSIX covers mode enforcement */
if (process.platform === 'win32') {
// Windows has no POSIX mode bits, but it reports a file-as-parent as
// ordinary ENOENT; canonicalization preserves the invalid-path failure.
await canonicalizeWatchPath(filename)
return
}
/* v8 ignore stop */
/* v8 ignore start -- Windows has no POSIX mode enforcement; POSIX behavior tests enforce this peer. */
let mode: number
try {
mode = (await stat(filename)).mode
@@ -117,6 +108,9 @@ async function assertOwnerOnly(filename: string): Promise<void> {
await canonicalizeWatchPath(filename)
return
}
/* v8 ignore next -- POSIX coverage cannot take the Windows peer; native Windows coverage does. */
if (process.platform === 'win32') return
/* v8 ignore start -- Windows has no POSIX mode enforcement; POSIX behavior tests enforce this peer. */
const offending = mode & GROUP_OTHER_BITS
if (offending === 0) return
throw new Error(