507 Commits
Author SHA1 Message Date
Bartek Iwańczuk 2ac9a901c2 feat(test): built-in snapshot testing via t.assertSnapshot (#35139)
Adds snapshot testing to the built-in test runner: a new
`t.assertSnapshot(actual, options?)` method on `Deno.TestContext` and an
`--update-snapshots` (`-u`) flag for `deno test`. Snapshots are stored
in the same `__snapshots__/<test file>.snap` format as
`@std/testing/snapshot` (same serializer settings), so existing snapshot files keep working
after switching to the built-in API.

Compared to the userland implementation, update mode is a proper CLI
flag instead of `deno test -- --update`, and no read or write permissions are
needed for snapshot files in the default location since the runner
manages them itself (custom `dir`/`path` locations still require permissions,
and snapshot writes are only authorized when `--update-snapshots` is
passed).
Updated and removed snapshot counts are reported through the test
reporters in the run summary. Stale snapshots are only removed when every test in
a module ran all of its assertions, so filtered, ignored, `only` and
failed runs never delete snapshots they didn't see.

Out of scope for this PR, noted as follow-ups: inline snapshots
(`assertInlineSnapshot`), `expect(...).toMatchSnapshot()` on top of the
same machinery, Jest-style CI behavior (failing on newly written snapshots in
CI), and a deprecation pointer in `@std/testing/snapshot` once this
ships.
2026-06-20 21:31:54 +02:00
Bartek Iwańczuk df9398d7d6 feat(test): add retry and repeats options to Deno.test (#35053)
Migrating a test suite from a third-party runner like Vitest to `deno
test` is harder than it should be, partly because there's no built-in way to
tolerate or surface flaky tests. This adds two per-test options that
mirror Vitest's semantics: `retry` re-runs a failing test and passes if any
attempt passes, while `repeats` runs the test several times and requires every
run to pass. They compose, so each repetition may itself be retried. Matching
`--retry` and `--repeats` flags set a default for the whole run; a test
that sets its own option takes precedence, including an explicit `0` that
opts the test out of a flag-provided default.

The runner already drives one JS call per test from Rust, so this wraps
that call in an attempt/repetition loop. Each attempt re-runs the beforeEach
and afterEach hooks and captures a fresh sanitizer baseline, which keeps
every attempt's leak check independent and makes a resource leak retryable
like any other failure. A failed-but-retried attempt is surfaced through a new
informational event so the reporter can print it, and a test that
ultimately passes after a retry is counted as `flaky` in the summary line. Hook
errors and uncaught errors are intentionally not retried.

A couple of limitations worth calling out: there is no `deno.json`
configuration for retry/repeats yet (CLI flag and per-test option only);
and the `junit` and `tap` reporters don't yet treat retried attempts
specially, so a retried test re-registers its steps under fresh ids and emits
duplicate `<testcase>`/step entries in those reporters (the pretty and dot
reporters drop the discarded attempts). When a test with steps passes on a later
attempt, the final attempt's passing steps are counted but not
re-printed individually (the earlier failed attempt's steps are still shown). None
of these affect correctness of the pass/fail verdict or the flaky count.

Closes https://github.com/denoland/deno/issues/19882
2026-06-16 14:17:04 +00:00
af9628d3ea feat(test): show sub-millisecond test durations (#35200)
Closes #30785

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2026-06-14 10:47:21 +00:00
LunaandBartek Iwańczuk b46f9dd705 feat(jupyter): rewrite kernel in JS, drop zeromq/runtimelib deps (#34083)
Replaces the Rust-based ZMQ kernel implementation (using `zeromq`,
`runtimelib`/`jupyter_runtime`, and `jupyter-protocol` crates) with a
pure-JS ZMTP 3.1 implementation running on top of `Deno.listen()`.

**Architecture**

- **Main OS thread** — new `cli/js/jupyter_kernel.js` (~800 lines) owns
all ZMQ/Jupyter protocol work: ZMTP 3.1 framing, NULL handshake,
HMAC-SHA256 message signing, and all five channel loops (shell, control,
iopub, heartbeat, stdin). Uses only non-blocking `Deno.listen()` TCP, so
the event loop never blocks.
- **Background OS thread** — runs the REPL session (user code
evaluation, CDP, TypeScript). Created via a cloned
`CliMainWorkerFactory`.
- The two threads talk over `tokio::mpsc` channels. The main thread can
interrupt user code at any time by calling
`IsolateHandle::terminate_execution()` on the handle sent back from the
background thread via a `oneshot` channel.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2026-06-01 12:54:36 +00:00
5c6094ef7f fix(test): don't kill the deno process on top-level Deno.exit() (#34564)
## Summary

Calling `Deno.exit()` from outside any test function — at module top
level, in an `unload` listener, or from async work that escaped a test —
used to kill the entire `deno test` process with the requested exit
code. That silently dropped buffered test results and made failing tests
"pass" with exit code 0.

Reproducer from #12888:

```ts
Deno.test("fail", () => { throw new Error("fail"); });
self.onunload = () => { Deno.exit(0); };
```

Before this PR:

```
$ deno test test.ts
Check file:///.../test.ts
running 1 test from file:///.../test.ts
test fail ... FAILED (9ms)
$ echo $?
0   # failed test, but zero exit code
```

After this PR:

```
$ deno test test.ts
running 1 test from ./test.ts
fail ... FAILED (1ms)

note ./test.ts called `Deno.exit(0)` from outside any test. The isolate was terminated; remaining test files will continue.

 ERRORS

fail => ./test.ts:1:6
error: Error: fail
...

FAILED | 0 passed | 1 failed (24ms)

error: Test failed
$ echo $?
1
```

## How it works

Each test specifier now installs a default exit handler (in addition to
the per-test `assertExit` handlers) that, when `Deno.exit(code)` is
called outside of any test function, calls a new `op_test_isolate_exit`
op:

- records the exit code in `OpState` (`IsolateExitInfo`)
- sends a new `TestEvent::IsolateExit(origin, exit_code)` to the
reporter
- asks V8 to terminate execution of just this isolate (uncatchable)

The test runner detects the termination via the `IsolateExitInfo` flag,
calls `cancel_terminate_execution`, and continues with any remaining
specifiers. A zero exit code is treated as a clean isolate teardown; a
non-zero exit code fails the run.

The existing `sanitizeExit: false` path (which kills the whole process
via `std::process::exit`) is preserved for `Deno.exit()` calls from
inside a test function — only the *outside-a-test* path changes here,
since that's where the silent-process-kill bug lived.

Fixes #12888.

Closes denoland/orchid#325

## Test plan

- [x] Existing `exit_sanitizer`, `exit_sanitizer_disabled`,
`exit_code{,2,3}`, `before_unload_prevent_default` spec tests still pass
- [x] New `exit_in_isolate_unload` spec test (the literal #12888
reproducer): test fails, isolate-exit note is printed, process exits 1
- [x] New `exit_in_isolate_top_level::exit_zero_alone`: top-level
`Deno.exit(0)` -> exit 0, no phantom tests
- [x] New `exit_in_isolate_top_level::exit_nonzero_alone`: top-level
`Deno.exit(7)` -> exit 1, failure reported
- [x] New
`exit_in_isolate_top_level::mixed_run_passing_alongside_isolate_exit`: a
passing test file run alongside an isolate-exit file still completes
normally
- [x] `cargo clippy --bin deno` clean

---------

Co-authored-by: divybot <divybot@users.noreply.github.com>
Co-authored-by: Divy Srivastava <me@littledivy.com>
2026-05-31 09:59:27 +05:30
d1152a1bac fix(test): abort with a message when a test exits with sanitizeExit disabled (#34491)
## Summary

Follow-up to #22515 / fixes #22516.

Previously, when a test set `sanitizeExit: false`, we treated the exit
sanitizer as completely disabled — a test calling `Deno.exit()`
terminated the process immediately. Because the test reporter's
stdout/stderr is buffered and flushed asynchronously through a channel,
this could drop output and produce flaky test runs. #22515 had to
comment out a node-compat test (`should allow exit`) precisely because
of this unreliable flushing.

This PR makes the exit handler always present during tests, with
behavior depending on `sanitizeExit`:

- **`sanitizeExit: true` (default)** — unchanged. An exit attempt fails
the current test (and a non-zero exit code set during a test fails it
too), and the remaining tests keep running.
- **`sanitizeExit: false`** — instead of silently terminating the
process, the test run is **aborted with a message**. The worker hands
the exit code to the reporter, which prints a message, reliably flushes
all buffered output, and then exits the process with the requested code.

Example output:

```
running 2 tests from ./main.ts
exit ...
------- output -------
output before exit
----- output end -----

warning A test called Deno.exit(42) while the exit sanitizer was disabled (sanitizeExit: false). Aborting the test run.

The following tests were pending:

exit => ./main.ts:1:6
```

(process exits with code 42)

## Implementation

- New `op_test_event_exit` op sends a new `TestEvent::Exit(code)` to the
reporter (which forces a stdio sync/flush first), then parks the worker
so user code can't keep running while the process is torn down.
- `report_tests` handles `TestEvent::Exit` much like
`TestEvent::Sigint`: it reports the pending tests, flushes the report,
and exits the process with the given code. A `report_exit` method was
added to the `TestReporter` trait (pretty/dot/tap/junit/compound).
- `op_test_event_exit` is added to the `NOT_IMPORTED_OPS` allowlist in
`99_main.js` so it stays available on `Deno.core.ops` (where the other
`deno_test` ops live).

## Tests

- New spec test `test/exit_sanitizer_disabled` covering the
abort-with-message + reliable-flush behavior and exit code propagation.
- Re-enables the `should allow exit` node-compat test that #22515
disabled, updating its expected output and exit code (123).
- Verified the default `sanitizeExit: true` behavior
(`test/exit_sanitizer`) is unchanged.

Closes denoland/orchid#282

---------

Co-authored-by: divybot <divybot@users.noreply.github.com>
Co-authored-by: Divy Srivastava <me@littledivy.com>
2026-05-29 17:35:15 +05:30
Hunnyboy1217 3a76e62a03 feat(test): add timeout option to Deno.test() (#33815)
Closes #11133.
Closes #13146.

## Summary

Adds a per-test `timeout` option to `Deno.test()` that fails a
test if it runs longer than the configured deadline. Both
asynchronous hangs and synchronous hot loops are caught:

```ts
Deno.test({
  name: "fetches within deadline",
  timeout: 5000,
  async fn() {
    await fetch("https://example.test");
  },
});
```

If `timeout` is unset or `0`, the test runs without a deadline.
2026-05-07 12:01:31 +02:00
Leo Kettmeir f17673aaf4 feat: OffscreenCanvas (#29357)
Progresses #5701
Closes #31381

---------

Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com>
2026-05-01 13:07:44 +02:00
David Sherret 39a07b283e refactor: force a reason on clippy overrides (#32761) 2026-03-16 12:41:51 +00:00
Kyle Kelley 1b4eac4c0a chore(jupyter): upgrade jupyter protocol dependencies (#32313)
Upgrading jupyter dependencies. After this one is merged I'll be able to
refactor the jupyter code to use the new `.split()` available on the
sockets to make the code cleaner. I think it also opens up some things
we couldn't handle before.
2026-02-25 12:45:30 +01:00
David Sherret 38f3ffe363 refactor: reduce cwd lookups and enforce canonicalize_path (#32250)
1. Enforces using `resolve_cwd`, which is more efficient and reduces.
2. Uses `canonicalize_path` instead of `.canonicalize()` because it
strips the unc path on Windows without us having to remember to do that.
2026-02-23 03:04:10 +00:00
Pietro Marchini 8012d48ec9 fix(test): throw when Deno.test() is called during test execution (#32184)
Fixes #30787.

`Deno.test()` was being accepted even when called from inside a running
test callback.
That means nested registrations could silently be ignored and tests
looked like they passed.

Now `Deno.test()` calls made from inside a running test are rejected
immediately.
Instead of silently registering too late, they fail with a clear error:

`Nested Deno.test() calls are not supported. Use t.step() for nested
tests.`

This makes the misuse explicit and points users to `t.step()`.
2026-02-16 18:50:06 +01:00
Divy 83d7b0c5ec fix(ext/node): Fix .only tests compatibilty (#32043)
Only tests in Node.js are filtered from running instead of erroring out.
This patch adds an option in Deno's test runner to skip santizing only
tests.
2026-02-05 10:03:22 +01:00
Leo Kettmeir 101366214b refactor: update deno_core (#31607)
For https://github.com/denoland/deno_core/pull/1262
2026-01-27 18:39:03 +01:00
Kenta Moriuchi 8193cf96c4 chore: Happy New Year 2026 (#31748) 2026-01-08 16:28:43 +01:00
Leo Kettmeir ded26474c0 refactor: rename deno_canvas to deno_image and move to cppgc (#31757)
In anticipation for #29357 to reduce the diff & complexity in that PR.

Reason for this is that deno_canvas will include the actual canvas
implementation, and both deno_webgpu & deno_canvas need to depend on
deno_image, so this cannot be merged into deno_canvas for now.
2026-01-05 12:24:23 +01:00
Leo Kettmeir e5b1487f7f fix(webgpu): update wgpu to 28.0.0 (#31163) 2026-01-02 07:28:49 +01:00
Bartek Iwańczuk 9fac6ccb8b feat(test): Add setup and teardown APIs to Deno.test API (#30504)
This commit adds `Deno.test.beforeAll`, `Deno.test.beforeEach`,
`Deno.test.afterAll` and `Deno.test.afterEach` APIs. 

These APIs can be used to perform setup and teardown for test cases. 

The API is similar to the Vitest API: https://vitest.dev/api/#setup-and-teardown, 
with the main difference being that that `before*` hooks don't return a cleanup
function.
2025-09-02 16:27:04 +02:00
Bartek Iwańczuk ada1580897 refactor: reorganize tools/test module (#30590)
There are no functional changes in the code, it's just a refactor that
moves code around to makes it easier to land
https://github.com/denoland/deno/pull/30504
2025-09-01 23:13:50 +02:00
Leo Kettmeirandsnek b59576cc0f feat(unstable): tunnelling (#30022)
Co-authored-by: snek <snek@deno.com>
2025-07-08 02:44:50 +02:00
Nathan Whitaker 9379a74e08 chore: update to edition 2024 (#29923) 2025-07-02 17:59:39 -07:00
林炳权 cb738ee5da chore: Rust 1.86.0 (#29435)
Since `rust 1.87.0` reported `undefined symbol:
ring::pbkdf2::PBKDF2_HMAC_SHA1::*` in CI and it was difficult to debug
locally, use `rust 1.86.0` in CI tests for troubleshoot the errors
2025-05-25 23:40:48 +02:00
Leo Kettmeir 17a51c401a feat(jupyter): make GPUTexture and GPUBuffer displayable (#28117) 2025-02-18 00:29:45 -08:00
Bartek Iwańczuk 1f169f4b09 fix(lint): don't mark plugin diagnostic as fixable, if it's not (#28147)
A vector with fixes was always created, even if there were no
applicable fixes.
2025-02-17 14:46:55 +00:00
Marvin Hagemeister aead459fb2 feat(unstable): support multiple fixes from lint plugins (#28040)
This PR supports returning multiple changes from a lint fix. It works
the same way as eslint, see
https://eslint.org/docs/latest/extend/custom-rules#applying-fixes .

- Return a single fix
- Return an array of fixes
- Return a generator function with fixes
2025-02-11 15:24:28 +01:00
Bartek Iwańczuk 7bd210f9e8 fix(lint): don't show docs URLs for plugins (#28033)
This commit removes the docs URL for diagnostics coming
from JS plugins. Before, we mistakenly printed
URLs pointing to `docs.deno.com`, even though they did not
exist.

An ability to actually specify a custom URL for plugin rules,
will be added in a follow up PR.
2025-02-10 17:32:31 +01:00
David Sherret e94581d272 fix(lint): clear plugin diagnostics on each lint file run (#28011)
This clears the diagnostics whenever a file is about to run. For
example, what could previously occur is an error and the diagnostics
would be leftover from the previous run.
2025-02-07 17:47:28 +00:00
f08ca6414b feat(lint): add JavaScript plugin support (#27203)
This commit adds an unstable lint plugin API.

Plugins are specified in the `deno.json` file under
`lint.plugins` option like so:

```
{
  "lint": {
    "plugins": [
      "./plugins/my-plugin.ts",
      "jsr:@deno/lint-plugin1",
      "npm:@deno/lint-plugin2"
    ]
  }
}
```

The API is considered unstable and might be subject
to changes in the future.

Plugin API was modelled after ESLint API for the 
most part, but there are no guarantees for compatibility.
The AST format exposed to plugins is closely modelled
after the AST that `typescript-eslint` uses.

Lint plugins use the visitor pattern and can add
diagnostics like so:

```
export default {
  name: "lint-plugin",
  rules: {
    "plugin-rule": {
      create(context) {
        return {
          Identifier(node) {
            if (node.name === "a") {
              context.report({
                node,
                message: "should be b",
                fix(fixer) {
                  return fixer.replaceText(node, "_b");
                },
              });
            }
          },
        };
      },
    },
  },
} satisfies Deno.lint.Plugin;
```

Besides reporting errors (diagnostics) plugins can provide
automatic fixes that use text replacement to apply changes.

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2025-02-05 16:59:24 +01:00
Leo KettmeirandDavid Sherret ea30e188a8 refactor: update deno_core for error refactor (#26867)
Closes #26171

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2025-01-08 14:52:32 -08:00
Kenta Moriuchi 8fb073d7b4 chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
David Sherret ac7b33a340 chore: cargo fmt - turn on group_imports=StdExternalCrate (#26646) 2024-12-31 12:13:39 -05:00
Marvin HagemeisterandBartek Iwańczuk 26425a137b feat(unstable): add JS linting plugin infrastructure (#27416)
This PR extracts the core part of
https://github.com/denoland/deno/pull/27203 to make it easier to review
and land in parts.

It contains:
-  The JS plugin code the deserializes and walks the buffer
- The Rust portion to serialize SWC to the buffer format (a bunch of
nodes are still todos, but imo these can land anytime later)
- Basic lint plugin types, without the AST node types to make this PR
easier to review
- Added more code comments to explain the format etc.


More fixes and changes will be done in follow-up PRs.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-12-21 00:58:03 +01:00
Leo KettmeirandBartek Iwańczuk cf49599359 feat: permission stack traces in ops (#26938)
This commit improves permission prompts by adding an option
to print a full trace of where the permissions is being requested.

Due to big performance hint of stack trace collection, this is only
enabled when `DENO_TRACE_PERMISSIONS` env var is present.

Closes https://github.com/denoland/deno/issues/20756

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-20 21:24:04 +00:00
snek 73fbd61bd0 fix: performance.timeOrigin (#26787)
`performance.timeOrigin` was being set from when JS started executing,
but `op_now` measures from an `std::time::Instant` stored in `OpState`,
which is created at a completely different time. This caused
`performance.timeOrigin` to be very incorrect. This PR corrects the
origin and also cleans up some of the timer code.

Compared to `Date.now()`, `performance`'s time origin is now
consistently within 5us (0.005ms) of system time.


![image](https://github.com/user-attachments/assets/0a7be04a-4f6d-4816-bd25-38a2e6136926)
2024-11-08 23:20:24 +01:00
Leo Kettmeir 1cab4f07a3 refactor: use concrete error type for remaining ops (#26746) 2024-11-06 16:57:57 -08:00
David Sherret c8f692057b refactor: bury descriptor parsing in PermissionsContainer (#25936)
Closes https://github.com/denoland/deno/issues/25634
2024-09-30 09:19:24 -04:00
David Sherret 62e952559f refactor(permissions): split up Descriptor into Allow, Deny, and Query (#25508)
This makes the permission system more versatile.
2024-09-16 21:39:37 +01:00
Kyle Kelley 63f8218a7d fix: adapt to new jupyter runtime API and include session IDs (#24762)
Closes #24737, #24437.
2024-07-27 10:39:08 +02:00
Zander HillandBartek Iwańczuk f00f0f9298 feat(jupyter): support confirm and prompt in notebooks (#23592)
Closes: https://github.com/denoland/deno/issues/22633

This commit adds support for `confirm` and `prompt` APIs,
that instead of reading from stdin are using notebook frontend
to show modal boxes and wait for answers.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-04 22:12:14 +00:00
Bartek Iwańczuk 7d919f6fd9 refactor(jupyter): move ZeroMQ server to a separate thread (#24373)
Moves the ZeroMQ messaging server to a separate thread.

This will allow to run blocking JS code and maintain communication
with the notebook frontend.

Towards https://github.com/denoland/deno/pull/23592
Towards https://github.com/denoland/deno/pull/24250
Closes https://github.com/denoland/deno/issues/23617
2024-07-03 00:37:54 +02:00
Divy Srivastava 05ec50672d chore: remove dead code (#24185) 2024-06-12 10:13:03 -04:00
David Sherret 386d5c8310 refactor: remove PermissionsContainer in deno_runtime (#24119)
Also removes permissions being passed in for node resolution. It was
completely useless because we only checked it for reading package.json
files, but Deno reading package.json files for resolution is perfectly
fine.

My guess is this is also a perf improvement because Deno is doing less
work.
2024-06-06 23:37:53 -04:00
Kyle KelleyandBartek Iwańczuk cf611fbf54 chore: upgrade jupyter runtimelib to 0.11.0 (#24036)
Brings in:

* More fully typed structures (for when we get to implementing more)
* `with_metadata`, `with_buffers`, etc. from
https://github.com/runtimed/runtimed/pull/99

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-29 22:46:47 +00:00
Kyle Kelley 8698e80304 refactor(jupyter): use runtimelib for Jupyter structures and directory paths (#23826)
This brings in [`runtimelib`](https://github.com/runtimed/runtimed) to
use:

## Fully typed structs for Jupyter Messages

```rust
let msg = connection.read().await?;

self
  .send_iopub(
    runtimelib::Status::busy().as_child_of(msg),
  )
  .await?;
```

## Jupyter paths

Jupyter paths are implemented in Rust, allowing the Deno kernel to be
installed completely via Deno without a requirement on Python or
Jupyter. Deno users will be able to install and use the kernel with just
VS Code or other editors that support Jupyter.

```rust
pub fn status() -> Result<(), AnyError> {
  let user_data_dir = user_data_dir()?;

  let kernel_spec_dir_path = user_data_dir.join("kernels").join("deno");
  let kernel_spec_path = kernel_spec_dir_path.join("kernel.json");

  if kernel_spec_path.exists() {
    log::info!("✅ Deno kernel already installed");
    Ok(())
  } else {
    log::warn!("ℹ️ Deno kernel is not yet installed, run `deno jupyter --install` to set it up");
    Ok(())
  }
}
```

Closes https://github.com/denoland/deno/issues/21619
2024-05-21 22:35:21 +02:00
David Sherret 47f7bed677 chore: enable clippy::print_stdout and clippy::print_stderr (#23732)
1. Generally we should prefer to use the `log` crate.
2. I very often accidentally commit `eprintln`s.

When we should use `println` or `eprintln`, it's not too bad to be a bit
more verbose and ignore the lint rule.
2024-05-08 22:45:06 -04:00
David Sherret 486437fee1 refactor(jupyter): move communication methods out of data structs (#23622)
Moves the communication methods out of the data structs and onto the
`Connection` struct.
2024-05-01 02:30:40 +00:00
Divy Srivastava c56f2e0fc0 chore: upgrade deno_core to 0.274.0 (#23344)
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-04-12 21:45:38 +02:00
Bartek Iwańczuk c940205353 refactor(bench): align ops to testing ops (#23038)
Internal refactor that changes how we use ops in `deno bench`
subcommand.

This brings it in line to what we do in `deno test` subcommand.
2024-03-24 06:22:37 +01:00
Divy Srivastava de28e6fc09 refactor: add deno_permissions crate (#22236)
Issue https://github.com/denoland/deno/issues/22222


![image](https://github.com/denoland/deno/assets/34997667/2af8474b-b919-4519-98ce-9d29bc7829f2)

This PR moves `runtime/permissions` code to a upstream crate called
`deno_permissions`. The `deno_permissions::PermissionsContainer` is put
into the OpState and can be used instead of the current trait-based
permissions system.

For this PR, I've migrated `deno_fetch` to the new crate but kept the
rest of the trait-based system as a wrapper of `deno_permissions` crate.
Doing the migration all at once is error prone and hard to review.

Comparing incremental compile times for `ext/fetch` on Mac M1:

| profile | `cargo build --bin deno` | `cargo plonk build --bin deno` |
| --------- | ------------- | ------------------- |
| `debug`   | 20 s          | 0.8s                |
| `release` | 4 mins 12 s   | 1.4s                  |
2024-03-12 10:42:26 -07:00
Matt Mastracci 96cfe82664 perf(cli): reduce overhead in test registration (#22552)
- Removes the origin call, since all origins are the same for an isolate
(ie: the main module)
- Collects the `TestDescription`s and sends them all at the same time
inside of an Arc, allowing us to (later on) re-use these instead of
cloning.

Needs a follow-up pass to remove all the cloning, but that's a thread
that is pretty long to pull

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-02-27 20:30:17 -07:00