summaryrefslogtreecommitdiff
path: root/tests/unit_node
AgeCommit message (Collapse)Author
2024-10-23fix(node:tls): set TLSSocket.alpnProtocol for client connections (#26476)Satya Rohith
Towards https://github.com/denoland/deno/issues/26127
2024-10-23fix(ext/node): map `ERROR_INVALID_NAME` to `ENOENT` on windows (#26475)Yoshiya Hinosawa
In libuv on windows, `ERROR_INVALID_NAME` is mapped to `ENOENT`, but it is mapped to `EINVAL` in our compat implementation, which causes the issue #24899. ref: https://github.com/libuv/libuv/blob/d4ab6fbba4669935a6bc23645372dfe4ac29ab39/src/win/error.c#L138 closes #24899 closes #26411 closes #23635 closes #21165 closes #19067
2024-10-17chore: fix flaky COPYFILE_EXCL test (#26370)Nathan Whitaker
It was missing an await
2024-10-17fix(node/fs): copyFile with `COPYFILE_EXCL` should not throw if the ↵Nathan Whitaker
destination doesn't exist (#26360) Fixes #26313. We were checking for the NotFound error, but still calling the callback with the error / throwing.
2024-10-16fix: don't warn on ignored signals on windows (#26332)Nathan Whitaker
Closes #26183. The warnings are super noisy and not actionable for the user
2024-10-17fix(node/http): normalize header names in `ServerResponse` (#26339)Nathan Whitaker
Fixes https://github.com/denoland/deno/issues/26115. We weren't normalizing the headers to lower case, so code that attempted to delete the `Content-Length` header (but used a different case) wasn't actually removing the header.
2024-10-16fix(child_process): map node `--no-warnings` flag to `--quiet` (#26288)Nathan Whitaker
Closes https://github.com/denoland/deno/issues/25899
2024-10-16fix(ext/node): fix dns.lookup result ordering (#26264)Yoshiya Hinosawa
partially unblocks #25470 This PR aligns the resolution of `localhost` hostname to Node.js behavior. In Node.js `dns.lookup("localhost", (_, addr) => console.log(addr))` prints ipv6 address `::1`, but it prints ipv4 address `127.0.0.1` in Deno. That difference causes some errors in the work of enabling `createConnection` option in `http.request` (#25470). This PR fixes the issue by aligning `dns.lookup` behavior to Node.js. This PR also changes the following behaviors (resolving TODOs): - `http.createServer` now listens on ipv6 address `[::]` by default on linux/mac - `net.createServer` now listens on ipv6 address `[::]` by default on linux/mac These changes are also alignments to Node.js behaviors.
2024-10-16fix(ext/node): timingSafeEqual account for AB byteOffset (#26292)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/26276
2024-10-14fix(ext/node): compute pem length (upper bound) for key exports (#26231)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/26188
2024-10-14fix(ext/node): allow writing to tty columns (#26201)Divy Srivastava
Behave similar to Node.js where modifying `stdout.columns` doesn't really resize the terminal. Ref https://github.com/nodejs/node/issues/17529 Fixes https://github.com/denoland/deno/issues/26196
2024-10-12fix(node/util): export `styleText` from `node:util` (#26194)Nathan Whitaker
Fixes #26184. It was added but not publicly exported.
2024-10-11fix(node): make `process.stdout.isTTY` writable (#26130)Marvin Hagemeister
Fixes https://github.com/denoland/deno/issues/26123
2024-10-08fix(ext/node): internal buffer length in readSync (#26064)Satya Rohith
Closes https://github.com/denoland/deno/issues/26054
2024-10-04fix(node): fix worker_threads issues blocking Angular support (#26024)Nathan Whitaker
Fixes #22995. Fixes #23000. There were a handful of bugs here causing the hang (each with a corresponding minimized test): - We were canceling recv futures when `receiveMessageOnPort` was called, but this caused the "receive loop" in the message port to exit. This was due to the fact that `CancelHandle`s are never reset (i.e., once you `cancel` a `CancelHandle`, it remains cancelled). That meant that after `receieveMessageOnPort` was called, the subsequent calls to `op_message_port_recv_message` would throw `Interrupted` exceptions, and we would exit the loop. The cancellation, however, isn't actually necessary. `op_message_port_recv_message` only borrows the underlying port for long enough to poll the receiver, so the borrow there could never overlap with `op_message_port_recv_message_sync`. - Calling `MessagePort.unref()` caused the "receive loop" in the message port to exit. This was because we were setting `messageEventListenerCount` to 0 on unref. Not only does that break the counter when multiple `MessagePort`s are present in the same thread, but we also exited the "receive loop" whenever the listener count was 0. I assume this was to prevent the recv promise from keeping the event loop open. Instead of this, I chose to just unref the recv promise as needed to control the event loop. - The last bug causing the hang (which was a doozy to debug) ended up being an unfortunate interaction between how we implement our messageport "receive loop" and a pattern found in `npm:piscina` (which angular uses). The gist of it is that piscina uses an atomic wait loop along with `receiveMessageOnPort` in its worker threads, and as the worker is getting started, the following incredibly convoluted series of events occurs: 1. Parent sends a MessagePort `p` to worker 2. Parent sends a message `m` to the port `p` 3. Parent notifies the worker with `Atomics.notify` that a new message is available 4. Worker receives message, adds "message" listener to port `p` 5. Adding the listener triggers `MessagePort.start()` on `p` 6. Receive loop in MessagePort.start receives the message `m`, but then hits an await point and yields (before dispatching the "message" event) 7. Worker continues execution, starts the atomic wait loop, and immediately receives the existing notification from the parent that a message is available 8. Worker attempts to receive the new message `m` with `receiveMessageOnPort`, but this returns `undefined` because the receive loop already took the message in 6 9. Atomic wait loop continues to next iteration, waiting for the next message with `Atomic.wait` 10. `Atomic.wait` blocks the worker thread, which prevents the receive loop from continuing and dispatching the "message" event for the received message 11. The parent waits for the worker to respond to the first message, and waits 12. The thread can't make any more progress, and the whole process hangs The fix I've chosen here (which I don't particularly love, but it works) is to just delay the `MessagePort.start` call until the end of the event loop turn, so that the atomic wait loop receives the message first. This prevents the hang. --- Those were the main issues causing the hang. There ended up being a few other small bugs as well, namely `exit` being emitted multiple times, and not patching up the message port when it's received by `receiveMessageOnPort`.
2024-09-27BREAKING(ext/net): improved error code accuracy (#25383)Luca Casonato
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-19fix(ext/node): support x509 certificates in `createPublicKey` (#25731)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/25681
2024-09-19fix(ext/node): don't throw error for unsupported signal binding on windows ↵Yoshiya Hinosawa
(#25699)
2024-09-18feat(ext/node): add rootCertificates to node:tls (#25707)Luca Casonato
Closes https://github.com/denoland/deno/issues/25604 Signed-off-by: Satya Rohith <me@satyarohith.com> Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-09-16fix(ext/crypto): support md4 digest algorithm (#25656)Luca Casonato
Fixes #25646
2024-09-14feat: TypeScript 5.6 and `npm:@types/node@22` (#25614)David Sherret
2024-09-13fix(ext/node): fix Decipheriv when autoPadding disabled (#25598)Yoshiya Hinosawa
This change fixes Decipheriv behavior when autoPadding disabled and enabled. By this change, the example given in https://github.com/denoland/deno/issues/20924#issuecomment-2345931295 works in the same way as Node. closes #20924
2024-09-12fix: add test ensuring als works across dynamic import (#25593)snek
The fix is in https://github.com/denoland/deno_core/pull/888 Fixes: https://github.com/denoland/deno/issues/25275 Signed-off-by: snek <snek@deno.com>
2024-09-12fix(ext/node): export request and response clases from `http2` module (#25592)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/20612 Closes https://github.com/denoland/deno/issues/23326 This makes `qwik` work.
2024-09-11fix(ext/node): fix `Cipheriv#update(string, undefined)` (#25571)Yoshiya Hinosawa
2024-09-11fix(ext/node): avoid showing `UNKNOWN` error from TCP handle (#25550)Yoshiya Hinosawa
2024-09-11fix(ext/node): validate input lengths in `Cipheriv` and `Decipheriv` (#25570)Yoshiya Hinosawa
addresses the first part of #25279
2024-09-10BREAKING(net): remove ↵Asher Gomez
`Deno.ConnectTlsOptions.{certChain,certFile,privateKey}` and `Deno.ListenTlsOptions.certChain,certFile,keyFile}` (#25525) Towards #22079
2024-09-11BREAKING(fs): remove `Deno.FsFile.prototype.rid` (#25499)Asher Gomez
Towards #22079 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-10feat(cli): use NotCapable error for permission errors (#25431)Luca Casonato
Closes #7394 --------- Co-authored-by: snek <snek@deno.com>
2024-09-10test: remove usage of `--unstable` flag (#25549)Bartek Iwańczuk
This commit removes all occurrences of `--unstable` flag from all the tests that are run in CI. Turns out none of the tests actually required that flag anymore.
2024-09-09fix(ext/node): Stream should be instance of EventEmitter (#25527)Satya Rohith
Closes https://github.com/denoland/deno/issues/25526
2024-09-08fix(ext/node): delay accept() call 2 ticks in net.Server#listen (#25481)Yoshiya Hinosawa
A workaround for the issue #25480 `Deno.Listener` can't be closed synchronously after `accept()` is called. This PR delays the `accept` call 2 ticks (The listener callback is called 1 tick later. So the 1 tick delay is not enough), and makes `net.Server` capable of being closed synchronously. This unblocks `npm:detect-port` and `npm:portfinder` closes #18301 closes #25175
2024-09-07chore: soft-remove `Deno.{stdin,stderr,stdout}.rid` (#25479)Asher Gomez
Towards #22079
2024-09-05feat(check): turn on useUnknownInCatchVariables (#25465)David Sherret
Part of #25162 Closes #11826
2024-09-05fix(ext/node): stub `process.cpuUsage()` (#25462)Yoshiya Hinosawa
closes #23401
2024-09-05feat(ext/node): add abort helpers, process & streams fix (#25262)Luca Casonato
This commit adds: - `addAbortListener` in `node:events` - `aborted` in `node:util` - `execPath` and `execvArgs` named export from `node:process` - `getDefaultHighWaterMark` from `node:stream` The `execPath` is very hacky - because module namespaces can not have real getters, `execPath` is an object with a `toString()` method that on call returns the actual `execPath`, and replaces the `execPath` binding with the string. This is done so that we don't require the `execPath` permission on startup.
2024-09-05fix(ext/http): do not set localhost to hostname unnecessarily (#24777)Yoshiya Hinosawa
This commit changes when to cause the hostname substition of `0.0.0.0` -> `localhost`. Currently we substitute `localhost` to the hostname on windows before calling `options.onListen`, which prevents the users to do more advanced thing using hostname string like https://github.com/denoland/std/issues/5558. This PR changes it not to substitute it when the user provide `onListen` callback. closes #24776 unblocks https://github.com/denoland/std/issues/5558
2024-09-05fix(ext/node): close upgraded socket when the underlying http connection is ↵Yoshiya Hinosawa
closed (#25387) This change fixes the handling of upgraded socket from `node:http` module. In `op_node_http_fetch_response_upgrade`, we create DuplexStream paired with `hyper::upgrade::Upgraded`. When the connection is closed from the server, the read result from `Upgraded` becomes 0. However because we don't close the paired DuplexStream at that point, the Socket object in JS side keeps alive even after the server closed. That caused the issue #20179 This change fixes it by closing the paired DuplexStream when the `Upgraded` stream returns 0 read result. closes #20179
2024-08-30fix: upgrade deno_ast 0.42 (#25313)David Sherret
2024-08-30fix(ext/node): session close during stream setup (#25170)Caleb Lloyd
Signed-off-by: Caleb Lloyd <caleblloyd@gmail.com>
2024-08-30test(ext/node): check hostname option has precedence over host option (#25292)Yoshiya Hinosawa
2024-08-29fix: reland async context (#25140)snek
This reverts commit 71ca61e189cca9215982ce4598b7a4da8430c584. Now uses a shared implementation from deno_core.
2024-08-29test: run `node_unit_tests` with `DENO_FUTURE=1` (#25285)Bartek Iwańczuk
This is blocking https://github.com/denoland/deno/pull/25213. Turns out a bunch of FS APIs are completely broken because they use RIDs (resource IDs) instead of FDs (file descriptors).
2024-08-28fix(ext/node): import RSA JWK keys (#25267)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/24129
2024-08-28fix(ext/node): export JWK public key (#25239)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/18928 Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-28fix(ext/node): import EC JWK keys (#25266)Divy Srivastava
2024-08-28fix(ext/node): update aead-gcm-stream to 0.3 (#25261)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/25260 Fixes https://github.com/denoland/deno/issues/25254 Fixes https://github.com/denoland/deno/issues/23693 Verified that `web-push` GCM decryption works in the browser. See `aead-gcm-stream` changes [here](https://github.com/littledivy/aead-gcm-stream/commit/a9ffd0c07c14e4b566c87bf51a20ff799b9e7f5e)
2024-08-28fix(ext/node): emit `online` event after worker thread is initialized (#25243)Nathan Whitaker
Fixes #23281. Part of #20613. We were emitting the `online` event in the constructor, so the caller could never receive it (since there was no time for them to add a listener). Instead, emit the event where it's intended – after the worker is initialized. --- After this parcel no longer freezes, but still will fail due to other bugs (which will be fixed in other PRs)
2024-08-26Revert "feat(fetch): accept async iterables for body" (#25207)Luca Casonato
Unfortunately this caused a regression: https://github.com/denoland/deno/issues/25203. Need to do some more upstream spec work to fix this before this can be re-landed. Reverts denoland/deno#24623