0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
Commit graph

222 commits

Author SHA1 Message Date
Nayeem Rahman
ca134d25e1
feat(test): Show Deno.test() call locations for failures (#14484) 2022-05-05 01:15:54 +02:00
Nayeem Rahman
6a21fe745a
test: Manually truncate path string (#14407) 2022-05-05 01:13:00 +02:00
Geert-Jan Zwiers
253fbf9d2a
fix(coverage): exclude .snap files (#14480) 2022-05-04 13:10:55 +02:00
Thanapat Chotipun
e3954df8c5
feat(ext/net): add "NS" record support in Deno.resolveDns API (#14372) 2022-05-03 20:04:20 +02:00
Adilson Schmitt Junior
256dcb058a
fix(test/bench): accept file protocol module specifier CLI args (#14429) 2022-05-02 15:43:03 -04:00
David Sherret
de33017a8b
fix(test): actually capture stdout and stderr in workers (#14435) 2022-05-01 14:44:55 -04:00
Kitson Kelly
ef26a267ae
fix(cli): add dom.extras lib (#14430)
Closes: #12558
Fixes: #14344
2022-04-29 13:47:58 +10:00
Andreu Botella
ba799b6729
fix(workers): Make worker.terminate() not block the current thread (#13941)
Calling `worker.terminate()` used to kill the worker's isolate and
then block until the worker's thread finished. This blocks the calling
thread if the worker's event loop was blocked in a sync op (as with
`Deno.sleepSync`), which wasn't realized at the time, but since the
worker's isolate was killed at that moment, it would not block the
calling thread if the worker was in a JS endless loop.

However, in #12831, in order to work around a V8 bug, worker
termination was changed to first set a signal to let the worker event
loop know that termination has been requested, and only kill the
isolate if the event loop has not finished after 2 seconds. However,
this change kept the blocking, which meant that JS endless loops in
the worker now blocked the parent for 2 seconds.

As it turns out, after #12831 it is fine to signal termination and
even kill the worker's isolate without waiting for the thread to
finish, so this change does that. However, that might leave the async
ops that receive messages and control data from the worker pending
after `worker.terminate()`, which leads to odd results from the op
sanitizer. Therefore, we set up a `CancelHandler` to cancel those ops
when the worker is terminated.
2022-04-27 18:22:47 +02: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
David Sherret
a1b4aa2ae6
fix(test): capture inherited stdout and stderr for subprocesses in test output (#14395) 2022-04-26 14:46:49 -04:00
Nayeem Rahman
e9041b9edc
fix(runtime/js/spawn): Pass stdio options for spawn() and spawnSync() (#14358) 2022-04-24 17:21:22 +02: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
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
Luca Casonato
803499886b
Remove the DENO_FUTURE_CHECK warning (#14320)
It has good intentions, but it is a really terrible user experience. As
such we shouldn't print this warning.
2022-04-19 17:08:23 +02:00
Nayeem Rahman
c30d95f2e3
feat(ext/web): add globalThis.reportError() (#13799) 2022-04-19 10:59:51 +02:00
Nayeem Rahman
66fbdd2ed4
feat: Add DENO_NO_PROMPT variable (#14209)
This commit adds support for "DENO_NO_PROMPT" env
variable, that can be used instead of "--no-prompt" flag
to completely disable permission prompts.
2022-04-18 21:08:30 +02:00
Nayeem Rahman
2f29673fb2
fix(cli/emit): Check JS roots with // @ts-check (#14090) 2022-04-18 16:52:26 +02: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
Bartek Iwańczuk
9c5928b5aa
fix: panic when trying to pledge permissions before restoring previous pledge (#14306)
This commit fixes and edge case, where testing/benching code could pledge new
permission set before restoring the previous pledge.

Appropriate panics were added and tests that assert that process is killed
in case of "recursive pledge".
2022-04-17 17:47:24 +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
Bartek Iwańczuk
a87be28a46
feat: Better formatting for AggregateError (#14285)
This commit adds "aggregated" field to "deno_core::JsError" that stores
instances of "JsError" recursively to properly handle "AggregateError"
formatting. Appropriate logics was added to "PrettyJsError" and
"console" API to format AggregateErrors.

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2022-04-16 16:12:26 +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
Nayeem Rahman
4d18f558e4
feat(ext/web): Add error events for event listener and timer errors (#14159)
- feat: Add handleable error event for even listener errors
- feat: Add handleable error event for setTimeout()/setInterval() errors
- feat: Add Deno.core.destructureError()
- feat: Add Deno.core.terminate()
- fix: Don't throw listener errors from dispatchEvent()
- fix: Use biased mode when selecting between mod_evaluate() and
  run_event_loop() results
2022-04-13 11:50:57 +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
Aaron O'Mullan
f5f7b56aca
refactor(core): OpCtx (#14228) 2022-04-08 10:32:48 +02:00
Divy Srivastava
b0f974fbfd
fix(compile): follow redirects when resolving (#14161) 2022-03-31 14:11:30 +05:30
Kitson Kelly
061090de7e
feat(lsp): add experimental testing API (#13798)
Ref: denoland/vscode_deno#629
2022-03-30 09:59:27 +11:00
Andreu Botella
d983b577bc
chore(wasm): Don't await on the argument to handleWasmStreaming (#14000)
`handleWasmStreaming` is the function that provides the binding with
the `fetch` API needed for `WebAssembly.instantiateStreaming()` and
`WebAssembly.compileStreaming()`. When I implemented it in #11200, I
thought V8 was calling these functions with the argument of the
`WebAssembly` streaming functions, without doing any resolving, and so
`handleWasmStreaming` awaits for the parameter to resolve. However,
as discovered in
https://github.com/denoland/deno/issues/13917#issuecomment-1065805565,
V8 does in fact resolve the parameter if it's a promise (and handles
rejections arising from that).

This change removes the `async` IIFE inside `handleWasmStreaming`,
letting initial errors be handled synchronously (which will however
not throw synchronously from the `WebAssembly` namespace functions).
Awaiting is still necessary for reading the bytes of the response,
though, and so there is an `async` IIFE for that.
2022-03-29 14:44:33 +02:00
Luca Casonato
25b73a366f
fix(ext/ffi): enforce unstable check on ops (#14115) 2022-03-25 12:29:54 +01:00
Bartek Iwańczuk
b82ded84d3
fix(bench): require --unstable flag in JavaScript (#14091) 2022-03-23 16:33:42 +01:00
Bartek Iwańczuk
c3f306d778
fix(test): don't error on missing op details (#14074) 2022-03-23 00:24:45 +01:00
Nayeem Rahman
d2c099ce34
fix(ext/fetch): Connect async error stack with user code (#13899) 2022-03-22 18:08:33 +01:00
Andreu Botella
12d28dffc6
fix(fetch): Fix uncaught rejection panic with WebAssembly.instantiateStreaming (#13925)
When an exception is thrown during the processing of streaming WebAssembly,
`op_wasm_streaming_abort` is called. This op calls into V8, which synchronously
rejects the promise and calls into the promise rejection handler, if applicable.
But calling an op borrows the isolate's `JsRuntimeState` for the duration of the
op, which means it is borrowed when V8 calls into `promise_reject_callback`,
which tries to borrow it again, panicking.

This change changes `op_wasm_streaming_abort` from an op to a binding
(`Deno.core.abortWasmStreaming`). Although that binding must borrow the
`JsRuntimeState` in order to access the `WasmStreamingResource` stored in the
`OpTable`, it also takes ownership of that `WasmStreamingResource` instance,
which means it can drop any borrows of the `JsRuntimeState` before calling into
V8.
2022-03-22 11:33:29 +01:00
Kitson Kelly
1414dc503b
feat(lsp): support deno.enablePaths setting (#13978)
Ref: denoland/vscode_deno#633
2022-03-21 12:33:37 +11:00
Luca Casonato
daa7c6d32a
fix: actually don't inherit runtime permissions (#14024) 2022-03-20 22:46:39 +01:00
Divy Srivastava
2799b0b7b4
chore(ops): include argument position in serde_v8 errors (#14027) 2022-03-18 20:53:31 +05:30
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
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
Geert-Jan Zwiers
38e88e32b7
fix(info): print deno info paths with unescaped backslashes on windows (#13847) 2022-03-10 19:57:57 -05:00
Bartek Iwańczuk
2e30112e62
test: update expected test output for 'deno test' (#13882) 2022-03-09 14:48:20 +01:00