Skip to content

fix(ext/node): enable node:fs compat tests + lchmod fix#32892

Merged
bartlomieju merged 7 commits intomainfrom
feat/enable-fs-compat-tests
Mar 23, 2026
Merged

fix(ext/node): enable node:fs compat tests + lchmod fix#32892
bartlomieju merged 7 commits intomainfrom
feat/enable-fs-compat-tests

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Summary

Enable 87 previously-disabled node:fs compatibility tests that now pass.

Code fix

  • promises.lchmod: Made the function async so validation errors become rejected promises instead of synchronous throws, matching Node.js behavior where assert.rejects can catch them.

Newly enabled tests (87 total)

Covers: append-file, chown, close-errors, constants, copyfile, fchmod, fchown, fmap, lchmod, lchown, mkdir, open-mode-mask, promises (chmod, readFile, stat, stream, sync, truncate, write, writeFile, readfile-with-fd, writefile-with-fd, statfs-validate-path, watch-iterator), read, readdir, readfile, readv, realpath, rename, rmdir, rmSync, sir-writes-alot, stream (construct-compat, destroy, double-close), symlink, timestamp, truncate, utimes, whatwg-url, write, write-buffer, write-file, write-stream, writev.

Test plan

  • All 87 newly enabled tests pass locally
  • Existing fs tests still pass

🤖 Generated with Claude Code

bartlomieju and others added 7 commits March 21, 2026 17:52
Enable 64 previously-disabled node:fs compatibility tests that now
pass without any code changes. These cover:
- append-file, chown, close-errors, constants, copyfile
- fchmod, fchown, fmap, lchown, mkdir, open-mode-mask
- promises (chmod, readFile, stat, stream, sync, truncate, write,
  writefile, watch-iterator, readfile-with-fd, writefile-with-fd,
  statfs-validate-path)
- read, readdir, readfile, readv, realpath, rmdir, rmSync
- stream (construct-compat, destroy, double-close)
- symlink, timestamp, truncate, utimes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Enable test-fs-write-stream-throw-type-error, test-fs-write-no-fd,
test-fs-writev, test-fs-writev-sync, test-fs-write-file-flush,
test-fs-write-sync.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
promises.lchmod was throwing validation errors synchronously instead
of returning rejected promises. Adding async keyword ensures
parseFileMode errors become promise rejections, matching Node.js
behavior where assert.rejects can catch them.

Enables parallel/test-fs-lchmod.js compat test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Enable test-fs-promises-file-handle-writeFile, test-fs-readfile-unlink,
test-fs-readfile-zero-byte-liar, test-fs-rename-type-check,
test-fs-stat-bigint, test-fs-symlink-dir, test-fs-symlink,
test-fs-whatwg-url, test-fs-write-buffer, test-fs-write-buffer-large,
test-fs-write-file-invalid-path, test-fs-write-file-typedarrays,
test-fs-write-file, test-fs-write-stream-encoding,
test-fs-write-stream-file-handle-2, test-fs-write-stream-file-handle,
test-fs-write-stream-patch-open.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When fileHandle.read(buffer) is called without an options argument,
pass an empty options object to readAsync instead of undefined,
which was causing a validation error. This also handles
fileHandle.read(buffer, options) where options may be undefined.

Enables parallel/test-fs-promises-write-optional-params.js.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…bols

- Add getValidatedFd() call to fstat and fstatSync to properly
  validate the file descriptor, throwing ERR_INVALID_ARG_TYPE for
  invalid types like strings, booleans, etc.
- Fix isInt32() to guard against Symbols which would throw
  "Cannot convert a Symbol value to a number" when doing bitwise OR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Disable test-fs-write-file-flush.js (flaky on all platforms)
- Disable test-fs-readdir-ucs2.js (fails on Linux CI)
- Disable test-fs-realpath-on-substed-drive.js (Windows-only test)
- Add windows: false for Unix-specific tests: chown-negative-one,
  fchown-negative-one, lchown-negative-one, mkdir-recursive-eaccess,
  open-mode-mask, symlink-longpath

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bartlomieju bartlomieju force-pushed the feat/enable-fs-compat-tests branch from b8089f0 to 04e6967 Compare March 21, 2026 21:00
@bartlomieju bartlomieju changed the title feat(node/fs): enable 87 additional node:fs compat tests + lchmod fix fix(ext/node): enable node:fs compat tests + lchmod fix Mar 23, 2026
@bartlomieju bartlomieju merged commit 72d86f7 into main Mar 23, 2026
113 checks passed
@bartlomieju bartlomieju deleted the feat/enable-fs-compat-tests branch March 23, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant