0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-04 09:57:11 -05:00
deno/tests/unit
Luca Casonato 5cf97f539b
BREAKING(permissions): remove --allow-hrtime (#25367)
Remove `--allow-hrtime` and `--deny-hrtime`. We are doing this because
it is already possible to get access to high resolution timers through
workers and SharedArrayBuffer.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-03 11:24:25 +02:00
..
abort_controller_test.ts
blob_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
body_test.ts
broadcast_channel_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
buffer_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
build_test.ts
cache_api_test.ts
chmod_test.ts
chown_test.ts
command_test.ts
console_test.ts chore: enable no-console dlint rule (#25113) 2024-08-20 15:14:37 -04:00
copy_file_test.ts
cron_test.ts
custom_event_test.ts
dir_test.ts
dom_exception_test.ts
error_stack_test.ts
error_test.ts
esnext_test.ts
event_source_test.ts
event_target_test.ts
event_test.ts
fetch_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
ffi_test.ts
file_test.ts
filereader_test.ts
files_test.ts BREAKING(permissions): remove --allow-hrtime (#25367) 2024-09-03 11:24:25 +02:00
fs_events_test.ts fix: rename watch event missing (#24893) 2024-08-07 18:15:57 +02:00
get_random_values_test.ts
globals_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
headers_test.ts
http_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
image_bitmap_test.ts
image_data_test.ts
internals_test.ts
intl_test.ts
io_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
jupyter_test.ts
kv_queue_test.ts
kv_queue_test_no_db_close.ts
kv_queue_undelivered_test.ts
kv_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
link_test.ts
make_temp_test.ts
message_channel_test.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
mkdir_test.ts
navigator_test.ts
net_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
network_interfaces_test.ts
ops_test.ts
os_test.ts fix(permissions): disallow any LD_ or DYLD_ prefixed env var without full --allow-run permissions (#25271) 2024-08-28 21:11:37 -04:00
path_from_url_test.ts
performance_test.ts BREAKING(permissions): remove --allow-hrtime (#25367) 2024-09-03 11:24:25 +02:00
permissions_test.ts BREAKING(permissions): remove --allow-hrtime (#25367) 2024-09-03 11:24:25 +02:00
process_test.ts BREAKING(unstable): drop support for Deno.run.{clearEnv,gid,uid} (#25371) 2024-09-03 11:07:02 +02:00
progressevent_test.ts
promise_hooks_test.ts
read_dir_test.ts
read_file_test.ts chore: improve accessing special file test (#25099) 2024-08-19 16:21:27 -04:00
read_link_test.ts
read_text_file_test.ts chore: improve accessing special file test (#25099) 2024-08-19 16:21:27 -04:00
README.md
real_path_test.ts
ref_unref_test.ts
remove_test.ts
rename_test.ts
request_test.ts
response_test.ts
serve_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
signal_test.ts
stat_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
stdio_test.ts
streams_test.ts Revert "feat(fetch): accept async iterables for body" (#25207) 2024-08-26 12:24:27 +02:00
structured_clone_test.ts
symbol_test.ts
symlink_test.ts
sync_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
test_util.ts BREAKING: DENO_FUTURE=1 by default, or welcome to Deno 2.0 (#25213) 2024-08-30 13:58:58 -04:00
testing_test.ts
text_encoding_test.ts
timers_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
tls_sni_test.ts
tls_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
truncate_test.ts
tty_color_test.ts
tty_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
umask_test.ts
url_search_params_test.ts
url_test.ts
urlpattern_test.ts fix(urlpattern): fallback to empty string for undefined group values (#25151) 2024-08-22 05:44:09 -07:00
utime_test.ts chore(fs): remove Deno.futime[Sync]() (#25252) 2024-08-31 13:13:23 +10:00
version_test.ts
wasm_test.ts
webcrypto_test.ts Reland "test: run unit tests with DENO_FUTURE=1" (#25212) 2024-08-26 23:58:28 +02:00
webgpu_test.ts fix(ext/webgpu): assign missing constants property of shader about GPUDevice.createRenderPipeline[Async] (#24803) 2024-08-01 11:19:25 -07:00
websocket_test.ts
websocketstream_test.ts.disabled chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
webstorage_test.ts
worker_permissions_test.ts
worker_test.ts BREAKING(permissions): remove --allow-hrtime (#25367) 2024-09-03 11:24:25 +02:00
write_file_test.ts
write_text_file_test.ts

Deno runtime tests

Files in this directory are unit tests for Deno runtime.

Testing Deno runtime code requires checking API under different runtime permissions. To accomplish this all tests exercised are created using Deno.test() function.

import {} from "./test_util.ts";

Deno.test(function simpleTestFn(): void {
  // test code here
});

Deno.test(
  {
    ignore: Deno.build.os === "windows",
    permissions: { read: true, write: true },
  },
  function complexTestFn(): void {
    // test code here
  },
);

Running tests

There are two ways to run unit_test_runner.ts:

# Run all tests.
cargo run --bin deno -- test --allow-all --unstable --location=http://js-unit-tests/foo/bar cli/tests/unit/

# Run a specific test module
cargo run --bin deno -- test --allow-all --unstable --location=http://js-unit-tests/foo/bar cli/tests/unit/files_test.ts

Http server

target/debug/test_server is required to run when one's running unit tests. During CI it's spawned automatically, but if you want to run tests manually make sure that server is spawned otherwise there'll be cascade of test failures.