Commit graph

273 commits

Author SHA1 Message Date
Geert-Jan Zwiers 253fbf9d2a
fix(coverage): exclude .snap files (#14480) 2022-05-04 13:10:55 +02:00
David Sherret e099ddb87c
fix(vendor): do not panic on relative specifier with scheme-like folder name (#14453) 2022-05-02 09:07:41 -04:00
David Sherret de33017a8b
fix(test): actually capture stdout and stderr in workers (#14435) 2022-05-01 14:44:55 -04:00
Nayeem Rahman 9853c96cc4
refactor: Remove PrettyJsError and js_error_create_fn (#14378)
This commit:
- removes "fmt_errors::PrettyJsError" in favor of "format_js_error" fn
- removes "deno_core::JsError::create" and 
"deno_core::RuntimeOptions::js_error_create_fn"
- adds new option to "deno_runtime::ops::worker_host::init"
2022-04-27 01:06:10 +02:00
David Sherret 58eab0e2b3
fix(test): capture worker stdout and stderr in test output (#14410) 2022-04-26 19:00:04 -04:00
Baoshuo Ren 2c33293f66
chore: remove git.io link (#14402)
All links on git.io will stop redirecting after April 29, 2022.

- https://github.blog/changelog/2022-04-25-git-io-deprecation/
2022-04-26 18:39:47 -04:00
David Sherret a1b4aa2ae6
fix(test): capture inherited stdout and stderr for subprocesses in test output (#14395) 2022-04-26 14:46:49 -04:00
evan 602097ab6e
fix(bench): report pending summary before clearing (#14369) 2022-04-23 14:20:28 +02:00
evan 6fad5c33c9
fix(bench): reset reporter context (#14360)
This commit fixes previous file benchmarks leaking into the next file benchmarks summary.
2022-04-22 13:43:22 +02:00
Colin Ihrig 2a93c134dc
feat(repl): add global clear() function (#14332)
This commit adds a clear() function in the REPL which works
similar to console.clear().
2022-04-20 15:48:15 -04:00
evan f785ecee1a
feat(bench): update API, new console reporter (#14305)
This commit changes "deno bench" subcommand, by updating
the "Deno.bench" API as follows:
- remove "Deno.BenchDefinition.n"
- remove "Deno.BenchDefintion.warmup"
- add "Deno.BenchDefinition.group"
- add "Deno.BenchDefintion.baseline"

This is done because bench cases are no longer run fixed amount
of iterations, but instead they are run until there is difference between
subsequent runs that is statistically insiginificant.

Additionally, console reporter was rewritten completely, to looks
similar to "hyperfine" reporter.
2022-04-20 21:06:39 +02:00
Naju Mancheril 3833d37b15
feat(repl): add "--eval-file" flag to execute a script file on startup (#14247)
This commit adds support for "--eval-file" in "deno repl" subcommand.

This flag can be used to pass paths or URLs to files, that will be executed
on REPL startup. All files will be executed in the same context as the REPL
(ie. as "plain old scripts", not ES modules), sharing the global scope.

This feature allows to implement custom REPLs on top of Deno's REPL.
2022-04-20 14:16:37 +02:00
David Sherret ae479b1036
perf(fmt/lint): incremental formatting and linting (#14314) 2022-04-19 22:14:00 -04:00
Bartek Iwańczuk f52031ecdf
feat(test): skip internal stack frames for errors (#14302)
This commit changes "deno test" to filter out stack frames if it is beneficial to the user.

This is the case when there are stack frames coming from "internal" code
below frames coming from user code.

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2022-04-18 15:22:23 +02:00
Nayeem Rahman bd6494d119
fix(cli/tools/test): Prefix test module paths with "./" (#14301) 2022-04-16 21:51:55 +02:00
Bartek Iwańczuk 5f2d9a4a22
feat(test): use structured data for JavaScript errors in tests (#14287)
This commit rewrites test runner to send structured error data from JavaScript
to Rust instead of passing strings. This will allow to customize display of errors
in test report (which will be addressed in follow up commits).
2022-04-16 19:51:12 +02:00
Nayeem Rahman 8b31fc23cd
refactor: Move source map lookups to core (#14274)
The following transformations gradually faced by "JsError" have all been 
moved up front to "JsError::from_v8_exception()": 

- finding the first non-"deno:" source line; 
- moving "JsError::script_resource_name" etc. into the first error stack 
in case of syntax errors; 
- source mapping "JsError::script_resource_name" etc. when wrapping 
the error even though the frame locations are source mapped earlier; 
- removing "JsError::{script_resource_name,line_number,start_column,end_column}"
entirely in favour of "js_error.frames.get(0)". 

We also no longer pass a js-side callback to "core/02_error.js" from cli. 
I avoided doing this on previous occasions because the source map lookups 
were in an awkward place.
2022-04-15 16:08:09 +02:00
Bartek Iwańczuk 244926e83c
feat(test): format user code output (#14271)
This commit changes "deno test" to better denote user output coming
from test cases.

This is done by printing "---- output ----" and "---- output end ----"
markers if an output is produced. The output from "console" and
"Deno.core.print" is captured, as well as direct writes to "Deno.stdout"
and "Deno.stderr".

To achieve that new APIs were added to "deno_core" crate, that allow
to replace an existing resource with a different one (while keeping resource
ids intact). Resources for stdout and stderr are replaced by pipes.

Co-authored-by: David Sherret <dsherret@gmail.com>
2022-04-15 14:24:41 +02:00
Bartek Iwańczuk c8313a7457
feat(test): Improve testing report output (#14255)
Following changes were done in this commit:

- remove "test" prefix before each test
- use gray color for "running N tests from ..." prompt
- use relative path or remote URL instead of full URL in "running N tests from ..." prompt
- in "failures" section, add file path/remote URL before the test name

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2022-04-11 18:27:17 +02:00
Bartek Iwańczuk 8ae17026cb
feat: Add "deno check" subcommand for type checking (#14072)
This commit adds new "deno check" subcommand.
Currently it is an alias for "deno cache" with the difference that remote
modules don't emit TS diagnostics by default.

Prints warning for "deno run" subcommand if "--check" flag is not present
and there's no "--no-check" flag. Adds "DENO_FUTURE_CHECK" env
variable that allows to opt into new behavior now.
2022-04-11 01:12:51 +02:00
David Sherret a4c1e1bdcf
fix: upgrade to swc_ecmascript 0.143 (#14238) 2022-04-08 12:31:47 -04:00
Valentin Anger b8d66a683a
fix(cli/install): preserve compat flag (#14223) 2022-04-06 16:54:12 -04:00
David Sherret 1c37ac3352
chore(tests): use custom temp dir creation for the tests (#14153) 2022-04-01 11:15:37 -04:00
Kitson Kelly 061090de7e
feat(lsp): add experimental testing API (#13798)
Ref: denoland/vscode_deno#629
2022-03-30 09:59:27 +11:00
TrickyPi 85e16a08c7
feat(cli/fmt): ignore .git folder when formatting files (#14138) 2022-03-29 14:57:42 -04:00
David Sherret 03c71a8b4a
chore: upgrade dprint-core to 0.54.1 (#14146) 2022-03-29 13:33:00 -04:00
Bartek Iwańczuk 381d565acf
refactor(flags): rename CheckFlag to TypecheckMode (#14111) 2022-03-29 03:48:29 +02:00
David Sherret 89dd5dac62
chore: fix compile_windows_ext test (#14142) 2022-03-28 14:38:15 -04:00
Bartek Iwańczuk b82ded84d3
fix(bench): require --unstable flag in JavaScript (#14091) 2022-03-23 16:33:42 +01:00
David Sherret 53dac7451b
chore: remove all pub(crate)s from the cli crate (#14083) 2022-03-23 09:54:22 -04:00
David Sherret e46b5f738d
fix(tests): do not use global env vars in install tests (#14078) 2022-03-22 13:37:15 -04:00
TrickyPi b01bc7faff
fix(cli): improve deno compile error messages (#13944)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-03-18 19:18:50 -04:00
Sylvain Cau c98c976294
fix(cli): add support for DENO_CERT in upgrade command (#13862) 2022-03-18 18:40:44 -04:00
Ryan Dahl 18f998fbee
chore: fix build (#13997) 2022-03-16 21:37:02 -04:00
David Sherret 748aff1e94
feat(task): add unstable warning to deno task (#13966) 2022-03-15 21:24:07 -04:00
Bartek Iwańczuk 9d9e60b694
feat(task): log task script (#13922)
Logs task name and associated script with additional args.
This is disabled if "--quiet/-q" flag is present.
2022-03-12 02:35:18 +01:00
Bartek Iwańczuk 5ebaa7943a
feat(task): allow colons in task name (#13918) 2022-03-11 18:22:45 -05:00
Bartek Iwańczuk 09ae512ccb
feat: "deno bench" subcommand (#13713)
This commit adds "deno bench" subcommand and "Deno.bench()"
API that allows to register bench cases. 

The API is modelled after "Deno.test()" and "deno test" subcommand.

Currently the output is rudimentary and bench cases and not
subject to "ops" and "resource" sanitizers.

Co-authored-by: evan <github@evan.lol>
2022-03-11 23:07:02 +01:00
Bartek Iwańczuk 47f22777be
feat: "deno task" subcommand (#13725)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-03-10 20:56:14 -05:00
Bartek Iwańczuk 808f797633
fix(compat): cjs/esm interop for dynamic imports (#13792)
This commit fixes CJS/ESM interop in compat mode for dynamically
imported modules.

"ProcState::prepare_module_load" was changed to accept a list
of "graph roots" without associated "module kind". That module kind
was always hardcoded to "ESM" which is not true for CJS/ESM interop -
a CommonJs module might be imported using "import()" function. In
such case the root of the graph should have "CommonJs" module kind
instead of "ESM".
2022-03-11 02:33:02 +01:00
Geert-Jan Zwiers 8db3a9546b
fix(test): skip typechecking for blocks inside HTML comments (#13889) 2022-03-11 02:14:32 +01:00
Bartek Iwańczuk 85cb6f2563
refactor(test): use tokio::sync::mpsc::unbounded_channel (#13881)
This causes to block one less thread when running "deno test"
subcommand.
2022-03-09 01:34:31 +01:00
Bartek Iwańczuk 22dbbf75f3
refactor: add cli/display.rs module (#13879) 2022-03-09 00:19:02 +01:00
Bartek Iwańczuk 32ef9bfa47
refactor(test): don't spawn additional thread (#13877) 2022-03-08 23:42:21 +01:00
Geert-Jan Zwiers e53b6c16bc
fix(test): typecheck blocks annotated with long js/ts notations (#13785) 2022-03-08 02:10:40 +01:00
Bartek Iwańczuk d332bf1132
feat: deno test --trace-ops (#13770)
This commit adds "--trace-ops" flag to "deno test" subcommand.

This flag enables saving of stack traces for async ops, that before were always
saved. While the feature proved to be very useful it comes with a significant performance
hit, it's caused by excessive source mapping of stack frames.
2022-02-25 16:14:46 +01:00
David Sherret 3b12afd072
chore: upgrade to Rust 1.59 (#13767) 2022-02-24 20:03:12 -05:00
Divy Srivastava 03c55b4970
fix(compile): Support import maps (#13756) 2022-02-24 18:58:00 +05:30
mlemesle f8b73ab97e
fix(upgrade): move the file permission check to the beginning of the upgrade process (#13726) 2022-02-23 16:11:46 -05:00
David Sherret 5d7e1229db
fix(vendor): do not add absolute specifiers to scopes (#13710) 2022-02-18 23:10:40 -05:00