summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node
AgeCommit message (Collapse)Author
2024-01-24feat: deprecate `Deno.fstat()` and `Deno.fstatSync()` (#22068)Asher Gomez
For removal in Deno v2.
2024-01-24feat: deprecate `Deno.write()` and `Deno.writeSync()` (#22064)Asher Gomez
For removal in Deno v2.
2024-01-24feat: deprecate `Deno.close()` (#22066)Asher Gomez
For removal in Deno v2. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24feat: deprecate `Deno.ftruncate()` and `Deno.ftruncateSync()` (#22069)Asher Gomez
For removal in Deno 2.0.
2024-01-24feat: deprecate `Deno.read()` and `Deno.readSync()` (#22063)Asher Gomez
For removal in Deno v2.
2024-01-24feat: deprecate `Deno.resources()` (#22059)Asher Gomez
Most uses of `Deno.resources()` within tests, as they previously checked for leaked resources. This is not needed as the test runner does this automatically. Other internal uses of this API have been replaced with the internal `Deno[Deno.internal].core.resources()`.
2024-01-24feat: `Deno.{stdin,stdout,stderr}.isTerminal()`, deprecate `Deno.isatty()` ↵Asher Gomez
(#22011) This change: 1. Implements `Deno.stdin.isTerminal()`, `Deno.stdout.isTerminal()` and `Deno.stderr.isTerminal()`. 2. Deprecates `Deno.isatty()` for removal in Deno v2, in favour of the above instance methods. 3. Replaces use of `Deno.isatty()` with the above instance methods. Related #21995 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-01-23fix(ext/node): fix no arg call of fs.promises.readFile (#22030)Yoshiya Hinosawa
2024-01-21chore: use `Deno.writeTextFile()` where appropriate (#22008)Asher Gomez
2024-01-21fix(node/fs): promises not exporting fs constants (#21997)Marvin Hagemeister
<!-- Before submitting a PR, please read https://deno.com/manual/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. --> We were missing the `constants` export in the promise `fs` API which is available in node. ```ts import { constants, promises } from "node:fs"; import { constants as fsPromiseConstants } from "node:fs/promises"; console.log(constants === promises.constants); // logs: true console.log(constants === fsPromiseConstants); // logs: true ``` Fixes https://github.com/denoland/deno/issues/21994
2024-01-19fix(node/http): remoteAddress and remotePort not being set (#21998)Marvin Hagemeister
<!-- Before submitting a PR, please read https://deno.com/manual/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. --> Ultimately, it came down to using incorrect property names in the `FakeSocket` constructor. The values are passed under `remoteAddress`, not `hostname` and `remotePort` instead of `port`. Fixes https://github.com/denoland/deno/issues/21980
2024-01-18fix(node): update `req.socket` on WS upgrade (#21984)Divy Srivastava
Update the `req.socket` to be a `net.Socket` from `FakeSocket` Fixes #21979
2024-01-05fix(ext/node): add WriteStream.isTTY (#21801)Divy Srivastava
2024-01-04fix(ci): copyright year for console_test.ts (#21787)Divy Srivastava
Missed in https://github.com/denoland/deno/commit/b2cd254c35b6b1b128beea0eacdb8e814d91e003#diff-0c2dcdd1ce20382e6ddefe52956cf2f570f18063cf09067f8a7ca44abaf33122
2024-01-04fix: strict type check for cross realms (#21669)Kenta Moriuchi
Deno v1.39 introduces `vm.runInNewContext`. This may cause problems when using `Object.prototype.isPrototypeOf` to check built-in types. ```js import vm from "node:vm"; const err = new Error(); const crossErr = vm.runInNewContext(`new Error()`); console.assert( !(crossErr instanceof Error) ); console.assert( Object.getPrototypeOf(err) !== Object.getPrototypeOf(crossErr) ); ``` This PR changes to check using internal slots solves them. --- current: ``` > import vm from "node:vm"; undefined > vm.runInNewContext(`new Error("message")`) Error {} > vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`) Date {} ``` this PR: ``` > import vm from "node:vm"; undefined > vm.runInNewContext(`new Error("message")`) Error: message at <anonymous>:1:1 > vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`) 2018-12-10T02:26:59.002Z ``` --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-04fix(ext/node): UdpSocket ref and unref (#21777)Divy Srivastava
2024-01-03fix(node/zlib): accept dataview and buffer in zlib bindings (#21756)Jovi De Croock
Fixes #20516 Follow up to #21747 and #21746 This tackles the last point of #20516 where certain inputs weren't accepted in the other zlib methods This adds the `toU8` conversion of `_brotli` to `_zlib.mjs`, when we create the ZLibBuffer, we'll sanitize the input. I noticed that the async had no handler for `string` input so I added that as well.
2024-01-02fix(ext/node): implement os.machine (#21751)Divy Srivastava
2024-01-02fix(ext/node): querystring stringify without encode callback (#21740)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/21734 Changes: - Use default encode when options do not provide a encode callback. - Remove internal TS for `node:querystring`. Its not helping catching bugs like this because of invalid type assumptions and use of `any`, more of a maintenance burden.
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-31fix(node/zlib): consistently return buffer (#21747)Jovi De Croock
This fixes point 3 of https://github.com/denoland/deno/issues/20516 This PR creates consistency between the sync and async versions of the brotli compress where we will always return a buffer like Node.
2023-12-31fix(node/zlib): cast Dataview and Buffer to uint8 (#21746)Jovi De Croock
This fixes point 2 of #20516 This adds a conversion from Dataview/Buffer by returning `obj.buffer` which can be converted to a `UInt8Array`. Question: Regarding point 4 of the mentioned issue would it be appropriate to copy the toU8 helper to the `zlib.mjs` methods?
2023-12-28fix(node): Implement os.cpus() (#21697)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/21666 Zero added dependency and tries to match the libuv implementation
2023-12-27fix(ext/node): Implement `aes-192-ecb` and `aes-256-ecb` (#21710)Lino Le Van
2023-12-25fix(ext/node): add ClientRequest#setNoDelay (#21694)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/18316
2023-12-20fix(node): child_process kill cancel pending IPC reads (#21647)Divy Srivastava
2023-12-20fix(node): add crypto.pseudoRandomBytes (#21649)Divy Srivastava
2023-12-14fix(node): return false from vm.isContext (#21568)Divy Srivastava
https://github.com/denoland/deno/issues/20851#issuecomment-1779226106 for `jsdom`
2023-12-13fix(zlib): handle no flush flag in handle_.write (#21432)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/21096
2023-12-11fix(ext/node): basic vm.runInNewContext implementation (#21527)Divy Srivastava
Simple implementation to support webpack (& Next.js): https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/javascript/JavascriptParser.js#L4329
2023-12-11fix(ext/node): ServerResponse getHeader() return undefined (#21525)Divy Srivastava
Matches Node's return type. Next.js check for `if (header === undefined)`: https://github.com/vercel/next.js/blob/e02fe314dcd0ae614c65b505c6daafbdeebb920e/packages/next/src/server/base-http/node.ts#L93
2023-12-11fix(ext/node): stub ServerResponse#flushHeaders (#21526)Divy Srivastava
This commit adds a no-op flushHeaders method to the ServerResponse object. It is a nop because the ServerResponse implementation is based on top of the Deno server API instead of the Node `OutgoingMessage` base. Fixes #21509
2023-12-08fix(ext/node): allow null value for req.setHeader (#21391)Yoshiya Hinosawa
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-07test(ext/node): compare free memory in log scale (#21475)Yoshiya Hinosawa
2023-12-04perf(node/fs): faster `existsSync` when not exists (#21458)David Sherret
2023-12-03fix(ext/node): sign with PEM private keys (#21287)Divy Srivastava
Add support for signing with a RSA PEM private key: `pkcs8` and `pkcs1`. Fixes https://github.com/denoland/deno/issues/18972 Ref #21124 Verified fix with `npm:sshpk`. Unverfied but fixes `npm:google-auth-library`, `npm:web-push` & `oracle/oci-typescript-sdk` --------- Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-12-02fix(node): setting process.exitCode should change exit code of process (#21429)David Sherret
2023-12-02chore: update std to 0.208.0 (#21318)Asher Gomez
Re-attempt at #21284. I was more thorough this time. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2023-12-01fix(ext/node): add stubbed process.report (#21373)Daniel Mizerski
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-11-30fix(ext/node): fix os.freemem (#21347)Yoshiya Hinosawa
2023-11-27fix(node): `spawnSync`'s `status` was incorrect (#21359)David Sherret
The exit code wasn't hooked up properly.
2023-11-25chore(ext/node): remove unnecessary test case (#21337)Yoshiya Hinosawa
This test case is covered by the last case in https://github.com/denoland/deno/blob/5710fffb120eba88e1b261e3ef379cb02575de42/cli/tests/node_compat/test/parallel/test-stream2-transform.js and not necessary anymore.
2023-11-24chore: deflake unit_node/crypto/crypto_key_test.ts (#21331)Bartek Iwańczuk
Ref https://github.com/denoland/deno/issues/21187 On CI we are going to run only fast tests, with an option to pass `SLOW_TESTS=1` env var to enable more comprehensive tests.
2023-11-23fix(ext/node): fix node:stream.Writable (#21297)Yoshiya Hinosawa
This change applies the same fix as https://github.com/nodejs/node/pull/46818, and the original example given in #20456 works as expected. closes #20456
2023-11-22refactor: replace `deferred()` from `std/async` with ↵Asher Gomez
`Promise.withResolvers()` (#21234) Closes #21041 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2023-11-22Revert "chore: update to `std@0.207.0` (#21284)" (#21295)Bartek Iwańczuk
This reverts commit 20aa0796e6ff7651cdfce4d0292bdb11da5dfe2e. `main` has been failing consistenly on `kv_undelivered_test` and `serve_test` after this upgrade.
2023-11-22chore: update to `std@0.207.0` (#21284)Asher Gomez
Closes #21002
2023-11-20fix(ext/node): handle closing process.stdin more than once (#21267)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/21112 Aligns more towards what Node.js does. Closing stdin more than once is a nop.
2023-11-14fix(ext/node): add APIs perf_hook.performance (#21192)Bartek Iwańczuk
Required for Next.js.
2023-11-11fix(node/http): export globalAgent (#21081)Jacob Hummer
Fixes #21080 Fixes #18312 --------- Signed-off-by: Jacob Hummer <jcbhmr@outlook.com>