summaryrefslogtreecommitdiff
path: root/cli/tests
AgeCommit message (Collapse)Author
2024-01-22refactor: don't error when `.env` is not present (#21879)Asher Gomez
Uses similar format to when the latest version of std is implicitly being used. Closes #21788
2024-01-22chore: use `FsFile[Symbol.dispose]()` (#22007)Asher Gomez
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-21fix: remove conditional unstable type-checking from other commands (#21991)Bartek Iwańczuk
It appears I missed this in https://github.com/denoland/deno/pull/21825.
2024-01-21chore: use `Deno.readTextFile()` where appropriate (#22018)Asher Gomez
2024-01-21fix(lsp): improved npm specifier to import map entry mapping (#22016)David Sherret
Upgrades to the latest deno_semver
2024-01-21chore: use `Deno.writeTextFile()` where appropriate (#22008)Asher Gomez
2024-01-21chore: add types for `Deno.UnsafeWindowSurface` (#22010)Divy Srivastava
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-18feat: Start warning on each use of a deprecated API (#21939)Bartek Iwańczuk
This commit introduces deprecation warnings for "Deno.*" APIs. This is gonna be quite noisy, but should tremendously help with user code updates to ensure smooth migration to Deno 2.0. The warning is printed at each unique call site to help quickly identify where code needs to be adjusted. There's some stack frame filtering going on to remove frames that are not useful to the user and would only cause confusion. The warning can be silenced using "--quiet" flag or "DENO_NO_DEPRECATION_WARNINGS" env var. "Deno.run()" API is now using this warning. Other deprecated APIs will start warning in follow up PRs. Example: ```js import { runEcho as runEcho2 } from "http://localhost:4545/run/warn_on_deprecated_api/mod.ts"; const p = Deno.run({ cmd: [ Deno.execPath(), "eval", "console.log('hello world')", ], }); await p.status(); p.close(); async function runEcho() { const p = Deno.run({ cmd: [ Deno.execPath(), "eval", "console.log('hello world')", ], }); await p.status(); p.close(); } await runEcho(); await runEcho(); for (let i = 0; i < 10; i++) { await runEcho(); } await runEcho2(); ``` ``` $ deno run --allow-read foo.js Warning ├ Use of deprecated "Deno.run()" API. │ ├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then. │ ├ Suggestion: Use "Deno.Command()" API instead. │ └ Stack trace: └─ at file:///Users/ib/dev/deno/foo.js:3:16 hello world Warning ├ Use of deprecated "Deno.run()" API. │ ├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then. │ ├ Suggestion: Use "Deno.Command()" API instead. │ └ Stack trace: ├─ at runEcho (file:///Users/ib/dev/deno/foo.js:8:18) └─ at file:///Users/ib/dev/deno/foo.js:13:7 hello world Warning ├ Use of deprecated "Deno.run()" API. │ ├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then. │ ├ Suggestion: Use "Deno.Command()" API instead. │ └ Stack trace: ├─ at runEcho (file:///Users/ib/dev/deno/foo.js:8:18) └─ at file:///Users/ib/dev/deno/foo.js:14:7 hello world Warning ├ Use of deprecated "Deno.run()" API. │ ├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then. │ ├ Suggestion: Use "Deno.Command()" API instead. │ └ Stack trace: ├─ at runEcho (file:///Users/ib/dev/deno/foo.js:8:18) └─ at file:///Users/ib/dev/deno/foo.js:17:9 hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world Warning ├ Use of deprecated "Deno.run()" API. │ ├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then. │ ├ Suggestion: Use "Deno.Command()" API instead. │ ├ Suggestion: It appears this API is used by a remote dependency. │ Try upgrading to the latest version of that dependency. │ └ Stack trace: ├─ at runEcho (http://localhost:4545/run/warn_on_deprecated_api/mod.ts:2:18) └─ at file:///Users/ib/dev/deno/foo.js:20:7 hello world ``` Closes #21839
2024-01-18feat(jupyter): don't require --unstable flag (#21963)Bartek Iwańczuk
This commit removes the requirement for `--unstable` flag in `deno jupyter` subcommand. The process will no longer exit if this flag is not provided, however the subcommand itself is still considered unstable and might change in the future. Required for https://github.com/denoland/deno/pull/21452
2024-01-18fix(lsp): regression - formatting was broken on windows (#21972)David Sherret
~~Waiting on: https://github.com/denoland/deno_config/pull/31~~ Closes #21971 Closes https://github.com/denoland/vscode_deno/issues/1029
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-17feat(lsp): send "deno/didChangeDenoConfiguration" on init (#21965)Nayeem Rahman
2024-01-17refactor: change tests to not rely on Deno.run() (#21961)Bartek Iwańczuk
For https://github.com/denoland/deno/pull/21939
2024-01-16chore: bump rustls-tokio-stream and rustls (#21955)Matt Mastracci
2024-01-16chore: ignore inspector_port_collision test (#21923)Bartek Iwańczuk
Ref https://github.com/denoland/deno/issues/21912 --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-15chore(ext/cache): remove CachePutResource in preparation for resource ↵Matt Mastracci
rewrite (#21949) We can use `resourceForReadableStream` to ensure that cached resources are implemented more efficiently and remove one more resource special case.
2024-01-15fix(publish): support deno.jsonc file (#21948)Bartek Iwańczuk
2024-01-14chore: upgrade deno_core to 0.246.0 (#21904)Bartek Iwańczuk
2024-01-15feat(unstable): add Temporal API support (#21738)Bartek Iwańczuk
This commit adds support for [Stage 3 Temporal API proposal](https://tc39.es/proposal-temporal/docs/). The API is available when `--unstable-temporal` flag is passed. --------- Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: David Sherret <dsherret@gmail.com> Co-authored-by: Kenta Moriuchi <moriken@kimamass.com>
2024-01-14feat(unstable): remove --unstable-workspaces flag (#21891)Bartek Iwańczuk
The workspaces feature is still considered unstable and can change. Requiring this flag hinders DX.
2024-01-14feat: remove conditional unstable type-checking (#21825)Bartek Iwańczuk
This commit removes conditional type-checking of unstable APIs. Before this commit `deno check` (or any other type-checking command and the LSP) would error out if there was an unstable API in the code, but not `--unstable` flag provided. This situation hinders DX and makes it harder to configure Deno. Failing during runtime unless `--unstable` flag is provided is enough in this case.
2024-01-13fix(check): should not panic when all specified files excluded (#21929)David Sherret
Closes #21926
2024-01-13fix(config): regression - handle relative patterns with leading dot slash ↵David Sherret
(#21922) This is a hacky quick fix. We need to spend more time cleaning up this code and push more stuff down into deno_config. Closes #21916
2024-01-12fix(publish): require http server for tests (#21919)Bartek Iwańczuk
2024-01-12feat: "rejectionhandled" Web event and "rejectionHandled" Node event (#21875)Bartek Iwańczuk
This commit adds support for "rejectionhandled" Web Event and "rejectionHandled" Node event. ```js import process from "node:process"; process.on("rejectionHandled", (promise) => { console.log("rejectionHandled", reason, promise); }); window.addEventListener("rejectionhandled", (event) => { console.log("rejectionhandled", event.reason, event.promise); }); ``` --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-11chore(publish): add --dry-run flag (#21895)Bartek Iwańczuk
2024-01-11fix(web): use rustyline for prompt (#21893)Divy Srivastava
Workaround until https://github.com/kkawakam/rustyline/pull/759
2024-01-10feat(unstable): fast subset type checking of JSR dependencies (#21873)David Sherret
2024-01-10fix: android support (#19437)cions
<!-- 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. --> --------- Signed-off-by: Matt Mastracci <matthew@mastracci.com> Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-09fix(ext/websocket): pass on uncaught errors in idleTimeout (#21846)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/21840 The problem was hard to reproduce as its a race condition. I've added a test that reproduces the problem 1/10 tries. We should move the idleTimeout handling to Rust (maybe even built into fastwebsocket).
2024-01-08fix(task): do not eagerly auto-install packages in package.json when ↵David Sherret
`"nodeModulesDir": false` (#21858) There's no need to auto-install the package.json if the user is not using a node_modules directory. Closes #21850
2024-01-08fix(unstable/tar): skip node_modules, .git, and config "exclude" (#21816)David Sherret
2024-01-08chore: rename do-not-use-publish (#21854)Ryan Dahl
2024-01-08perf: skip expanding exclude globs (#21817)David Sherret
We were calling `expand_glob` on our excludes, which is very expensive and unnecessary because we can pattern match while traversing instead. 1. Doesn't expand "exclude" globs. Instead pattern matches while walking the directory. 2. Splits up the "include" into base paths and applicable file patterns. This causes less pattern matching to occur because we're only pattern matching on patterns that might match and not ones in completely unrelated directories.
2024-01-06fix(compile): preserve granular unstable features (#21827)Bartek Iwańczuk
Fix https://github.com/denoland/deno/issues/21814
2024-01-06feat(ext/crypto): initial support for p521 in `generateKey` and `importKey` ↵Divy Srivastava
(#21815) Part 1 of a potential 3 part series. Ref #13449 The current implementation passes key material back and forth RustCrypto group of crates and ring. ring does not implement p521 yet. This PR adds support for P521 named curve in `generateKey` and `importKey` where we use RustCrypto. Other parts should be moved over to the RustGroup group of crates for consistency.
2024-01-05fix(ext/node): add WriteStream.isTTY (#21801)Divy Srivastava
2024-01-04chore(cli): bump deno_core (#21790)Matt Mastracci
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(unstable/byonm): support using an import map with byonm (#21786)David Sherret
Supports mixing an import map with byonm.
2024-01-04fix(ext/node): UdpSocket ref and unref (#21777)Divy Srivastava
2024-01-03fix(cli): respect `exclude` option for `deno check` command (#21779)nokazn
This PR fixes #21658. - `check` subcommand sees `exclude` option in `deno.json`. When some paths passed with `check` command listed in `exclude`, they are ignored. - When some files are listed in `exclude` and imported indirectly among module graph, they are checked.
2024-01-04fix(cli): harden permission stdio check (#21778)Matt Mastracci
Harden the code that does permission checks to protect against re-opening of stdin. Code that runs FFI is vulnerable to an attack where fd 0 is closed during a permission check and re-opened with a file that contains a positive response (ie: `y` or `A`). While FFI code is dangerous in general, we can make it more difficult for FFI-enabled code to bypass additional permission checks. - Checks to see if the underlying file for stdin has changed from the start to the end of the permission check (detects races) - Checks to see if the message is excessively long (lowering the window for races) - Checks to see if stdin and stderr are still terminals at the end of the function (making races more difficult)
2024-01-03fix(jupyter): error message when install fails due to jupyter command not ↵David Sherret
being on PATH (#21767) We were failing silently in this scenario.
2024-01-03fix(cli): make signals tests more reliable (#21772)Matt Mastracci
Delivering POSIX signals too quickly may result in signal coalescing.
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-03chore: ignore hanging lsp jsx test (#21771)Nayeem Rahman