summaryrefslogtreecommitdiff
path: root/cli/tests/testdata
AgeCommit message (Collapse)Author
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.
2024-02-10fix: cache bust jsr deps on constraint failure (#22372)David Sherret
Removes the `FileFetcher`'s internal cache because I don't believe it's necessary (we already cache this kind of stuff in places like deno_graph or config files in different places). Removing it fixes this bug because this functionality was already implemented in deno_graph and lowers memory usage of the CLI a little bit.
2024-02-09fix: upgrade to deno_ast 0.33 (#22341)David Sherret
* Uses diagnostics from deno_ast * Real fix for https://github.com/denoland/deno/pull/22310 * Moves `deno lint --json` code here * Upgrades swc Closes #22117 Closes #22109 Closes #21927 Closes #20993
2024-02-08chore: Promote some integration tests to js_unit_tests (#22355)Matt Mastracci
- Move a workers test to js_unit_tests and make it work - (slightly) repair the websocketstream_test and make it a JS unit test. This test was being ignored and rotted quite a bit, but there's some value in running as much of it as we can. - Merge the two websocket test files
2024-02-07chore: don't expose FFI ops to user code (#22313)Bartek Iwańczuk
This commit removes some not really necessary FFI tests and in effect removes them from being accessible from the user code. This lowers the number of ops accessible to user code to 16.
2024-02-07chore: use same test server for jsr tests (#22303)David Sherret
We had two test servers.
2024-02-06fix(publish): 'explit' typo (#22296)John Spurlock
2024-02-06fix(publish): lazily parse sources (#22301)David Sherret
Closes #22290
2024-02-05Reland refactor(cli): use new sanitizer for resources (#22226)Matt Mastracci
Originally in #22125 Reverted in #22153 because of #22148 Fixed in deno_core https://github.com/denoland/deno_core/pull/538 Test plan: 1. Check out: https://github.com/poolifier/poolifier-deno.git 2. `PATH=.../deno/target/release/:$PATH deno task test` 3. `ok | 13 passed (188 steps) | 0 failed (18s)`
2024-02-02docs: point to new "Deno 1.x to 2.x Migration Guide" (#22199)Asher Gomez
Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-02-01fix(publish): add node specifiers (#22213)Leo Kettmeir
2024-02-01refactor: load bytes in deno_graph (#22212)David Sherret
Upgrades deno_graph to 0.64 where deno_graph is now responsible for turning bytes into a string. This is in preparation for Wasm modules.
2024-02-01fix(publish): rename --no-fast-check to --no-zap (#22214)Bartek Iwańczuk
Also prints an information about the flag when there are `zap` errors.
2024-01-31chore(publish): add --no-fast-check flag (#22203)Bartek Iwańczuk
2024-01-27Revert "refactor(cli): use new sanitizer for resources (#22125)" (#22153)Bartek Iwańczuk
2024-01-26refactor(cli): use new sanitizer for resources (#22125)Matt Mastracci
Step 1 of the Rustification of sanitizers, which unblocks the faster timers. This replaces the resource sanitizer with a Rust one, using the new APIs in deno_core.
2024-01-26fix: make deprecation warnings less verbose (#22128)Bartek Iwańczuk
This commit makes deprecation warnings less verbose by default. Only a single warnings is issued per deprecated API use. `DENO_VERBOSE_WARNINGS` env var can be provided to enable more detailed logging for each use of API including a stack trace. https://github.com/denoland/deno/assets/13602871/9c036c84-0044-4cb6-9c8e-deb641f43712
2024-01-24feat: Expand 'imports' section of deno.json (#22087)Bartek Iwańczuk
This commit adds automatic expansion of "imports" field in "deno.json" file. If "npm:" or "jsr:" imports are encountered we automatically try to add a "directory" remapping. Previously users had to specify entries for both `foo` and `foo/` to be able to import like `import { symbol1 } from "foo";` and `import { symbol2 } from "foo/some_file.js"`: ``` { "imports": { "foo": "npm:@foo/bar", "foo/": "npm:/@foo/bar/", } ``` With this change users can only add entry for `foo`: ``` { "imports": { "foo": "npm:@foo/bar", } ``` The entry for `foo/` will be provided automatically. Similarly if user provides "directory" remapping explicitly, we will not overwrite it.
2024-01-24feat(publish): error on invalid external imports (#22088)Luca Casonato
2024-01-24feat(publish): give diagnostic on invalid package files (#22082)Luca Casonato
2024-01-24Revert "feat: deprecate `window` global (#22057)" (#22084)Bartek Iwańczuk
This reverts commit 930ce2087051b4e45b2026ce7a77c14360a6993f. This is producing false-positives that are not actionable to users. We're gonna address this in another release.
2024-01-24feat: Change deprecation warning formatting (#22080)Bartek Iwańczuk
Removes weird "frame like" characters and simplifies the output: ``` warning: Use of deprecated "Deno.isatty()" API. This API will be removed in Deno 2. Stack trace: at file:///Users/ib/dev/deno/foo.js:2:8 hint: Use `stdStream.isTerminal()` instead. warning: Use of deprecated "Deno.isatty()" API. This API will be removed in Deno 2. Stack trace: at file:///Users/ib/dev/deno/foo.js:7:8 hint: Use `stdStream.isTerminal()` instead. ``` https://github.com/denoland/deno/assets/13602871/7a6e24bf-44ec-4dbf-ac96-2af1db9f2ab9
2024-01-24chore: improve unanalyzable dynamic import diagnostic (#22051)Luca Casonato
2024-01-24feat: deprecate `window` global (#22057)Bartek Iwańczuk
This commit deprecates `window` global and adds deprecation notice on each use of `window`. We decided to proceed with removal of `window` global variable in Deno 2.0. There's a lot of code in the wild that uses pattern like this: ``` if (typeof window !== "undefined) { ... } ``` to check if the code is being run in browser. However, this check passes fine in Deno and most often libraries that do this check try to access some browser API that is not available in Deno, or use DOM APIs (which are also not available in Deno). This situation has occurred multiple times already and it's unfeasible to expect the whole ecosystem to migrate to new check (and even if that happened there's a ton of code that's already shipped and won't change). The migration is straightfoward - replace all usages of `window` with `globalThis` or `self`. When Deno encounters use of `window` global it will now issue a warning, steering users towards required changes: ``` Warning ├ Use of deprecated "window" API. │ ├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then. │ ├ Suggestion: Use `globalThis` or `self` instead. │ ├ Suggestion: You can provide `window` in the current scope with: `const window = globalThis`. │ └ Stack trace: └─ at file:///Users/ib/dev/deno/foo.js:7:1 ``` Ref https://github.com/denoland/deno/issues/13367.
2024-01-24feat: TC39 decorator proposal support (#22040)Bartek Iwańczuk
This commit adds support for [TC39 Decorator Proposal](https://github.com/tc39/proposal-decorators). These decorators are only available in transpiled sources - ie. non-JavaScript files (because of lack of support in V8). This entails that "experimental TypeScript decorators" are not available by default and require to be configured, with a configuration like this: ``` { "compilerOptions": { "experimentalDecorators": true } } ``` Closes https://github.com/denoland/deno/issues/19160 --------- Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: crowlkats <crowlkats@toaxl.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-01-24refactor: set removal version for `deno bundle` (#22062)Asher Gomez
This change sets the removal version for the `deno bundle` sub-command for Deno v2. The warnings appear when `deno bundle` is run and in the `--help` menu.
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-23feat: import.meta.filename and import.meta.dirname (#22061)Bartek Iwańczuk
This commit adds `import.meta.filename` and `import.meta.dirname` APIs. These APIs return string representation of filename and containing dirname. They are only defined for local modules (modules that have `file:///` scheme). Example: ```ts console.log(import.meta.filename, import.meta.dirname) ``` Unix: ``` $ deno run /dev/my_module.ts /dev/my_module.ts /dev/ ``` Windows: ``` $ deno run C:\dev\my_module.ts C:\dev\my_module.ts C:\ ```
2024-01-23chore: deflake rejection_handled_web_process test (#22056)Bartek Iwańczuk
2024-01-23refactor: set removal version for `Deno.ListenTlsOptions.certFile`, ↵Asher Gomez
`Deno.ListenTlsOptions.keyFile` and `Deno.ConnectTlsOptions.certFile` (#22026) This change: 1. Sets the removal version for `Deno.ListenTlsOptions.certFile`, `Deno.ListenTlsOptions.keyFile` and `Deno.ConnectTlsOptions.certFile` for Deno v2, in favour of the `cert`, `key` and `caCerts` options, respectively. 2. Replaces use of the deprecated options with the new recommended options. Towards #22021
2024-01-23feat(cli): improved diagnostics printing (#22049)Luca Casonato
This initially uses the new diagnostic printer in `deno lint`, `deno doc` and `deno publish`. In the limit we should also update `deno check` to use this printer.
2024-01-23feat: warn when using --unstable, prefer granular flags (#21452)Bartek Iwańczuk
This commit deprecates "--unstable" flag. When "--unstable" flag is encountered a warning like this is printed: ``` The `--unstable` flag is deprecated, use granular `--unstable-*` flags instead. Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags ``` When "--unstable" flag is used and an unstable API is called an additional warning like this is printed for each API call: ``` The `Deno.dlopen` API was used with `--unstable` flag. The `--unstable` flag is deprecated, use granular `--unstable-ffi` instead. Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags ``` When no "--unstable-*" flag is provided and an unstable API is called following warning is issued before exiting: ``` Unstable API 'Deno.dlopen'. The `--unstable-ffi` flag must be provided. ``` --------- Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com> Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-01-23chore: update deno_ast and deno_graph (#22033)Bartek Iwańczuk
This upgrade unblocks support for ES decorator proposal. Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-01-23refactor: set removal version for `--jobs` flag (#22028)Asher Gomez
For removal in Deno v2. I'm uncertain of the output format but used #21452 as a guide. Towards #22021
2024-01-22feat(unstable): remove Deno.upgradeHttp API (#21856)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/21828. This API is a huge footgun. And given that "Deno.serveHttp" is a deprecated API that is discouraged to use (use "Deno.serve()" instead); it makes no sense to keep this API around. This is a step towards fully migrating to Hyper 1.
2024-01-22feat(lockfile): track JSR and npm dependencies in config file (#22004)David Sherret
See overview in https://github.com/denoland/deno_lockfile/pull/13
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-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-21fix(lsp): improved npm specifier to import map entry mapping (#22016)David Sherret
Upgrades to the latest deno_semver
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-17refactor: change tests to not rely on Deno.run() (#21961)Bartek Iwańczuk
For https://github.com/denoland/deno/pull/21939
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-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-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