Commit graph

438 commits

Author SHA1 Message Date
Bartek Iwańczuk
11e9e073d9
fix(ext/node): support for inspector.url() (#31705)
Some checks failed
ci / pre-build (push) Has been cancelled
ci / test release macos-aarch64 (push) Has been cancelled
ci / bench release linux-x86_64 (push) Has been cancelled
ci / test debug linux-x86_64 (push) Has been cancelled
ci / test release linux-x86_64 (push) Has been cancelled
ci / test debug macos-x86_64 (push) Has been cancelled
ci / test release macos-x86_64 (push) Has been cancelled
ci / test debug windows-x86_64 (push) Has been cancelled
ci / test release windows-x86_64 (push) Has been cancelled
ci / test debug linux-aarch64 (push) Has been cancelled
ci / test release linux-aarch64 (push) Has been cancelled
ci / test debug macos-aarch64 (push) Has been cancelled
ci / lint debug linux-x86_64 (push) Has been cancelled
ci / lint debug macos-x86_64 (push) Has been cancelled
ci / lint debug windows-x86_64 (push) Has been cancelled
ci / build libs (push) Has been cancelled
ci / publish canary (push) Has been cancelled
Closes https://github.com/denoland/deno/issues/31700
2025-12-22 23:42:06 +00:00
David Sherret
0a162aaecc
ci: upload test results as artifacts (#31686)
This will allow us to track slow and flaky tests.
2025-12-22 12:49:29 -05:00
David Sherret
d3668555dc
Revert "fix(ext/node): stub out Module.register and Module.registerHooks" (#31684)
Reverts denoland/deno#31666
2025-12-20 10:53:17 +01:00
Bartek Iwańczuk
bd7b0a8f3a
fix(ext/node): stub out Module.register and Module.registerHooks (#31666)
Stubs out `Module.register` and `Module.registerHooks` functions that
are meant to be used for Module Loader hooks as per
https://nodejs.org/api/module.html#customization-hooks.

This is a follow up to https://github.com/denoland/deno/pull/24965

Ref https://github.com/denoland/deno/issues/31665.
Improves error message from
https://github.com/denoland/deno/issues/30538#issuecomment-3658925471.
2025-12-19 13:28:29 +01:00
Mert Can Altin
719132d265
fix(ext/node): add error handling functions and tests for UV bindings (#31639) 2025-12-18 13:14:47 +01:00
David Sherret
15f9fe2f92
chore: add pty reporter for tests (#31644)
Adds a PTY reporter for local development that gives a summary of the
longest running pending tests and also recent failures.

This can be disabled by setting `DENO_TEST_UTIL_REPORTER=log`
2025-12-17 11:21:26 -05:00
David Sherret
70384a652d
ci: run flaky tests in isolation on failure then restore parallelism (#31626)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
If a test is flaky on the CI, it will now force the flaky test to run
all by itself. Once it passes or fails in isolation, it will then
restore having tests run in parallel.
2025-12-16 16:39:22 -05:00
Daniel Osvaldo Rahmanto
2ec057b3e0
fix(ext/node): sqlite:backup compatibility (#31610)
Notable changes:
- Respect progress callback function option.
- Set default backup rate to 100 to follow Node's implementation.
- Various validation and error handling.

Note that the op implementation in this PR is still sync.

Given this code:
```js
import { backup, DatabaseSync } from "node:sqlite";

const populate = (database, rows) => {
  database.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);");
  let values = "";
  for (let i = 0; i < rows; i++) {
    values += `(${i}, 'Name ${i}'),`;
  }
  values = values.slice(0, -1);
  database.exec(`INSERT INTO test (id, name) VALUES ${values}`);
};

const backupPath = "backup.sqlite";
const database = new DatabaseSync(":memory:");
populate(database, 1000);

const t0 = performance.now();
await backup(database, backupPath, { rate: 1 });
const t1 = performance.now();
database.close();
console.log(`Backup completed in ${(t1 - t0).toFixed(2)} ms`);
```

Results:
```bash
# Node.js v25.2.1
➜ node ./backup-benchmark.js
Backup completed in 0.71 ms

# This PR (debug build mode)
➜ ddeno -A ./backup-benchmark.js
Backup completed in 0.71 ms

# Deno v2.6.0
➜ deno -A ./backup-benchmark.js
Backup completed in 1272.16 ms
```

The current implementation is slow because it sleeps 250ms after each
`sqlite3_backup_step` call.
2025-12-16 15:26:12 +07:00
David Sherret
ee7c483df4
ci: more stability for integration tests (#31578)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
1. Marks all integration tests as flaky on the CI and outputs when
they're flaky so we can track it.
2. Uses a custom test runner for integration tests, giving us full
control over how they're run.
3. Runs watcher tests sequentially for more stability.
2025-12-12 16:19:07 -05:00
David Sherret
67ad37af78
ci: attempt to improve test stability (#31563)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
1. Moves `unit` and `unit_node` tests to use file_test_runner.
1. Marks all spec, unit, and node_unit tests as flaky on the CI and
outputs when they're flaky so we can track it.
1. Reduces CI concurrency to 1 on 3 flaky test failures (for now...
would be more ideal to lower it slowly maybe, which is easily possible
with this pr)
1. Adds a 100ms delay between flaky test failures.
2025-12-11 11:42:47 -05:00
Daniel Osvaldo Rahmanto
80e36fc36a
fix(ext/node): DatabaseSync compatibility (#31515)
Closes #29439

Notable changes:
- `DatabaseSync`:
  - accept Buffer and URL paths.
  - implement `.location()` method.
  - add `isTransaction` and `isOpen` getters.
  - respect timeout option.
- `backup`: accept Buffer and URL paths.

Allows
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-sqlite-database-sync.js
test to pass.
2025-12-11 20:04:20 +07:00
Divy
0bc213b15b
fix(ext/node): prevent cipher operations after finalize (#31533)
Throw a state error for operations if the cipher is already finalized.
2025-12-09 16:03:37 +05:30
Daniel Osvaldo Rahmanto
2353b9ba6a
fix(ext/node): implement DatabaseSync.aggregate() (#31461)
Implementation is based on
https://github.com/nodejs/node/blob/v24.2.0/src/node_sqlite.cc

It passes all tests from
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-sqlite-aggregate-function.mjs
except for two test cases where it uses `mock()` from `node:test`, which
we don't yet implement. The tests on `sqlite_test.ts` are copied from
the node compat test cases.

---------

Co-authored-by: Divy <dj.srivastava23@gmail.com>
2025-12-08 10:34:31 +00:00
Marvin Hagemeister
b8b549d574
fix(node): missing statfs export from node:fs/promises (#31528)
We already had the functionality, we just didn't export it.

Fixes https://github.com/denoland/deno/issues/31526
2025-12-08 09:45:01 +00:00
Nicholas R
bc9d356059
fix(node/net): return string family in server.address() (#31465)
Some checks are pending
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
## Summary

Aligns Deno's Node.js compatibility layer (`node:net`, `node:http`,
`node:https`,
`node:http2`, `node:dns`) with Node.js v18.4.0+ behavior by returning
the `family`
property as a string (`"IPv4"` or `"IPv6"`) rather than a number in
`server.address()`
   and socket address methods.

Node.js briefly changed `family` from string to number in v18.0.0
(nodejs/node#41431),
   but reverted in v18.4.0 (nodejs/node#43054) due to ecosystem breakage
   (nodejs/node#43014).

This fix ensures compatibility with npm packages that rely on the string
format, which
   has been the stable API since Node.js v18.4.0.

   ## Changes

- Modified `ext/node/polyfills/http.ts` to add `family` property to
`address()` return
- Modified `ext/node/polyfills/internal_binding/tcp_wrap.ts` to return
string `family`
instead of number in `getsockname()`, `getpeername()`, and `#connect()`
- Modified `ext/node/polyfills/net.ts` to fix `socket.remoteFamily`
getter (no longer
   needs conversion since `family` is now a string)
   - Modified `ext/node/polyfills/dns.ts` and
`ext/node/polyfills/internal/dns/promises.ts` to accept string family
values (`"IPv4"`,
`"IPv6"`) in `lookup()`, matching [Node.js
behavior](https://nodejs.org/api/dns.html#dnslookuphostname-options-callback)
- Added tests in `tests/unit_node/http_test.ts`,
`tests/unit_node/http2_test.ts`,
   `tests/unit_node/https_test.ts`, `tests/unit_node/dns_test.ts`, and
   `tests/unit_node/net_test.ts`

   ## Node.js Compatibility Note

For non-IP addresses (when `isIP()` returns 0), the `family` property is
`undefined`.
This matches Node.js C++ behavior in
[`AddressToJS`](https://github.com/nodejs/node/blob/main/src/tcp_wrap.cc)
where family
is only set for `AF_INET` (`"IPv4"`) and `AF_INET6` (`"IPv6"`), and left
undefined
   otherwise.

   ## Refs

   - nodejs/node#43054
   - nodejs/node@70b516e


<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Daniel Rahmanto <daniel.rahmanto@gmail.com>
2025-12-06 10:51:55 +07:00
denobot
49fa02d988
fix(ext/node): url.domainToASCII returns empty string for invalid domains (#31219)
Some checks are pending
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
## Summary

This PR fixes the behavior of `url.domainToASCII` to match Node.js by
returning an empty string when an invalid domain is passed, instead of
throwing an error.

## Changes

- Modified `op_node_idna_domain_to_ascii` in `ext/node/ops/idna.rs` to
return an empty string on error instead of propagating the error
- Updated documentation in `ext/node/polyfills/internal/idna.ts` to
clarify this behavior
- Added spec test in `tests/specs/node/url_domain_to_ascii/` to verify
the fix

## Test Plan

### Manual Testing
Tested with the example from the issue:
```javascript
import url from 'node:url';
console.log(url.domainToASCII('xn--iñvalid.com')); // Returns empty string instead of throwing
```

Also tested with various valid and invalid domains to ensure
compatibility:
- Valid domains: `example.com` → `example.com`
- Valid unicode: `münchen.de` → `xn--mnchen-3ya.de`
- Invalid punycode: `xn--iñvalid.com` → `` (empty string)
- Invalid domain: `xn--` → `` (empty string)

### Automated Tests
Added spec test that verifies the behavior matches Node.js for both
valid and invalid domains.

## Closes

Fixes #31133

---

_This PR was autogenerated and may require review and adjustments._

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Daniel Rahmanto <daniel.rahmanto@gmail.com>
2025-12-03 21:57:53 +07:00
Nicholas R
42b6c82254
fix(node/process): make process.stdin.isTTY writable (#31464)
## Summary

In Node.js, `tty.ReadStream` sets `isTTY` as a simple instance property
(`this.isTTY = true`), making it naturally writable. Deno's polyfill
used a getter-only property definition, preventing assignment.

Some npm packages need to override `isTTY` at runtime. For example,
Playwright's test server sets `process.stdin.isTTY = undefined` to
prevent reporters from blocking on user input during UI mode
(microsoft/playwright#37867).

This aligns stdin with the stdout/stderr fix from #26130, ensuring all
stdio streams behave consistently with Node.js.

## Refs
-
6a1a3ba045/lib/tty.js (L71)
-
3a5a32d26d/packages/playwright/src/runner/testServer.ts (L257-L266)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-02 00:37:23 +01:00
Nathan Whitaker
faf9505814
fix(node): support advanced serialization in IPC (#31380)
Some checks are pending
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Fixes #31354.
2025-11-26 23:15:32 +00:00
Daniel Osvaldo Rahmanto
0bd52c4640
fix(ext/node): implement DatabaseSync.function() and better error details (#31386)
Some checks are pending
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Closes #30097

Implementation is based on
https://github.com/nodejs/node/blob/v24.2.0/src/node_sqlite.cc

Changes in this PR allows
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-sqlite-custom-functions.js
test to pass.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-11-25 14:14:27 +00:00
Daniel Osvaldo Rahmanto
f881b2f9a7
fix(ext/node): autopadding behavior on crypto.Cipheriv (#31389)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
2025-11-24 18:33:57 +07:00
Daniel Osvaldo Rahmanto
f61f5ffe7b
fix(ext/node): StatementSync.iterate() should reset is_iter_finished flag on every call (#31361) 2025-11-20 23:22:26 +07:00
Daniel Osvaldo Rahmanto
491274d6ed
fix(ext/node): implement dns.lookupService (#31310)
Closes #26300

Allows the following node compatibility tests to pass:
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-dns-lookupService-promises.js
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-dns-lookupService.js

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added `dns.lookupService()` for reverse DNS lookups, supporting both
callback and Promise-based APIs.
* Returns hostname and service information for a given IP address and
port combination.

* **Tests**
* Added unit tests for new DNS lookupService functionality across
callback and Promise variants.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-11-20 11:12:26 +00:00
Marvin Hagemeister
dbe35b03fb
fix(node): stub missing process.sourceMapsEnabled (#31358)
See https://nodejs.org/api/process.html#processsourcemapsenabled

This fixes an issue in Fresh with vite's environment API which relies on
this property to check if vite should map stack traces
https://github.com/vitejs/vite/blob/main/packages/vite/src/module-runner/sourcemap/index.ts#L17
2025-11-20 09:39:24 +00:00
Daniel Osvaldo Rahmanto
3c0f2890eb
fix(ext/node): segfault on calling StatementSync methods after connection has closed (#31331)
Some checks are pending
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Previously, running this code causes segfault:

```ts
import { DatabaseSync } from "node:sqlite";
const db = new DatabaseSync(':memory:');
const stmt = db.prepare('SELECT 1 AS value');
db.close();
stmt.get(); // segmentation fault (core dumped)
```

Changes in this PR also allows the
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-sqlite-statement-sync-columns.js
test to pass.
2025-11-19 08:56:09 +07:00
Ishita SIngh
ccc9aba580
fix(node/assert): deepStrictEqual now correctly handles Number objects (#31233)
Fixes #31172

## Description

The `deepStrictEqual` function was using `asserts.equal()` which doesn't
properly handle boxed primitives like Number objects. Changed it to use
`isDeepStrictEqual()` from `comparisons.ts` which correctly handles
Number, String, Boolean, BigInt, and Symbol objects.

## Changes

- Modified `ext/node/polyfills/assert.ts`:
- Added import for `isDeepStrictEqual` from
`ext:deno_node/internal/util/comparisons.ts`
- Updated `deepStrictEqual` function to use `isDeepStrictEqual()`
instead of `asserts.equal()`

- Added test cases in `tests/unit_node/assert_test.ts`:
- Test that `deepStrictEqual` throws `AssertionError` for different
Number objects
  - Test that `deepStrictEqual` passes for equal Number objects

## Testing

Added unit tests to verify:
- `deepStrictEqual` throws `AssertionError` for different Number objects
(e.g., `new Number(1)` vs `new Number(2)`)
- `deepStrictEqual` passes for equal Number objects (e.g., `new
Number(1)` vs `new Number(1)`)

## Related Issue

#31172 - `assert.deepStrictEqual` does not throw exception for Number
objects

---------

Co-authored-by: Daniel Rahmanto <daniel.rahmanto@gmail.com>
2025-11-18 09:02:21 +07:00
Sravanth
863abe816e
feat(ext/node): implement FileHandle.appendFile(data[, options]) (#31301)
Part of #25554

This PR adds support for the missing `FileHandle.appendFile()` API in
the Node.js compatibility layer.
2025-11-17 08:57:04 +01:00
Adriano
b0cfbf53d3
fix(ext/node): Add sqlite setAllowUnknownNamedParameters option (#31202)
Adds
[statement.setAllowUnknownNamedParameters(enabled)](https://nodejs.org/api/sqlite.html#statementsetallowunknownnamedparametersenabled)
to `node:sqlite`.

Closes #31196
2025-11-14 16:00:03 +05:30
Daniel Osvaldo Rahmanto
ffe207a859
fix(ext/node): FileHandle compatibility (#31164)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Towards #29972

Tries to reland #31094 that got reverted on #31103 due to CI test
failures. This PR differs by fixing the `[kUnref]` method to close
resource ID correctly.

Allows the following tests to pass:
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-filehandle-close.js
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-fs-filehandle-use-after-close.js

---------

Signed-off-by: Daniel Osvaldo Rahmanto <daniel.rahmanto@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-14 12:17:45 +07:00
Jake Champion
05bc6360e7
fix(node:console): ensure that the node:console implementation has an implementation for emitWarning in scope (#31263)
Introduces the emitWarning function from the process module to enable
warning capabilities within the console constructor implementation.

This fixes a bug where the `time`, `countReset` and `timeLogImpl`
functions would throw an error due to trying to call `emitWarning`, they
would throw an error for an undefined variable named `emitWarning` or if
a global function had that name` they would call that function, which is
not expected behaviour here.

---------

Signed-off-by: Jake Champion <me@jakechampion.name>
2025-11-13 10:33:50 +01:00
TarikSogukpinar
1edd1fb657
fix(ext/node): ensure 'exit' event is fired only once for worker_threads (#31231)
Closes #30013

The `'exit'` event in `node:worker_threads` was not consistently fired,
or in some cases emitted multiple times, diverging from Node.js
behavior.
2025-11-12 14:15:44 +01:00
amitihere
30cf1f4162
fix(ext/node): implement performance.timerify() (#31238)
Adds the missing implementation for `performance.timerify()` in
`node:perf_hooks`, which previously resulted in a "Not implemented"
error.

Fixes #31115
2025-11-12 13:55:02 +01:00
Daniel Osvaldo Rahmanto
19c7f1fc5d
fix(ext/node): truncate first non-hex value on Buffer.from (#31227) 2025-11-10 18:32:09 +07:00
Daniel Osvaldo Rahmanto
88aa2461c1
fix(ext/node): implement process.setgid() and process.setuid() (#31162)
Closes #31145, #31146
2025-11-05 09:15:28 +01:00
Daniel Osvaldo Rahmanto
d21201e2a0
fix(ext/node): implement process:seteuid() (#31160)
Closes #31144
2025-11-03 21:30:21 +07:00
Daniel Osvaldo Rahmanto
361c83ea35
fix(ext/node): implement process.setegid() (#31155)
Closes #31116
2025-11-03 20:27:53 +07:00
Felipe Cardozo
be1ede505b
fix(ext/node): implement util.getSystemErrorMessage() (#31147)
Solution for https://github.com/denoland/deno/issues/31132
2025-11-03 11:24:06 +01:00
Daniel Osvaldo Rahmanto
552cb3df05
fix(ext/node): respects flag option on fs.readfile and fs.readfilesync (#31129)
Closes #31099
2025-10-31 09:32:36 +01:00
Daniel Osvaldo Rahmanto
58f21ae597
fix(ext/node): inconsistent error message thrown by AssertionError (#31089)
Closes #31082
2025-10-28 09:51:09 +01:00
Felipe Cardozo
ee6c66b9e9
fix(ext/node): handle empty writes in chunked HTTP requests (#31066)
Some checks are pending
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
2025-10-28 07:08:49 +05:30
Daniel Osvaldo Rahmanto
202a8c054b
Revert "fix(ext/node): fileHandle compatibility" (#31103)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Reverts denoland/deno#31094

This has caused node compat tests to fail on main.
2025-10-27 16:27:50 +00:00
Daniel Osvaldo Rahmanto
3a1ae29327
fix(ext/node): fileHandle compatibility (#31094)
Towards #29972

Notable changes:
- Omits `path` from the `FileHandle` constructor. This includes
replacing `utimes` and `chown` with `futimes` and `fchown`.
- Handles closing resource ID gracefully to follow node's
implementation. Closed resource IDs are marked as `-1`.
- Make every fs method to call the `fsCall` function.

Allows the following tests to pass:
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-filehandle-close.js
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-fs-filehandle-use-after-close.js
2025-10-27 16:58:23 +05:30
Felipe Cardozo
c0ebacba75
fix(ext/node): handle multiple calls in inspector.Session.post() (#31067)
Some checks are pending
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
Fixes a panic that occurred when using nested session.post() calls in
the node:inspector module. The issue manifested when callbacks from
inspector commands (like Profiler.enable) called session.post() again,
causing a re-entrant invocation of op_inspector_dispatch.

Fixes https://github.com/denoland/deno/issues/31020
2025-10-27 10:46:55 +01:00
Daniel Osvaldo Rahmanto
2b0f277e96
fix(ext/node): fs.read/fs.readSync and fs.write/fs.writeSync compatibility (#31013)
Towards #29972

- `fs.read` and `fs.readSync`: accepts object option parameter.
- `fs.write` and `fs.writeSync`: negative position value defaults to the
current seek position.
- Allows several node compatibility tests to pass.
2025-10-22 10:48:42 +02:00
Edilson Pateguana
3987af2aa1
feat(ext/node): impl sqlite 'backup' capability (#29842)
Towards #29439 

This commit implements the `backup` function from the `node:sqlite` module.
2025-10-21 23:27:34 +02:00
Daniel Osvaldo Rahmanto
243857c362
fix(ext/node): false deprecation warning on crypto.createHmac (#31025)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-10-20 18:22:25 +00:00
Felipe Cardozo
48f273b8c9
fix(ext/node): process.moduleLoadList as undefined (#31022) 2025-10-20 14:51:46 +00:00
Daniel Osvaldo Rahmanto
a44f0cb99f
fix(ext/node): support option object parameter on fs.write and fs.writeSync (#30999)
Some checks are pending
ci / build libs (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Closes #30972

Other changes:
- Re-enables ignored tests on `tests/unit_node/_fs/_fs_write_test.ts`
- Ported the polyfill to `.ts`, though defining the types are tricky
since our implementation (ported from node) mutates a lot of variables.
2025-10-17 14:28:31 +02:00
Daniel Osvaldo Rahmanto
80e54a81e7
fix(ext/node): checking Symbol in env should not ask for permission (#30965)
Discovered on #30905, though not directly addressing the main issue

Given this code: 
```ts
console.log(globalThis.process.env)
```

Deno 2.5.4:
```bash
➜ deno index.ts 
 Granted env access to "Symbol(Deno.customInspect)".
 Granted env access to "Symbol(Deno.privateCustomInspect)".
 Granted env access to "Symbol(nodejs.util.inspect.custom)".
 Granted env access to "constructor".
 Granted env access to "Symbol(Symbol.iterator)".
 Granted env access.
[..result..]
```

This PR:
```bash
➜ deno index.ts
 Granted env access to "constructor".
 Granted env access.
[..result..]
```

Futhermore, it allows the following tests to pass:
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-process-env-deprecation.js
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-process-env-ignore-getter-setter.js
2025-10-14 08:25:35 +02:00
Daniel Osvaldo Rahmanto
03a5e4531b
fix(ext/node): dns.resolve6 compatibility (#30974)
Closes #30936

The `compressIPv6` function is causing this issue. Maybe it was used in
the past to compress IPv6 address returned from the op function, though
I might be wrong about this.

Both `Deno.resolveDns` and the `resolve6` polyfill use `op_dns_resolve`
op function, which returns a result that already matches with the
Node.js' `resolve6`. The incorrect result is due to our `resolve6`
polyfill applying the `compressIPv6` function to the result.
2025-10-13 11:20:08 +02:00
Daniel Osvaldo Rahmanto
805973385d
fix(ext/node): omit smi from zlib.crc32 op function (#30907)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Closes #30636
2025-10-03 13:57:30 -07:00