Commit graph

40 commits

Author SHA1 Message Date
Nathan Whitaker ebbc897b69
fix(ext/node): Reimplement StringDecoder to match node's behavior (#22933)
Fixes #22158.

Basically reimplements the whole `StringDecoder` with a much more direct
translation (read like one-to-one) of node's current logic. The old
implementation was closer to node's super old impl and it was too hard
to keep the code structure while matching the behavior of their new
logic.

This adds support for UTF-16LE, ascii, and latin1. 

This also enables the node_compat test, which now passes without
modification.
2024-03-15 17:24:13 -07:00
Asher Gomez c38c14f51f
chore: make Node setup script less sensitive to changes (#22855)
This change tweaks the Node setup script less sensitive to changes by
removing the test counter line in `tools/node_compat/TODO.md`.
Previously, this line would cause linting issues when two Node compat
changes occured one after another.

See
https://github.com/denoland/deno/actions/runs/8226735149/job/22493585874

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-03-12 03:31:34 +00:00
Nathan Whitaker a77b2987bc
fix(ext/node): Match punycode module behavior to node (#22847)
Fixes #19214.

We were using the `idna` crate to implement our polyfill for
`punycode.toASCII` and `punycode.toUnicode`. The `idna` crate is
correct, and adheres to the IDNA2003/2008 spec, but it turns out
`node`'s implementations don't really follow any spec! Instead, node
splits the domain by `'.'` and punycode encodes/decodes each part. This
means that node's implementations will happily work on codepoints that
are disallowed by the IDNA specs, causing the error in #19214.

While fixing this, I went ahead and matched the node behavior on all of
the punycode functions and enabled node's punycode test in our
`node_compat` suite.
2024-03-11 15:49:43 -07:00
Bartek Iwańczuk badb42fc23
build: fix node_compat/setup.ts check (#22842) 2024-03-11 13:31:24 +00:00
mash-graz 80dbcd3ddf
fix(ext/node) implement receiveMessageOnPort for node:worker_threads (#22766)
Implementation of `receiveMessageOnPort` for `node:worker_threads`

Fixes: #22702
2024-03-11 00:23:06 +01:00
mash-graz 16dbbfa64a
fix(node:http) Export validateHeaderName and validateHeaderValue functions (#22616)
Modify `_http_outgoing.ts` to support the extended signature of
`validateHeaderName()` used since node v19.5.0/v18.14.0 by adding the
`label` parameter. (see:
https://nodejs.org/api/http.html#httpvalidateheadernamename-label)

Making both validation functions accessible as public exports of
`node:http`

Fixes: #22614
2024-03-10 22:46:05 +00:00
Aapo Alasuutari 3333d67335
chore(tests): Remove vestiges of cli/tests folder (#22712) 2024-03-05 13:49:21 -07:00
Asher Gomez 6be389ce29
chore: move test_util/std to tests/util/std (#22402)
Note: tests are not the only part of the codebase that uses `std`. Other
parts, like `tools/`, do too. So, it could be argued that this is a
little misleading. Either way, I'm doing this as discussed with
@mmastrac.
2024-02-13 09:22:49 -07:00
Asher Gomez 92f6188253
chore: use @std import instead of @test_util/std (#22398)
This PR:
1. Replaces `@test_util/std`-prefixed imports with `@std`.
2. Adds `@std/` import map entries to a few `deno.json` files.
2024-02-13 02:05:10 +00:00
Matt Mastracci f5e46c9bf2
chore: move cli/tests/ -> tests/ (#22369)
This looks like a massive PR, but it's only a move from cli/tests ->
tests, and updates of relative paths for files.

This is the first step towards aggregate all of the integration test
files under tests/, which will lead to a set of integration tests that
can run without the CLI binary being built.

While we could leave these tests under `cli`, it would require us to
keep a more complex directory structure for the various test runners. In
addition, we have a lot of complexity to ignore various test files in
the `cli` project itself (cargo publish exclusion rules, autotests =
false, etc).

And finally, the `tests/` folder will eventually house the `test_ffi`,
`test_napi` and other testing code, reducing the size of the root repo
directory.

For easier review, the extremely large and noisy "move" is in the first
commit (with no changes -- just a move), while the remainder of the
changes to actual files is in the second commit.
2024-02-10 20:22:13 +00:00
Matt Mastracci 64ebd441e9
chore: use @test_util for node_compat tests (#22331) 2024-02-07 23:21:32 +00:00
Asher Gomez 983c745d4f
chore: use FsFile[Symbol.dispose]() (#22007)
This change takes advantage of explicit resources management for
`FsFile` instances and tweaks documentation to encourage the use of it.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-01-22 00:20:59 +01:00
David Sherret 7e72f3af61
chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
Yoshiya Hinosawa 5710fffb12
chore: update node_compat test suites to v18.18.2 (#21328) 2023-11-25 11:35:36 +09:00
Divy Srivastava 09204107d8
fix: implement node:tty (#20892)
Fixes #21012
Closes https://github.com/denoland/deno/issues/20855
Fixes https://github.com/denoland/deno/issues/20890
Fixes https://github.com/denoland/deno/issues/20611
Fixes https://github.com/denoland/deno/issues/20336
Fixes `create-svelte` from https://github.com/denoland/deno/issues/17248

Fixes more reports here:
- https://github.com/denoland/deno/issues/6529#issuecomment-1432690559
- https://github.com/denoland/deno/issues/6529#issuecomment-1522059006
- https://github.com/denoland/deno/issues/6529#issuecomment-1695803570
2023-10-30 15:53:08 +00:00
Aapo Alasuutari effb5e1ce4
fix(node/buffer): utf8ToBytes should return a Uint8Array (#20769) 2023-10-08 11:09:50 +09:00
Hirotaka Tagawa / wafuwafu13 9017e789df
test(node_compat): add test-http-url.parse* (#20458)
Add `test-http-url.parse*` tests for Node compat.
2023-09-30 10:14:48 +02:00
Bartek Iwańczuk 2a1ba2732e
chore: disable 'test-http-content-length.js` test (#20344) 2023-09-04 23:23:01 +02:00
osddeitf c2547ba039
fix(node/http): correctly send Content-length header instead of Transfer-Encoding: chunked (#20127)
Fix #20063.
2023-08-28 09:32:54 +02:00
Martin Fischer 801b9ec62d
chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
Hirotaka Tagawa / wafuwafu13 0104741d6f
chore(node_compat): fix path strings generated by setup.ts (#19347) 2023-06-02 15:05:32 +09:00
Hirotaka Tagawa / wafuwafu13 1a0445dc6b
chore(node_compat): add deno task for setting up and running tests (#19293) 2023-06-01 17:31:06 +09:00
Bartek Iwańczuk d90a75c036
fix: use proper ALPN protocols if HTTP client is HTTP/1.1 only (#19303)
Closes https://github.com/denoland/deno/issues/16923

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-05-29 23:05:45 +02:00
Leo Kettmeir be59e93220
refactor(node/http): don't use readablestream for writing to request (#19282)
Refactors the internal usage of a readablestream to write to the
resource directly

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-27 15:42:20 +02:00
Hirotaka Tagawa / wafuwafu13 0a3d355ce6
chore(node_compat): fix broken link and typo (#19265) 2023-05-26 05:00:29 +02:00
Yoshiya Hinosawa 243d9c846d
fix(ext/node): fix whatwg url formatting (#19146) 2023-05-17 14:51:51 +09:00
Leo Kettmeir 867a6d3032
refactor(node): reimplement http client (#19122)
This commit reimplements most of "node:http" client APIs using
"ext/fetch".

There is some duplicated code and two removed Node compat tests that
will be fixed in follow up PRs.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-17 01:20:32 +02:00
Levente Kurusa 1171c54952
feat(node/crypto): Builtin Diffie-Hellman Groups (#19137)
Towards #18455
2023-05-16 00:07:58 +02:00
Levente Kurusa 3356173d00
feat(node/crypto): Diffie Hellman Support (#18943)
Support crypto.DiffieHellman class in ext/node/crypto
2023-05-15 19:41:53 +02:00
Yoshiya Hinosawa 0ccfccdcd2
chore: check node_compat config diff in CI (#19119) 2023-05-15 21:22:53 +09:00
Yoshiya Hinosawa ab88dc2c68
chore(ext/node): removed skipped compat test cases (#19109) 2023-05-13 15:26:16 +09:00
Yoshiya Hinosawa 2a0c664840
chore: fix & update node compat config (#19106) 2023-05-13 14:49:11 +09:00
Yoshiya Hinosawa 63befe9377
fix(ext/node): fix hash.flush (#18818) 2023-04-25 11:21:26 +09:00
Yoshiya Hinosawa 53c9f5918c
fix(ext/node): improve vm.runInThisContext (#18767) 2023-04-19 23:26:16 +09:00
Yoshiya Hinosawa de21a780fd
fix(ext/node): add req.socket.remoteAddress (#18733) 2023-04-18 16:00:51 +09:00
Yoshiya Hinosawa 559a61b879
chore: update node compat config (#18736) 2023-04-18 00:36:49 +09:00
Bartek Iwańczuk 381f5801f9
Revert "refactor(ext/node): Use Deno.inspect (#17960)" (#18491)
This reverts commit a3529d0232.

This change made debugging Node tests very hard - `AssertionError` is
now printed as `[Circular *1]` giving no visibility what failed.

We need to align two implementations together and remove this one then.
2023-03-30 15:33:28 +00:00
Yoshiya Hinosawa 8b596cbae1
chore: document Node.js compat test setup script (#18381) 2023-03-26 12:22:09 +03:00
Ryan Dahl a3529d0232
refactor(ext/node): Use Deno.inspect (#17960)
No need for two almost identical implementations of the same thing

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-03-23 10:01:07 -04:00
Yoshiya Hinosawa aa729a42b4
chore(tools): restore node compat test setup script (#18290) 2023-03-21 22:38:07 +09:00