summaryrefslogtreecommitdiff
path: root/tests/node_compat/test/parallel
AgeCommit message (Collapse)Author
2024-11-13feat(node): stabilize detecting if CJS via `"type": "commonjs"` in a ↵David Sherret
package.json (#26439) This will respect `"type": "commonjs"` in a package.json to determine if `.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to be ESM it will be loaded as ESM though.
2024-11-12fix(ext/node): add autoSelectFamily option to net.createConnection (#26661)Yoshiya Hinosawa
2024-10-31fix(node): Implement `os.userInfo` properly, add missing `toPrimitive` (#24702)Nathan Whitaker
Fixes the implementation of `os.userInfo`, and adds a missing `toPrimitive` for `tmpdir`. This allows us to enable the corresponding node_compat test.
2024-10-28fix: report exceptions from nextTick (#26579)snek
Fixes: https://github.com/denoland/deno/issues/24713 Fixes: https://github.com/denoland/deno/issues/25855
2024-10-15fix(ext/node): implement TCP.setNoDelay (#26263)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/26177 The significant delay was caused by Nagel's algorithm + delayed ACKs in Linux kernels. Here's the [kernel patch](https://lwn.net/Articles/502585/) which added 40ms `tcp_default_delack_min` ``` $ deno run -A pg-bench.mjs # main Tue Oct 15 2024 12:27:22 GMT+0530 (India Standard Time): 42ms $ target/release/deno run -A pg-bench.mjs # this patch Tue Oct 15 2024 12:28:02 GMT+0530 (India Standard Time): 1ms ``` ```js import { Buffer } from "node:buffer"; import pg from 'pg' const { Client } = pg const client = new Client({ connectionString: 'postgresql://postgres:postgres@127.0.0.1:5432/postgres' }) await client.connect() async function fetch() { const startPerf = performance.now(); const res = await client.query(`select $1::int as int, $2 as string, $3::timestamp with time zone as timestamp, $4 as null, $5::bool as boolean, $6::bytea as bytea, $7::jsonb as json `, [ 1337, 'wat', new Date().toISOString(), null, false, Buffer.from('awesome'), JSON.stringify([{ some: 'json' }, { array: 'object' }]) ]) console.log(`${new Date()}: ${Math.round(performance.now() - startPerf)}ms`) } for(;;) await fetch(); ```
2024-10-02feat(ext/node): buffer.transcode() (#25972)Satya Rohith
Closes https://github.com/denoland/deno/issues/25911
2024-09-25test: disable 'test-child-process-ipc-next-tick.js' Node compat test (#25856)Bartek Iwańczuk
This test is super flaky recently. See https://github.com/denoland/deno/issues/25855 for more details.
2024-09-12fix(ext/node): Implement detached option in `child_process` (#25218)Nathan Whitaker
Fixes https://github.com/denoland/deno/issues/25193.
2024-09-11fix(ext/node): add `FileHandle#writeFile` (#25555)Yoshiya Hinosawa
This PR adds `writeFile` methods of `FileHandle` class https://nodejs.org/api/fs.html#filehandlewritefiledata-options
2024-09-10fix(ext/node): Rewrite `node:v8` serialize/deserialize (#25439)Nathan Whitaker
Closes #20613. Reimplements the serialization on top of the v8 APIs instead of deno_core. Implements `v8.Serializer`, `v8.DefaultSerializer`, `v8.Deserializer`, and `v8.DefaultSerializer`.
2024-08-06feat: vm rewrite (#24596)snek
rewrite vm implementation to increase compat. vm.Module+importModuleDynamically callbacks should be added in a followup.
2024-07-25fix(node/worker_threads): support `port.once()` (#24725)Marvin Hagemeister
Support `MessagePort.once` in Node mode and enable relevant `worker_threads` test. Noticed that another Node test was passing as well, so I enabled that too.
2024-07-24fix(node): Run node compat tests listed in the `ignore` field (and fix the ↵Nathan Whitaker
ones that fail) (#24631) The intent is that those tests will be executed, but our check that the files are up to date won't overwrite the contents of the tests. This is useful when a test needs some manual edits to work. It turns out we weren't actually running them. --- This ended up turning into a couple of small bug fixes to get the tests passing: - We weren't canonicalizing the exec path properly (it sometimes still had `..` or `.` in it) - We weren't accepting strings in `process.exit` There was one failure I couldn't figure out quickly, so I disabled the test for now, and filed a follow up issue: #24694
2024-07-05fix(node): Implement `fs.lchown` (and `process.getegid`) (#24418)Nathan Whitaker
Closes https://github.com/denoland/deno/issues/21260. Part of https://github.com/denoland/deno/issues/18218. Implements `node:fs.lchown`, and enables the node_compat test for it. The test uses `process.getegid`, which we didn't have implemented, so I went ahead and implemented that as well to get the test working.
2024-07-05fix(ext/node): rewrite digest handling (#24392)Luca Casonato
Previously we had many different code paths all handling digests in different places, all with wildly different digest support. This commit rewrites this to use a single digest handling mechanism for all digest operations. It adds various aliases for digest algorithms, like node does. For example `sha1WithRSAEncryption` is an alias for `sha1`. It also adds support for `md5-sha1` digests in various places.
2024-07-02fix(ext/node): Add `fs.lutimes` / `fs.lutimesSync` (#23172)Nathan Whitaker
Part of #18218 - Adds `fs.lutimes` and `fs.lutimesSync` to our node polyfills. To do this I added methods to the `FileSystem` trait + ops to expose the functionality to JS. - Exports `fs._toUnixTimestamp`. Node exposes an internal util `toUnixTimestamp` from the fs module to be used by unit tests (so we need it for the unit test to pass unmodified). It's weird because it's only supposed to be used internally but it's still publicly accessible - Matches up error handling and timestamp handling for fs.futimes and fs.utimes with node - Enables the node_compat utimes test - this exercises futimes, lutimes, and utimes.
2024-07-02chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24388)Bartek Iwańczuk
Reland of https://github.com/denoland/deno/pull/24056 that doesn't suffer from the problem that was discovered in https://github.com/denoland/deno/pull/24261. It uses upgraded `hyper` and `hyper-util` that fixed the previous problem in https://github.com/hyperium/hyper/pull/3691.
2024-06-25test(node_compat): enable more stream-writable tests (#24328)Satya Rohith
2024-06-24fix(ext/node): rewrite crypto.Hash (#24302)Luca Casonato
Changes in this PR: - Added new fixed size hash algorithms (blake2b512, blake2s256, sha512-224, sha512-256, sha3-224, sha3-256, sha3-384, sha3-512, sm3) - Added variable size hash algorithms (the concept), with the algorithms shake128 and shake256 - Use cppgc instead of resources for the hasher - Enable Node's crypto.Hash tests and fix found bugs
2024-06-19Revert "chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24056)" (#24262)Bartek Iwańczuk
This reverts commit fb31eaa9ca59f6daaee0210d5cd206185c7041b9. Reverting because users reported spurious errors when downloading dependencies - https://github.com/denoland/deno/issues/24260. Closes https://github.com/denoland/deno/issues/24260
2024-06-18feat(ext/node): add BlockList & SocketAddress classes (#24229)Satya Rohith
Closes https://github.com/denoland/deno/issues/24059
2024-06-15fix(ext/node): better support for `node:diagnostics_channel` module (#24088)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/24060
2024-06-13chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24056)Bartek Iwańczuk
This commit updates Deno to use `reqwest` at 0.12.4 and `rustls` at 0.22. Other related crates were updated as well to match versions accepted by `reqwest` and `rustls`. Note: we are not using the latest available `rustls` yet, but this upgrade was non-trivial already, so a bump to 0.23 for `rustls` will be done in a separate commit. Closes #23370 --------- Signed-off-by: Ryan Dahl <ry@tinyclouds.org> Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Ryan Dahl <ry@tinyclouds.org> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-06-11chore: sync up Node.js test files for v20.11.1 (#24066)Bartek Iwańczuk
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-06-02chore: disable part of `test-fs-read-stream.js` (#24085)Bartek Iwańczuk
2024-05-21feat(node): buffer isUtf8/isAscii (#23928)snek
Fixes: https://github.com/denoland/deno/issues/23657 Implements `isUtf8` and `isAscii` as ops.
2024-04-03chore: move `tools/node_compat` to `tests/node_compat/runner` (#23025)Asher Gomez
The `tools/node_compat/node` submodule has been moved to `tests/node_compat/runner/suite` and the remaining files within `tools/node_compat` to `tests/node_compat/runner`. Most of the changes are of the header within `tests/node_compat/test` files. The `setup` and `test` tasks within `tests/node_comapt` execute successfully. Towards #22525 CC @mmastrac
2024-04-01fix(ext/node): Add fs.readv, fs.readvSync (#23166)Nathan Whitaker
Part of #18218. Implements `fs.readv` and `fs.readvSync` and enables the corresponding `node_compat` tests.
2024-03-15fix(ext/node): Reimplement StringDecoder to match node's behavior (#22933)Nathan Whitaker
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-11fix(ext/node): Match punycode module behavior to node (#22847)Nathan Whitaker
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-11fix(ext/node) implement receiveMessageOnPort for node:worker_threads (#22766)mash-graz
Implementation of `receiveMessageOnPort` for `node:worker_threads` Fixes: #22702
2024-03-10fix(node:http) Export `validateHeaderName` and `validateHeaderValue` ↵mash-graz
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-02-10chore: move cli/tests/ -> tests/ (#22369)Matt Mastracci
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.