From 1464b756a4ef091ef97d1bf7340188ab5fe5492a Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 19 Sep 2022 09:32:21 -0500 Subject: refactor: move out test files from root testdata directory into sub directories (#15949) --- cli/tests/integration/bundle_tests.rs | 68 +- cli/tests/integration/cache_tests.rs | 24 +- cli/tests/integration/cert_tests.rs | 316 +++ cli/tests/integration/check_tests.rs | 108 +- cli/tests/integration/compile_tests.rs | 30 +- cli/tests/integration/doc_tests.rs | 9 +- cli/tests/integration/eval_tests.rs | 14 +- cli/tests/integration/flags_tests.rs | 45 + cli/tests/integration/fmt_tests.rs | 20 +- cli/tests/integration/info_tests.rs | 70 +- cli/tests/integration/lsp_tests.rs | 4 +- cli/tests/integration/mod.rs | 1139 +---------- cli/tests/integration/repl_tests.rs | 10 +- cli/tests/integration/run_tests.rs | 2023 +++++++++++++------- cli/tests/integration/vendor_tests.rs | 1 + cli/tests/integration/watcher_tests.rs | 20 +- cli/tests/integration/worker_tests.rs | 12 +- cli/tests/testdata/001_hello.js | 1 - cli/tests/testdata/001_hello.js.out | 1 - cli/tests/testdata/002_hello.ts | 1 - cli/tests/testdata/002_hello.ts.out | 1 - cli/tests/testdata/003_relative_import.ts | 3 - cli/tests/testdata/003_relative_import.ts.out | 2 - cli/tests/testdata/004_set_timeout.ts | 11 - cli/tests/testdata/004_set_timeout.ts.out | 2 - cli/tests/testdata/005_more_imports.ts | 11 - cli/tests/testdata/005_more_imports.ts.out | 1 - cli/tests/testdata/006_url_imports.ts | 3 - cli/tests/testdata/006_url_imports.ts.out | 2 - cli/tests/testdata/012_async.ts | 11 - cli/tests/testdata/012_async.ts.out | 3 - cli/tests/testdata/013_dynamic_import.ts | 15 - cli/tests/testdata/013_dynamic_import.ts.out | 1 - cli/tests/testdata/014_duplicate_import.ts | 9 - cli/tests/testdata/014_duplicate_import.ts.out | 1 - .../testdata/015_duplicate_parallel_import.js | 20 - .../testdata/015_duplicate_parallel_import.js.out | 1 - cli/tests/testdata/016_double_await.ts | 8 - cli/tests/testdata/016_double_await.ts.out | 2 - cli/tests/testdata/017_import_redirect.ts | 4 - cli/tests/testdata/017_import_redirect.ts.out | 1 - cli/tests/testdata/017_import_redirect_info.out | 6 - cli/tests/testdata/018_async_catch.ts | 14 - cli/tests/testdata/018_async_catch.ts.out | 3 - cli/tests/testdata/019_media_types.ts | 24 - cli/tests/testdata/019_media_types.ts.out | 1 - cli/tests/testdata/020_json_modules.ts | 2 - cli/tests/testdata/020_json_modules.ts.out | 4 - cli/tests/testdata/021_mjs_modules.ts | 2 - cli/tests/testdata/021_mjs_modules.ts.out | 1 - cli/tests/testdata/022_info_flag_script.out | 14 - cli/tests/testdata/023_no_ext | 2 - cli/tests/testdata/023_no_ext.out | 1 - .../testdata/024_import_no_ext_with_headers.ts | 1 - .../testdata/024_import_no_ext_with_headers.ts.out | 1 - cli/tests/testdata/025_hrtime.ts | 5 - cli/tests/testdata/025_hrtime.ts.out | 2 - cli/tests/testdata/025_reload_js_type_error.js | 6 - cli/tests/testdata/025_reload_js_type_error.js.out | 1 - cli/tests/testdata/026_redirect_javascript.js | 2 - cli/tests/testdata/026_redirect_javascript.js.out | 1 - cli/tests/testdata/027_redirect_typescript.ts | 2 - cli/tests/testdata/027_redirect_typescript.ts.out | 1 - cli/tests/testdata/028_args.ts | 3 - cli/tests/testdata/028_args.ts.out | 6 - cli/tests/testdata/029_eval.out | 1 - cli/tests/testdata/030_eval_ts.out | 1 - cli/tests/testdata/031_info_ts_error.out | 5 - cli/tests/testdata/031_info_ts_error.ts | 1 - cli/tests/testdata/033_import_map.out | 7 - cli/tests/testdata/033_import_map_remote.out | 5 - cli/tests/testdata/034_onload.out | 11 - cli/tests/testdata/034_onload/imported.ts | 12 - cli/tests/testdata/034_onload/main.ts | 27 - cli/tests/testdata/034_onload/nest_imported.ts | 11 - cli/tests/testdata/035_cached_only_flag.out | 4 - cli/tests/testdata/036_import_map_fetch.out | 0 cli/tests/testdata/037_fetch_multiple.out | 5 - cli/tests/testdata/038_checkjs.js | 5 - cli/tests/testdata/038_checkjs.js.out | 22 - cli/tests/testdata/041_dyn_import_eval.out | 2 - cli/tests/testdata/041_info_flag.out | 6 - cli/tests/testdata/041_info_flag_location.out | 7 - cli/tests/testdata/042_dyn_import_evalcontext.ts | 4 - .../testdata/042_dyn_import_evalcontext.ts.out | 1 - cli/tests/testdata/044_bad_resource.ts | 3 - cli/tests/testdata/044_bad_resource.ts.out | 2 - cli/tests/testdata/045_mod.ts | 5 - cli/tests/testdata/045_output.ts | 3 - .../testdata/045_programmatic_proxy_client.ts | 16 - cli/tests/testdata/045_proxy_client.ts | 5 - cli/tests/testdata/045_proxy_test.ts | 121 -- cli/tests/testdata/045_proxy_test.ts.out | 6 - cli/tests/testdata/046_jsx_test.tsx | 14 - cli/tests/testdata/046_jsx_test.tsx.out | 1 - cli/tests/testdata/047_jsx_test.jsx | 7 - cli/tests/testdata/047_jsx_test.jsx.out | 1 - cli/tests/testdata/048_media_types_jsx.ts | 32 - cli/tests/testdata/048_media_types_jsx.ts.out | 2 - cli/tests/testdata/049_info_flag_script_jsx.out | 14 - cli/tests/testdata/052_no_remote_flag.out | 4 - cli/tests/testdata/053_import_compression.out | 4 - cli/tests/testdata/053_import_compression/brotli | 2 - cli/tests/testdata/053_import_compression/gziped | Bin 39 -> 0 bytes cli/tests/testdata/053_import_compression/main.ts | 13 - cli/tests/testdata/054_info_local_imports.out | 8 - cli/tests/testdata/055_info_file_json.out | 90 - .../testdata/056_make_temp_file_write_perm.out | 1 - .../testdata/056_make_temp_file_write_perm.ts | 9 - cli/tests/testdata/058_tasks_microtasks_close.ts | 19 - .../testdata/058_tasks_microtasks_close.ts.out | 6 - cli/tests/testdata/059_fs_relative_path_perm.ts | 2 - .../testdata/059_fs_relative_path_perm.ts.out | 4 - ...o_doc_displays_all_overloads_in_details_view.ts | 6 - ...c_displays_all_overloads_in_details_view.ts.out | 9 - cli/tests/testdata/061_permissions_request.ts | 9 - .../testdata/062_permissions_request_global.ts | 6 - cli/tests/testdata/063_permissions_revoke.ts | 6 - cli/tests/testdata/063_permissions_revoke.ts.out | 3 - .../testdata/064_permissions_revoke_global.ts | 6 - .../testdata/064_permissions_revoke_global.ts.out | 3 - cli/tests/testdata/065_import_map_info.out | 5 - cli/tests/testdata/066_prompt.ts | 21 - cli/tests/testdata/070_location.ts | 18 - cli/tests/testdata/070_location.ts.out | 16 - cli/tests/testdata/071_location_unset.ts | 16 - cli/tests/testdata/071_location_unset.ts.out | 5 - cli/tests/testdata/072_location_relative_fetch.ts | 2 - .../testdata/072_location_relative_fetch.ts.out | 2 - cli/tests/testdata/075_import_local_query_hash.ts | 2 - .../testdata/075_import_local_query_hash.ts.out | 2 - cli/tests/testdata/076_info_json_deps_order.out | 163 -- cli/tests/testdata/076_info_json_deps_order.ts | 2 - cli/tests/testdata/077_fetch_empty.ts | 1 - cli/tests/testdata/077_fetch_empty.ts.out | 2 - cli/tests/testdata/078_unload_on_exit.ts | 9 - cli/tests/testdata/078_unload_on_exit.ts.out | 1 - cli/tests/testdata/079_location_authentication.ts | 1 - .../testdata/079_location_authentication.ts.out | 3 - .../081_location_relative_fetch_redirect.ts | 2 - .../081_location_relative_fetch_redirect.ts.out | 1 - .../testdata/082_prepare_stack_trace_throw.js | 6 - .../testdata/082_prepare_stack_trace_throw.js.out | 2 - .../testdata/083_legacy_external_source_map.ts | 2 - cli/tests/testdata/084_worker_custom_inspect.ts | 4 - .../testdata/084_worker_custom_inspect.ts.out | 2 - .../testdata/084_worker_custom_inspect_worker.ts | 2 - .../testdata/085_dynamic_import_async_error.ts | 7 - .../testdata/085_dynamic_import_async_error.ts.out | 2 - .../086_dynamic_import_already_rejected.ts | 15 - .../086_dynamic_import_already_rejected.ts.out | 4 - cli/tests/testdata/087_hello.ts | 2 - .../087_no_check_imports_not_used_as_values.ts | 4 - .../087_no_check_imports_not_used_as_values.ts.out | 2 - .../088_dynamic_import_already_evaluating.ts | 2 - .../088_dynamic_import_already_evaluating.ts.out | 4 - cli/tests/testdata/088_dynamic_import_target.ts | 3 - cli/tests/testdata/089_run_allow_list.ts | 12 - cli/tests/testdata/089_run_allow_list.ts.out | 3 - cli/tests/testdata/090_run_permissions_request.ts | 18 - .../testdata/091_use_define_for_class_fields.ts | 4 - .../091_use_define_for_class_fields.ts.out | 4 - .../092_import_map_unmapped_bare_specifier.ts | 1 - .../092_import_map_unmapped_bare_specifier.ts.out | 7 - cli/tests/testdata/095_cache_with_bare_import.ts | 1 - .../testdata/095_cache_with_bare_import.ts.out | 2 - cli/tests/testdata/Component.tsx | 1 - cli/tests/testdata/DenoWinRunner.cs | 127 -- cli/tests/testdata/DenoWinRunner.ps1 | 10 - cli/tests/testdata/aggregate_error.out | 18 - cli/tests/testdata/aggregate_error.ts | 9 - cli/tests/testdata/assets/DenoWinRunner.cs | 127 ++ cli/tests/testdata/assets/DenoWinRunner.ps1 | 10 + .../testdata/assets/deno_dom_0.1.3-alpha2.wasm | Bin 0 -> 616631 bytes cli/tests/testdata/assets/fixture.json | 14 + cli/tests/testdata/assets/hello.txt | 1 + cli/tests/testdata/assets/unreachable.wasm | Bin 0 -> 42 bytes cli/tests/testdata/async_error.ts | 9 - cli/tests/testdata/async_error.ts.out | 8 - cli/tests/testdata/badly_formatted.json | 12 - cli/tests/testdata/badly_formatted.md | 46 - cli/tests/testdata/badly_formatted.mjs | 4 - cli/tests/testdata/badly_formatted_fixed.js | 2 - cli/tests/testdata/badly_formatted_fixed.json | 8 - cli/tests/testdata/badly_formatted_fixed.md | 37 - cli/tests/testdata/before_unload.js | 21 - cli/tests/testdata/before_unload.js.out | 8 - cli/tests/testdata/benches/response_string_perf.js | 34 + cli/tests/testdata/benches/text_decoder_perf.js | 38 + .../testdata/benches/text_encoder_into_perf.js | 34 + cli/tests/testdata/benches/text_encoder_perf.js | 33 + cli/tests/testdata/blob_gc_finalization.js | 11 - cli/tests/testdata/blob_gc_finalization.js.out | 1 - cli/tests/testdata/bundle.test.out | 27 - .../bundle/bare_imports/error_with_bare_import.ts | 1 + .../bare_imports/error_with_bare_import.ts.out | 2 + cli/tests/testdata/bundle/bundle.test.out | 27 + .../testdata/bundle/check_local_by_default.out | 6 - .../testdata/bundle/check_local_by_default.ts | 3 - .../bundle/check_local_by_default/no_errors.out | 6 + .../bundle/check_local_by_default/no_errors.ts | 3 + .../bundle/check_local_by_default/type_error.out | 4 + .../bundle/check_local_by_default/type_error.ts | 6 + .../testdata/bundle/check_local_by_default2.out | 4 - .../testdata/bundle/check_local_by_default2.ts | 6 - .../testdata/bundle/decorators/ts_decorators.out | 49 + .../testdata/bundle/decorators/ts_decorators.ts | 25 + cli/tests/testdata/bundle/dynamic_import.ts | 3 + .../testdata/bundle/ignore_directives.test.out | 6 + .../testdata/bundle/import_map/import_map.json | 5 + cli/tests/testdata/bundle/import_map/main.ts | 17 + cli/tests/testdata/bundle/jsx.out | 9 + .../testdata/bundle/lockfile/check_error.json | 5 + cli/tests/testdata/bundle/lockfile/check_error.out | 4 + cli/tests/testdata/bundle_dynamic_import.ts | 3 - .../testdata/bundle_ignore_directives.test.out | 6 - cli/tests/testdata/bundle_im.json | 5 - cli/tests/testdata/bundle_im.ts | 17 - cli/tests/testdata/bundle_jsx.out | 9 - cli/tests/testdata/byte_order_mark.out | 1 - cli/tests/testdata/byte_order_mark.ts | 4 - cli/tests/testdata/cache/036_import_map_fetch.out | 0 cli/tests/testdata/cache/037_fetch_multiple.out | 5 + .../testdata/cache/095_cache_with_bare_import.ts | 1 + .../cache/095_cache_with_bare_import.ts.out | 2 + cli/tests/testdata/cache/cache_extensionless.out | 2 + .../testdata/cache/cache_random_extension.out | 2 + cli/tests/testdata/cache/ignore_require.js | 2 + cli/tests/testdata/cache/performance_stats.out | 16 + cli/tests/testdata/cache/redirect_cache.out | 5 + cli/tests/testdata/cache_extensionless.out | 2 - cli/tests/testdata/cache_random_extension.out | 2 - cli/tests/testdata/cafile_info.ts | 24 - cli/tests/testdata/cafile_info.ts.out | 13 - cli/tests/testdata/cafile_ts_fetch.ts | 3 - cli/tests/testdata/cafile_ts_fetch.ts.out | 2 - .../testdata/cafile_ts_fetch_unsafe_ssl.ts.out | 3 - cli/tests/testdata/cafile_url_imports.ts | 3 - cli/tests/testdata/cafile_url_imports.ts.out | 2 - .../testdata/cafile_url_imports_unsafe_ssl.ts.out | 3 - cli/tests/testdata/cert/cafile_info.ts | 24 + cli/tests/testdata/cert/cafile_info.ts.out | 13 + cli/tests/testdata/cert/cafile_ts_fetch.ts | 3 + cli/tests/testdata/cert/cafile_ts_fetch.ts.out | 2 + .../cert/cafile_ts_fetch_unsafe_ssl.ts.out | 3 + cli/tests/testdata/cert/cafile_url_imports.ts | 3 + cli/tests/testdata/cert/cafile_url_imports.ts.out | 2 + .../cert/cafile_url_imports_unsafe_ssl.ts.out | 3 + cli/tests/testdata/cert/deno_land_unsafe_ssl.ts | 2 + .../testdata/cert/deno_land_unsafe_ssl.ts.out | 2 + cli/tests/testdata/cert/ip_address_unsafe_ssl.ts | 2 + .../testdata/cert/ip_address_unsafe_ssl.ts.out | 2 + cli/tests/testdata/cert/listen_tls_alpn.ts | 14 + cli/tests/testdata/cert/listen_tls_alpn_fail.ts | 20 + .../testdata/cert/localhost_unsafe_ssl.ts.out | 3 + cli/tests/testdata/check/check_all.out | 4 + cli/tests/testdata/check/check_all.ts | 3 + .../declaration_header_file_with_no_exports.ts | 2 + ...declaration_header_file_with_no_exports_js.d.ts | 0 .../declaration_header_file_with_no_exports_js.js | 1 + cli/tests/testdata/check/module_detection_force.ts | 3 + .../check/module_detection_force/import.ts | 2 + .../testdata/check/module_detection_force/main.ts | 3 + cli/tests/testdata/check_all.out | 4 - cli/tests/testdata/check_all.ts | 3 - cli/tests/testdata/checkjs.tsconfig.json | 6 - cli/tests/testdata/circular1.js | 2 - cli/tests/testdata/circular1.js.out | 2 - cli/tests/testdata/circular2.js | 2 - cli/tests/testdata/cjs_imports.ts | 1 - cli/tests/testdata/cjs_imports.ts.out | 1 - cli/tests/testdata/classic_workers_event_loop.js | 4 - .../testdata/classic_workers_event_loop.js.out | 1 - cli/tests/testdata/colors_without_globalThis.js | 1 - cli/tests/testdata/commonjs.cjs | 1 - cli/tests/testdata/compile/args.ts | 3 + cli/tests/testdata/compile/standalone_error.ts | 9 + .../standalone_error_module_with_imports_1.ts | 1 + .../standalone_error_module_with_imports_2.ts | 2 + .../compile/standalone_follow_redirects.ts | 2 + .../compile/standalone_follow_redirects_2.js | 5 + .../testdata/compile/standalone_import_datauri.ts | 4 + .../testdata/compile/standalone_import_map.json | 5 + .../testdata/compile/standalone_import_map.ts | 1 + .../testdata/compile/standalone_runtime_flags.ts | 3 + cli/tests/testdata/complex_error.ts | 18 - cli/tests/testdata/complex_error.ts.out | 44 - cli/tests/testdata/complex_permissions_test.ts | 53 - cli/tests/testdata/config.ts | 5 - cli/tests/testdata/config.ts.out | 4 - cli/tests/testdata/config.tsconfig.json | 7 - cli/tests/testdata/config_json_import.ts | 2 - cli/tests/testdata/config_json_import.ts.out | 3 - cli/tests/testdata/config_types.ts | 1 - cli/tests/testdata/config_types.ts.out | 1 - cli/tests/testdata/config_types.tsconfig.json | 7 - .../testdata/config_types_remote.tsconfig.json | 7 - cli/tests/testdata/custom_inspect_url.js | 3 - cli/tests/testdata/custom_inspect_url.js.out | 47 - .../declaration_header_file_with_no_exports.ts | 2 - ...declaration_header_file_with_no_exports_js.d.ts | 0 .../declaration_header_file_with_no_exports_js.js | 1 - cli/tests/testdata/delayed_error.ts | 2 - cli/tests/testdata/delete_window.js | 1 - cli/tests/testdata/deno_doc.ts | 3 - cli/tests/testdata/deno_doc_builtin.out | 3 - cli/tests/testdata/deno_dom_0.1.3-alpha2.wasm | Bin 616631 -> 0 bytes cli/tests/testdata/deno_exit_tampering.ts | 3 - cli/tests/testdata/deno_land_unsafe_ssl.ts | 2 - cli/tests/testdata/deno_land_unsafe_ssl.ts.out | 2 - cli/tests/testdata/disallow_http_from_https.js | 2 - cli/tests/testdata/disallow_http_from_https.ts | 2 - cli/tests/testdata/disallow_http_from_https_js.out | 3 - cli/tests/testdata/disallow_http_from_https_ts.out | 3 - ...o_doc_displays_all_overloads_in_details_view.ts | 6 + ...c_displays_all_overloads_in_details_view.ts.out | 9 + cli/tests/testdata/doc/deno_doc.ts | 3 + cli/tests/testdata/doc/deno_doc_builtin.out | 3 + cli/tests/testdata/dom_exception_formatting.ts | 1 - cli/tests/testdata/dom_exception_formatting.ts.out | 3 - cli/tests/testdata/dynamic_import_conditional.js | 3 - .../testdata/dynamic_import_conditional.js.out | 1 - cli/tests/testdata/empty.out | 0 cli/tests/testdata/error_001.ts | 9 - cli/tests/testdata/error_001.ts.out | 6 - cli/tests/testdata/error_002.ts | 7 - cli/tests/testdata/error_002.ts.out | 6 - cli/tests/testdata/error_003_typescript.ts | 20 - cli/tests/testdata/error_003_typescript.ts.out | 7 - cli/tests/testdata/error_004_missing_module.ts | 3 - cli/tests/testdata/error_004_missing_module.ts.out | 2 - .../testdata/error_005_missing_dynamic_import.ts | 3 - .../error_005_missing_dynamic_import.ts.out | 4 - cli/tests/testdata/error_006_import_ext_failure.ts | 1 - .../testdata/error_006_import_ext_failure.ts.out | 2 - cli/tests/testdata/error_007_any.ts | 1 - cli/tests/testdata/error_007_any.ts.out | 1 - cli/tests/testdata/error_008_checkjs.js | 5 - cli/tests/testdata/error_008_checkjs.js.out | 4 - cli/tests/testdata/error_009_extensions_error.js | 2 - .../testdata/error_009_extensions_error.js.out | 6 - .../testdata/error_009_missing_js_module.disabled | 4 - cli/tests/testdata/error_009_missing_js_module.js | 1 - .../testdata/error_009_missing_js_module.js.out | 1 - .../testdata/error_010_nonexistent_arg.disabled | 4 - cli/tests/testdata/error_010_nonexistent_arg.out | 1 - .../testdata/error_011_bad_module_specifier.ts | 3 - .../testdata/error_011_bad_module_specifier.ts.out | 2 - .../error_012_bad_dynamic_import_specifier.ts | 3 - .../error_012_bad_dynamic_import_specifier.ts.out | 7 - cli/tests/testdata/error_013_missing_script.out | 1 - .../error_014_catch_dynamic_import_error.js | 31 - .../error_014_catch_dynamic_import_error.js.out | 15 - .../error_015_dynamic_import_permissions.js | 3 - .../error_015_dynamic_import_permissions.out | 4 - .../error_016_dynamic_import_permissions2.js | 5 - .../error_016_dynamic_import_permissions2.out | 7 - .../testdata/error_017_hide_long_source_ts.ts | 3 - .../testdata/error_017_hide_long_source_ts.ts.out | 3 - .../testdata/error_018_hide_long_source_js.js | 3 - .../testdata/error_018_hide_long_source_js.js.out | 2 - cli/tests/testdata/error_019_stack_function.ts | 12 - cli/tests/testdata/error_019_stack_function.ts.out | 8 - cli/tests/testdata/error_020_stack_constructor.ts | 14 - .../testdata/error_020_stack_constructor.ts.out | 8 - cli/tests/testdata/error_021_stack_method.ts | 14 - cli/tests/testdata/error_021_stack_method.ts.out | 8 - cli/tests/testdata/error_022_stack_custom_error.ts | 14 - .../testdata/error_022_stack_custom_error.ts.out | 6 - cli/tests/testdata/error_023_stack_async.ts | 14 - cli/tests/testdata/error_023_stack_async.ts.out | 10 - cli/tests/testdata/error_024_stack_promise_all.ts | 16 - .../testdata/error_024_stack_promise_all.ts.out | 10 - cli/tests/testdata/error_025_tab_indent | 9 - cli/tests/testdata/error_025_tab_indent.out | 6 - .../testdata/error_026_remote_import_error.ts | 1 - .../testdata/error_026_remote_import_error.ts.out | 7 - .../testdata/error_027_bundle_with_bare_import.ts | 1 - .../error_027_bundle_with_bare_import.ts.out | 2 - cli/tests/testdata/error_cause.ts | 14 - cli/tests/testdata/error_cause.ts.out | 15 - cli/tests/testdata/error_cause_recursive.ts | 4 - cli/tests/testdata/error_cause_recursive.ts.out | 10 - cli/tests/testdata/error_for_await.ts | 12 - cli/tests/testdata/error_for_await.ts.out | 10 - .../testdata/error_import_map_unable_to_load.out | 4 - .../error_local_static_import_from_remote.js | 1 - .../error_local_static_import_from_remote.js.out | 4 - .../error_local_static_import_from_remote.ts | 1 - .../error_local_static_import_from_remote.ts.out | 4 - .../testdata/error_missing_module_named_import.ts | 3 - .../error_missing_module_named_import.ts.out | 3 - cli/tests/testdata/error_name_non_string.js | 8 - cli/tests/testdata/error_name_non_string.js.out | 4 - cli/tests/testdata/error_no_check.ts | 1 - cli/tests/testdata/error_no_check.ts.out | 2 - cli/tests/testdata/error_syntax.js | 3 - cli/tests/testdata/error_syntax.js.out | 1 - .../testdata/error_syntax_empty_trailing_line.mjs | 2 - .../error_syntax_empty_trailing_line.mjs.out | 1 - cli/tests/testdata/error_type_definitions.ts | 5 - cli/tests/testdata/error_type_definitions.ts.out | 2 - .../testdata/error_worker_permissions_local.ts | 4 - .../testdata/error_worker_permissions_local.ts.out | 3 - .../testdata/error_worker_permissions_remote.ts | 4 - .../error_worker_permissions_remote.ts.out | 3 - cli/tests/testdata/es_private_fields.js | 15 - cli/tests/testdata/es_private_fields.js.out | 1 - cli/tests/testdata/esm_imports_a.js | 3 - cli/tests/testdata/esm_imports_b.js | 4 - cli/tests/testdata/eval/dyn_import_eval.out | 2 + .../testdata/eval_context_throw_dom_exception.js | 2 - .../eval_context_throw_dom_exception.js.out | 1 - cli/tests/testdata/event_listener_error.ts | 6 - cli/tests/testdata/event_listener_error.ts.out | 7 - cli/tests/testdata/event_listener_error_handled.ts | 23 - .../testdata/event_listener_error_handled.ts.out | 17 - .../event_listener_error_immediate_exit.ts | 12 - .../event_listener_error_immediate_exit.ts.out | 7 - .../event_listener_error_immediate_exit_worker.ts | 4 - ...ent_listener_error_immediate_exit_worker.ts.out | 8 - cli/tests/testdata/exec_path.ts | 1 - cli/tests/testdata/exit_error42.ts | 3 - cli/tests/testdata/exit_error42.ts.out | 1 - cli/tests/testdata/export_type_def.ts | 2 - cli/tests/testdata/fetch/hello.txt | 1 - cli/tests/testdata/fetch/other.ts | 1 - cli/tests/testdata/fetch/test.ts | 1 - cli/tests/testdata/fetch_async_error_stack.ts | 1 - cli/tests/testdata/fetch_async_error_stack.ts.out | 5 - cli/tests/testdata/fetch_response_finalization.js | 16 - .../testdata/fetch_response_finalization.js.out | 2 - cli/tests/testdata/file_exists.ts | 6 - cli/tests/testdata/finalization_registry.js | 20 - cli/tests/testdata/finalization_registry.js.out | 1 - cli/tests/testdata/fix_dynamic_import_errors.js | 7 - .../testdata/fix_dynamic_import_errors.js.out | 2 - cli/tests/testdata/fix_emittable_skipped.js | 7 - cli/tests/testdata/fix_emittable_skipped.ts.out | 2 - cli/tests/testdata/fix_exotic_specifiers.ts | 3 - cli/tests/testdata/fix_exotic_specifiers.ts.out | 1 - cli/tests/testdata/fix_js_import_js.ts | 3 - cli/tests/testdata/fix_js_import_js.ts.out | 1 - cli/tests/testdata/fix_js_imports.ts | 3 - cli/tests/testdata/fix_js_imports.ts.out | 1 - cli/tests/testdata/fix_tsc_file_exists.out | 1 - cli/tests/testdata/fix_worker_dispatchevent.ts | 43 - cli/tests/testdata/fix_worker_dispatchevent.ts.out | 1 - cli/tests/testdata/fixture.json | 14 - cli/tests/testdata/fmt/badly_formatted.json | 12 + cli/tests/testdata/fmt/badly_formatted.md | 46 + cli/tests/testdata/fmt/badly_formatted.mjs | 4 + cli/tests/testdata/fmt/badly_formatted_fixed.js | 2 + cli/tests/testdata/fmt/badly_formatted_fixed.json | 8 + cli/tests/testdata/fmt/badly_formatted_fixed.md | 37 + cli/tests/testdata/fmt/with_config/subdir/a.ts | 2 +- cli/tests/testdata/fmt/with_config/subdir/b.ts | 4 +- .../testdata/followup_dyn_import_resolves/main.ts | 14 - .../followup_dyn_import_resolves/main.ts.out | 3 - .../testdata/followup_dyn_import_resolves/sub1.ts | 2 - .../testdata/followup_dyn_import_resolves/sub2.ts | 1 - cli/tests/testdata/future_check.ts | 1 - cli/tests/testdata/future_check2.out | 1 - cli/tests/testdata/heapstats.js | 37 - cli/tests/testdata/heapstats.js.out | 2 - cli/tests/testdata/hello.txt | 1 - cli/tests/testdata/http2_request_url.ts | 12 - cli/tests/testdata/https_import.ts | 3 - cli/tests/testdata/https_import.ts.out | 1 - cli/tests/testdata/if_main.ts | 6 - cli/tests/testdata/if_main.ts.out | 1 - cli/tests/testdata/ignore_require.js | 2 - cli/tests/testdata/import_blob_url.ts | 13 - cli/tests/testdata/import_blob_url.ts.out | 3 - cli/tests/testdata/import_blob_url_error_stack.ts | 13 - .../testdata/import_blob_url_error_stack.ts.out | 6 - .../testdata/import_blob_url_import_relative.ts | 8 - .../import_blob_url_import_relative.ts.out | 5 - cli/tests/testdata/import_blob_url_imports.ts | 11 - cli/tests/testdata/import_blob_url_imports.ts.out | 1 - cli/tests/testdata/import_blob_url_jsx.ts | 16 - cli/tests/testdata/import_blob_url_jsx.ts.out | 1 - cli/tests/testdata/import_data_url.ts | 12 - cli/tests/testdata/import_data_url.ts.out | 3 - cli/tests/testdata/import_data_url_error_stack.ts | 3 - .../testdata/import_data_url_error_stack.ts.out | 6 - .../testdata/import_data_url_import_relative.ts | 4 - .../import_data_url_import_relative.ts.out | 2 - cli/tests/testdata/import_data_url_imports.ts | 4 - cli/tests/testdata/import_data_url_imports.ts.out | 1 - cli/tests/testdata/import_data_url_jsx.ts | 10 - cli/tests/testdata/import_data_url_jsx.ts.out | 1 - cli/tests/testdata/import_dynamic_data_url.ts | 14 - cli/tests/testdata/import_dynamic_data_url.ts.out | 3 - cli/tests/testdata/import_extensionless.ts | 3 - cli/tests/testdata/import_extensionless.ts.out | 2 - cli/tests/testdata/import_file_with_colon.ts | 1 - cli/tests/testdata/import_file_with_colon.ts.out | 1 - cli/tests/testdata/import_meta.importmap.json | 11 - cli/tests/testdata/import_meta.ts | 34 - cli/tests/testdata/import_meta.ts.out | 9 - cli/tests/testdata/import_meta2.ts | 1 - cli/tests/testdata/import_type.ts | 5 - cli/tests/testdata/import_type.ts.out | 2 - cli/tests/testdata/info/031_info_ts_error.out | 5 + cli/tests/testdata/info/031_info_ts_error.ts | 1 + cli/tests/testdata/info/041_info_flag.out | 6 + cli/tests/testdata/info/041_info_flag_location.out | 7 + .../testdata/info/049_info_flag_script_jsx.out | 14 + cli/tests/testdata/info/054_info_local_imports.out | 8 + cli/tests/testdata/info/065_import_map_info.out | 5 + .../testdata/info/076_info_json_deps_order.out | 163 ++ .../testdata/info/076_info_json_deps_order.ts | 2 + .../testdata/info/error_009_missing_js_module.js | 1 + .../info/error_009_missing_js_module.js.out | 1 + cli/tests/testdata/info/info_json.out | 8 + cli/tests/testdata/info/info_json_location.out | 9 + cli/tests/testdata/info/info_missing_module.out | 6 + .../testdata/info/info_recursive_imports_test.out | 12 + .../testdata/info/info_recursive_imports_test.ts | 5 + cli/tests/testdata/info/info_type_import.out | 5 + cli/tests/testdata/info/info_type_import.ts | 3 + cli/tests/testdata/info/json_output/main.out | 90 + cli/tests/testdata/info/json_output/main.ts | 11 + cli/tests/testdata/info/multiple_imports.out | 14 + cli/tests/testdata/info/recursive_imports/A.ts | 7 + cli/tests/testdata/info/recursive_imports/B.ts | 7 + cli/tests/testdata/info/recursive_imports/C.ts | 8 + .../testdata/info/recursive_imports/common.ts | 2 + cli/tests/testdata/info_json.out | 8 - cli/tests/testdata/info_json_location.out | 9 - cli/tests/testdata/info_missing_module.out | 6 - cli/tests/testdata/info_recursive_imports_test.out | 12 - cli/tests/testdata/info_recursive_imports_test.ts | 5 - cli/tests/testdata/info_type_import.out | 5 - cli/tests/testdata/info_type_import.ts | 3 - cli/tests/testdata/inline_js_source_map.ts | 6 - cli/tests/testdata/inline_js_source_map_2.js | 4 - cli/tests/testdata/inline_js_source_map_2.js.out | 2 - cli/tests/testdata/inline_js_source_map_2.ts | 6 - .../inline_js_source_map_2_with_inline_contents.js | 4 - ...ine_js_source_map_2_with_inline_contents.js.out | 2 - ...nline_js_source_map_with_contents_from_graph.js | 4 - ...e_js_source_map_with_contents_from_graph.js.out | 4 - cli/tests/testdata/ip_address_unsafe_ssl.ts | 2 - cli/tests/testdata/ip_address_unsafe_ssl.ts.out | 2 - cli/tests/testdata/issue13562.ts | 3 - cli/tests/testdata/issue13562.ts.out | 2 - cli/tests/testdata/issue9750.js | 6 - cli/tests/testdata/js_import_detect.ts | 3 - cli/tests/testdata/js_import_detect.ts.out | 1 - cli/tests/testdata/js_root_with_ts_check.js | 5 - cli/tests/testdata/js_root_with_ts_check.js.out | 4 - cli/tests/testdata/jsx_import_from_ts.App.jsx | 11 - cli/tests/testdata/jsx_import_from_ts.ts | 3 - cli/tests/testdata/jsx_import_from_ts.ts.out | 1 - cli/tests/testdata/jsx_import_source.out | 2 - cli/tests/testdata/jsx_import_source_dev.out | 2 - cli/tests/testdata/jsx_import_source_error.out | 2 - .../testdata/jsx_import_source_import_map.out | 2 - .../testdata/jsx_import_source_import_map_dev.out | 2 - cli/tests/testdata/jsx_import_source_no_pragma.tsx | 7 - cli/tests/testdata/jsx_import_source_pragma.tsx | 9 - .../jsx_import_source_pragma_import_map.tsx | 9 - cli/tests/testdata/listen_tls_alpn.ts | 14 - cli/tests/testdata/listen_tls_alpn_fail.ts | 20 - cli/tests/testdata/localhost_unsafe_ssl.ts.out | 3 - cli/tests/testdata/lock_check_err.json | 4 - cli/tests/testdata/lock_check_err.out | 3 - cli/tests/testdata/lock_check_err2.json | 10 - cli/tests/testdata/lock_check_err2.out | 3 - cli/tests/testdata/lock_check_err_with_bundle.json | 5 - cli/tests/testdata/lock_check_err_with_bundle.out | 4 - cli/tests/testdata/lock_check_ok.json | 4 - cli/tests/testdata/lock_check_ok2.json | 10 - cli/tests/testdata/lock_dynamic_imports.json | 6 - cli/tests/testdata/lock_dynamic_imports.out | 4 - cli/tests/testdata/lock_write_fetch.ts | 52 - cli/tests/testdata/lock_write_fetch.ts.out | 3 - cli/tests/testdata/lock_write_requires_lock.out | 3 - cli/tests/testdata/long_data_url_formatting.ts | 3 - cli/tests/testdata/long_data_url_formatting.ts.out | 8 - .../lsp/code_action_redirect_response.json | 6 +- cli/tests/testdata/lsp/x_deno_warning_redirect.js | 1 + cli/tests/testdata/main_module.ts | 3 - cli/tests/testdata/main_module.ts.out | 2 - cli/tests/testdata/main_module2.ts | 1 - cli/tests/testdata/module_detection_force.ts | 3 - .../testdata/module_detection_force_import.ts | 2 - cli/tests/testdata/mts_dmts_mjs.out | 2 - cli/tests/testdata/nested_error.ts | 3 - cli/tests/testdata/nested_error.ts.out | 4 - cli/tests/testdata/no_check_decorators.ts | 21 - cli/tests/testdata/no_check_decorators.ts.out | 3 - cli/tests/testdata/no_check_remote.ts | 3 - cli/tests/testdata/no_check_remote.ts.disabled.out | 4 - cli/tests/testdata/no_check_remote.ts.enabled.out | 1 - cli/tests/testdata/no_color.js | 1 - cli/tests/testdata/no_mem_cache.js | 33 - cli/tests/testdata/no_mem_cache.js.out | 2 - cli/tests/testdata/no_prompt.ts | 10 - cli/tests/testdata/no_validate_asm.js | 20 - cli/tests/testdata/node_env_var_allowlist.ts | 2 - ...ode_env_var_allowlist_with_unstable_flag.ts.out | 5 - ..._env_var_allowlist_without_unstable_flag.ts.out | 4 - .../testdata/op_exit_op_set_exit_code_in_worker.ts | 13 - .../testdata/op_exit_op_set_exit_code_worker.js | 4 - cli/tests/testdata/performance_stats.out | 16 - cli/tests/testdata/permission_test.ts | 30 - cli/tests/testdata/preserve_imports.tsconfig.json | 5 - cli/tests/testdata/private_field_presence.ts | 20 - cli/tests/testdata/private_field_presence.ts.out | 3 - cli/tests/testdata/proto_exploit.js | 5 - cli/tests/testdata/proto_exploit.js.out | 2 - cli/tests/testdata/queue_microtask_error.ts | 5 - cli/tests/testdata/queue_microtask_error.ts.out | 6 - .../testdata/queue_microtask_error_handled.ts | 21 - .../testdata/queue_microtask_error_handled.ts.out | 15 - cli/tests/testdata/raw_mode.ts | 18 - cli/tests/testdata/recursive_imports/A.ts | 7 - cli/tests/testdata/recursive_imports/B.ts | 7 - cli/tests/testdata/recursive_imports/C.ts | 8 - cli/tests/testdata/recursive_imports/common.ts | 2 - cli/tests/testdata/redirect_cache.out | 5 - cli/tests/testdata/reference_types.ts | 3 - cli/tests/testdata/reference_types.ts.out | 1 - cli/tests/testdata/reference_types_error.js | 2 - cli/tests/testdata/reference_types_error.js.out | 2 - cli/tests/testdata/reference_types_remote.ts | 3 - cli/tests/testdata/reference_types_remote.ts.out | 1 - cli/tests/testdata/repl/import_type.ts | 5 + cli/tests/testdata/replace_self.js | 21 - cli/tests/testdata/replace_self.js.out | 4 - cli/tests/testdata/report_error.ts | 3 - cli/tests/testdata/report_error.ts.out | 5 - cli/tests/testdata/report_error_end_of_program.ts | 1 - .../testdata/report_error_end_of_program.ts.out | 4 - cli/tests/testdata/report_error_handled.ts | 19 - cli/tests/testdata/report_error_handled.ts.out | 13 - cli/tests/testdata/resolve_dns.ts | 64 - cli/tests/testdata/resolve_dns.ts.out | 25 - cli/tests/testdata/resolve_dns.zone.in | 31 - cli/tests/testdata/response_string_perf.js | 34 - cli/tests/testdata/run/001_hello.js | 1 + cli/tests/testdata/run/001_hello.js.out | 1 + cli/tests/testdata/run/002_hello.ts | 1 + cli/tests/testdata/run/002_hello.ts.out | 1 + cli/tests/testdata/run/003_relative_import.ts | 3 + cli/tests/testdata/run/003_relative_import.ts.out | 2 + cli/tests/testdata/run/004_set_timeout.ts | 11 + cli/tests/testdata/run/004_set_timeout.ts.out | 2 + cli/tests/testdata/run/005_more_imports.ts | 11 + cli/tests/testdata/run/005_more_imports.ts.out | 1 + cli/tests/testdata/run/006_url_imports.ts | 3 + cli/tests/testdata/run/006_url_imports.ts.out | 2 + cli/tests/testdata/run/012_async.ts | 11 + cli/tests/testdata/run/012_async.ts.out | 3 + cli/tests/testdata/run/013_dynamic_import.ts | 15 + cli/tests/testdata/run/013_dynamic_import.ts.out | 1 + cli/tests/testdata/run/014_duplicate_import.ts | 9 + cli/tests/testdata/run/014_duplicate_import.ts.out | 1 + .../testdata/run/015_duplicate_parallel_import.js | 20 + .../run/015_duplicate_parallel_import.js.out | 1 + cli/tests/testdata/run/016_double_await.ts | 8 + cli/tests/testdata/run/016_double_await.ts.out | 2 + cli/tests/testdata/run/017_import_redirect.ts | 4 + cli/tests/testdata/run/017_import_redirect.ts.out | 1 + .../testdata/run/017_import_redirect_info.out | 6 + cli/tests/testdata/run/018_async_catch.ts | 14 + cli/tests/testdata/run/018_async_catch.ts.out | 3 + cli/tests/testdata/run/019_media_types.ts | 24 + cli/tests/testdata/run/019_media_types.ts.out | 1 + cli/tests/testdata/run/020_json_modules.ts | 2 + cli/tests/testdata/run/020_json_modules.ts.out | 4 + cli/tests/testdata/run/021_mjs_modules.ts | 2 + cli/tests/testdata/run/021_mjs_modules.ts.out | 1 + cli/tests/testdata/run/023_no_ext | 2 + cli/tests/testdata/run/023_no_ext.out | 1 + cli/tests/testdata/run/025_hrtime.ts | 5 + cli/tests/testdata/run/025_hrtime.ts.out | 2 + cli/tests/testdata/run/025_reload_js_type_error.js | 6 + .../testdata/run/025_reload_js_type_error.js.out | 1 + cli/tests/testdata/run/026_redirect_javascript.js | 2 + .../testdata/run/026_redirect_javascript.js.out | 1 + cli/tests/testdata/run/027_redirect_typescript.ts | 2 + .../testdata/run/027_redirect_typescript.ts.out | 1 + cli/tests/testdata/run/028_args.ts | 3 + cli/tests/testdata/run/028_args.ts.out | 6 + cli/tests/testdata/run/033_import_map.out | 7 + cli/tests/testdata/run/033_import_map_remote.out | 5 + cli/tests/testdata/run/035_cached_only_flag.out | 4 + cli/tests/testdata/run/038_checkjs.js | 5 + cli/tests/testdata/run/038_checkjs.js.out | 22 + .../testdata/run/042_dyn_import_evalcontext.ts | 4 + .../testdata/run/042_dyn_import_evalcontext.ts.out | 1 + cli/tests/testdata/run/044_bad_resource.ts | 3 + cli/tests/testdata/run/044_bad_resource.ts.out | 2 + cli/tests/testdata/run/045_mod.ts | 5 + cli/tests/testdata/run/045_output.ts | 3 + .../testdata/run/045_programmatic_proxy_client.ts | 16 + cli/tests/testdata/run/045_proxy_client.ts | 5 + cli/tests/testdata/run/045_proxy_test.ts | 121 ++ cli/tests/testdata/run/045_proxy_test.ts.out | 6 + cli/tests/testdata/run/046_jsx_test.tsx | 14 + cli/tests/testdata/run/046_jsx_test.tsx.out | 1 + cli/tests/testdata/run/047_jsx_test.jsx | 7 + cli/tests/testdata/run/047_jsx_test.jsx.out | 1 + cli/tests/testdata/run/048_media_types_jsx.ts | 32 + cli/tests/testdata/run/048_media_types_jsx.ts.out | 2 + cli/tests/testdata/run/052_no_remote_flag.out | 4 + .../testdata/run/056_make_temp_file_write_perm.out | 1 + .../testdata/run/056_make_temp_file_write_perm.ts | 9 + .../testdata/run/058_tasks_microtasks_close.ts | 19 + .../testdata/run/058_tasks_microtasks_close.ts.out | 6 + .../testdata/run/059_fs_relative_path_perm.ts | 2 + .../testdata/run/059_fs_relative_path_perm.ts.out | 4 + cli/tests/testdata/run/061_permissions_request.ts | 9 + .../testdata/run/062_permissions_request_global.ts | 6 + cli/tests/testdata/run/063_permissions_revoke.ts | 6 + .../testdata/run/063_permissions_revoke.ts.out | 3 + .../testdata/run/064_permissions_revoke_global.ts | 6 + .../run/064_permissions_revoke_global.ts.out | 3 + cli/tests/testdata/run/066_prompt.ts | 21 + cli/tests/testdata/run/070_location.ts | 18 + cli/tests/testdata/run/070_location.ts.out | 16 + cli/tests/testdata/run/071_location_unset.ts | 16 + cli/tests/testdata/run/071_location_unset.ts.out | 5 + .../testdata/run/072_location_relative_fetch.ts | 2 + .../run/072_location_relative_fetch.ts.out | 2 + .../testdata/run/075_import_local_query_hash.ts | 2 + .../run/075_import_local_query_hash.ts.out | 2 + cli/tests/testdata/run/077_fetch_empty.ts | 1 + cli/tests/testdata/run/077_fetch_empty.ts.out | 2 + cli/tests/testdata/run/078_unload_on_exit.ts | 9 + cli/tests/testdata/run/078_unload_on_exit.ts.out | 1 + .../testdata/run/079_location_authentication.ts | 1 + .../run/079_location_authentication.ts.out | 3 + .../run/081_location_relative_fetch_redirect.ts | 2 + .../081_location_relative_fetch_redirect.ts.out | 1 + .../testdata/run/082_prepare_stack_trace_throw.js | 6 + .../run/082_prepare_stack_trace_throw.js.out | 2 + .../testdata/run/083_legacy_external_source_map.ts | 2 + .../run/088_dynamic_import_already_evaluating.ts | 2 + .../088_dynamic_import_already_evaluating.ts.out | 4 + .../testdata/run/088_dynamic_import_target.ts | 3 + cli/tests/testdata/run/089_run_allow_list.ts | 12 + cli/tests/testdata/run/089_run_allow_list.ts.out | 3 + .../testdata/run/090_run_permissions_request.ts | 18 + .../run/091_use_define_for_class_fields.ts | 4 + .../run/091_use_define_for_class_fields.ts.out | 4 + .../run/092_import_map_unmapped_bare_specifier.ts | 1 + .../092_import_map_unmapped_bare_specifier.ts.out | 7 + cli/tests/testdata/run/aggregate_error.out | 18 + cli/tests/testdata/run/aggregate_error.ts | 9 + cli/tests/testdata/run/async_error.ts | 9 + cli/tests/testdata/run/async_error.ts.out | 8 + cli/tests/testdata/run/before_unload.js | 21 + cli/tests/testdata/run/before_unload.js.out | 8 + cli/tests/testdata/run/blob_gc_finalization.js | 11 + cli/tests/testdata/run/blob_gc_finalization.js.out | 1 + cli/tests/testdata/run/byte_order_mark.out | 1 + cli/tests/testdata/run/byte_order_mark.ts | 4 + cli/tests/testdata/run/checkjs.tsconfig.json | 6 + cli/tests/testdata/run/cjs_imports/commonjs.cjs | 1 + cli/tests/testdata/run/cjs_imports/main.out | 1 + cli/tests/testdata/run/cjs_imports/main.ts | 1 + .../testdata/run/classic_workers_event_loop.js | 4 + .../testdata/run/classic_workers_event_loop.js.out | 1 + .../testdata/run/colors_without_globalThis.js | 1 + cli/tests/testdata/run/complex_error.ts | 18 + cli/tests/testdata/run/complex_error.ts.out | 44 + cli/tests/testdata/run/complex_permissions_test.ts | 53 + cli/tests/testdata/run/config/main.out | 4 + cli/tests/testdata/run/config/main.ts | 5 + cli/tests/testdata/run/config/tsconfig.json | 7 + cli/tests/testdata/run/config_json_import.ts | 2 + cli/tests/testdata/run/config_json_import.ts.out | 3 + cli/tests/testdata/run/config_types/main.out | 1 + cli/tests/testdata/run/config_types/main.ts | 1 + .../testdata/run/config_types/remote.tsconfig.json | 7 + cli/tests/testdata/run/config_types/tsconfig.json | 7 + cli/tests/testdata/run/config_types/types.d.ts | 2 + cli/tests/testdata/run/custom_inspect_url.js | 3 + cli/tests/testdata/run/custom_inspect_url.js.out | 47 + cli/tests/testdata/run/delete_window.js | 1 + cli/tests/testdata/run/deno_exit_tampering.ts | 3 + cli/tests/testdata/run/disallow_http_from_https.js | 2 + cli/tests/testdata/run/disallow_http_from_https.ts | 2 + .../testdata/run/disallow_http_from_https_js.out | 3 + .../testdata/run/disallow_http_from_https_ts.out | 3 + cli/tests/testdata/run/dom_exception_formatting.ts | 1 + .../testdata/run/dom_exception_formatting.ts.out | 3 + .../dynamic_import_already_rejected/error_001.ts | 9 + .../run/dynamic_import_already_rejected/main.out | 4 + .../run/dynamic_import_already_rejected/main.ts | 15 + .../dynamic_import_async_error/delayed_error.ts | 2 + .../run/dynamic_import_async_error/main.out | 2 + .../run/dynamic_import_async_error/main.ts | 7 + .../testdata/run/dynamic_import_conditional.js | 3 + .../testdata/run/dynamic_import_conditional.js.out | 1 + cli/tests/testdata/run/empty.ts | 0 cli/tests/testdata/run/error_001.ts | 9 + cli/tests/testdata/run/error_001.ts.out | 6 + cli/tests/testdata/run/error_002.ts | 7 + cli/tests/testdata/run/error_002.ts.out | 6 + cli/tests/testdata/run/error_003_typescript.ts | 20 + cli/tests/testdata/run/error_003_typescript.ts.out | 7 + cli/tests/testdata/run/error_004_missing_module.ts | 3 + .../testdata/run/error_004_missing_module.ts.out | 2 + .../run/error_005_missing_dynamic_import.ts | 3 + .../run/error_005_missing_dynamic_import.ts.out | 4 + .../testdata/run/error_006_import_ext_failure.ts | 1 + .../run/error_006_import_ext_failure.ts.out | 2 + cli/tests/testdata/run/error_007_any.ts | 1 + cli/tests/testdata/run/error_007_any.ts.out | 1 + cli/tests/testdata/run/error_008_checkjs.js | 5 + cli/tests/testdata/run/error_008_checkjs.js.out | 4 + .../testdata/run/error_009_extensions_error.js | 2 + .../testdata/run/error_009_extensions_error.js.out | 6 + .../run/error_009_missing_js_module.disabled | 4 + .../testdata/run/error_011_bad_module_specifier.ts | 3 + .../run/error_011_bad_module_specifier.ts.out | 2 + .../run/error_012_bad_dynamic_import_specifier.ts | 3 + .../error_012_bad_dynamic_import_specifier.ts.out | 7 + .../testdata/run/error_013_missing_script.out | 1 + .../run/error_014_catch_dynamic_import_error.js | 31 + .../error_014_catch_dynamic_import_error.js.out | 15 + .../run/error_015_dynamic_import_permissions.js | 3 + .../run/error_015_dynamic_import_permissions.out | 4 + .../run/error_016_dynamic_import_permissions2.js | 5 + .../run/error_016_dynamic_import_permissions2.out | 7 + .../testdata/run/error_017_hide_long_source_ts.ts | 3 + .../run/error_017_hide_long_source_ts.ts.out | 3 + .../testdata/run/error_018_hide_long_source_js.js | 3 + .../run/error_018_hide_long_source_js.js.out | 2 + cli/tests/testdata/run/error_019_stack_function.ts | 12 + .../testdata/run/error_019_stack_function.ts.out | 8 + .../testdata/run/error_020_stack_constructor.ts | 14 + .../run/error_020_stack_constructor.ts.out | 8 + cli/tests/testdata/run/error_021_stack_method.ts | 14 + .../testdata/run/error_021_stack_method.ts.out | 8 + .../testdata/run/error_022_stack_custom_error.ts | 14 + .../run/error_022_stack_custom_error.ts.out | 6 + cli/tests/testdata/run/error_023_stack_async.ts | 14 + .../testdata/run/error_023_stack_async.ts.out | 10 + .../testdata/run/error_024_stack_promise_all.ts | 16 + .../run/error_024_stack_promise_all.ts.out | 10 + cli/tests/testdata/run/error_025_tab_indent | 9 + cli/tests/testdata/run/error_025_tab_indent.out | 6 + .../testdata/run/error_026_remote_import_error.ts | 1 + .../run/error_026_remote_import_error.ts.out | 7 + cli/tests/testdata/run/error_cause.ts | 14 + cli/tests/testdata/run/error_cause.ts.out | 15 + cli/tests/testdata/run/error_cause_recursive.ts | 4 + .../testdata/run/error_cause_recursive.ts.out | 10 + cli/tests/testdata/run/error_for_await.ts | 12 + cli/tests/testdata/run/error_for_await.ts.out | 10 + .../run/error_import_map_unable_to_load.out | 4 + .../run/error_local_static_import_from_remote.js | 1 + .../error_local_static_import_from_remote.js.out | 4 + .../run/error_local_static_import_from_remote.ts | 1 + .../error_local_static_import_from_remote.ts.out | 4 + .../run/error_missing_module_named_import.ts | 3 + .../run/error_missing_module_named_import.ts.out | 3 + cli/tests/testdata/run/error_name_non_string.js | 8 + .../testdata/run/error_name_non_string.js.out | 4 + cli/tests/testdata/run/error_no_check.ts | 1 + cli/tests/testdata/run/error_no_check.ts.out | 2 + cli/tests/testdata/run/error_syntax.js | 3 + cli/tests/testdata/run/error_syntax.js.out | 1 + .../run/error_syntax_empty_trailing_line.mjs | 2 + .../run/error_syntax_empty_trailing_line.mjs.out | 1 + cli/tests/testdata/run/error_type_definitions.ts | 5 + .../testdata/run/error_type_definitions.ts.out | 2 + cli/tests/testdata/run/es_private_fields.js | 15 + cli/tests/testdata/run/es_private_fields.js.out | 1 + .../run/eval_context_throw_dom_exception.js | 2 + .../run/eval_context_throw_dom_exception.js.out | 1 + cli/tests/testdata/run/event_listener_error.ts | 6 + cli/tests/testdata/run/event_listener_error.ts.out | 7 + .../testdata/run/event_listener_error_handled.ts | 23 + .../run/event_listener_error_handled.ts.out | 17 + .../run/event_listener_error_immediate_exit.ts | 12 + .../run/event_listener_error_immediate_exit.ts.out | 7 + .../event_listener_error_immediate_exit_worker.ts | 4 + ...ent_listener_error_immediate_exit_worker.ts.out | 8 + cli/tests/testdata/run/exec_path.ts | 1 + cli/tests/testdata/run/exit_error42.ts | 3 + cli/tests/testdata/run/exit_error42.ts.out | 1 + cli/tests/testdata/run/export_type_def.ts | 2 + cli/tests/testdata/run/fetch/hello.txt | 1 + cli/tests/testdata/run/fetch/other.ts | 1 + cli/tests/testdata/run/fetch/test.ts | 1 + cli/tests/testdata/run/fetch_async_error_stack.ts | 1 + .../testdata/run/fetch_async_error_stack.ts.out | 5 + .../testdata/run/fetch_response_finalization.js | 16 + .../run/fetch_response_finalization.js.out | 2 + cli/tests/testdata/run/ffi/unstable_ffi_1.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_1.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_10.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_10.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_11.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_11.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_12.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_12.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_13.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_13.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_14.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_14.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_15.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_15.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_2.js | 5 + cli/tests/testdata/run/ffi/unstable_ffi_2.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_3.js | 5 + cli/tests/testdata/run/ffi/unstable_ffi_3.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_4.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_4.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_5.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_5.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_6.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_6.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_7.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_7.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_8.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_8.js.out | 1 + cli/tests/testdata/run/ffi/unstable_ffi_9.js | 1 + cli/tests/testdata/run/ffi/unstable_ffi_9.js.out | 1 + cli/tests/testdata/run/finalization_registry.js | 20 + .../testdata/run/finalization_registry.js.out | 1 + .../testdata/run/fix_dynamic_import_errors.js | 7 + .../testdata/run/fix_dynamic_import_errors.js.out | 2 + cli/tests/testdata/run/fix_emittable_skipped.js | 7 + .../testdata/run/fix_emittable_skipped.ts.out | 2 + cli/tests/testdata/run/fix_exotic_specifiers.ts | 3 + .../testdata/run/fix_exotic_specifiers.ts.out | 1 + cli/tests/testdata/run/fix_js_import_js.ts | 3 + cli/tests/testdata/run/fix_js_import_js.ts.out | 1 + cli/tests/testdata/run/fix_js_imports.ts | 3 + cli/tests/testdata/run/fix_js_imports.ts.out | 1 + cli/tests/testdata/run/fix_tsc_file_exists.out | 1 + cli/tests/testdata/run/fix_worker_dispatchevent.ts | 43 + .../testdata/run/fix_worker_dispatchevent.ts.out | 1 + .../run/followup_dyn_import_resolves/main.ts | 14 + .../run/followup_dyn_import_resolves/main.ts.out | 3 + .../run/followup_dyn_import_resolves/sub1.ts | 2 + .../run/followup_dyn_import_resolves/sub2.ts | 1 + cli/tests/testdata/run/future_check.ts | 1 + cli/tests/testdata/run/future_check2.out | 1 + cli/tests/testdata/run/heapstats.js | 37 + cli/tests/testdata/run/heapstats.js.out | 2 + cli/tests/testdata/run/http2_request_url.ts | 12 + cli/tests/testdata/run/https_import.ts | 3 + cli/tests/testdata/run/https_import.ts.out | 1 + cli/tests/testdata/run/if_main.ts | 6 + cli/tests/testdata/run/if_main.ts.out | 1 + cli/tests/testdata/run/import_blob_url.ts | 13 + cli/tests/testdata/run/import_blob_url.ts.out | 3 + .../testdata/run/import_blob_url_error_stack.ts | 13 + .../run/import_blob_url_error_stack.ts.out | 6 + .../run/import_blob_url_import_relative.ts | 8 + .../run/import_blob_url_import_relative.ts.out | 5 + cli/tests/testdata/run/import_blob_url_imports.ts | 11 + .../testdata/run/import_blob_url_imports.ts.out | 1 + cli/tests/testdata/run/import_blob_url_jsx.ts | 16 + cli/tests/testdata/run/import_blob_url_jsx.ts.out | 1 + cli/tests/testdata/run/import_compression/brotli | 2 + cli/tests/testdata/run/import_compression/gziped | Bin 0 -> 39 bytes cli/tests/testdata/run/import_compression/main.out | 4 + cli/tests/testdata/run/import_compression/main.ts | 13 + cli/tests/testdata/run/import_data_url.ts | 12 + cli/tests/testdata/run/import_data_url.ts.out | 3 + .../testdata/run/import_data_url_error_stack.ts | 3 + .../run/import_data_url_error_stack.ts.out | 6 + .../run/import_data_url_import_relative.ts | 4 + .../run/import_data_url_import_relative.ts.out | 2 + cli/tests/testdata/run/import_data_url_imports.ts | 4 + .../testdata/run/import_data_url_imports.ts.out | 1 + cli/tests/testdata/run/import_data_url_jsx.ts | 10 + cli/tests/testdata/run/import_data_url_jsx.ts.out | 1 + cli/tests/testdata/run/import_dynamic_data_url.ts | 14 + .../testdata/run/import_dynamic_data_url.ts.out | 3 + cli/tests/testdata/run/import_extensionless.ts | 3 + cli/tests/testdata/run/import_extensionless.ts.out | 2 + cli/tests/testdata/run/import_file_with_colon.ts | 1 + .../testdata/run/import_file_with_colon.ts.out | 1 + cli/tests/testdata/run/import_meta/importmap.json | 11 + cli/tests/testdata/run/import_meta/main.out | 9 + cli/tests/testdata/run/import_meta/main.ts | 34 + cli/tests/testdata/run/import_meta/other.ts | 1 + cli/tests/testdata/run/import_type.ts | 5 + cli/tests/testdata/run/import_type.ts.out | 2 + cli/tests/testdata/run/inline_js_source_map.ts | 6 + cli/tests/testdata/run/inline_js_source_map_2.js | 4 + .../testdata/run/inline_js_source_map_2.js.out | 2 + cli/tests/testdata/run/inline_js_source_map_2.ts | 6 + .../inline_js_source_map_2_with_inline_contents.js | 4 + ...ine_js_source_map_2_with_inline_contents.js.out | 2 + ...nline_js_source_map_with_contents_from_graph.js | 4 + ...e_js_source_map_with_contents_from_graph.js.out | 4 + cli/tests/testdata/run/issue13562.ts | 3 + cli/tests/testdata/run/issue13562.ts.out | 2 + cli/tests/testdata/run/issue9750.js | 6 + cli/tests/testdata/run/js_import_detect.ts | 3 + cli/tests/testdata/run/js_import_detect.ts.out | 1 + cli/tests/testdata/run/js_root_with_ts_check.js | 5 + .../testdata/run/js_root_with_ts_check.js.out | 4 + cli/tests/testdata/run/jsx_import_from_ts.App.jsx | 11 + cli/tests/testdata/run/jsx_import_from_ts.ts | 3 + cli/tests/testdata/run/jsx_import_from_ts.ts.out | 1 + cli/tests/testdata/run/jsx_import_source.out | 2 + cli/tests/testdata/run/jsx_import_source_dev.out | 2 + cli/tests/testdata/run/jsx_import_source_error.out | 2 + .../testdata/run/jsx_import_source_import_map.out | 2 + .../run/jsx_import_source_import_map_dev.out | 2 + .../testdata/run/jsx_import_source_no_pragma.tsx | 7 + .../testdata/run/jsx_import_source_pragma.tsx | 9 + .../run/jsx_import_source_pragma_import_map.tsx | 9 + cli/tests/testdata/run/lock_check_err.json | 4 + cli/tests/testdata/run/lock_check_err.out | 3 + cli/tests/testdata/run/lock_check_err2.json | 10 + cli/tests/testdata/run/lock_check_err2.out | 3 + cli/tests/testdata/run/lock_check_ok.json | 4 + cli/tests/testdata/run/lock_check_ok2.json | 10 + cli/tests/testdata/run/lock_dynamic_imports.json | 6 + cli/tests/testdata/run/lock_dynamic_imports.out | 4 + .../testdata/run/lock_write_fetch/file_exists.ts | 6 + cli/tests/testdata/run/lock_write_fetch/main.out | 3 + cli/tests/testdata/run/lock_write_fetch/main.ts | 52 + .../testdata/run/lock_write_requires_lock.out | 3 + cli/tests/testdata/run/long_data_url_formatting.ts | 3 + .../testdata/run/long_data_url_formatting.ts.out | 8 + cli/tests/testdata/run/main_module/main.out | 2 + cli/tests/testdata/run/main_module/main.ts | 3 + cli/tests/testdata/run/main_module/other.ts | 1 + cli/tests/testdata/run/mts_dmts_mjs.out | 2 + cli/tests/testdata/run/nested_error.ts | 3 + cli/tests/testdata/run/nested_error.ts.out | 4 + cli/tests/testdata/run/no_check_decorators.ts | 21 + cli/tests/testdata/run/no_check_decorators.ts.out | 3 + .../no_check_imports_not_used_as_values/hello.ts | 2 + .../no_check_imports_not_used_as_values/main.out | 2 + .../no_check_imports_not_used_as_values/main.ts | 4 + .../preserve_imports.tsconfig.json | 5 + cli/tests/testdata/run/no_check_remote.ts | 3 + .../testdata/run/no_check_remote.ts.disabled.out | 4 + .../testdata/run/no_check_remote.ts.enabled.out | 1 + cli/tests/testdata/run/no_mem_cache.js | 33 + cli/tests/testdata/run/no_mem_cache.js.out | 2 + cli/tests/testdata/run/no_prompt.ts | 10 + cli/tests/testdata/run/no_validate_asm.js | 20 + cli/tests/testdata/run/node_env_var_allowlist.ts | 2 + ...ode_env_var_allowlist_with_unstable_flag.ts.out | 5 + ..._env_var_allowlist_without_unstable_flag.ts.out | 4 + cli/tests/testdata/run/onload/imported.ts | 12 + cli/tests/testdata/run/onload/main.out | 11 + cli/tests/testdata/run/onload/main.ts | 27 + cli/tests/testdata/run/onload/nest_imported.ts | 11 + .../run/op_exit_op_set_exit_code_in_worker.ts | 13 + .../run/op_exit_op_set_exit_code_worker.js | 4 + cli/tests/testdata/run/permission_test.ts | 30 + cli/tests/testdata/run/private_field_presence.ts | 20 + .../testdata/run/private_field_presence.ts.out | 3 + cli/tests/testdata/run/proto_exploit.js | 5 + cli/tests/testdata/run/proto_exploit.js.out | 2 + cli/tests/testdata/run/queue_microtask_error.ts | 5 + .../testdata/run/queue_microtask_error.ts.out | 6 + .../testdata/run/queue_microtask_error_handled.ts | 21 + .../run/queue_microtask_error_handled.ts.out | 15 + cli/tests/testdata/run/reference_types.ts | 3 + cli/tests/testdata/run/reference_types.ts.out | 1 + cli/tests/testdata/run/reference_types_error.js | 2 + .../testdata/run/reference_types_error.js.out | 2 + cli/tests/testdata/run/reference_types_remote.ts | 3 + .../testdata/run/reference_types_remote.ts.out | 1 + cli/tests/testdata/run/replace_self.js | 21 + cli/tests/testdata/run/replace_self.js.out | 4 + cli/tests/testdata/run/report_error.ts | 3 + cli/tests/testdata/run/report_error.ts.out | 5 + .../testdata/run/report_error_end_of_program.ts | 1 + .../run/report_error_end_of_program.ts.out | 4 + cli/tests/testdata/run/report_error_handled.ts | 19 + cli/tests/testdata/run/report_error_handled.ts.out | 13 + cli/tests/testdata/run/resolve_dns.ts | 64 + cli/tests/testdata/run/resolve_dns.ts.out | 25 + cli/tests/testdata/run/resolve_dns.zone.in | 31 + cli/tests/testdata/run/runtime_decorators.ts | 42 + cli/tests/testdata/run/runtime_decorators.ts.out | 7 + cli/tests/testdata/run/seed_random.js | 11 + cli/tests/testdata/run/seed_random.js.out | 22 + cli/tests/testdata/run/set_exit_code_0.ts | 2 + cli/tests/testdata/run/set_exit_code_1.ts | 2 + cli/tests/testdata/run/set_exit_code_2.ts | 2 + cli/tests/testdata/run/set_timeout_error.ts | 3 + cli/tests/testdata/run/set_timeout_error.ts.out | 5 + .../testdata/run/set_timeout_error_handled.ts | 19 + .../testdata/run/set_timeout_error_handled.ts.out | 13 + cli/tests/testdata/run/shebang.ts | 5 + cli/tests/testdata/run/shebang.ts.out | 1 + cli/tests/testdata/run/shebang2.ts | 3 + .../testdata/run/single_compile_with_reload.ts | 18 + .../testdata/run/single_compile_with_reload.ts.out | 9 + .../testdata/run/single_compile_with_reload_dyn.ts | 11 + .../run/single_compile_with_reload_worker.ts | 3 + cli/tests/testdata/run/spawn_stdout_inherit.ts | 8 + cli/tests/testdata/run/spawn_stdout_inherit.ts.out | 2 + cli/tests/testdata/run/swc_syntax_error.ts | 4 + cli/tests/testdata/run/swc_syntax_error.ts.out | 1 + cli/tests/testdata/run/test_and_bench_in_run.js | 5 + cli/tests/testdata/run/tls.out | 1 + cli/tests/testdata/run/tls_connecttls.js | 70 + cli/tests/testdata/run/tls_starttls.js | 68 + cli/tests/testdata/run/top_level_await/circular.js | 8 + .../testdata/run/top_level_await/circular.out | 9 + cli/tests/testdata/run/top_level_await/loop.js | 20 + cli/tests/testdata/run/top_level_await/loop.out | 5 + cli/tests/testdata/run/top_level_await/nested.out | 5 + cli/tests/testdata/run/top_level_await/nested/a.js | 3 + cli/tests/testdata/run/top_level_await/nested/b.js | 1 + .../testdata/run/top_level_await/nested/main.js | 3 + cli/tests/testdata/run/top_level_await/order.js | 21 + cli/tests/testdata/run/top_level_await/order.out | 2 + cli/tests/testdata/run/top_level_await/tla/a.js | 3 + cli/tests/testdata/run/top_level_await/tla/b.js | 7 + cli/tests/testdata/run/top_level_await/tla/c.js | 3 + cli/tests/testdata/run/top_level_await/tla/d.js | 8 + .../testdata/run/top_level_await/tla/order.js | 1 + .../testdata/run/top_level_await/tla/parent.js | 9 + cli/tests/testdata/run/top_level_await/tla2/a.js | 5 + cli/tests/testdata/run/top_level_await/tla2/b.js | 5 + cli/tests/testdata/run/top_level_await/tla3/b.js | 7 + .../run/top_level_await/tla3/timeout_loop.js | 23 + .../run/top_level_await/top_level_await.js | 3 + .../run/top_level_await/top_level_await.out | 3 + .../run/top_level_await/top_level_await.ts | 3 + .../run/top_level_await/top_level_for_await.js | 10 + .../run/top_level_await/top_level_for_await.out | 3 + .../run/top_level_await/top_level_for_await.ts | 10 + .../testdata/run/top_level_await/unresolved.js | 1 + .../testdata/run/top_level_await/unresolved.out | 1 + cli/tests/testdata/run/ts_decorators.ts | 14 + cli/tests/testdata/run/ts_decorators.ts.out | 2 + cli/tests/testdata/run/ts_import_from_js/deps.js | 2 + cli/tests/testdata/run/ts_import_from_js/main.js | 3 + cli/tests/testdata/run/ts_import_from_js/main.out | 3 + cli/tests/testdata/run/ts_type_imports.ts | 5 + cli/tests/testdata/run/ts_type_imports.ts.out | 6 + cli/tests/testdata/run/ts_type_imports_foo.ts | 1 + cli/tests/testdata/run/ts_type_only_import.d.ts | 3 + cli/tests/testdata/run/ts_type_only_import.ts | 1 + cli/tests/testdata/run/ts_type_only_import.ts.out | 1 + cli/tests/testdata/run/tsx_imports/Component.tsx | 1 + cli/tests/testdata/run/tsx_imports/tsx_imports.ts | 1 + .../testdata/run/tsx_imports/tsx_imports.ts.out | 2 + cli/tests/testdata/run/type_definitions.ts | 12 + cli/tests/testdata/run/type_definitions.ts.out | 3 + .../testdata/run/type_definitions_for_export.ts | 7 + .../run/type_definitions_for_export.ts.out | 5 + cli/tests/testdata/run/type_directives_01.ts | 3 + cli/tests/testdata/run/type_directives_01.ts.out | 3 + cli/tests/testdata/run/type_directives_02.ts | 3 + cli/tests/testdata/run/type_directives_02.ts.out | 3 + cli/tests/testdata/run/type_directives_js_main.js | 3 + .../testdata/run/type_directives_js_main.js.out | 3 + cli/tests/testdata/run/type_directives_redirect.ts | 1 + .../testdata/run/type_directives_redirect.ts.out | 5 + cli/tests/testdata/run/type_headers_deno_types.ts | 18 + .../testdata/run/type_headers_deno_types.ts.out | 5 + cli/tests/testdata/run/unbuffered_stderr.ts | 1 + cli/tests/testdata/run/unbuffered_stderr.ts.out | 2 + cli/tests/testdata/run/unbuffered_stdout.ts | 1 + cli/tests/testdata/run/unbuffered_stdout.ts.out | 1 + cli/tests/testdata/run/unhandled_rejection.ts | 13 + cli/tests/testdata/run/unhandled_rejection.ts.out | 9 + .../testdata/run/unhandled_rejection_sync_error.ts | 6 + .../run/unhandled_rejection_sync_error.ts.out | 6 + cli/tests/testdata/run/unstable.js | 1 + cli/tests/testdata/run/unstable.ts | 1 + cli/tests/testdata/run/unstable_disabled.out | 5 + cli/tests/testdata/run/unstable_disabled_js.out | 1 + cli/tests/testdata/run/unstable_enabled.out | 1 + cli/tests/testdata/run/unstable_enabled_js.out | 1 + cli/tests/testdata/run/unstable_worker.ts | 6 + cli/tests/testdata/run/unstable_worker.ts.out | 2 + .../run/unsupported_dynamic_import_scheme.out | 7 + cli/tests/testdata/run/v8_flags.js | 1 + cli/tests/testdata/run/v8_flags.js.out | 1 + cli/tests/testdata/run/v8_flags_unrecognized.out | 5 + cli/tests/testdata/run/v8_help.out | 4 + cli/tests/testdata/run/wasm.ts | 16 + cli/tests/testdata/run/wasm.ts.out | 1 + cli/tests/testdata/run/wasm_async.js | 27 + cli/tests/testdata/run/wasm_async.out | 1 + cli/tests/testdata/run/wasm_shared.out | 0 cli/tests/testdata/run/wasm_shared.ts | 6 + .../testdata/run/wasm_streaming_panic_test.js | 3 + .../testdata/run/wasm_streaming_panic_test.js.out | 2 + cli/tests/testdata/run/wasm_unreachable.js | 9 + cli/tests/testdata/run/wasm_unreachable.out | 3 + cli/tests/testdata/run/wasm_url.js | 8 + cli/tests/testdata/run/wasm_url.out | 3 + cli/tests/testdata/run/weakref.ts | 1 + cli/tests/testdata/run/weakref.ts.out | 1 + .../testdata/run/websocket_server_idletimeout.ts | 26 + ...et_server_multi_field_connection_header_test.ts | 17 + cli/tests/testdata/run/websocket_test.ts | 308 +++ .../testdata/run/websocketstream_ping_test.ts | 5 + cli/tests/testdata/run/websocketstream_test.ts | 335 ++++ cli/tests/testdata/run/webstorage/config_a.jsonc | 3 + cli/tests/testdata/run/webstorage/config_b.jsonc | 3 + cli/tests/testdata/run/webstorage/fixture.ts | 2 + cli/tests/testdata/run/webstorage/logger.ts | 1 + cli/tests/testdata/run/webstorage/serialization.ts | 4 + .../testdata/run/webstorage/serialization.ts.out | 3 + cli/tests/testdata/run/webstorage/setter.ts | 1 + .../testdata/run/worker_close_in_wasm_reactions.js | 10 + .../run/worker_close_in_wasm_reactions.js.out | 1 + cli/tests/testdata/run/worker_close_nested.js | 20 + cli/tests/testdata/run/worker_close_nested.js.out | 5 + cli/tests/testdata/run/worker_close_race.js | 14 + cli/tests/testdata/run/worker_close_race.js.out | 0 cli/tests/testdata/run/worker_drop_handle_race.js | 12 + .../testdata/run/worker_drop_handle_race.js.out | 8 + .../run/worker_drop_handle_race_terminate.js | 37 + .../run/worker_drop_handle_race_terminate.js.out | 4 + .../testdata/run/worker_event_handler_test.js | 5 + .../testdata/run/worker_event_handler_test.js.out | 11 + .../testdata/run/worker_message_before_close.js | 26 + .../run/worker_message_before_close.js.out | 1 + cli/tests/testdata/runtime/esm_imports_a.js | 3 + cli/tests/testdata/runtime/esm_imports_b.js | 4 + cli/tests/testdata/runtime_decorators.ts | 42 - cli/tests/testdata/runtime_decorators.ts.out | 7 - cli/tests/testdata/seed_random.js | 11 - cli/tests/testdata/seed_random.js.out | 22 - cli/tests/testdata/set_exit_code_0.ts | 2 - cli/tests/testdata/set_exit_code_1.ts | 2 - cli/tests/testdata/set_exit_code_2.ts | 2 - cli/tests/testdata/set_timeout_error.ts | 3 - cli/tests/testdata/set_timeout_error.ts.out | 5 - cli/tests/testdata/set_timeout_error_handled.ts | 19 - .../testdata/set_timeout_error_handled.ts.out | 13 - cli/tests/testdata/shebang.ts | 5 - cli/tests/testdata/shebang.ts.out | 1 - cli/tests/testdata/shebang2.ts | 3 - cli/tests/testdata/single_compile_with_reload.ts | 18 - .../testdata/single_compile_with_reload.ts.out | 9 - .../testdata/single_compile_with_reload_dyn.ts | 11 - .../testdata/single_compile_with_reload_worker.ts | 3 - cli/tests/testdata/spawn_stdout_inherit.ts | 8 - cli/tests/testdata/spawn_stdout_inherit.ts.out | 2 - cli/tests/testdata/standalone_dynamic_imports.ts | 15 - cli/tests/testdata/standalone_error.ts | 9 - .../standalone_error_module_with_imports_1.ts | 1 - .../standalone_error_module_with_imports_2.ts | 2 - cli/tests/testdata/standalone_follow_redirects.ts | 2 - .../testdata/standalone_follow_redirects_2.js | 5 - cli/tests/testdata/standalone_import.ts | 2 - cli/tests/testdata/standalone_import_datauri.ts | 4 - cli/tests/testdata/standalone_import_map.json | 5 - cli/tests/testdata/standalone_import_map.ts | 1 - cli/tests/testdata/standalone_runtime_flags.ts | 3 - cli/tests/testdata/std_lint.out | 3 - cli/tests/testdata/subdir/empty.ts | 0 cli/tests/testdata/subdir/types.d.ts | 2 - cli/tests/testdata/swc_syntax_error.ts | 4 - cli/tests/testdata/swc_syntax_error.ts.out | 1 - cli/tests/testdata/test/resource_sanitizer.ts | 2 +- cli/tests/testdata/test_and_bench_in_run.js | 5 - cli/tests/testdata/text_decoder_perf.js | 38 - cli/tests/testdata/text_encoder_into_perf.js | 34 - cli/tests/testdata/text_encoder_perf.js | 33 - cli/tests/testdata/tla/a.js | 3 - cli/tests/testdata/tla/b.js | 7 - cli/tests/testdata/tla/c.js | 3 - cli/tests/testdata/tla/d.js | 8 - cli/tests/testdata/tla/order.js | 1 - cli/tests/testdata/tla/parent.js | 9 - cli/tests/testdata/tla2/a.js | 5 - cli/tests/testdata/tla2/b.js | 5 - cli/tests/testdata/tla3/b.js | 7 - cli/tests/testdata/tla3/timeout_loop.js | 23 - cli/tests/testdata/tls.out | 1 - cli/tests/testdata/tls_connecttls.js | 70 - cli/tests/testdata/tls_starttls.js | 68 - cli/tests/testdata/top_level_await.js | 3 - cli/tests/testdata/top_level_await.out | 3 - cli/tests/testdata/top_level_await.ts | 3 - cli/tests/testdata/top_level_await_circular.js | 8 - cli/tests/testdata/top_level_await_circular.out | 9 - cli/tests/testdata/top_level_await_loop.js | 18 - cli/tests/testdata/top_level_await_loop.out | 5 - cli/tests/testdata/top_level_await_nested.out | 5 - cli/tests/testdata/top_level_await_nested/a.js | 3 - cli/tests/testdata/top_level_await_nested/b.js | 1 - cli/tests/testdata/top_level_await_nested/main.js | 3 - cli/tests/testdata/top_level_await_order.js | 21 - cli/tests/testdata/top_level_await_order.out | 2 - cli/tests/testdata/top_level_await_unresolved.js | 1 - cli/tests/testdata/top_level_await_unresolved.out | 1 - cli/tests/testdata/top_level_for_await.js | 10 - cli/tests/testdata/top_level_for_await.out | 3 - cli/tests/testdata/top_level_for_await.ts | 10 - cli/tests/testdata/ts_decorators.ts | 14 - cli/tests/testdata/ts_decorators.ts.out | 2 - cli/tests/testdata/ts_decorators_bundle.out | 49 - cli/tests/testdata/ts_decorators_bundle.ts | 25 - cli/tests/testdata/ts_import_from_js.deps.js | 2 - cli/tests/testdata/ts_import_from_js.js | 3 - cli/tests/testdata/ts_import_from_js.js.out | 3 - cli/tests/testdata/ts_type_imports.ts | 5 - cli/tests/testdata/ts_type_imports.ts.out | 6 - cli/tests/testdata/ts_type_imports_foo.ts | 1 - cli/tests/testdata/ts_type_only_import.d.ts | 3 - cli/tests/testdata/ts_type_only_import.ts | 1 - cli/tests/testdata/ts_type_only_import.ts.out | 1 - cli/tests/testdata/ts_with_generic.ts | 3 - cli/tests/testdata/tsx_imports.ts | 1 - cli/tests/testdata/tsx_imports.ts.out | 2 - cli/tests/testdata/type_definitions.ts | 12 - cli/tests/testdata/type_definitions.ts.out | 3 - cli/tests/testdata/type_definitions_for_export.ts | 7 - .../testdata/type_definitions_for_export.ts.out | 5 - cli/tests/testdata/type_directives_01.ts | 3 - cli/tests/testdata/type_directives_01.ts.out | 3 - cli/tests/testdata/type_directives_02.ts | 3 - cli/tests/testdata/type_directives_02.ts.out | 3 - cli/tests/testdata/type_directives_js_main.js | 3 - cli/tests/testdata/type_directives_js_main.js.out | 3 - cli/tests/testdata/type_directives_redirect.ts | 1 - cli/tests/testdata/type_directives_redirect.ts.out | 5 - cli/tests/testdata/type_headers_deno_types.ts | 18 - cli/tests/testdata/type_headers_deno_types.ts.out | 5 - cli/tests/testdata/types.out | 3 - cli/tests/testdata/types/types.out | 3 + cli/tests/testdata/unbuffered_stderr.ts | 1 - cli/tests/testdata/unbuffered_stderr.ts.out | 2 - cli/tests/testdata/unbuffered_stdout.ts | 1 - cli/tests/testdata/unbuffered_stdout.ts.out | 1 - cli/tests/testdata/unhandled_rejection.ts | 13 - cli/tests/testdata/unhandled_rejection.ts.out | 9 - .../testdata/unhandled_rejection_sync_error.ts | 6 - .../testdata/unhandled_rejection_sync_error.ts.out | 6 - cli/tests/testdata/unreachable.wasm | Bin 42 -> 0 bytes cli/tests/testdata/unstable.js | 1 - cli/tests/testdata/unstable.ts | 1 - cli/tests/testdata/unstable_disabled.out | 5 - cli/tests/testdata/unstable_disabled_js.out | 1 - cli/tests/testdata/unstable_enabled.out | 1 - cli/tests/testdata/unstable_enabled_js.out | 1 - cli/tests/testdata/unstable_ffi_1.js | 1 - cli/tests/testdata/unstable_ffi_1.js.out | 1 - cli/tests/testdata/unstable_ffi_10.js | 1 - cli/tests/testdata/unstable_ffi_10.js.out | 1 - cli/tests/testdata/unstable_ffi_11.js | 1 - cli/tests/testdata/unstable_ffi_11.js.out | 1 - cli/tests/testdata/unstable_ffi_12.js | 1 - cli/tests/testdata/unstable_ffi_12.js.out | 1 - cli/tests/testdata/unstable_ffi_13.js | 1 - cli/tests/testdata/unstable_ffi_13.js.out | 1 - cli/tests/testdata/unstable_ffi_14.js | 1 - cli/tests/testdata/unstable_ffi_14.js.out | 1 - cli/tests/testdata/unstable_ffi_15.js | 1 - cli/tests/testdata/unstable_ffi_15.js.out | 1 - cli/tests/testdata/unstable_ffi_2.js | 5 - cli/tests/testdata/unstable_ffi_2.js.out | 1 - cli/tests/testdata/unstable_ffi_3.js | 5 - cli/tests/testdata/unstable_ffi_3.js.out | 1 - cli/tests/testdata/unstable_ffi_4.js | 1 - cli/tests/testdata/unstable_ffi_4.js.out | 1 - cli/tests/testdata/unstable_ffi_5.js | 1 - cli/tests/testdata/unstable_ffi_5.js.out | 1 - cli/tests/testdata/unstable_ffi_6.js | 1 - cli/tests/testdata/unstable_ffi_6.js.out | 1 - cli/tests/testdata/unstable_ffi_7.js | 1 - cli/tests/testdata/unstable_ffi_7.js.out | 1 - cli/tests/testdata/unstable_ffi_8.js | 1 - cli/tests/testdata/unstable_ffi_8.js.out | 1 - cli/tests/testdata/unstable_ffi_9.js | 1 - cli/tests/testdata/unstable_ffi_9.js.out | 1 - cli/tests/testdata/unstable_worker.ts | 6 - cli/tests/testdata/unstable_worker.ts.out | 2 - .../testdata/unsupported_dynamic_import_scheme.out | 7 - cli/tests/testdata/v8_flags.js | 1 - cli/tests/testdata/v8_flags.js.out | 1 - cli/tests/testdata/v8_flags_unrecognized.out | 5 - cli/tests/testdata/v8_help.out | 4 - cli/tests/testdata/wasm.ts | 16 - cli/tests/testdata/wasm.ts.out | 1 - cli/tests/testdata/wasm_async.js | 27 - cli/tests/testdata/wasm_async.out | 1 - cli/tests/testdata/wasm_shared.out | 0 cli/tests/testdata/wasm_shared.ts | 6 - cli/tests/testdata/wasm_streaming_panic_test.js | 3 - .../testdata/wasm_streaming_panic_test.js.out | 2 - cli/tests/testdata/wasm_unreachable.js | 9 - cli/tests/testdata/wasm_unreachable.out | 3 - cli/tests/testdata/wasm_url.js | 8 - cli/tests/testdata/wasm_url.out | 3 - cli/tests/testdata/weakref.ts | 1 - cli/tests/testdata/weakref.ts.out | 1 - cli/tests/testdata/webgpu/computepass_shader.wgsl | 38 + cli/tests/testdata/webgpu/hellotriangle.out | Bin 0 -> 204800 bytes .../testdata/webgpu/hellotriangle_shader.wgsl | 11 + cli/tests/testdata/webgpu_computepass_shader.wgsl | 38 - cli/tests/testdata/webgpu_hellotriangle.out | Bin 204800 -> 0 bytes .../testdata/webgpu_hellotriangle_shader.wgsl | 11 - cli/tests/testdata/websocket_server_idletimeout.ts | 26 - ...et_server_multi_field_connection_header_test.ts | 17 - cli/tests/testdata/websocket_test.ts | 308 --- cli/tests/testdata/websocketstream_ping_test.ts | 5 - cli/tests/testdata/websocketstream_test.ts | 335 ---- cli/tests/testdata/webstorage/config_a.jsonc | 3 - cli/tests/testdata/webstorage/config_b.jsonc | 3 - cli/tests/testdata/webstorage/fixture.ts | 2 - cli/tests/testdata/webstorage/logger.ts | 1 - cli/tests/testdata/webstorage/serialization.ts | 4 - cli/tests/testdata/webstorage/serialization.ts.out | 3 - cli/tests/testdata/webstorage/setter.ts | 1 - .../testdata/worker_close_in_wasm_reactions.js | 10 - .../testdata/worker_close_in_wasm_reactions.js.out | 1 - cli/tests/testdata/worker_close_nested.js | 20 - cli/tests/testdata/worker_close_nested.js.out | 5 - cli/tests/testdata/worker_close_race.js | 14 - cli/tests/testdata/worker_close_race.js.out | 0 cli/tests/testdata/worker_drop_handle_race.js | 12 - cli/tests/testdata/worker_drop_handle_race.js.out | 8 - .../testdata/worker_drop_handle_race_terminate.js | 37 - .../worker_drop_handle_race_terminate.js.out | 4 - cli/tests/testdata/worker_event_handler_test.js | 5 - .../testdata/worker_event_handler_test.js.out | 11 - cli/tests/testdata/worker_message_before_close.js | 26 - .../testdata/worker_message_before_close.js.out | 1 - cli/tests/testdata/workers/custom_inspect/main.out | 2 + cli/tests/testdata/workers/custom_inspect/main.ts | 4 + .../testdata/workers/custom_inspect/worker.ts | 2 + .../workers/error_worker_permissions_local.ts | 4 + .../workers/error_worker_permissions_local.ts.out | 3 + .../workers/error_worker_permissions_remote.ts | 4 + .../workers/error_worker_permissions_remote.ts.out | 3 + cli/tests/testdata/x_deno_warning_redirect.js | 1 - cli/tests/unit/fetch_test.ts | 48 +- cli/tests/unit/files_test.ts | 30 +- cli/tests/unit/flock_test.ts | 2 +- cli/tests/unit/net_test.ts | 2 +- cli/tests/unit/read_dir_test.ts | 4 +- cli/tests/unit/read_file_test.ts | 20 +- cli/tests/unit/read_text_file_test.ts | 22 +- cli/tests/unit/real_path_test.ts | 8 +- cli/tests/unit/resources_test.ts | 2 +- cli/tests/unit/stat_test.ts | 2 +- cli/tests/unit/tty_test.ts | 4 +- cli/tests/unit/wasm_test.ts | 4 +- cli/tests/unit/webgpu_test.ts | 6 +- 1453 files changed, 7849 insertions(+), 7858 deletions(-) create mode 100644 cli/tests/integration/cert_tests.rs create mode 100644 cli/tests/integration/flags_tests.rs delete mode 100644 cli/tests/testdata/001_hello.js delete mode 100644 cli/tests/testdata/001_hello.js.out delete mode 100644 cli/tests/testdata/002_hello.ts delete mode 100644 cli/tests/testdata/002_hello.ts.out delete mode 100644 cli/tests/testdata/003_relative_import.ts delete mode 100644 cli/tests/testdata/003_relative_import.ts.out delete mode 100644 cli/tests/testdata/004_set_timeout.ts delete mode 100644 cli/tests/testdata/004_set_timeout.ts.out delete mode 100644 cli/tests/testdata/005_more_imports.ts delete mode 100644 cli/tests/testdata/005_more_imports.ts.out delete mode 100644 cli/tests/testdata/006_url_imports.ts delete mode 100644 cli/tests/testdata/006_url_imports.ts.out delete mode 100644 cli/tests/testdata/012_async.ts delete mode 100644 cli/tests/testdata/012_async.ts.out delete mode 100644 cli/tests/testdata/013_dynamic_import.ts delete mode 100644 cli/tests/testdata/013_dynamic_import.ts.out delete mode 100644 cli/tests/testdata/014_duplicate_import.ts delete mode 100644 cli/tests/testdata/014_duplicate_import.ts.out delete mode 100644 cli/tests/testdata/015_duplicate_parallel_import.js delete mode 100644 cli/tests/testdata/015_duplicate_parallel_import.js.out delete mode 100644 cli/tests/testdata/016_double_await.ts delete mode 100644 cli/tests/testdata/016_double_await.ts.out delete mode 100644 cli/tests/testdata/017_import_redirect.ts delete mode 100644 cli/tests/testdata/017_import_redirect.ts.out delete mode 100644 cli/tests/testdata/017_import_redirect_info.out delete mode 100644 cli/tests/testdata/018_async_catch.ts delete mode 100644 cli/tests/testdata/018_async_catch.ts.out delete mode 100644 cli/tests/testdata/019_media_types.ts delete mode 100644 cli/tests/testdata/019_media_types.ts.out delete mode 100644 cli/tests/testdata/020_json_modules.ts delete mode 100644 cli/tests/testdata/020_json_modules.ts.out delete mode 100644 cli/tests/testdata/021_mjs_modules.ts delete mode 100644 cli/tests/testdata/021_mjs_modules.ts.out delete mode 100644 cli/tests/testdata/022_info_flag_script.out delete mode 100644 cli/tests/testdata/023_no_ext delete mode 100644 cli/tests/testdata/023_no_ext.out delete mode 100644 cli/tests/testdata/024_import_no_ext_with_headers.ts delete mode 100644 cli/tests/testdata/024_import_no_ext_with_headers.ts.out delete mode 100644 cli/tests/testdata/025_hrtime.ts delete mode 100644 cli/tests/testdata/025_hrtime.ts.out delete mode 100644 cli/tests/testdata/025_reload_js_type_error.js delete mode 100644 cli/tests/testdata/025_reload_js_type_error.js.out delete mode 100644 cli/tests/testdata/026_redirect_javascript.js delete mode 100644 cli/tests/testdata/026_redirect_javascript.js.out delete mode 100644 cli/tests/testdata/027_redirect_typescript.ts delete mode 100644 cli/tests/testdata/027_redirect_typescript.ts.out delete mode 100644 cli/tests/testdata/028_args.ts delete mode 100644 cli/tests/testdata/028_args.ts.out delete mode 100644 cli/tests/testdata/029_eval.out delete mode 100644 cli/tests/testdata/030_eval_ts.out delete mode 100644 cli/tests/testdata/031_info_ts_error.out delete mode 100644 cli/tests/testdata/031_info_ts_error.ts delete mode 100644 cli/tests/testdata/033_import_map.out delete mode 100644 cli/tests/testdata/033_import_map_remote.out delete mode 100644 cli/tests/testdata/034_onload.out delete mode 100644 cli/tests/testdata/034_onload/imported.ts delete mode 100644 cli/tests/testdata/034_onload/main.ts delete mode 100644 cli/tests/testdata/034_onload/nest_imported.ts delete mode 100644 cli/tests/testdata/035_cached_only_flag.out delete mode 100644 cli/tests/testdata/036_import_map_fetch.out delete mode 100644 cli/tests/testdata/037_fetch_multiple.out delete mode 100644 cli/tests/testdata/038_checkjs.js delete mode 100644 cli/tests/testdata/038_checkjs.js.out delete mode 100644 cli/tests/testdata/041_dyn_import_eval.out delete mode 100644 cli/tests/testdata/041_info_flag.out delete mode 100644 cli/tests/testdata/041_info_flag_location.out delete mode 100644 cli/tests/testdata/042_dyn_import_evalcontext.ts delete mode 100644 cli/tests/testdata/042_dyn_import_evalcontext.ts.out delete mode 100644 cli/tests/testdata/044_bad_resource.ts delete mode 100644 cli/tests/testdata/044_bad_resource.ts.out delete mode 100644 cli/tests/testdata/045_mod.ts delete mode 100644 cli/tests/testdata/045_output.ts delete mode 100644 cli/tests/testdata/045_programmatic_proxy_client.ts delete mode 100644 cli/tests/testdata/045_proxy_client.ts delete mode 100644 cli/tests/testdata/045_proxy_test.ts delete mode 100644 cli/tests/testdata/045_proxy_test.ts.out delete mode 100644 cli/tests/testdata/046_jsx_test.tsx delete mode 100644 cli/tests/testdata/046_jsx_test.tsx.out delete mode 100644 cli/tests/testdata/047_jsx_test.jsx delete mode 100644 cli/tests/testdata/047_jsx_test.jsx.out delete mode 100644 cli/tests/testdata/048_media_types_jsx.ts delete mode 100644 cli/tests/testdata/048_media_types_jsx.ts.out delete mode 100644 cli/tests/testdata/049_info_flag_script_jsx.out delete mode 100644 cli/tests/testdata/052_no_remote_flag.out delete mode 100644 cli/tests/testdata/053_import_compression.out delete mode 100644 cli/tests/testdata/053_import_compression/brotli delete mode 100644 cli/tests/testdata/053_import_compression/gziped delete mode 100644 cli/tests/testdata/053_import_compression/main.ts delete mode 100644 cli/tests/testdata/054_info_local_imports.out delete mode 100644 cli/tests/testdata/055_info_file_json.out delete mode 100644 cli/tests/testdata/056_make_temp_file_write_perm.out delete mode 100644 cli/tests/testdata/056_make_temp_file_write_perm.ts delete mode 100644 cli/tests/testdata/058_tasks_microtasks_close.ts delete mode 100644 cli/tests/testdata/058_tasks_microtasks_close.ts.out delete mode 100644 cli/tests/testdata/059_fs_relative_path_perm.ts delete mode 100644 cli/tests/testdata/059_fs_relative_path_perm.ts.out delete mode 100644 cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts delete mode 100644 cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts.out delete mode 100644 cli/tests/testdata/061_permissions_request.ts delete mode 100644 cli/tests/testdata/062_permissions_request_global.ts delete mode 100644 cli/tests/testdata/063_permissions_revoke.ts delete mode 100644 cli/tests/testdata/063_permissions_revoke.ts.out delete mode 100644 cli/tests/testdata/064_permissions_revoke_global.ts delete mode 100644 cli/tests/testdata/064_permissions_revoke_global.ts.out delete mode 100644 cli/tests/testdata/065_import_map_info.out delete mode 100644 cli/tests/testdata/066_prompt.ts delete mode 100644 cli/tests/testdata/070_location.ts delete mode 100644 cli/tests/testdata/070_location.ts.out delete mode 100644 cli/tests/testdata/071_location_unset.ts delete mode 100644 cli/tests/testdata/071_location_unset.ts.out delete mode 100644 cli/tests/testdata/072_location_relative_fetch.ts delete mode 100644 cli/tests/testdata/072_location_relative_fetch.ts.out delete mode 100644 cli/tests/testdata/075_import_local_query_hash.ts delete mode 100644 cli/tests/testdata/075_import_local_query_hash.ts.out delete mode 100644 cli/tests/testdata/076_info_json_deps_order.out delete mode 100644 cli/tests/testdata/076_info_json_deps_order.ts delete mode 100644 cli/tests/testdata/077_fetch_empty.ts delete mode 100644 cli/tests/testdata/077_fetch_empty.ts.out delete mode 100644 cli/tests/testdata/078_unload_on_exit.ts delete mode 100644 cli/tests/testdata/078_unload_on_exit.ts.out delete mode 100644 cli/tests/testdata/079_location_authentication.ts delete mode 100644 cli/tests/testdata/079_location_authentication.ts.out delete mode 100644 cli/tests/testdata/081_location_relative_fetch_redirect.ts delete mode 100644 cli/tests/testdata/081_location_relative_fetch_redirect.ts.out delete mode 100644 cli/tests/testdata/082_prepare_stack_trace_throw.js delete mode 100644 cli/tests/testdata/082_prepare_stack_trace_throw.js.out delete mode 100644 cli/tests/testdata/083_legacy_external_source_map.ts delete mode 100644 cli/tests/testdata/084_worker_custom_inspect.ts delete mode 100644 cli/tests/testdata/084_worker_custom_inspect.ts.out delete mode 100644 cli/tests/testdata/084_worker_custom_inspect_worker.ts delete mode 100644 cli/tests/testdata/085_dynamic_import_async_error.ts delete mode 100644 cli/tests/testdata/085_dynamic_import_async_error.ts.out delete mode 100644 cli/tests/testdata/086_dynamic_import_already_rejected.ts delete mode 100644 cli/tests/testdata/086_dynamic_import_already_rejected.ts.out delete mode 100644 cli/tests/testdata/087_hello.ts delete mode 100644 cli/tests/testdata/087_no_check_imports_not_used_as_values.ts delete mode 100644 cli/tests/testdata/087_no_check_imports_not_used_as_values.ts.out delete mode 100644 cli/tests/testdata/088_dynamic_import_already_evaluating.ts delete mode 100644 cli/tests/testdata/088_dynamic_import_already_evaluating.ts.out delete mode 100644 cli/tests/testdata/088_dynamic_import_target.ts delete mode 100644 cli/tests/testdata/089_run_allow_list.ts delete mode 100644 cli/tests/testdata/089_run_allow_list.ts.out delete mode 100644 cli/tests/testdata/090_run_permissions_request.ts delete mode 100644 cli/tests/testdata/091_use_define_for_class_fields.ts delete mode 100644 cli/tests/testdata/091_use_define_for_class_fields.ts.out delete mode 100644 cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts delete mode 100644 cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts.out delete mode 100644 cli/tests/testdata/095_cache_with_bare_import.ts delete mode 100644 cli/tests/testdata/095_cache_with_bare_import.ts.out delete mode 100644 cli/tests/testdata/Component.tsx delete mode 100644 cli/tests/testdata/DenoWinRunner.cs delete mode 100644 cli/tests/testdata/DenoWinRunner.ps1 delete mode 100644 cli/tests/testdata/aggregate_error.out delete mode 100644 cli/tests/testdata/aggregate_error.ts create mode 100644 cli/tests/testdata/assets/DenoWinRunner.cs create mode 100644 cli/tests/testdata/assets/DenoWinRunner.ps1 create mode 100644 cli/tests/testdata/assets/deno_dom_0.1.3-alpha2.wasm create mode 100644 cli/tests/testdata/assets/fixture.json create mode 100644 cli/tests/testdata/assets/hello.txt create mode 100644 cli/tests/testdata/assets/unreachable.wasm delete mode 100644 cli/tests/testdata/async_error.ts delete mode 100644 cli/tests/testdata/async_error.ts.out delete mode 100644 cli/tests/testdata/badly_formatted.json delete mode 100644 cli/tests/testdata/badly_formatted.md delete mode 100644 cli/tests/testdata/badly_formatted.mjs delete mode 100644 cli/tests/testdata/badly_formatted_fixed.js delete mode 100644 cli/tests/testdata/badly_formatted_fixed.json delete mode 100644 cli/tests/testdata/badly_formatted_fixed.md delete mode 100644 cli/tests/testdata/before_unload.js delete mode 100644 cli/tests/testdata/before_unload.js.out create mode 100644 cli/tests/testdata/benches/response_string_perf.js create mode 100644 cli/tests/testdata/benches/text_decoder_perf.js create mode 100644 cli/tests/testdata/benches/text_encoder_into_perf.js create mode 100644 cli/tests/testdata/benches/text_encoder_perf.js delete mode 100644 cli/tests/testdata/blob_gc_finalization.js delete mode 100644 cli/tests/testdata/blob_gc_finalization.js.out delete mode 100644 cli/tests/testdata/bundle.test.out create mode 100644 cli/tests/testdata/bundle/bare_imports/error_with_bare_import.ts create mode 100644 cli/tests/testdata/bundle/bare_imports/error_with_bare_import.ts.out create mode 100644 cli/tests/testdata/bundle/bundle.test.out delete mode 100644 cli/tests/testdata/bundle/check_local_by_default.out delete mode 100644 cli/tests/testdata/bundle/check_local_by_default.ts create mode 100644 cli/tests/testdata/bundle/check_local_by_default/no_errors.out create mode 100644 cli/tests/testdata/bundle/check_local_by_default/no_errors.ts create mode 100644 cli/tests/testdata/bundle/check_local_by_default/type_error.out create mode 100644 cli/tests/testdata/bundle/check_local_by_default/type_error.ts delete mode 100644 cli/tests/testdata/bundle/check_local_by_default2.out delete mode 100644 cli/tests/testdata/bundle/check_local_by_default2.ts create mode 100644 cli/tests/testdata/bundle/decorators/ts_decorators.out create mode 100644 cli/tests/testdata/bundle/decorators/ts_decorators.ts create mode 100644 cli/tests/testdata/bundle/dynamic_import.ts create mode 100644 cli/tests/testdata/bundle/ignore_directives.test.out create mode 100644 cli/tests/testdata/bundle/import_map/import_map.json create mode 100644 cli/tests/testdata/bundle/import_map/main.ts create mode 100644 cli/tests/testdata/bundle/jsx.out create mode 100644 cli/tests/testdata/bundle/lockfile/check_error.json create mode 100644 cli/tests/testdata/bundle/lockfile/check_error.out delete mode 100644 cli/tests/testdata/bundle_dynamic_import.ts delete mode 100644 cli/tests/testdata/bundle_ignore_directives.test.out delete mode 100644 cli/tests/testdata/bundle_im.json delete mode 100644 cli/tests/testdata/bundle_im.ts delete mode 100644 cli/tests/testdata/bundle_jsx.out delete mode 100644 cli/tests/testdata/byte_order_mark.out delete mode 100644 cli/tests/testdata/byte_order_mark.ts create mode 100644 cli/tests/testdata/cache/036_import_map_fetch.out create mode 100644 cli/tests/testdata/cache/037_fetch_multiple.out create mode 100644 cli/tests/testdata/cache/095_cache_with_bare_import.ts create mode 100644 cli/tests/testdata/cache/095_cache_with_bare_import.ts.out create mode 100644 cli/tests/testdata/cache/cache_extensionless.out create mode 100644 cli/tests/testdata/cache/cache_random_extension.out create mode 100644 cli/tests/testdata/cache/ignore_require.js create mode 100644 cli/tests/testdata/cache/performance_stats.out create mode 100644 cli/tests/testdata/cache/redirect_cache.out delete mode 100644 cli/tests/testdata/cache_extensionless.out delete mode 100644 cli/tests/testdata/cache_random_extension.out delete mode 100644 cli/tests/testdata/cafile_info.ts delete mode 100644 cli/tests/testdata/cafile_info.ts.out delete mode 100644 cli/tests/testdata/cafile_ts_fetch.ts delete mode 100644 cli/tests/testdata/cafile_ts_fetch.ts.out delete mode 100644 cli/tests/testdata/cafile_ts_fetch_unsafe_ssl.ts.out delete mode 100644 cli/tests/testdata/cafile_url_imports.ts delete mode 100644 cli/tests/testdata/cafile_url_imports.ts.out delete mode 100644 cli/tests/testdata/cafile_url_imports_unsafe_ssl.ts.out create mode 100644 cli/tests/testdata/cert/cafile_info.ts create mode 100644 cli/tests/testdata/cert/cafile_info.ts.out create mode 100644 cli/tests/testdata/cert/cafile_ts_fetch.ts create mode 100644 cli/tests/testdata/cert/cafile_ts_fetch.ts.out create mode 100644 cli/tests/testdata/cert/cafile_ts_fetch_unsafe_ssl.ts.out create mode 100644 cli/tests/testdata/cert/cafile_url_imports.ts create mode 100644 cli/tests/testdata/cert/cafile_url_imports.ts.out create mode 100644 cli/tests/testdata/cert/cafile_url_imports_unsafe_ssl.ts.out create mode 100644 cli/tests/testdata/cert/deno_land_unsafe_ssl.ts create mode 100644 cli/tests/testdata/cert/deno_land_unsafe_ssl.ts.out create mode 100644 cli/tests/testdata/cert/ip_address_unsafe_ssl.ts create mode 100644 cli/tests/testdata/cert/ip_address_unsafe_ssl.ts.out create mode 100644 cli/tests/testdata/cert/listen_tls_alpn.ts create mode 100644 cli/tests/testdata/cert/listen_tls_alpn_fail.ts create mode 100644 cli/tests/testdata/cert/localhost_unsafe_ssl.ts.out create mode 100644 cli/tests/testdata/check/check_all.out create mode 100644 cli/tests/testdata/check/check_all.ts create mode 100644 cli/tests/testdata/check/declaration_header_file_with_no_exports.ts create mode 100644 cli/tests/testdata/check/declaration_header_file_with_no_exports_js.d.ts create mode 100644 cli/tests/testdata/check/declaration_header_file_with_no_exports_js.js create mode 100644 cli/tests/testdata/check/module_detection_force.ts create mode 100644 cli/tests/testdata/check/module_detection_force/import.ts create mode 100644 cli/tests/testdata/check/module_detection_force/main.ts delete mode 100644 cli/tests/testdata/check_all.out delete mode 100644 cli/tests/testdata/check_all.ts delete mode 100644 cli/tests/testdata/checkjs.tsconfig.json delete mode 100644 cli/tests/testdata/circular1.js delete mode 100644 cli/tests/testdata/circular1.js.out delete mode 100644 cli/tests/testdata/circular2.js delete mode 100644 cli/tests/testdata/cjs_imports.ts delete mode 100644 cli/tests/testdata/cjs_imports.ts.out delete mode 100644 cli/tests/testdata/classic_workers_event_loop.js delete mode 100644 cli/tests/testdata/classic_workers_event_loop.js.out delete mode 100644 cli/tests/testdata/colors_without_globalThis.js delete mode 100644 cli/tests/testdata/commonjs.cjs create mode 100644 cli/tests/testdata/compile/args.ts create mode 100644 cli/tests/testdata/compile/standalone_error.ts create mode 100644 cli/tests/testdata/compile/standalone_error_module_with_imports_1.ts create mode 100644 cli/tests/testdata/compile/standalone_error_module_with_imports_2.ts create mode 100644 cli/tests/testdata/compile/standalone_follow_redirects.ts create mode 100644 cli/tests/testdata/compile/standalone_follow_redirects_2.js create mode 100644 cli/tests/testdata/compile/standalone_import_datauri.ts create mode 100644 cli/tests/testdata/compile/standalone_import_map.json create mode 100644 cli/tests/testdata/compile/standalone_import_map.ts create mode 100644 cli/tests/testdata/compile/standalone_runtime_flags.ts delete mode 100644 cli/tests/testdata/complex_error.ts delete mode 100644 cli/tests/testdata/complex_error.ts.out delete mode 100644 cli/tests/testdata/complex_permissions_test.ts delete mode 100644 cli/tests/testdata/config.ts delete mode 100644 cli/tests/testdata/config.ts.out delete mode 100644 cli/tests/testdata/config.tsconfig.json delete mode 100644 cli/tests/testdata/config_json_import.ts delete mode 100644 cli/tests/testdata/config_json_import.ts.out delete mode 100644 cli/tests/testdata/config_types.ts delete mode 100644 cli/tests/testdata/config_types.ts.out delete mode 100644 cli/tests/testdata/config_types.tsconfig.json delete mode 100644 cli/tests/testdata/config_types_remote.tsconfig.json delete mode 100644 cli/tests/testdata/custom_inspect_url.js delete mode 100644 cli/tests/testdata/custom_inspect_url.js.out delete mode 100644 cli/tests/testdata/declaration_header_file_with_no_exports.ts delete mode 100644 cli/tests/testdata/declaration_header_file_with_no_exports_js.d.ts delete mode 100644 cli/tests/testdata/declaration_header_file_with_no_exports_js.js delete mode 100644 cli/tests/testdata/delayed_error.ts delete mode 100644 cli/tests/testdata/delete_window.js delete mode 100644 cli/tests/testdata/deno_doc.ts delete mode 100644 cli/tests/testdata/deno_doc_builtin.out delete mode 100644 cli/tests/testdata/deno_dom_0.1.3-alpha2.wasm delete mode 100644 cli/tests/testdata/deno_exit_tampering.ts delete mode 100644 cli/tests/testdata/deno_land_unsafe_ssl.ts delete mode 100644 cli/tests/testdata/deno_land_unsafe_ssl.ts.out delete mode 100644 cli/tests/testdata/disallow_http_from_https.js delete mode 100644 cli/tests/testdata/disallow_http_from_https.ts delete mode 100644 cli/tests/testdata/disallow_http_from_https_js.out delete mode 100644 cli/tests/testdata/disallow_http_from_https_ts.out create mode 100644 cli/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts create mode 100644 cli/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts.out create mode 100644 cli/tests/testdata/doc/deno_doc.ts create mode 100644 cli/tests/testdata/doc/deno_doc_builtin.out delete mode 100644 cli/tests/testdata/dom_exception_formatting.ts delete mode 100644 cli/tests/testdata/dom_exception_formatting.ts.out delete mode 100644 cli/tests/testdata/dynamic_import_conditional.js delete mode 100644 cli/tests/testdata/dynamic_import_conditional.js.out delete mode 100644 cli/tests/testdata/empty.out delete mode 100644 cli/tests/testdata/error_001.ts delete mode 100644 cli/tests/testdata/error_001.ts.out delete mode 100644 cli/tests/testdata/error_002.ts delete mode 100644 cli/tests/testdata/error_002.ts.out delete mode 100644 cli/tests/testdata/error_003_typescript.ts delete mode 100644 cli/tests/testdata/error_003_typescript.ts.out delete mode 100644 cli/tests/testdata/error_004_missing_module.ts delete mode 100644 cli/tests/testdata/error_004_missing_module.ts.out delete mode 100644 cli/tests/testdata/error_005_missing_dynamic_import.ts delete mode 100644 cli/tests/testdata/error_005_missing_dynamic_import.ts.out delete mode 100644 cli/tests/testdata/error_006_import_ext_failure.ts delete mode 100644 cli/tests/testdata/error_006_import_ext_failure.ts.out delete mode 100644 cli/tests/testdata/error_007_any.ts delete mode 100644 cli/tests/testdata/error_007_any.ts.out delete mode 100644 cli/tests/testdata/error_008_checkjs.js delete mode 100644 cli/tests/testdata/error_008_checkjs.js.out delete mode 100644 cli/tests/testdata/error_009_extensions_error.js delete mode 100644 cli/tests/testdata/error_009_extensions_error.js.out delete mode 100644 cli/tests/testdata/error_009_missing_js_module.disabled delete mode 100644 cli/tests/testdata/error_009_missing_js_module.js delete mode 100644 cli/tests/testdata/error_009_missing_js_module.js.out delete mode 100644 cli/tests/testdata/error_010_nonexistent_arg.disabled delete mode 100644 cli/tests/testdata/error_010_nonexistent_arg.out delete mode 100644 cli/tests/testdata/error_011_bad_module_specifier.ts delete mode 100644 cli/tests/testdata/error_011_bad_module_specifier.ts.out delete mode 100644 cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts delete mode 100644 cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts.out delete mode 100644 cli/tests/testdata/error_013_missing_script.out delete mode 100644 cli/tests/testdata/error_014_catch_dynamic_import_error.js delete mode 100644 cli/tests/testdata/error_014_catch_dynamic_import_error.js.out delete mode 100644 cli/tests/testdata/error_015_dynamic_import_permissions.js delete mode 100644 cli/tests/testdata/error_015_dynamic_import_permissions.out delete mode 100644 cli/tests/testdata/error_016_dynamic_import_permissions2.js delete mode 100644 cli/tests/testdata/error_016_dynamic_import_permissions2.out delete mode 100644 cli/tests/testdata/error_017_hide_long_source_ts.ts delete mode 100644 cli/tests/testdata/error_017_hide_long_source_ts.ts.out delete mode 100644 cli/tests/testdata/error_018_hide_long_source_js.js delete mode 100644 cli/tests/testdata/error_018_hide_long_source_js.js.out delete mode 100644 cli/tests/testdata/error_019_stack_function.ts delete mode 100644 cli/tests/testdata/error_019_stack_function.ts.out delete mode 100644 cli/tests/testdata/error_020_stack_constructor.ts delete mode 100644 cli/tests/testdata/error_020_stack_constructor.ts.out delete mode 100644 cli/tests/testdata/error_021_stack_method.ts delete mode 100644 cli/tests/testdata/error_021_stack_method.ts.out delete mode 100644 cli/tests/testdata/error_022_stack_custom_error.ts delete mode 100644 cli/tests/testdata/error_022_stack_custom_error.ts.out delete mode 100644 cli/tests/testdata/error_023_stack_async.ts delete mode 100644 cli/tests/testdata/error_023_stack_async.ts.out delete mode 100644 cli/tests/testdata/error_024_stack_promise_all.ts delete mode 100644 cli/tests/testdata/error_024_stack_promise_all.ts.out delete mode 100644 cli/tests/testdata/error_025_tab_indent delete mode 100644 cli/tests/testdata/error_025_tab_indent.out delete mode 100644 cli/tests/testdata/error_026_remote_import_error.ts delete mode 100644 cli/tests/testdata/error_026_remote_import_error.ts.out delete mode 100644 cli/tests/testdata/error_027_bundle_with_bare_import.ts delete mode 100644 cli/tests/testdata/error_027_bundle_with_bare_import.ts.out delete mode 100644 cli/tests/testdata/error_cause.ts delete mode 100644 cli/tests/testdata/error_cause.ts.out delete mode 100644 cli/tests/testdata/error_cause_recursive.ts delete mode 100644 cli/tests/testdata/error_cause_recursive.ts.out delete mode 100644 cli/tests/testdata/error_for_await.ts delete mode 100644 cli/tests/testdata/error_for_await.ts.out delete mode 100644 cli/tests/testdata/error_import_map_unable_to_load.out delete mode 100644 cli/tests/testdata/error_local_static_import_from_remote.js delete mode 100644 cli/tests/testdata/error_local_static_import_from_remote.js.out delete mode 100644 cli/tests/testdata/error_local_static_import_from_remote.ts delete mode 100644 cli/tests/testdata/error_local_static_import_from_remote.ts.out delete mode 100644 cli/tests/testdata/error_missing_module_named_import.ts delete mode 100644 cli/tests/testdata/error_missing_module_named_import.ts.out delete mode 100644 cli/tests/testdata/error_name_non_string.js delete mode 100644 cli/tests/testdata/error_name_non_string.js.out delete mode 100644 cli/tests/testdata/error_no_check.ts delete mode 100644 cli/tests/testdata/error_no_check.ts.out delete mode 100644 cli/tests/testdata/error_syntax.js delete mode 100644 cli/tests/testdata/error_syntax.js.out delete mode 100644 cli/tests/testdata/error_syntax_empty_trailing_line.mjs delete mode 100644 cli/tests/testdata/error_syntax_empty_trailing_line.mjs.out delete mode 100644 cli/tests/testdata/error_type_definitions.ts delete mode 100644 cli/tests/testdata/error_type_definitions.ts.out delete mode 100644 cli/tests/testdata/error_worker_permissions_local.ts delete mode 100644 cli/tests/testdata/error_worker_permissions_local.ts.out delete mode 100644 cli/tests/testdata/error_worker_permissions_remote.ts delete mode 100644 cli/tests/testdata/error_worker_permissions_remote.ts.out delete mode 100644 cli/tests/testdata/es_private_fields.js delete mode 100644 cli/tests/testdata/es_private_fields.js.out delete mode 100644 cli/tests/testdata/esm_imports_a.js delete mode 100644 cli/tests/testdata/esm_imports_b.js create mode 100644 cli/tests/testdata/eval/dyn_import_eval.out delete mode 100644 cli/tests/testdata/eval_context_throw_dom_exception.js delete mode 100644 cli/tests/testdata/eval_context_throw_dom_exception.js.out delete mode 100644 cli/tests/testdata/event_listener_error.ts delete mode 100644 cli/tests/testdata/event_listener_error.ts.out delete mode 100644 cli/tests/testdata/event_listener_error_handled.ts delete mode 100644 cli/tests/testdata/event_listener_error_handled.ts.out delete mode 100644 cli/tests/testdata/event_listener_error_immediate_exit.ts delete mode 100644 cli/tests/testdata/event_listener_error_immediate_exit.ts.out delete mode 100644 cli/tests/testdata/event_listener_error_immediate_exit_worker.ts delete mode 100644 cli/tests/testdata/event_listener_error_immediate_exit_worker.ts.out delete mode 100644 cli/tests/testdata/exec_path.ts delete mode 100644 cli/tests/testdata/exit_error42.ts delete mode 100644 cli/tests/testdata/exit_error42.ts.out delete mode 100644 cli/tests/testdata/export_type_def.ts delete mode 100644 cli/tests/testdata/fetch/hello.txt delete mode 100644 cli/tests/testdata/fetch/other.ts delete mode 100644 cli/tests/testdata/fetch/test.ts delete mode 100644 cli/tests/testdata/fetch_async_error_stack.ts delete mode 100644 cli/tests/testdata/fetch_async_error_stack.ts.out delete mode 100644 cli/tests/testdata/fetch_response_finalization.js delete mode 100644 cli/tests/testdata/fetch_response_finalization.js.out delete mode 100644 cli/tests/testdata/file_exists.ts delete mode 100644 cli/tests/testdata/finalization_registry.js delete mode 100644 cli/tests/testdata/finalization_registry.js.out delete mode 100644 cli/tests/testdata/fix_dynamic_import_errors.js delete mode 100644 cli/tests/testdata/fix_dynamic_import_errors.js.out delete mode 100644 cli/tests/testdata/fix_emittable_skipped.js delete mode 100644 cli/tests/testdata/fix_emittable_skipped.ts.out delete mode 100644 cli/tests/testdata/fix_exotic_specifiers.ts delete mode 100644 cli/tests/testdata/fix_exotic_specifiers.ts.out delete mode 100644 cli/tests/testdata/fix_js_import_js.ts delete mode 100644 cli/tests/testdata/fix_js_import_js.ts.out delete mode 100644 cli/tests/testdata/fix_js_imports.ts delete mode 100644 cli/tests/testdata/fix_js_imports.ts.out delete mode 100644 cli/tests/testdata/fix_tsc_file_exists.out delete mode 100644 cli/tests/testdata/fix_worker_dispatchevent.ts delete mode 100644 cli/tests/testdata/fix_worker_dispatchevent.ts.out delete mode 100644 cli/tests/testdata/fixture.json create mode 100644 cli/tests/testdata/fmt/badly_formatted.json create mode 100644 cli/tests/testdata/fmt/badly_formatted.md create mode 100644 cli/tests/testdata/fmt/badly_formatted.mjs create mode 100644 cli/tests/testdata/fmt/badly_formatted_fixed.js create mode 100644 cli/tests/testdata/fmt/badly_formatted_fixed.json create mode 100644 cli/tests/testdata/fmt/badly_formatted_fixed.md delete mode 100644 cli/tests/testdata/followup_dyn_import_resolves/main.ts delete mode 100644 cli/tests/testdata/followup_dyn_import_resolves/main.ts.out delete mode 100644 cli/tests/testdata/followup_dyn_import_resolves/sub1.ts delete mode 100644 cli/tests/testdata/followup_dyn_import_resolves/sub2.ts delete mode 100644 cli/tests/testdata/future_check.ts delete mode 100644 cli/tests/testdata/future_check2.out delete mode 100644 cli/tests/testdata/heapstats.js delete mode 100644 cli/tests/testdata/heapstats.js.out delete mode 100644 cli/tests/testdata/hello.txt delete mode 100644 cli/tests/testdata/http2_request_url.ts delete mode 100644 cli/tests/testdata/https_import.ts delete mode 100644 cli/tests/testdata/https_import.ts.out delete mode 100644 cli/tests/testdata/if_main.ts delete mode 100644 cli/tests/testdata/if_main.ts.out delete mode 100644 cli/tests/testdata/ignore_require.js delete mode 100644 cli/tests/testdata/import_blob_url.ts delete mode 100644 cli/tests/testdata/import_blob_url.ts.out delete mode 100644 cli/tests/testdata/import_blob_url_error_stack.ts delete mode 100644 cli/tests/testdata/import_blob_url_error_stack.ts.out delete mode 100644 cli/tests/testdata/import_blob_url_import_relative.ts delete mode 100644 cli/tests/testdata/import_blob_url_import_relative.ts.out delete mode 100644 cli/tests/testdata/import_blob_url_imports.ts delete mode 100644 cli/tests/testdata/import_blob_url_imports.ts.out delete mode 100644 cli/tests/testdata/import_blob_url_jsx.ts delete mode 100644 cli/tests/testdata/import_blob_url_jsx.ts.out delete mode 100644 cli/tests/testdata/import_data_url.ts delete mode 100644 cli/tests/testdata/import_data_url.ts.out delete mode 100644 cli/tests/testdata/import_data_url_error_stack.ts delete mode 100644 cli/tests/testdata/import_data_url_error_stack.ts.out delete mode 100644 cli/tests/testdata/import_data_url_import_relative.ts delete mode 100644 cli/tests/testdata/import_data_url_import_relative.ts.out delete mode 100644 cli/tests/testdata/import_data_url_imports.ts delete mode 100644 cli/tests/testdata/import_data_url_imports.ts.out delete mode 100644 cli/tests/testdata/import_data_url_jsx.ts delete mode 100644 cli/tests/testdata/import_data_url_jsx.ts.out delete mode 100644 cli/tests/testdata/import_dynamic_data_url.ts delete mode 100644 cli/tests/testdata/import_dynamic_data_url.ts.out delete mode 100644 cli/tests/testdata/import_extensionless.ts delete mode 100644 cli/tests/testdata/import_extensionless.ts.out delete mode 100644 cli/tests/testdata/import_file_with_colon.ts delete mode 100644 cli/tests/testdata/import_file_with_colon.ts.out delete mode 100644 cli/tests/testdata/import_meta.importmap.json delete mode 100644 cli/tests/testdata/import_meta.ts delete mode 100644 cli/tests/testdata/import_meta.ts.out delete mode 100644 cli/tests/testdata/import_meta2.ts delete mode 100644 cli/tests/testdata/import_type.ts delete mode 100644 cli/tests/testdata/import_type.ts.out create mode 100644 cli/tests/testdata/info/031_info_ts_error.out create mode 100644 cli/tests/testdata/info/031_info_ts_error.ts create mode 100644 cli/tests/testdata/info/041_info_flag.out create mode 100644 cli/tests/testdata/info/041_info_flag_location.out create mode 100644 cli/tests/testdata/info/049_info_flag_script_jsx.out create mode 100644 cli/tests/testdata/info/054_info_local_imports.out create mode 100644 cli/tests/testdata/info/065_import_map_info.out create mode 100644 cli/tests/testdata/info/076_info_json_deps_order.out create mode 100644 cli/tests/testdata/info/076_info_json_deps_order.ts create mode 100644 cli/tests/testdata/info/error_009_missing_js_module.js create mode 100644 cli/tests/testdata/info/error_009_missing_js_module.js.out create mode 100644 cli/tests/testdata/info/info_json.out create mode 100644 cli/tests/testdata/info/info_json_location.out create mode 100644 cli/tests/testdata/info/info_missing_module.out create mode 100644 cli/tests/testdata/info/info_recursive_imports_test.out create mode 100644 cli/tests/testdata/info/info_recursive_imports_test.ts create mode 100644 cli/tests/testdata/info/info_type_import.out create mode 100644 cli/tests/testdata/info/info_type_import.ts create mode 100644 cli/tests/testdata/info/json_output/main.out create mode 100644 cli/tests/testdata/info/json_output/main.ts create mode 100644 cli/tests/testdata/info/multiple_imports.out create mode 100644 cli/tests/testdata/info/recursive_imports/A.ts create mode 100644 cli/tests/testdata/info/recursive_imports/B.ts create mode 100644 cli/tests/testdata/info/recursive_imports/C.ts create mode 100644 cli/tests/testdata/info/recursive_imports/common.ts delete mode 100644 cli/tests/testdata/info_json.out delete mode 100644 cli/tests/testdata/info_json_location.out delete mode 100644 cli/tests/testdata/info_missing_module.out delete mode 100644 cli/tests/testdata/info_recursive_imports_test.out delete mode 100644 cli/tests/testdata/info_recursive_imports_test.ts delete mode 100644 cli/tests/testdata/info_type_import.out delete mode 100644 cli/tests/testdata/info_type_import.ts delete mode 100644 cli/tests/testdata/inline_js_source_map.ts delete mode 100644 cli/tests/testdata/inline_js_source_map_2.js delete mode 100644 cli/tests/testdata/inline_js_source_map_2.js.out delete mode 100644 cli/tests/testdata/inline_js_source_map_2.ts delete mode 100644 cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js delete mode 100644 cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out delete mode 100644 cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js delete mode 100644 cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js.out delete mode 100644 cli/tests/testdata/ip_address_unsafe_ssl.ts delete mode 100644 cli/tests/testdata/ip_address_unsafe_ssl.ts.out delete mode 100644 cli/tests/testdata/issue13562.ts delete mode 100644 cli/tests/testdata/issue13562.ts.out delete mode 100644 cli/tests/testdata/issue9750.js delete mode 100644 cli/tests/testdata/js_import_detect.ts delete mode 100644 cli/tests/testdata/js_import_detect.ts.out delete mode 100644 cli/tests/testdata/js_root_with_ts_check.js delete mode 100644 cli/tests/testdata/js_root_with_ts_check.js.out delete mode 100644 cli/tests/testdata/jsx_import_from_ts.App.jsx delete mode 100644 cli/tests/testdata/jsx_import_from_ts.ts delete mode 100644 cli/tests/testdata/jsx_import_from_ts.ts.out delete mode 100644 cli/tests/testdata/jsx_import_source.out delete mode 100644 cli/tests/testdata/jsx_import_source_dev.out delete mode 100644 cli/tests/testdata/jsx_import_source_error.out delete mode 100644 cli/tests/testdata/jsx_import_source_import_map.out delete mode 100644 cli/tests/testdata/jsx_import_source_import_map_dev.out delete mode 100644 cli/tests/testdata/jsx_import_source_no_pragma.tsx delete mode 100644 cli/tests/testdata/jsx_import_source_pragma.tsx delete mode 100644 cli/tests/testdata/jsx_import_source_pragma_import_map.tsx delete mode 100644 cli/tests/testdata/listen_tls_alpn.ts delete mode 100644 cli/tests/testdata/listen_tls_alpn_fail.ts delete mode 100644 cli/tests/testdata/localhost_unsafe_ssl.ts.out delete mode 100644 cli/tests/testdata/lock_check_err.json delete mode 100644 cli/tests/testdata/lock_check_err.out delete mode 100644 cli/tests/testdata/lock_check_err2.json delete mode 100644 cli/tests/testdata/lock_check_err2.out delete mode 100644 cli/tests/testdata/lock_check_err_with_bundle.json delete mode 100644 cli/tests/testdata/lock_check_err_with_bundle.out delete mode 100644 cli/tests/testdata/lock_check_ok.json delete mode 100644 cli/tests/testdata/lock_check_ok2.json delete mode 100644 cli/tests/testdata/lock_dynamic_imports.json delete mode 100644 cli/tests/testdata/lock_dynamic_imports.out delete mode 100644 cli/tests/testdata/lock_write_fetch.ts delete mode 100644 cli/tests/testdata/lock_write_fetch.ts.out delete mode 100644 cli/tests/testdata/lock_write_requires_lock.out delete mode 100644 cli/tests/testdata/long_data_url_formatting.ts delete mode 100644 cli/tests/testdata/long_data_url_formatting.ts.out create mode 100644 cli/tests/testdata/lsp/x_deno_warning_redirect.js delete mode 100644 cli/tests/testdata/main_module.ts delete mode 100644 cli/tests/testdata/main_module.ts.out delete mode 100644 cli/tests/testdata/main_module2.ts delete mode 100644 cli/tests/testdata/module_detection_force.ts delete mode 100644 cli/tests/testdata/module_detection_force_import.ts delete mode 100644 cli/tests/testdata/mts_dmts_mjs.out delete mode 100644 cli/tests/testdata/nested_error.ts delete mode 100644 cli/tests/testdata/nested_error.ts.out delete mode 100644 cli/tests/testdata/no_check_decorators.ts delete mode 100644 cli/tests/testdata/no_check_decorators.ts.out delete mode 100644 cli/tests/testdata/no_check_remote.ts delete mode 100644 cli/tests/testdata/no_check_remote.ts.disabled.out delete mode 100644 cli/tests/testdata/no_check_remote.ts.enabled.out delete mode 100644 cli/tests/testdata/no_color.js delete mode 100644 cli/tests/testdata/no_mem_cache.js delete mode 100644 cli/tests/testdata/no_mem_cache.js.out delete mode 100644 cli/tests/testdata/no_prompt.ts delete mode 100644 cli/tests/testdata/no_validate_asm.js delete mode 100644 cli/tests/testdata/node_env_var_allowlist.ts delete mode 100644 cli/tests/testdata/node_env_var_allowlist_with_unstable_flag.ts.out delete mode 100644 cli/tests/testdata/node_env_var_allowlist_without_unstable_flag.ts.out delete mode 100644 cli/tests/testdata/op_exit_op_set_exit_code_in_worker.ts delete mode 100644 cli/tests/testdata/op_exit_op_set_exit_code_worker.js delete mode 100644 cli/tests/testdata/performance_stats.out delete mode 100644 cli/tests/testdata/permission_test.ts delete mode 100644 cli/tests/testdata/preserve_imports.tsconfig.json delete mode 100644 cli/tests/testdata/private_field_presence.ts delete mode 100644 cli/tests/testdata/private_field_presence.ts.out delete mode 100644 cli/tests/testdata/proto_exploit.js delete mode 100644 cli/tests/testdata/proto_exploit.js.out delete mode 100644 cli/tests/testdata/queue_microtask_error.ts delete mode 100644 cli/tests/testdata/queue_microtask_error.ts.out delete mode 100644 cli/tests/testdata/queue_microtask_error_handled.ts delete mode 100644 cli/tests/testdata/queue_microtask_error_handled.ts.out delete mode 100644 cli/tests/testdata/raw_mode.ts delete mode 100644 cli/tests/testdata/recursive_imports/A.ts delete mode 100644 cli/tests/testdata/recursive_imports/B.ts delete mode 100644 cli/tests/testdata/recursive_imports/C.ts delete mode 100644 cli/tests/testdata/recursive_imports/common.ts delete mode 100644 cli/tests/testdata/redirect_cache.out delete mode 100644 cli/tests/testdata/reference_types.ts delete mode 100644 cli/tests/testdata/reference_types.ts.out delete mode 100644 cli/tests/testdata/reference_types_error.js delete mode 100644 cli/tests/testdata/reference_types_error.js.out delete mode 100644 cli/tests/testdata/reference_types_remote.ts delete mode 100644 cli/tests/testdata/reference_types_remote.ts.out create mode 100644 cli/tests/testdata/repl/import_type.ts delete mode 100644 cli/tests/testdata/replace_self.js delete mode 100644 cli/tests/testdata/replace_self.js.out delete mode 100644 cli/tests/testdata/report_error.ts delete mode 100644 cli/tests/testdata/report_error.ts.out delete mode 100644 cli/tests/testdata/report_error_end_of_program.ts delete mode 100644 cli/tests/testdata/report_error_end_of_program.ts.out delete mode 100644 cli/tests/testdata/report_error_handled.ts delete mode 100644 cli/tests/testdata/report_error_handled.ts.out delete mode 100644 cli/tests/testdata/resolve_dns.ts delete mode 100644 cli/tests/testdata/resolve_dns.ts.out delete mode 100644 cli/tests/testdata/resolve_dns.zone.in delete mode 100644 cli/tests/testdata/response_string_perf.js create mode 100644 cli/tests/testdata/run/001_hello.js create mode 100644 cli/tests/testdata/run/001_hello.js.out create mode 100644 cli/tests/testdata/run/002_hello.ts create mode 100644 cli/tests/testdata/run/002_hello.ts.out create mode 100644 cli/tests/testdata/run/003_relative_import.ts create mode 100644 cli/tests/testdata/run/003_relative_import.ts.out create mode 100644 cli/tests/testdata/run/004_set_timeout.ts create mode 100644 cli/tests/testdata/run/004_set_timeout.ts.out create mode 100644 cli/tests/testdata/run/005_more_imports.ts create mode 100644 cli/tests/testdata/run/005_more_imports.ts.out create mode 100644 cli/tests/testdata/run/006_url_imports.ts create mode 100644 cli/tests/testdata/run/006_url_imports.ts.out create mode 100644 cli/tests/testdata/run/012_async.ts create mode 100644 cli/tests/testdata/run/012_async.ts.out create mode 100644 cli/tests/testdata/run/013_dynamic_import.ts create mode 100644 cli/tests/testdata/run/013_dynamic_import.ts.out create mode 100644 cli/tests/testdata/run/014_duplicate_import.ts create mode 100644 cli/tests/testdata/run/014_duplicate_import.ts.out create mode 100644 cli/tests/testdata/run/015_duplicate_parallel_import.js create mode 100644 cli/tests/testdata/run/015_duplicate_parallel_import.js.out create mode 100644 cli/tests/testdata/run/016_double_await.ts create mode 100644 cli/tests/testdata/run/016_double_await.ts.out create mode 100644 cli/tests/testdata/run/017_import_redirect.ts create mode 100644 cli/tests/testdata/run/017_import_redirect.ts.out create mode 100644 cli/tests/testdata/run/017_import_redirect_info.out create mode 100644 cli/tests/testdata/run/018_async_catch.ts create mode 100644 cli/tests/testdata/run/018_async_catch.ts.out create mode 100644 cli/tests/testdata/run/019_media_types.ts create mode 100644 cli/tests/testdata/run/019_media_types.ts.out create mode 100644 cli/tests/testdata/run/020_json_modules.ts create mode 100644 cli/tests/testdata/run/020_json_modules.ts.out create mode 100644 cli/tests/testdata/run/021_mjs_modules.ts create mode 100644 cli/tests/testdata/run/021_mjs_modules.ts.out create mode 100644 cli/tests/testdata/run/023_no_ext create mode 100644 cli/tests/testdata/run/023_no_ext.out create mode 100644 cli/tests/testdata/run/025_hrtime.ts create mode 100644 cli/tests/testdata/run/025_hrtime.ts.out create mode 100644 cli/tests/testdata/run/025_reload_js_type_error.js create mode 100644 cli/tests/testdata/run/025_reload_js_type_error.js.out create mode 100644 cli/tests/testdata/run/026_redirect_javascript.js create mode 100644 cli/tests/testdata/run/026_redirect_javascript.js.out create mode 100644 cli/tests/testdata/run/027_redirect_typescript.ts create mode 100644 cli/tests/testdata/run/027_redirect_typescript.ts.out create mode 100644 cli/tests/testdata/run/028_args.ts create mode 100644 cli/tests/testdata/run/028_args.ts.out create mode 100644 cli/tests/testdata/run/033_import_map.out create mode 100644 cli/tests/testdata/run/033_import_map_remote.out create mode 100644 cli/tests/testdata/run/035_cached_only_flag.out create mode 100644 cli/tests/testdata/run/038_checkjs.js create mode 100644 cli/tests/testdata/run/038_checkjs.js.out create mode 100644 cli/tests/testdata/run/042_dyn_import_evalcontext.ts create mode 100644 cli/tests/testdata/run/042_dyn_import_evalcontext.ts.out create mode 100644 cli/tests/testdata/run/044_bad_resource.ts create mode 100644 cli/tests/testdata/run/044_bad_resource.ts.out create mode 100644 cli/tests/testdata/run/045_mod.ts create mode 100644 cli/tests/testdata/run/045_output.ts create mode 100644 cli/tests/testdata/run/045_programmatic_proxy_client.ts create mode 100644 cli/tests/testdata/run/045_proxy_client.ts create mode 100644 cli/tests/testdata/run/045_proxy_test.ts create mode 100644 cli/tests/testdata/run/045_proxy_test.ts.out create mode 100644 cli/tests/testdata/run/046_jsx_test.tsx create mode 100644 cli/tests/testdata/run/046_jsx_test.tsx.out create mode 100644 cli/tests/testdata/run/047_jsx_test.jsx create mode 100644 cli/tests/testdata/run/047_jsx_test.jsx.out create mode 100644 cli/tests/testdata/run/048_media_types_jsx.ts create mode 100644 cli/tests/testdata/run/048_media_types_jsx.ts.out create mode 100644 cli/tests/testdata/run/052_no_remote_flag.out create mode 100644 cli/tests/testdata/run/056_make_temp_file_write_perm.out create mode 100644 cli/tests/testdata/run/056_make_temp_file_write_perm.ts create mode 100644 cli/tests/testdata/run/058_tasks_microtasks_close.ts create mode 100644 cli/tests/testdata/run/058_tasks_microtasks_close.ts.out create mode 100644 cli/tests/testdata/run/059_fs_relative_path_perm.ts create mode 100644 cli/tests/testdata/run/059_fs_relative_path_perm.ts.out create mode 100644 cli/tests/testdata/run/061_permissions_request.ts create mode 100644 cli/tests/testdata/run/062_permissions_request_global.ts create mode 100644 cli/tests/testdata/run/063_permissions_revoke.ts create mode 100644 cli/tests/testdata/run/063_permissions_revoke.ts.out create mode 100644 cli/tests/testdata/run/064_permissions_revoke_global.ts create mode 100644 cli/tests/testdata/run/064_permissions_revoke_global.ts.out create mode 100644 cli/tests/testdata/run/066_prompt.ts create mode 100644 cli/tests/testdata/run/070_location.ts create mode 100644 cli/tests/testdata/run/070_location.ts.out create mode 100644 cli/tests/testdata/run/071_location_unset.ts create mode 100644 cli/tests/testdata/run/071_location_unset.ts.out create mode 100644 cli/tests/testdata/run/072_location_relative_fetch.ts create mode 100644 cli/tests/testdata/run/072_location_relative_fetch.ts.out create mode 100644 cli/tests/testdata/run/075_import_local_query_hash.ts create mode 100644 cli/tests/testdata/run/075_import_local_query_hash.ts.out create mode 100644 cli/tests/testdata/run/077_fetch_empty.ts create mode 100644 cli/tests/testdata/run/077_fetch_empty.ts.out create mode 100644 cli/tests/testdata/run/078_unload_on_exit.ts create mode 100644 cli/tests/testdata/run/078_unload_on_exit.ts.out create mode 100644 cli/tests/testdata/run/079_location_authentication.ts create mode 100644 cli/tests/testdata/run/079_location_authentication.ts.out create mode 100644 cli/tests/testdata/run/081_location_relative_fetch_redirect.ts create mode 100644 cli/tests/testdata/run/081_location_relative_fetch_redirect.ts.out create mode 100644 cli/tests/testdata/run/082_prepare_stack_trace_throw.js create mode 100644 cli/tests/testdata/run/082_prepare_stack_trace_throw.js.out create mode 100644 cli/tests/testdata/run/083_legacy_external_source_map.ts create mode 100644 cli/tests/testdata/run/088_dynamic_import_already_evaluating.ts create mode 100644 cli/tests/testdata/run/088_dynamic_import_already_evaluating.ts.out create mode 100644 cli/tests/testdata/run/088_dynamic_import_target.ts create mode 100644 cli/tests/testdata/run/089_run_allow_list.ts create mode 100644 cli/tests/testdata/run/089_run_allow_list.ts.out create mode 100644 cli/tests/testdata/run/090_run_permissions_request.ts create mode 100644 cli/tests/testdata/run/091_use_define_for_class_fields.ts create mode 100644 cli/tests/testdata/run/091_use_define_for_class_fields.ts.out create mode 100644 cli/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts create mode 100644 cli/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts.out create mode 100644 cli/tests/testdata/run/aggregate_error.out create mode 100644 cli/tests/testdata/run/aggregate_error.ts create mode 100644 cli/tests/testdata/run/async_error.ts create mode 100644 cli/tests/testdata/run/async_error.ts.out create mode 100644 cli/tests/testdata/run/before_unload.js create mode 100644 cli/tests/testdata/run/before_unload.js.out create mode 100644 cli/tests/testdata/run/blob_gc_finalization.js create mode 100644 cli/tests/testdata/run/blob_gc_finalization.js.out create mode 100644 cli/tests/testdata/run/byte_order_mark.out create mode 100644 cli/tests/testdata/run/byte_order_mark.ts create mode 100644 cli/tests/testdata/run/checkjs.tsconfig.json create mode 100644 cli/tests/testdata/run/cjs_imports/commonjs.cjs create mode 100644 cli/tests/testdata/run/cjs_imports/main.out create mode 100644 cli/tests/testdata/run/cjs_imports/main.ts create mode 100644 cli/tests/testdata/run/classic_workers_event_loop.js create mode 100644 cli/tests/testdata/run/classic_workers_event_loop.js.out create mode 100644 cli/tests/testdata/run/colors_without_globalThis.js create mode 100644 cli/tests/testdata/run/complex_error.ts create mode 100644 cli/tests/testdata/run/complex_error.ts.out create mode 100644 cli/tests/testdata/run/complex_permissions_test.ts create mode 100644 cli/tests/testdata/run/config/main.out create mode 100644 cli/tests/testdata/run/config/main.ts create mode 100644 cli/tests/testdata/run/config/tsconfig.json create mode 100644 cli/tests/testdata/run/config_json_import.ts create mode 100644 cli/tests/testdata/run/config_json_import.ts.out create mode 100644 cli/tests/testdata/run/config_types/main.out create mode 100644 cli/tests/testdata/run/config_types/main.ts create mode 100644 cli/tests/testdata/run/config_types/remote.tsconfig.json create mode 100644 cli/tests/testdata/run/config_types/tsconfig.json create mode 100644 cli/tests/testdata/run/config_types/types.d.ts create mode 100644 cli/tests/testdata/run/custom_inspect_url.js create mode 100644 cli/tests/testdata/run/custom_inspect_url.js.out create mode 100644 cli/tests/testdata/run/delete_window.js create mode 100644 cli/tests/testdata/run/deno_exit_tampering.ts create mode 100644 cli/tests/testdata/run/disallow_http_from_https.js create mode 100644 cli/tests/testdata/run/disallow_http_from_https.ts create mode 100644 cli/tests/testdata/run/disallow_http_from_https_js.out create mode 100644 cli/tests/testdata/run/disallow_http_from_https_ts.out create mode 100644 cli/tests/testdata/run/dom_exception_formatting.ts create mode 100644 cli/tests/testdata/run/dom_exception_formatting.ts.out create mode 100644 cli/tests/testdata/run/dynamic_import_already_rejected/error_001.ts create mode 100644 cli/tests/testdata/run/dynamic_import_already_rejected/main.out create mode 100644 cli/tests/testdata/run/dynamic_import_already_rejected/main.ts create mode 100644 cli/tests/testdata/run/dynamic_import_async_error/delayed_error.ts create mode 100644 cli/tests/testdata/run/dynamic_import_async_error/main.out create mode 100644 cli/tests/testdata/run/dynamic_import_async_error/main.ts create mode 100644 cli/tests/testdata/run/dynamic_import_conditional.js create mode 100644 cli/tests/testdata/run/dynamic_import_conditional.js.out create mode 100644 cli/tests/testdata/run/empty.ts create mode 100644 cli/tests/testdata/run/error_001.ts create mode 100644 cli/tests/testdata/run/error_001.ts.out create mode 100644 cli/tests/testdata/run/error_002.ts create mode 100644 cli/tests/testdata/run/error_002.ts.out create mode 100644 cli/tests/testdata/run/error_003_typescript.ts create mode 100644 cli/tests/testdata/run/error_003_typescript.ts.out create mode 100644 cli/tests/testdata/run/error_004_missing_module.ts create mode 100644 cli/tests/testdata/run/error_004_missing_module.ts.out create mode 100644 cli/tests/testdata/run/error_005_missing_dynamic_import.ts create mode 100644 cli/tests/testdata/run/error_005_missing_dynamic_import.ts.out create mode 100644 cli/tests/testdata/run/error_006_import_ext_failure.ts create mode 100644 cli/tests/testdata/run/error_006_import_ext_failure.ts.out create mode 100644 cli/tests/testdata/run/error_007_any.ts create mode 100644 cli/tests/testdata/run/error_007_any.ts.out create mode 100644 cli/tests/testdata/run/error_008_checkjs.js create mode 100644 cli/tests/testdata/run/error_008_checkjs.js.out create mode 100644 cli/tests/testdata/run/error_009_extensions_error.js create mode 100644 cli/tests/testdata/run/error_009_extensions_error.js.out create mode 100644 cli/tests/testdata/run/error_009_missing_js_module.disabled create mode 100644 cli/tests/testdata/run/error_011_bad_module_specifier.ts create mode 100644 cli/tests/testdata/run/error_011_bad_module_specifier.ts.out create mode 100644 cli/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts create mode 100644 cli/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts.out create mode 100644 cli/tests/testdata/run/error_013_missing_script.out create mode 100644 cli/tests/testdata/run/error_014_catch_dynamic_import_error.js create mode 100644 cli/tests/testdata/run/error_014_catch_dynamic_import_error.js.out create mode 100644 cli/tests/testdata/run/error_015_dynamic_import_permissions.js create mode 100644 cli/tests/testdata/run/error_015_dynamic_import_permissions.out create mode 100644 cli/tests/testdata/run/error_016_dynamic_import_permissions2.js create mode 100644 cli/tests/testdata/run/error_016_dynamic_import_permissions2.out create mode 100644 cli/tests/testdata/run/error_017_hide_long_source_ts.ts create mode 100644 cli/tests/testdata/run/error_017_hide_long_source_ts.ts.out create mode 100644 cli/tests/testdata/run/error_018_hide_long_source_js.js create mode 100644 cli/tests/testdata/run/error_018_hide_long_source_js.js.out create mode 100644 cli/tests/testdata/run/error_019_stack_function.ts create mode 100644 cli/tests/testdata/run/error_019_stack_function.ts.out create mode 100644 cli/tests/testdata/run/error_020_stack_constructor.ts create mode 100644 cli/tests/testdata/run/error_020_stack_constructor.ts.out create mode 100644 cli/tests/testdata/run/error_021_stack_method.ts create mode 100644 cli/tests/testdata/run/error_021_stack_method.ts.out create mode 100644 cli/tests/testdata/run/error_022_stack_custom_error.ts create mode 100644 cli/tests/testdata/run/error_022_stack_custom_error.ts.out create mode 100644 cli/tests/testdata/run/error_023_stack_async.ts create mode 100644 cli/tests/testdata/run/error_023_stack_async.ts.out create mode 100644 cli/tests/testdata/run/error_024_stack_promise_all.ts create mode 100644 cli/tests/testdata/run/error_024_stack_promise_all.ts.out create mode 100644 cli/tests/testdata/run/error_025_tab_indent create mode 100644 cli/tests/testdata/run/error_025_tab_indent.out create mode 100644 cli/tests/testdata/run/error_026_remote_import_error.ts create mode 100644 cli/tests/testdata/run/error_026_remote_import_error.ts.out create mode 100644 cli/tests/testdata/run/error_cause.ts create mode 100644 cli/tests/testdata/run/error_cause.ts.out create mode 100644 cli/tests/testdata/run/error_cause_recursive.ts create mode 100644 cli/tests/testdata/run/error_cause_recursive.ts.out create mode 100644 cli/tests/testdata/run/error_for_await.ts create mode 100644 cli/tests/testdata/run/error_for_await.ts.out create mode 100644 cli/tests/testdata/run/error_import_map_unable_to_load.out create mode 100644 cli/tests/testdata/run/error_local_static_import_from_remote.js create mode 100644 cli/tests/testdata/run/error_local_static_import_from_remote.js.out create mode 100644 cli/tests/testdata/run/error_local_static_import_from_remote.ts create mode 100644 cli/tests/testdata/run/error_local_static_import_from_remote.ts.out create mode 100644 cli/tests/testdata/run/error_missing_module_named_import.ts create mode 100644 cli/tests/testdata/run/error_missing_module_named_import.ts.out create mode 100644 cli/tests/testdata/run/error_name_non_string.js create mode 100644 cli/tests/testdata/run/error_name_non_string.js.out create mode 100644 cli/tests/testdata/run/error_no_check.ts create mode 100644 cli/tests/testdata/run/error_no_check.ts.out create mode 100644 cli/tests/testdata/run/error_syntax.js create mode 100644 cli/tests/testdata/run/error_syntax.js.out create mode 100644 cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs create mode 100644 cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs.out create mode 100644 cli/tests/testdata/run/error_type_definitions.ts create mode 100644 cli/tests/testdata/run/error_type_definitions.ts.out create mode 100644 cli/tests/testdata/run/es_private_fields.js create mode 100644 cli/tests/testdata/run/es_private_fields.js.out create mode 100644 cli/tests/testdata/run/eval_context_throw_dom_exception.js create mode 100644 cli/tests/testdata/run/eval_context_throw_dom_exception.js.out create mode 100644 cli/tests/testdata/run/event_listener_error.ts create mode 100644 cli/tests/testdata/run/event_listener_error.ts.out create mode 100644 cli/tests/testdata/run/event_listener_error_handled.ts create mode 100644 cli/tests/testdata/run/event_listener_error_handled.ts.out create mode 100644 cli/tests/testdata/run/event_listener_error_immediate_exit.ts create mode 100644 cli/tests/testdata/run/event_listener_error_immediate_exit.ts.out create mode 100644 cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts create mode 100644 cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out create mode 100644 cli/tests/testdata/run/exec_path.ts create mode 100644 cli/tests/testdata/run/exit_error42.ts create mode 100644 cli/tests/testdata/run/exit_error42.ts.out create mode 100644 cli/tests/testdata/run/export_type_def.ts create mode 100644 cli/tests/testdata/run/fetch/hello.txt create mode 100644 cli/tests/testdata/run/fetch/other.ts create mode 100644 cli/tests/testdata/run/fetch/test.ts create mode 100644 cli/tests/testdata/run/fetch_async_error_stack.ts create mode 100644 cli/tests/testdata/run/fetch_async_error_stack.ts.out create mode 100644 cli/tests/testdata/run/fetch_response_finalization.js create mode 100644 cli/tests/testdata/run/fetch_response_finalization.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_1.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_1.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_10.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_10.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_11.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_11.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_12.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_12.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_13.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_13.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_14.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_14.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_15.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_15.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_2.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_2.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_3.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_3.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_4.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_4.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_5.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_5.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_6.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_6.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_7.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_7.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_8.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_8.js.out create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_9.js create mode 100644 cli/tests/testdata/run/ffi/unstable_ffi_9.js.out create mode 100644 cli/tests/testdata/run/finalization_registry.js create mode 100644 cli/tests/testdata/run/finalization_registry.js.out create mode 100644 cli/tests/testdata/run/fix_dynamic_import_errors.js create mode 100644 cli/tests/testdata/run/fix_dynamic_import_errors.js.out create mode 100644 cli/tests/testdata/run/fix_emittable_skipped.js create mode 100644 cli/tests/testdata/run/fix_emittable_skipped.ts.out create mode 100644 cli/tests/testdata/run/fix_exotic_specifiers.ts create mode 100644 cli/tests/testdata/run/fix_exotic_specifiers.ts.out create mode 100644 cli/tests/testdata/run/fix_js_import_js.ts create mode 100644 cli/tests/testdata/run/fix_js_import_js.ts.out create mode 100644 cli/tests/testdata/run/fix_js_imports.ts create mode 100644 cli/tests/testdata/run/fix_js_imports.ts.out create mode 100644 cli/tests/testdata/run/fix_tsc_file_exists.out create mode 100644 cli/tests/testdata/run/fix_worker_dispatchevent.ts create mode 100644 cli/tests/testdata/run/fix_worker_dispatchevent.ts.out create mode 100644 cli/tests/testdata/run/followup_dyn_import_resolves/main.ts create mode 100644 cli/tests/testdata/run/followup_dyn_import_resolves/main.ts.out create mode 100644 cli/tests/testdata/run/followup_dyn_import_resolves/sub1.ts create mode 100644 cli/tests/testdata/run/followup_dyn_import_resolves/sub2.ts create mode 100644 cli/tests/testdata/run/future_check.ts create mode 100644 cli/tests/testdata/run/future_check2.out create mode 100644 cli/tests/testdata/run/heapstats.js create mode 100644 cli/tests/testdata/run/heapstats.js.out create mode 100644 cli/tests/testdata/run/http2_request_url.ts create mode 100644 cli/tests/testdata/run/https_import.ts create mode 100644 cli/tests/testdata/run/https_import.ts.out create mode 100644 cli/tests/testdata/run/if_main.ts create mode 100644 cli/tests/testdata/run/if_main.ts.out create mode 100644 cli/tests/testdata/run/import_blob_url.ts create mode 100644 cli/tests/testdata/run/import_blob_url.ts.out create mode 100644 cli/tests/testdata/run/import_blob_url_error_stack.ts create mode 100644 cli/tests/testdata/run/import_blob_url_error_stack.ts.out create mode 100644 cli/tests/testdata/run/import_blob_url_import_relative.ts create mode 100644 cli/tests/testdata/run/import_blob_url_import_relative.ts.out create mode 100644 cli/tests/testdata/run/import_blob_url_imports.ts create mode 100644 cli/tests/testdata/run/import_blob_url_imports.ts.out create mode 100644 cli/tests/testdata/run/import_blob_url_jsx.ts create mode 100644 cli/tests/testdata/run/import_blob_url_jsx.ts.out create mode 100644 cli/tests/testdata/run/import_compression/brotli create mode 100644 cli/tests/testdata/run/import_compression/gziped create mode 100644 cli/tests/testdata/run/import_compression/main.out create mode 100644 cli/tests/testdata/run/import_compression/main.ts create mode 100644 cli/tests/testdata/run/import_data_url.ts create mode 100644 cli/tests/testdata/run/import_data_url.ts.out create mode 100644 cli/tests/testdata/run/import_data_url_error_stack.ts create mode 100644 cli/tests/testdata/run/import_data_url_error_stack.ts.out create mode 100644 cli/tests/testdata/run/import_data_url_import_relative.ts create mode 100644 cli/tests/testdata/run/import_data_url_import_relative.ts.out create mode 100644 cli/tests/testdata/run/import_data_url_imports.ts create mode 100644 cli/tests/testdata/run/import_data_url_imports.ts.out create mode 100644 cli/tests/testdata/run/import_data_url_jsx.ts create mode 100644 cli/tests/testdata/run/import_data_url_jsx.ts.out create mode 100644 cli/tests/testdata/run/import_dynamic_data_url.ts create mode 100644 cli/tests/testdata/run/import_dynamic_data_url.ts.out create mode 100644 cli/tests/testdata/run/import_extensionless.ts create mode 100644 cli/tests/testdata/run/import_extensionless.ts.out create mode 100644 cli/tests/testdata/run/import_file_with_colon.ts create mode 100644 cli/tests/testdata/run/import_file_with_colon.ts.out create mode 100644 cli/tests/testdata/run/import_meta/importmap.json create mode 100644 cli/tests/testdata/run/import_meta/main.out create mode 100644 cli/tests/testdata/run/import_meta/main.ts create mode 100644 cli/tests/testdata/run/import_meta/other.ts create mode 100644 cli/tests/testdata/run/import_type.ts create mode 100644 cli/tests/testdata/run/import_type.ts.out create mode 100644 cli/tests/testdata/run/inline_js_source_map.ts create mode 100644 cli/tests/testdata/run/inline_js_source_map_2.js create mode 100644 cli/tests/testdata/run/inline_js_source_map_2.js.out create mode 100644 cli/tests/testdata/run/inline_js_source_map_2.ts create mode 100644 cli/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js create mode 100644 cli/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js.out create mode 100644 cli/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js create mode 100644 cli/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js.out create mode 100644 cli/tests/testdata/run/issue13562.ts create mode 100644 cli/tests/testdata/run/issue13562.ts.out create mode 100644 cli/tests/testdata/run/issue9750.js create mode 100644 cli/tests/testdata/run/js_import_detect.ts create mode 100644 cli/tests/testdata/run/js_import_detect.ts.out create mode 100644 cli/tests/testdata/run/js_root_with_ts_check.js create mode 100644 cli/tests/testdata/run/js_root_with_ts_check.js.out create mode 100644 cli/tests/testdata/run/jsx_import_from_ts.App.jsx create mode 100644 cli/tests/testdata/run/jsx_import_from_ts.ts create mode 100644 cli/tests/testdata/run/jsx_import_from_ts.ts.out create mode 100644 cli/tests/testdata/run/jsx_import_source.out create mode 100644 cli/tests/testdata/run/jsx_import_source_dev.out create mode 100644 cli/tests/testdata/run/jsx_import_source_error.out create mode 100644 cli/tests/testdata/run/jsx_import_source_import_map.out create mode 100644 cli/tests/testdata/run/jsx_import_source_import_map_dev.out create mode 100644 cli/tests/testdata/run/jsx_import_source_no_pragma.tsx create mode 100644 cli/tests/testdata/run/jsx_import_source_pragma.tsx create mode 100644 cli/tests/testdata/run/jsx_import_source_pragma_import_map.tsx create mode 100644 cli/tests/testdata/run/lock_check_err.json create mode 100644 cli/tests/testdata/run/lock_check_err.out create mode 100644 cli/tests/testdata/run/lock_check_err2.json create mode 100644 cli/tests/testdata/run/lock_check_err2.out create mode 100644 cli/tests/testdata/run/lock_check_ok.json create mode 100644 cli/tests/testdata/run/lock_check_ok2.json create mode 100644 cli/tests/testdata/run/lock_dynamic_imports.json create mode 100644 cli/tests/testdata/run/lock_dynamic_imports.out create mode 100644 cli/tests/testdata/run/lock_write_fetch/file_exists.ts create mode 100644 cli/tests/testdata/run/lock_write_fetch/main.out create mode 100644 cli/tests/testdata/run/lock_write_fetch/main.ts create mode 100644 cli/tests/testdata/run/lock_write_requires_lock.out create mode 100644 cli/tests/testdata/run/long_data_url_formatting.ts create mode 100644 cli/tests/testdata/run/long_data_url_formatting.ts.out create mode 100644 cli/tests/testdata/run/main_module/main.out create mode 100644 cli/tests/testdata/run/main_module/main.ts create mode 100644 cli/tests/testdata/run/main_module/other.ts create mode 100644 cli/tests/testdata/run/mts_dmts_mjs.out create mode 100644 cli/tests/testdata/run/nested_error.ts create mode 100644 cli/tests/testdata/run/nested_error.ts.out create mode 100644 cli/tests/testdata/run/no_check_decorators.ts create mode 100644 cli/tests/testdata/run/no_check_decorators.ts.out create mode 100644 cli/tests/testdata/run/no_check_imports_not_used_as_values/hello.ts create mode 100644 cli/tests/testdata/run/no_check_imports_not_used_as_values/main.out create mode 100644 cli/tests/testdata/run/no_check_imports_not_used_as_values/main.ts create mode 100644 cli/tests/testdata/run/no_check_imports_not_used_as_values/preserve_imports.tsconfig.json create mode 100644 cli/tests/testdata/run/no_check_remote.ts create mode 100644 cli/tests/testdata/run/no_check_remote.ts.disabled.out create mode 100644 cli/tests/testdata/run/no_check_remote.ts.enabled.out create mode 100644 cli/tests/testdata/run/no_mem_cache.js create mode 100644 cli/tests/testdata/run/no_mem_cache.js.out create mode 100644 cli/tests/testdata/run/no_prompt.ts create mode 100644 cli/tests/testdata/run/no_validate_asm.js create mode 100644 cli/tests/testdata/run/node_env_var_allowlist.ts create mode 100644 cli/tests/testdata/run/node_env_var_allowlist_with_unstable_flag.ts.out create mode 100644 cli/tests/testdata/run/node_env_var_allowlist_without_unstable_flag.ts.out create mode 100644 cli/tests/testdata/run/onload/imported.ts create mode 100644 cli/tests/testdata/run/onload/main.out create mode 100644 cli/tests/testdata/run/onload/main.ts create mode 100644 cli/tests/testdata/run/onload/nest_imported.ts create mode 100644 cli/tests/testdata/run/op_exit_op_set_exit_code_in_worker.ts create mode 100644 cli/tests/testdata/run/op_exit_op_set_exit_code_worker.js create mode 100644 cli/tests/testdata/run/permission_test.ts create mode 100644 cli/tests/testdata/run/private_field_presence.ts create mode 100644 cli/tests/testdata/run/private_field_presence.ts.out create mode 100644 cli/tests/testdata/run/proto_exploit.js create mode 100644 cli/tests/testdata/run/proto_exploit.js.out create mode 100644 cli/tests/testdata/run/queue_microtask_error.ts create mode 100644 cli/tests/testdata/run/queue_microtask_error.ts.out create mode 100644 cli/tests/testdata/run/queue_microtask_error_handled.ts create mode 100644 cli/tests/testdata/run/queue_microtask_error_handled.ts.out create mode 100644 cli/tests/testdata/run/reference_types.ts create mode 100644 cli/tests/testdata/run/reference_types.ts.out create mode 100644 cli/tests/testdata/run/reference_types_error.js create mode 100644 cli/tests/testdata/run/reference_types_error.js.out create mode 100644 cli/tests/testdata/run/reference_types_remote.ts create mode 100644 cli/tests/testdata/run/reference_types_remote.ts.out create mode 100644 cli/tests/testdata/run/replace_self.js create mode 100644 cli/tests/testdata/run/replace_self.js.out create mode 100644 cli/tests/testdata/run/report_error.ts create mode 100644 cli/tests/testdata/run/report_error.ts.out create mode 100644 cli/tests/testdata/run/report_error_end_of_program.ts create mode 100644 cli/tests/testdata/run/report_error_end_of_program.ts.out create mode 100644 cli/tests/testdata/run/report_error_handled.ts create mode 100644 cli/tests/testdata/run/report_error_handled.ts.out create mode 100644 cli/tests/testdata/run/resolve_dns.ts create mode 100644 cli/tests/testdata/run/resolve_dns.ts.out create mode 100644 cli/tests/testdata/run/resolve_dns.zone.in create mode 100644 cli/tests/testdata/run/runtime_decorators.ts create mode 100644 cli/tests/testdata/run/runtime_decorators.ts.out create mode 100644 cli/tests/testdata/run/seed_random.js create mode 100644 cli/tests/testdata/run/seed_random.js.out create mode 100644 cli/tests/testdata/run/set_exit_code_0.ts create mode 100644 cli/tests/testdata/run/set_exit_code_1.ts create mode 100644 cli/tests/testdata/run/set_exit_code_2.ts create mode 100644 cli/tests/testdata/run/set_timeout_error.ts create mode 100644 cli/tests/testdata/run/set_timeout_error.ts.out create mode 100644 cli/tests/testdata/run/set_timeout_error_handled.ts create mode 100644 cli/tests/testdata/run/set_timeout_error_handled.ts.out create mode 100644 cli/tests/testdata/run/shebang.ts create mode 100644 cli/tests/testdata/run/shebang.ts.out create mode 100644 cli/tests/testdata/run/shebang2.ts create mode 100644 cli/tests/testdata/run/single_compile_with_reload.ts create mode 100644 cli/tests/testdata/run/single_compile_with_reload.ts.out create mode 100644 cli/tests/testdata/run/single_compile_with_reload_dyn.ts create mode 100644 cli/tests/testdata/run/single_compile_with_reload_worker.ts create mode 100644 cli/tests/testdata/run/spawn_stdout_inherit.ts create mode 100644 cli/tests/testdata/run/spawn_stdout_inherit.ts.out create mode 100644 cli/tests/testdata/run/swc_syntax_error.ts create mode 100644 cli/tests/testdata/run/swc_syntax_error.ts.out create mode 100644 cli/tests/testdata/run/test_and_bench_in_run.js create mode 100644 cli/tests/testdata/run/tls.out create mode 100644 cli/tests/testdata/run/tls_connecttls.js create mode 100644 cli/tests/testdata/run/tls_starttls.js create mode 100644 cli/tests/testdata/run/top_level_await/circular.js create mode 100644 cli/tests/testdata/run/top_level_await/circular.out create mode 100644 cli/tests/testdata/run/top_level_await/loop.js create mode 100644 cli/tests/testdata/run/top_level_await/loop.out create mode 100644 cli/tests/testdata/run/top_level_await/nested.out create mode 100644 cli/tests/testdata/run/top_level_await/nested/a.js create mode 100644 cli/tests/testdata/run/top_level_await/nested/b.js create mode 100644 cli/tests/testdata/run/top_level_await/nested/main.js create mode 100644 cli/tests/testdata/run/top_level_await/order.js create mode 100644 cli/tests/testdata/run/top_level_await/order.out create mode 100644 cli/tests/testdata/run/top_level_await/tla/a.js create mode 100644 cli/tests/testdata/run/top_level_await/tla/b.js create mode 100644 cli/tests/testdata/run/top_level_await/tla/c.js create mode 100644 cli/tests/testdata/run/top_level_await/tla/d.js create mode 100644 cli/tests/testdata/run/top_level_await/tla/order.js create mode 100644 cli/tests/testdata/run/top_level_await/tla/parent.js create mode 100644 cli/tests/testdata/run/top_level_await/tla2/a.js create mode 100644 cli/tests/testdata/run/top_level_await/tla2/b.js create mode 100644 cli/tests/testdata/run/top_level_await/tla3/b.js create mode 100644 cli/tests/testdata/run/top_level_await/tla3/timeout_loop.js create mode 100644 cli/tests/testdata/run/top_level_await/top_level_await.js create mode 100644 cli/tests/testdata/run/top_level_await/top_level_await.out create mode 100644 cli/tests/testdata/run/top_level_await/top_level_await.ts create mode 100644 cli/tests/testdata/run/top_level_await/top_level_for_await.js create mode 100644 cli/tests/testdata/run/top_level_await/top_level_for_await.out create mode 100644 cli/tests/testdata/run/top_level_await/top_level_for_await.ts create mode 100644 cli/tests/testdata/run/top_level_await/unresolved.js create mode 100644 cli/tests/testdata/run/top_level_await/unresolved.out create mode 100644 cli/tests/testdata/run/ts_decorators.ts create mode 100644 cli/tests/testdata/run/ts_decorators.ts.out create mode 100644 cli/tests/testdata/run/ts_import_from_js/deps.js create mode 100644 cli/tests/testdata/run/ts_import_from_js/main.js create mode 100644 cli/tests/testdata/run/ts_import_from_js/main.out create mode 100644 cli/tests/testdata/run/ts_type_imports.ts create mode 100644 cli/tests/testdata/run/ts_type_imports.ts.out create mode 100644 cli/tests/testdata/run/ts_type_imports_foo.ts create mode 100644 cli/tests/testdata/run/ts_type_only_import.d.ts create mode 100644 cli/tests/testdata/run/ts_type_only_import.ts create mode 100644 cli/tests/testdata/run/ts_type_only_import.ts.out create mode 100644 cli/tests/testdata/run/tsx_imports/Component.tsx create mode 100644 cli/tests/testdata/run/tsx_imports/tsx_imports.ts create mode 100644 cli/tests/testdata/run/tsx_imports/tsx_imports.ts.out create mode 100644 cli/tests/testdata/run/type_definitions.ts create mode 100644 cli/tests/testdata/run/type_definitions.ts.out create mode 100644 cli/tests/testdata/run/type_definitions_for_export.ts create mode 100644 cli/tests/testdata/run/type_definitions_for_export.ts.out create mode 100644 cli/tests/testdata/run/type_directives_01.ts create mode 100644 cli/tests/testdata/run/type_directives_01.ts.out create mode 100644 cli/tests/testdata/run/type_directives_02.ts create mode 100644 cli/tests/testdata/run/type_directives_02.ts.out create mode 100644 cli/tests/testdata/run/type_directives_js_main.js create mode 100644 cli/tests/testdata/run/type_directives_js_main.js.out create mode 100644 cli/tests/testdata/run/type_directives_redirect.ts create mode 100644 cli/tests/testdata/run/type_directives_redirect.ts.out create mode 100644 cli/tests/testdata/run/type_headers_deno_types.ts create mode 100644 cli/tests/testdata/run/type_headers_deno_types.ts.out create mode 100644 cli/tests/testdata/run/unbuffered_stderr.ts create mode 100644 cli/tests/testdata/run/unbuffered_stderr.ts.out create mode 100644 cli/tests/testdata/run/unbuffered_stdout.ts create mode 100644 cli/tests/testdata/run/unbuffered_stdout.ts.out create mode 100644 cli/tests/testdata/run/unhandled_rejection.ts create mode 100644 cli/tests/testdata/run/unhandled_rejection.ts.out create mode 100644 cli/tests/testdata/run/unhandled_rejection_sync_error.ts create mode 100644 cli/tests/testdata/run/unhandled_rejection_sync_error.ts.out create mode 100644 cli/tests/testdata/run/unstable.js create mode 100644 cli/tests/testdata/run/unstable.ts create mode 100644 cli/tests/testdata/run/unstable_disabled.out create mode 100644 cli/tests/testdata/run/unstable_disabled_js.out create mode 100644 cli/tests/testdata/run/unstable_enabled.out create mode 100644 cli/tests/testdata/run/unstable_enabled_js.out create mode 100644 cli/tests/testdata/run/unstable_worker.ts create mode 100644 cli/tests/testdata/run/unstable_worker.ts.out create mode 100644 cli/tests/testdata/run/unsupported_dynamic_import_scheme.out create mode 100644 cli/tests/testdata/run/v8_flags.js create mode 100644 cli/tests/testdata/run/v8_flags.js.out create mode 100644 cli/tests/testdata/run/v8_flags_unrecognized.out create mode 100644 cli/tests/testdata/run/v8_help.out create mode 100644 cli/tests/testdata/run/wasm.ts create mode 100644 cli/tests/testdata/run/wasm.ts.out create mode 100644 cli/tests/testdata/run/wasm_async.js create mode 100644 cli/tests/testdata/run/wasm_async.out create mode 100644 cli/tests/testdata/run/wasm_shared.out create mode 100644 cli/tests/testdata/run/wasm_shared.ts create mode 100644 cli/tests/testdata/run/wasm_streaming_panic_test.js create mode 100644 cli/tests/testdata/run/wasm_streaming_panic_test.js.out create mode 100644 cli/tests/testdata/run/wasm_unreachable.js create mode 100644 cli/tests/testdata/run/wasm_unreachable.out create mode 100644 cli/tests/testdata/run/wasm_url.js create mode 100644 cli/tests/testdata/run/wasm_url.out create mode 100644 cli/tests/testdata/run/weakref.ts create mode 100644 cli/tests/testdata/run/weakref.ts.out create mode 100644 cli/tests/testdata/run/websocket_server_idletimeout.ts create mode 100644 cli/tests/testdata/run/websocket_server_multi_field_connection_header_test.ts create mode 100644 cli/tests/testdata/run/websocket_test.ts create mode 100644 cli/tests/testdata/run/websocketstream_ping_test.ts create mode 100644 cli/tests/testdata/run/websocketstream_test.ts create mode 100644 cli/tests/testdata/run/webstorage/config_a.jsonc create mode 100644 cli/tests/testdata/run/webstorage/config_b.jsonc create mode 100644 cli/tests/testdata/run/webstorage/fixture.ts create mode 100644 cli/tests/testdata/run/webstorage/logger.ts create mode 100644 cli/tests/testdata/run/webstorage/serialization.ts create mode 100644 cli/tests/testdata/run/webstorage/serialization.ts.out create mode 100644 cli/tests/testdata/run/webstorage/setter.ts create mode 100644 cli/tests/testdata/run/worker_close_in_wasm_reactions.js create mode 100644 cli/tests/testdata/run/worker_close_in_wasm_reactions.js.out create mode 100644 cli/tests/testdata/run/worker_close_nested.js create mode 100644 cli/tests/testdata/run/worker_close_nested.js.out create mode 100644 cli/tests/testdata/run/worker_close_race.js create mode 100644 cli/tests/testdata/run/worker_close_race.js.out create mode 100644 cli/tests/testdata/run/worker_drop_handle_race.js create mode 100644 cli/tests/testdata/run/worker_drop_handle_race.js.out create mode 100644 cli/tests/testdata/run/worker_drop_handle_race_terminate.js create mode 100644 cli/tests/testdata/run/worker_drop_handle_race_terminate.js.out create mode 100644 cli/tests/testdata/run/worker_event_handler_test.js create mode 100644 cli/tests/testdata/run/worker_event_handler_test.js.out create mode 100644 cli/tests/testdata/run/worker_message_before_close.js create mode 100644 cli/tests/testdata/run/worker_message_before_close.js.out create mode 100644 cli/tests/testdata/runtime/esm_imports_a.js create mode 100644 cli/tests/testdata/runtime/esm_imports_b.js delete mode 100644 cli/tests/testdata/runtime_decorators.ts delete mode 100644 cli/tests/testdata/runtime_decorators.ts.out delete mode 100644 cli/tests/testdata/seed_random.js delete mode 100644 cli/tests/testdata/seed_random.js.out delete mode 100644 cli/tests/testdata/set_exit_code_0.ts delete mode 100644 cli/tests/testdata/set_exit_code_1.ts delete mode 100644 cli/tests/testdata/set_exit_code_2.ts delete mode 100644 cli/tests/testdata/set_timeout_error.ts delete mode 100644 cli/tests/testdata/set_timeout_error.ts.out delete mode 100644 cli/tests/testdata/set_timeout_error_handled.ts delete mode 100644 cli/tests/testdata/set_timeout_error_handled.ts.out delete mode 100644 cli/tests/testdata/shebang.ts delete mode 100644 cli/tests/testdata/shebang.ts.out delete mode 100644 cli/tests/testdata/shebang2.ts delete mode 100644 cli/tests/testdata/single_compile_with_reload.ts delete mode 100644 cli/tests/testdata/single_compile_with_reload.ts.out delete mode 100644 cli/tests/testdata/single_compile_with_reload_dyn.ts delete mode 100644 cli/tests/testdata/single_compile_with_reload_worker.ts delete mode 100644 cli/tests/testdata/spawn_stdout_inherit.ts delete mode 100644 cli/tests/testdata/spawn_stdout_inherit.ts.out delete mode 100644 cli/tests/testdata/standalone_dynamic_imports.ts delete mode 100644 cli/tests/testdata/standalone_error.ts delete mode 100644 cli/tests/testdata/standalone_error_module_with_imports_1.ts delete mode 100644 cli/tests/testdata/standalone_error_module_with_imports_2.ts delete mode 100644 cli/tests/testdata/standalone_follow_redirects.ts delete mode 100644 cli/tests/testdata/standalone_follow_redirects_2.js delete mode 100644 cli/tests/testdata/standalone_import.ts delete mode 100644 cli/tests/testdata/standalone_import_datauri.ts delete mode 100644 cli/tests/testdata/standalone_import_map.json delete mode 100644 cli/tests/testdata/standalone_import_map.ts delete mode 100644 cli/tests/testdata/standalone_runtime_flags.ts delete mode 100644 cli/tests/testdata/std_lint.out delete mode 100644 cli/tests/testdata/subdir/empty.ts delete mode 100644 cli/tests/testdata/subdir/types.d.ts delete mode 100644 cli/tests/testdata/swc_syntax_error.ts delete mode 100644 cli/tests/testdata/swc_syntax_error.ts.out delete mode 100644 cli/tests/testdata/test_and_bench_in_run.js delete mode 100644 cli/tests/testdata/text_decoder_perf.js delete mode 100644 cli/tests/testdata/text_encoder_into_perf.js delete mode 100644 cli/tests/testdata/text_encoder_perf.js delete mode 100644 cli/tests/testdata/tla/a.js delete mode 100644 cli/tests/testdata/tla/b.js delete mode 100644 cli/tests/testdata/tla/c.js delete mode 100644 cli/tests/testdata/tla/d.js delete mode 100644 cli/tests/testdata/tla/order.js delete mode 100644 cli/tests/testdata/tla/parent.js delete mode 100644 cli/tests/testdata/tla2/a.js delete mode 100644 cli/tests/testdata/tla2/b.js delete mode 100644 cli/tests/testdata/tla3/b.js delete mode 100644 cli/tests/testdata/tla3/timeout_loop.js delete mode 100644 cli/tests/testdata/tls.out delete mode 100644 cli/tests/testdata/tls_connecttls.js delete mode 100644 cli/tests/testdata/tls_starttls.js delete mode 100644 cli/tests/testdata/top_level_await.js delete mode 100644 cli/tests/testdata/top_level_await.out delete mode 100644 cli/tests/testdata/top_level_await.ts delete mode 100644 cli/tests/testdata/top_level_await_circular.js delete mode 100644 cli/tests/testdata/top_level_await_circular.out delete mode 100644 cli/tests/testdata/top_level_await_loop.js delete mode 100644 cli/tests/testdata/top_level_await_loop.out delete mode 100644 cli/tests/testdata/top_level_await_nested.out delete mode 100644 cli/tests/testdata/top_level_await_nested/a.js delete mode 100644 cli/tests/testdata/top_level_await_nested/b.js delete mode 100644 cli/tests/testdata/top_level_await_nested/main.js delete mode 100644 cli/tests/testdata/top_level_await_order.js delete mode 100644 cli/tests/testdata/top_level_await_order.out delete mode 100644 cli/tests/testdata/top_level_await_unresolved.js delete mode 100644 cli/tests/testdata/top_level_await_unresolved.out delete mode 100644 cli/tests/testdata/top_level_for_await.js delete mode 100644 cli/tests/testdata/top_level_for_await.out delete mode 100644 cli/tests/testdata/top_level_for_await.ts delete mode 100644 cli/tests/testdata/ts_decorators.ts delete mode 100644 cli/tests/testdata/ts_decorators.ts.out delete mode 100644 cli/tests/testdata/ts_decorators_bundle.out delete mode 100644 cli/tests/testdata/ts_decorators_bundle.ts delete mode 100644 cli/tests/testdata/ts_import_from_js.deps.js delete mode 100644 cli/tests/testdata/ts_import_from_js.js delete mode 100644 cli/tests/testdata/ts_import_from_js.js.out delete mode 100644 cli/tests/testdata/ts_type_imports.ts delete mode 100644 cli/tests/testdata/ts_type_imports.ts.out delete mode 100644 cli/tests/testdata/ts_type_imports_foo.ts delete mode 100644 cli/tests/testdata/ts_type_only_import.d.ts delete mode 100644 cli/tests/testdata/ts_type_only_import.ts delete mode 100644 cli/tests/testdata/ts_type_only_import.ts.out delete mode 100644 cli/tests/testdata/ts_with_generic.ts delete mode 100644 cli/tests/testdata/tsx_imports.ts delete mode 100644 cli/tests/testdata/tsx_imports.ts.out delete mode 100644 cli/tests/testdata/type_definitions.ts delete mode 100644 cli/tests/testdata/type_definitions.ts.out delete mode 100644 cli/tests/testdata/type_definitions_for_export.ts delete mode 100644 cli/tests/testdata/type_definitions_for_export.ts.out delete mode 100644 cli/tests/testdata/type_directives_01.ts delete mode 100644 cli/tests/testdata/type_directives_01.ts.out delete mode 100644 cli/tests/testdata/type_directives_02.ts delete mode 100644 cli/tests/testdata/type_directives_02.ts.out delete mode 100644 cli/tests/testdata/type_directives_js_main.js delete mode 100644 cli/tests/testdata/type_directives_js_main.js.out delete mode 100644 cli/tests/testdata/type_directives_redirect.ts delete mode 100644 cli/tests/testdata/type_directives_redirect.ts.out delete mode 100644 cli/tests/testdata/type_headers_deno_types.ts delete mode 100644 cli/tests/testdata/type_headers_deno_types.ts.out delete mode 100644 cli/tests/testdata/types.out create mode 100644 cli/tests/testdata/types/types.out delete mode 100644 cli/tests/testdata/unbuffered_stderr.ts delete mode 100644 cli/tests/testdata/unbuffered_stderr.ts.out delete mode 100644 cli/tests/testdata/unbuffered_stdout.ts delete mode 100644 cli/tests/testdata/unbuffered_stdout.ts.out delete mode 100644 cli/tests/testdata/unhandled_rejection.ts delete mode 100644 cli/tests/testdata/unhandled_rejection.ts.out delete mode 100644 cli/tests/testdata/unhandled_rejection_sync_error.ts delete mode 100644 cli/tests/testdata/unhandled_rejection_sync_error.ts.out delete mode 100644 cli/tests/testdata/unreachable.wasm delete mode 100644 cli/tests/testdata/unstable.js delete mode 100644 cli/tests/testdata/unstable.ts delete mode 100644 cli/tests/testdata/unstable_disabled.out delete mode 100644 cli/tests/testdata/unstable_disabled_js.out delete mode 100644 cli/tests/testdata/unstable_enabled.out delete mode 100644 cli/tests/testdata/unstable_enabled_js.out delete mode 100644 cli/tests/testdata/unstable_ffi_1.js delete mode 100644 cli/tests/testdata/unstable_ffi_1.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_10.js delete mode 100644 cli/tests/testdata/unstable_ffi_10.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_11.js delete mode 100644 cli/tests/testdata/unstable_ffi_11.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_12.js delete mode 100644 cli/tests/testdata/unstable_ffi_12.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_13.js delete mode 100644 cli/tests/testdata/unstable_ffi_13.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_14.js delete mode 100644 cli/tests/testdata/unstable_ffi_14.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_15.js delete mode 100644 cli/tests/testdata/unstable_ffi_15.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_2.js delete mode 100644 cli/tests/testdata/unstable_ffi_2.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_3.js delete mode 100644 cli/tests/testdata/unstable_ffi_3.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_4.js delete mode 100644 cli/tests/testdata/unstable_ffi_4.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_5.js delete mode 100644 cli/tests/testdata/unstable_ffi_5.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_6.js delete mode 100644 cli/tests/testdata/unstable_ffi_6.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_7.js delete mode 100644 cli/tests/testdata/unstable_ffi_7.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_8.js delete mode 100644 cli/tests/testdata/unstable_ffi_8.js.out delete mode 100644 cli/tests/testdata/unstable_ffi_9.js delete mode 100644 cli/tests/testdata/unstable_ffi_9.js.out delete mode 100644 cli/tests/testdata/unstable_worker.ts delete mode 100644 cli/tests/testdata/unstable_worker.ts.out delete mode 100644 cli/tests/testdata/unsupported_dynamic_import_scheme.out delete mode 100644 cli/tests/testdata/v8_flags.js delete mode 100644 cli/tests/testdata/v8_flags.js.out delete mode 100644 cli/tests/testdata/v8_flags_unrecognized.out delete mode 100644 cli/tests/testdata/v8_help.out delete mode 100644 cli/tests/testdata/wasm.ts delete mode 100644 cli/tests/testdata/wasm.ts.out delete mode 100644 cli/tests/testdata/wasm_async.js delete mode 100644 cli/tests/testdata/wasm_async.out delete mode 100644 cli/tests/testdata/wasm_shared.out delete mode 100644 cli/tests/testdata/wasm_shared.ts delete mode 100644 cli/tests/testdata/wasm_streaming_panic_test.js delete mode 100644 cli/tests/testdata/wasm_streaming_panic_test.js.out delete mode 100644 cli/tests/testdata/wasm_unreachable.js delete mode 100644 cli/tests/testdata/wasm_unreachable.out delete mode 100644 cli/tests/testdata/wasm_url.js delete mode 100644 cli/tests/testdata/wasm_url.out delete mode 100644 cli/tests/testdata/weakref.ts delete mode 100644 cli/tests/testdata/weakref.ts.out create mode 100644 cli/tests/testdata/webgpu/computepass_shader.wgsl create mode 100644 cli/tests/testdata/webgpu/hellotriangle.out create mode 100644 cli/tests/testdata/webgpu/hellotriangle_shader.wgsl delete mode 100644 cli/tests/testdata/webgpu_computepass_shader.wgsl delete mode 100644 cli/tests/testdata/webgpu_hellotriangle.out delete mode 100644 cli/tests/testdata/webgpu_hellotriangle_shader.wgsl delete mode 100644 cli/tests/testdata/websocket_server_idletimeout.ts delete mode 100644 cli/tests/testdata/websocket_server_multi_field_connection_header_test.ts delete mode 100644 cli/tests/testdata/websocket_test.ts delete mode 100644 cli/tests/testdata/websocketstream_ping_test.ts delete mode 100644 cli/tests/testdata/websocketstream_test.ts delete mode 100644 cli/tests/testdata/webstorage/config_a.jsonc delete mode 100644 cli/tests/testdata/webstorage/config_b.jsonc delete mode 100644 cli/tests/testdata/webstorage/fixture.ts delete mode 100644 cli/tests/testdata/webstorage/logger.ts delete mode 100644 cli/tests/testdata/webstorage/serialization.ts delete mode 100644 cli/tests/testdata/webstorage/serialization.ts.out delete mode 100644 cli/tests/testdata/webstorage/setter.ts delete mode 100644 cli/tests/testdata/worker_close_in_wasm_reactions.js delete mode 100644 cli/tests/testdata/worker_close_in_wasm_reactions.js.out delete mode 100644 cli/tests/testdata/worker_close_nested.js delete mode 100644 cli/tests/testdata/worker_close_nested.js.out delete mode 100644 cli/tests/testdata/worker_close_race.js delete mode 100644 cli/tests/testdata/worker_close_race.js.out delete mode 100644 cli/tests/testdata/worker_drop_handle_race.js delete mode 100644 cli/tests/testdata/worker_drop_handle_race.js.out delete mode 100644 cli/tests/testdata/worker_drop_handle_race_terminate.js delete mode 100644 cli/tests/testdata/worker_drop_handle_race_terminate.js.out delete mode 100644 cli/tests/testdata/worker_event_handler_test.js delete mode 100644 cli/tests/testdata/worker_event_handler_test.js.out delete mode 100644 cli/tests/testdata/worker_message_before_close.js delete mode 100644 cli/tests/testdata/worker_message_before_close.js.out create mode 100644 cli/tests/testdata/workers/custom_inspect/main.out create mode 100644 cli/tests/testdata/workers/custom_inspect/main.ts create mode 100644 cli/tests/testdata/workers/custom_inspect/worker.ts create mode 100644 cli/tests/testdata/workers/error_worker_permissions_local.ts create mode 100644 cli/tests/testdata/workers/error_worker_permissions_local.ts.out create mode 100644 cli/tests/testdata/workers/error_worker_permissions_remote.ts create mode 100644 cli/tests/testdata/workers/error_worker_permissions_remote.ts.out delete mode 100644 cli/tests/testdata/x_deno_warning_redirect.js (limited to 'cli/tests') diff --git a/cli/tests/integration/bundle_tests.rs b/cli/tests/integration/bundle_tests.rs index a2e529000..ff5a51e98 100644 --- a/cli/tests/integration/bundle_tests.rs +++ b/cli/tests/integration/bundle_tests.rs @@ -231,27 +231,27 @@ fn bundle_js() { #[test] fn bundle_dynamic_import() { let _g = util::http_server(); - let dynamic_import = util::testdata_path().join("bundle_dynamic_import.ts"); + let dynamic_import = util::testdata_path().join("bundle/dynamic_import.ts"); assert!(dynamic_import.is_file()); let t = TempDir::new(); - let bundle = t.path().join("bundle_dynamic_import.bundle.js"); + let output_path = t.path().join("bundle_dynamic_import.bundle.js"); let mut deno = util::deno_cmd() .current_dir(util::testdata_path()) .arg("bundle") .arg(dynamic_import) - .arg(&bundle) + .arg(&output_path) .spawn() .unwrap(); let status = deno.wait().unwrap(); assert!(status.success()); - assert!(bundle.is_file()); + assert!(output_path.is_file()); let output = util::deno_cmd() .current_dir(util::testdata_path()) .arg("run") .arg("--allow-net") .arg("--quiet") - .arg(&bundle) + .arg(&output_path) .output() .unwrap(); // check the output of the test.ts program. @@ -264,23 +264,24 @@ fn bundle_dynamic_import() { #[test] fn bundle_import_map() { - let import = util::testdata_path().join("bundle_im.ts"); - let import_map_path = util::testdata_path().join("bundle_im.json"); + let import = util::testdata_path().join("bundle/import_map/main.ts"); + let import_map_path = + util::testdata_path().join("bundle/import_map/import_map.json"); assert!(import.is_file()); let t = TempDir::new(); - let bundle = t.path().join("import_map.bundle.js"); + let output_path = t.path().join("import_map.bundle.js"); let mut deno = util::deno_cmd() .current_dir(util::testdata_path()) .arg("bundle") .arg("--import-map") .arg(import_map_path) .arg(import) - .arg(&bundle) + .arg(&output_path) .spawn() .unwrap(); let status = deno.wait().unwrap(); assert!(status.success()); - assert!(bundle.is_file()); + assert!(output_path.is_file()); // Now we try to use that bundle from another module. let test = t.path().join("test.js"); @@ -309,23 +310,24 @@ fn bundle_import_map() { #[test] fn bundle_import_map_no_check() { - let import = util::testdata_path().join("bundle_im.ts"); - let import_map_path = util::testdata_path().join("bundle_im.json"); + let import = util::testdata_path().join("bundle/import_map/main.ts"); + let import_map_path = + util::testdata_path().join("bundle/import_map/import_map.json"); assert!(import.is_file()); let t = TempDir::new(); - let bundle = t.path().join("import_map.bundle.js"); + let output_path = t.path().join("import_map.bundle.js"); let mut deno = util::deno_cmd() .current_dir(util::testdata_path()) .arg("bundle") .arg("--import-map") .arg(import_map_path) .arg(import) - .arg(&bundle) + .arg(&output_path) .spawn() .unwrap(); let status = deno.wait().unwrap(); assert!(status.success()); - assert!(bundle.is_file()); + assert!(output_path.is_file()); // Now we try to use that bundle from another module. let test = t.path().join("test.js"); @@ -414,32 +416,32 @@ fn bundle_json_module_escape_sub() { ); } -itest!(lock_check_err_with_bundle { - args: "bundle --lock=lock_check_err_with_bundle.json http://127.0.0.1:4545/subdir/mod1.ts", - output: "lock_check_err_with_bundle.out", +itest!(lockfile_check_error { + args: "bundle --lock=bundle/lockfile/check_error.json http://127.0.0.1:4545/subdir/mod1.ts", + output: "bundle/lockfile/check_error.out", exit_code: 10, http_server: true, }); itest!(bundle { args: "bundle subdir/mod1.ts", - output: "bundle.test.out", + output: "bundle/bundle.test.out", }); itest!(bundle_jsx { - args: "bundle jsx_import_from_ts.ts", - output: "bundle_jsx.out", + args: "bundle run/jsx_import_from_ts.ts", + output: "bundle/jsx.out", }); -itest!(error_027_bundle_with_bare_import { - args: "bundle error_027_bundle_with_bare_import.ts", - output: "error_027_bundle_with_bare_import.ts.out", +itest!(error_bundle_with_bare_import { + args: "bundle bundle/bare_imports/error_with_bare_import.ts", + output: "bundle/bare_imports/error_with_bare_import.ts.out", exit_code: 1, }); itest!(ts_decorators_bundle { - args: "bundle ts_decorators_bundle.ts", - output: "ts_decorators_bundle.out", + args: "bundle bundle/decorators/ts_decorators.ts", + output: "bundle/decorators/ts_decorators.out", }); itest!(bundle_export_specifier_with_alias { @@ -449,18 +451,18 @@ itest!(bundle_export_specifier_with_alias { itest!(bundle_ignore_directives { args: "bundle subdir/mod1.ts", - output: "bundle_ignore_directives.test.out", + output: "bundle/ignore_directives.test.out", }); -itest!(check_local_by_default { - args: "bundle --quiet bundle/check_local_by_default.ts", - output: "bundle/check_local_by_default.out", +itest!(check_local_by_default_no_errors { + args: "bundle --quiet bundle/check_local_by_default/no_errors.ts", + output: "bundle/check_local_by_default/no_errors.out", http_server: true, }); -itest!(check_local_by_default2 { - args: "bundle --quiet bundle/check_local_by_default2.ts", - output: "bundle/check_local_by_default2.out", +itest!(check_local_by_default_type_error { + args: "bundle --quiet bundle/check_local_by_default/type_error.ts", + output: "bundle/check_local_by_default/type_error.out", http_server: true, exit_code: 1, }); diff --git a/cli/tests/integration/cache_tests.rs b/cli/tests/integration/cache_tests.rs index 54aea8106..3fca335a9 100644 --- a/cli/tests/integration/cache_tests.rs +++ b/cli/tests/integration/cache_tests.rs @@ -5,48 +5,48 @@ use crate::itest; itest!(_036_import_map_fetch { args: "cache --quiet --reload --import-map=import_maps/import_map.json import_maps/test.ts", - output: "036_import_map_fetch.out", + output: "cache/036_import_map_fetch.out", }); itest!(_037_fetch_multiple { - args: "cache --reload --check=all fetch/test.ts fetch/other.ts", + args: "cache --reload --check=all run/fetch/test.ts run/fetch/other.ts", http_server: true, - output: "037_fetch_multiple.out", + output: "cache/037_fetch_multiple.out", }); itest!(_095_cache_with_bare_import { - args: "cache 095_cache_with_bare_import.ts", - output: "095_cache_with_bare_import.ts.out", + args: "cache cache/095_cache_with_bare_import.ts", + output: "cache/095_cache_with_bare_import.ts.out", exit_code: 1, }); itest!(cache_extensionless { args: "cache --reload --check=all http://localhost:4545/subdir/no_js_ext", - output: "cache_extensionless.out", + output: "cache/cache_extensionless.out", http_server: true, }); itest!(cache_random_extension { args: "cache --reload --check=all http://localhost:4545/subdir/no_js_ext@1.0.0", - output: "cache_random_extension.out", + output: "cache/cache_random_extension.out", http_server: true, }); itest!(performance_stats { - args: "cache --reload --check=all --log-level debug 002_hello.ts", - output: "performance_stats.out", + args: "cache --reload --check=all --log-level debug run/002_hello.ts", + output: "cache/performance_stats.out", }); itest!(redirect_cache { http_server: true, args: "cache --reload --check=all http://localhost:4548/subdir/redirects/a.ts", - output: "redirect_cache.out", + output: "cache/redirect_cache.out", }); itest!(ignore_require { - args: "cache --reload --no-check ignore_require.js", + args: "cache --reload --no-check cache/ignore_require.js", output_str: Some(""), exit_code: 0, }); @@ -71,7 +71,7 @@ fn relative_home_dir() { .arg("cache") .arg("--reload") .arg("--no-check") - .arg("002_hello.ts") + .arg("run/002_hello.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() diff --git a/cli/tests/integration/cert_tests.rs b/cli/tests/integration/cert_tests.rs new file mode 100644 index 000000000..fd19c1cc1 --- /dev/null +++ b/cli/tests/integration/cert_tests.rs @@ -0,0 +1,316 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +use crate::itest; +use deno_runtime::deno_net::ops_tls::TlsStream; +use deno_runtime::deno_tls::rustls; +use deno_runtime::deno_tls::rustls_pemfile; +use std::io::BufReader; +use std::io::Cursor; +use std::io::Read; +use std::process::Command; +use std::sync::Arc; +use test_util as util; +use test_util::TempDir; +use tokio::task::LocalSet; + +itest_flaky!(cafile_url_imports { + args: "run --quiet --reload --cert tls/RootCA.pem cert/cafile_url_imports.ts", + output: "cert/cafile_url_imports.ts.out", + http_server: true, +}); + +itest_flaky!(cafile_ts_fetch { + args: + "run --quiet --reload --allow-net --cert tls/RootCA.pem cert/cafile_ts_fetch.ts", + output: "cert/cafile_ts_fetch.ts.out", + http_server: true, +}); + +itest_flaky!(cafile_eval { + args: "eval --cert tls/RootCA.pem fetch('https://localhost:5545/cert/cafile_ts_fetch.ts.out').then(r=>r.text()).then(t=>console.log(t.trimEnd()))", + output: "cert/cafile_ts_fetch.ts.out", + http_server: true, +}); + +itest_flaky!(cafile_info { + args: + "info --quiet --cert tls/RootCA.pem https://localhost:5545/cert/cafile_info.ts", + output: "cert/cafile_info.ts.out", + http_server: true, +}); + +itest_flaky!(cafile_url_imports_unsafe_ssl { + args: "run --quiet --reload --unsafely-ignore-certificate-errors=localhost cert/cafile_url_imports.ts", + output: "cert/cafile_url_imports_unsafe_ssl.ts.out", + http_server: true, +}); + +itest_flaky!(cafile_ts_fetch_unsafe_ssl { + args: + "run --quiet --reload --allow-net --unsafely-ignore-certificate-errors cert/cafile_ts_fetch.ts", + output: "cert/cafile_ts_fetch_unsafe_ssl.ts.out", + http_server: true, +}); + +itest!(deno_land_unsafe_ssl { + args: + "run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=deno.land cert/deno_land_unsafe_ssl.ts", + output: "cert/deno_land_unsafe_ssl.ts.out", +}); + +itest!(ip_address_unsafe_ssl { + args: + "run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=1.1.1.1 cert/ip_address_unsafe_ssl.ts", + output: "cert/ip_address_unsafe_ssl.ts.out", +}); + +itest!(localhost_unsafe_ssl { + args: + "run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=deno.land cert/cafile_url_imports.ts", + output: "cert/localhost_unsafe_ssl.ts.out", + http_server: true, + exit_code: 1, +}); + +#[flaky_test::flaky_test] +fn cafile_env_fetch() { + use deno_core::url::Url; + let _g = util::http_server(); + let deno_dir = TempDir::new(); + let module_url = + Url::parse("https://localhost:5545/cert/cafile_url_imports.ts").unwrap(); + let cafile = util::testdata_path().join("tls/RootCA.pem"); + let output = Command::new(util::deno_exe_path()) + .env("DENO_DIR", deno_dir.path()) + .env("DENO_CERT", cafile) + .current_dir(util::testdata_path()) + .arg("cache") + .arg(module_url.to_string()) + .output() + .expect("Failed to spawn script"); + assert!(output.status.success()); +} + +#[flaky_test::flaky_test] +fn cafile_fetch() { + use deno_core::url::Url; + let _g = util::http_server(); + let deno_dir = TempDir::new(); + let module_url = + Url::parse("http://localhost:4545/cert/cafile_url_imports.ts").unwrap(); + let cafile = util::testdata_path().join("tls/RootCA.pem"); + let output = Command::new(util::deno_exe_path()) + .env("DENO_DIR", deno_dir.path()) + .current_dir(util::testdata_path()) + .arg("cache") + .arg("--cert") + .arg(cafile) + .arg(module_url.to_string()) + .output() + .expect("Failed to spawn script"); + assert!(output.status.success()); + let out = std::str::from_utf8(&output.stdout).unwrap(); + assert_eq!(out, ""); +} + +#[flaky_test::flaky_test] +fn cafile_install_remote_module() { + let _g = util::http_server(); + let temp_dir = TempDir::new(); + let bin_dir = temp_dir.path().join("bin"); + std::fs::create_dir(&bin_dir).unwrap(); + let deno_dir = TempDir::new(); + let cafile = util::testdata_path().join("tls/RootCA.pem"); + + let install_output = Command::new(util::deno_exe_path()) + .env("DENO_DIR", deno_dir.path()) + .current_dir(util::testdata_path()) + .arg("install") + .arg("--cert") + .arg(cafile) + .arg("--root") + .arg(temp_dir.path()) + .arg("-n") + .arg("echo_test") + .arg("https://localhost:5545/echo.ts") + .output() + .expect("Failed to spawn script"); + println!("{}", std::str::from_utf8(&install_output.stdout).unwrap()); + eprintln!("{}", std::str::from_utf8(&install_output.stderr).unwrap()); + assert!(install_output.status.success()); + + let mut echo_test_path = bin_dir.join("echo_test"); + if cfg!(windows) { + echo_test_path = echo_test_path.with_extension("cmd"); + } + assert!(echo_test_path.exists()); + + let output = Command::new(echo_test_path) + .current_dir(temp_dir.path()) + .arg("foo") + .env("PATH", util::target_dir()) + .output() + .expect("failed to spawn script"); + let stdout = std::str::from_utf8(&output.stdout).unwrap().trim(); + assert!(stdout.ends_with("foo")); +} + +#[flaky_test::flaky_test] +fn cafile_bundle_remote_exports() { + let _g = util::http_server(); + + // First we have to generate a bundle of some remote module that has exports. + let mod1 = "https://localhost:5545/subdir/mod1.ts"; + let cafile = util::testdata_path().join("tls/RootCA.pem"); + let t = TempDir::new(); + let bundle = t.path().join("mod1.bundle.js"); + let mut deno = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("bundle") + .arg("--cert") + .arg(cafile) + .arg(mod1) + .arg(&bundle) + .spawn() + .expect("failed to spawn script"); + let status = deno.wait().expect("failed to wait for the child process"); + assert!(status.success()); + assert!(bundle.is_file()); + + // Now we try to use that bundle from another module. + let test = t.path().join("test.js"); + std::fs::write( + &test, + " + import { printHello3 } from \"./mod1.bundle.js\"; + printHello3(); ", + ) + .expect("error writing file"); + + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("run") + .arg("--check") + .arg(&test) + .output() + .expect("failed to spawn script"); + // check the output of the test.ts program. + assert!(std::str::from_utf8(&output.stdout) + .unwrap() + .trim() + .ends_with("Hello")); + assert_eq!(output.stderr, b""); +} + +#[tokio::test] +async fn listen_tls_alpn() { + // TLS streams require the presence of an ambient local task set to gracefully + // close dropped connections in the background. + LocalSet::new() + .run_until(async { + let mut child = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("run") + .arg("--unstable") + .arg("--quiet") + .arg("--allow-net") + .arg("--allow-read") + .arg("./cert/listen_tls_alpn.ts") + .arg("4504") + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap(); + let stdout = child.stdout.as_mut().unwrap(); + let mut msg = [0; 5]; + let read = stdout.read(&mut msg).unwrap(); + assert_eq!(read, 5); + assert_eq!(&msg, b"READY"); + + let mut reader = &mut BufReader::new(Cursor::new(include_bytes!( + "../testdata/tls/RootCA.crt" + ))); + let certs = rustls_pemfile::certs(&mut reader).unwrap(); + let mut root_store = rustls::RootCertStore::empty(); + root_store.add_parsable_certificates(&certs); + let mut cfg = rustls::ClientConfig::builder() + .with_safe_defaults() + .with_root_certificates(root_store) + .with_no_client_auth(); + cfg.alpn_protocols.push(b"foobar".to_vec()); + let cfg = Arc::new(cfg); + + let hostname = rustls::ServerName::try_from("localhost").unwrap(); + + let tcp_stream = tokio::net::TcpStream::connect("localhost:4504") + .await + .unwrap(); + let mut tls_stream = + TlsStream::new_client_side(tcp_stream, cfg, hostname); + + tls_stream.handshake().await.unwrap(); + + let (_, rustls_connection) = tls_stream.get_ref(); + let alpn = rustls_connection.alpn_protocol().unwrap(); + assert_eq!(alpn, b"foobar"); + + let status = child.wait().unwrap(); + assert!(status.success()); + }) + .await; +} + +#[tokio::test] +async fn listen_tls_alpn_fail() { + // TLS streams require the presence of an ambient local task set to gracefully + // close dropped connections in the background. + LocalSet::new() + .run_until(async { + let mut child = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("run") + .arg("--unstable") + .arg("--quiet") + .arg("--allow-net") + .arg("--allow-read") + .arg("./cert/listen_tls_alpn_fail.ts") + .arg("4505") + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap(); + let stdout = child.stdout.as_mut().unwrap(); + let mut msg = [0; 5]; + let read = stdout.read(&mut msg).unwrap(); + assert_eq!(read, 5); + assert_eq!(&msg, b"READY"); + + let mut reader = &mut BufReader::new(Cursor::new(include_bytes!( + "../testdata/tls/RootCA.crt" + ))); + let certs = rustls_pemfile::certs(&mut reader).unwrap(); + let mut root_store = rustls::RootCertStore::empty(); + root_store.add_parsable_certificates(&certs); + let mut cfg = rustls::ClientConfig::builder() + .with_safe_defaults() + .with_root_certificates(root_store) + .with_no_client_auth(); + cfg.alpn_protocols.push(b"boofar".to_vec()); + let cfg = Arc::new(cfg); + + let hostname = rustls::ServerName::try_from("localhost").unwrap(); + + let tcp_stream = tokio::net::TcpStream::connect("localhost:4505") + .await + .unwrap(); + let mut tls_stream = + TlsStream::new_client_side(tcp_stream, cfg, hostname); + + tls_stream.handshake().await.unwrap_err(); + + let (_, rustls_connection) = tls_stream.get_ref(); + assert!(rustls_connection.alpn_protocol().is_none()); + + let status = child.wait().unwrap(); + assert!(status.success()); + }) + .await; +} diff --git a/cli/tests/integration/check_tests.rs b/cli/tests/integration/check_tests.rs index 5ceaffe51..ab96670ef 100644 --- a/cli/tests/integration/check_tests.rs +++ b/cli/tests/integration/check_tests.rs @@ -1,50 +1,52 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use std::process::Command; use std::process::Stdio; use crate::itest; use test_util as util; +use util::TempDir; itest!(_095_check_with_bare_import { - args: "check 095_cache_with_bare_import.ts", - output: "095_cache_with_bare_import.ts.out", + args: "check cache/095_cache_with_bare_import.ts", + output: "cache/095_cache_with_bare_import.ts.out", exit_code: 1, }); itest!(check_extensionless { args: "check --reload http://localhost:4545/subdir/no_js_ext", - output: "cache_extensionless.out", + output: "cache/cache_extensionless.out", http_server: true, }); itest!(check_random_extension { args: "check --reload http://localhost:4545/subdir/no_js_ext@1.0.0", - output: "cache_random_extension.out", + output: "cache/cache_random_extension.out", http_server: true, }); itest!(check_all { - args: "check --quiet --remote check_all.ts", - output: "check_all.out", + args: "check --quiet --remote check/check_all.ts", + output: "check/check_all.out", http_server: true, exit_code: 1, }); itest!(check_all_local { - args: "check --quiet check_all.ts", + args: "check --quiet check/check_all.ts", output_str: Some(""), http_server: true, }); itest!(module_detection_force { - args: "check --quiet module_detection_force.ts", + args: "check --quiet check/module_detection_force/main.ts", output_str: Some(""), }); // Regression test for https://github.com/denoland/deno/issues/14937. itest!(declaration_header_file_with_no_exports { - args: "check --quiet declaration_header_file_with_no_exports.ts", + args: "check --quiet check/declaration_header_file_with_no_exports.ts", output_str: Some(""), }); @@ -106,3 +108,91 @@ fn reload_flag() { stderr.contains("Check") } } + +#[test] +fn typecheck_declarations_ns() { + let output = util::deno_cmd() + .arg("test") + .arg("--doc") + .arg(util::root_path().join("cli/dts/lib.deno.ns.d.ts")) + .output() + .unwrap(); + println!("stdout: {}", String::from_utf8(output.stdout).unwrap()); + println!("stderr: {}", String::from_utf8(output.stderr).unwrap()); + assert!(output.status.success()); +} + +#[test] +fn typecheck_declarations_unstable() { + let output = util::deno_cmd() + .arg("test") + .arg("--doc") + .arg("--unstable") + .arg(util::root_path().join("cli/dts/lib.deno.unstable.d.ts")) + .output() + .unwrap(); + println!("stdout: {}", String::from_utf8(output.stdout).unwrap()); + println!("stderr: {}", String::from_utf8(output.stderr).unwrap()); + assert!(output.status.success()); +} + +#[test] +fn typecheck_core() { + let deno_dir = TempDir::new(); + let test_file = deno_dir.path().join("test_deno_core_types.ts"); + std::fs::write( + &test_file, + format!( + "import \"{}\";", + deno_core::resolve_path( + util::root_path() + .join("core/lib.deno_core.d.ts") + .to_str() + .unwrap() + ) + .unwrap() + ), + ) + .unwrap(); + let output = util::deno_cmd_with_deno_dir(&deno_dir) + .arg("run") + .arg(test_file.to_str().unwrap()) + .output() + .unwrap(); + println!("stdout: {}", String::from_utf8(output.stdout).unwrap()); + println!("stderr: {}", String::from_utf8(output.stderr).unwrap()); + assert!(output.status.success()); +} + +#[test] +fn ts_no_recheck_on_redirect() { + let deno_dir = util::new_deno_dir(); + let e = util::deno_exe_path(); + + let redirect_ts = util::testdata_path().join("run/017_import_redirect.ts"); + assert!(redirect_ts.is_file()); + let mut cmd = Command::new(e.clone()); + cmd.env("DENO_DIR", deno_dir.path()); + let mut initial = cmd + .current_dir(util::testdata_path()) + .arg("run") + .arg("--check") + .arg(redirect_ts.clone()) + .spawn() + .expect("failed to span script"); + let status_initial = + initial.wait().expect("failed to wait for child process"); + assert!(status_initial.success()); + + let mut cmd = Command::new(e); + cmd.env("DENO_DIR", deno_dir.path()); + let output = cmd + .current_dir(util::testdata_path()) + .arg("run") + .arg("--check") + .arg(redirect_ts) + .output() + .expect("failed to spawn script"); + + assert!(std::str::from_utf8(&output.stderr).unwrap().is_empty()); +} diff --git a/cli/tests/integration/compile_tests.rs b/cli/tests/integration/compile_tests.rs index 5c9a7f074..dea17e598 100644 --- a/cli/tests/integration/compile_tests.rs +++ b/cli/tests/integration/compile_tests.rs @@ -53,7 +53,7 @@ fn standalone_args() { .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./028_args.ts") + .arg("./compile/args.ts") .arg("a") .arg("b") .stdout(std::process::Stdio::piped()) @@ -90,7 +90,7 @@ fn standalone_error() { .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./standalone_error.ts") + .arg("./compile/standalone_error.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -135,7 +135,7 @@ fn standalone_error_module_with_imports() { .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./standalone_error_module_with_imports_1.ts") + .arg("./compile/standalone_error_module_with_imports_1.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -177,7 +177,7 @@ fn standalone_load_datauri() { .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./standalone_import_datauri.ts") + .arg("./compile/standalone_import_datauri.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -210,7 +210,7 @@ fn standalone_follow_redirects() { .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./standalone_follow_redirects.ts") + .arg("./compile/standalone_follow_redirects.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -244,7 +244,7 @@ fn compile_with_file_exists_error() { .arg("--unstable") .arg("--output") .arg(&output_path) - .arg("./028_args.ts") + .arg("./compile/args.ts") .stderr(std::process::Stdio::piped()) .spawn() .unwrap() @@ -278,7 +278,7 @@ fn compile_with_directory_exists_error() { .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./028_args.ts") + .arg("./compile/args.ts") .stderr(std::process::Stdio::piped()) .spawn() .unwrap() @@ -312,7 +312,7 @@ fn compile_with_conflict_file_exists_error() { .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./028_args.ts") + .arg("./compile/args.ts") .stderr(std::process::Stdio::piped()) .spawn() .unwrap() @@ -349,7 +349,7 @@ fn compile_and_overwrite_file() { .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./028_args.ts") + .arg("./compile/args.ts") .stderr(std::process::Stdio::piped()) .spawn() .unwrap() @@ -364,7 +364,7 @@ fn compile_and_overwrite_file() { .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./028_args.ts") + .arg("./compile/args.ts") .stderr(std::process::Stdio::piped()) .spawn() .unwrap() @@ -390,7 +390,7 @@ fn standalone_runtime_flags() { .arg("1") .arg("--output") .arg(&exe) - .arg("./standalone_runtime_flags.ts") + .arg("./compile/standalone_runtime_flags.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -426,10 +426,10 @@ fn standalone_import_map() { .arg("--unstable") .arg("--allow-read") .arg("--import-map") - .arg("standalone_import_map.json") + .arg("compile/standalone_import_map.json") .arg("--output") .arg(&exe) - .arg("./standalone_import_map.ts") + .arg("./compile/standalone_import_map.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -461,7 +461,7 @@ fn skip_rebundle() { .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./001_hello.js") + .arg("./run/001_hello.js") .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) .spawn() @@ -470,7 +470,7 @@ fn skip_rebundle() { .unwrap(); assert!(output.status.success()); - //no "Bundle testdata_path/001_hello.js" in output + //no "Bundle testdata_path/run/001_hello.js" in output assert!(!String::from_utf8(output.stderr).unwrap().contains("Bundle")); let output = Command::new(exe) diff --git a/cli/tests/integration/doc_tests.rs b/cli/tests/integration/doc_tests.rs index f225eeb2c..4309d9754 100644 --- a/cli/tests/integration/doc_tests.rs +++ b/cli/tests/integration/doc_tests.rs @@ -8,7 +8,7 @@ use crate::itest; itest!(deno_doc_builtin { args: "doc", - output: "deno_doc_builtin.out", + output: "doc/deno_doc_builtin.out", }); #[test] @@ -19,7 +19,7 @@ fn deno_doc() { let output = util::deno_cmd_with_deno_dir(&dir) .current_dir(util::testdata_path()) .arg("doc") - .arg("deno_doc.ts") + .arg("doc/deno_doc.ts") .env("NO_COLOR", "1") .stdout(std::process::Stdio::piped()) .spawn() @@ -56,8 +56,9 @@ itest!(deno_doc_types_header { }); itest!(_060_deno_doc_displays_all_overloads_in_details_view { - args: "doc 060_deno_doc_displays_all_overloads_in_details_view.ts NS.test", - output: "060_deno_doc_displays_all_overloads_in_details_view.ts.out", + args: + "doc doc/060_deno_doc_displays_all_overloads_in_details_view.ts NS.test", + output: "doc/060_deno_doc_displays_all_overloads_in_details_view.ts.out", }); itest!(deno_doc_types_header_direct { diff --git a/cli/tests/integration/eval_tests.rs b/cli/tests/integration/eval_tests.rs index 892ca7ffd..2d560812e 100644 --- a/cli/tests/integration/eval_tests.rs +++ b/cli/tests/integration/eval_tests.rs @@ -44,27 +44,27 @@ fn eval_randomness() { assert!(numbers.len() > 1); } -itest!(_029_eval { +itest!(eval_basic { args: "eval console.log(\"hello\")", - output: "029_eval.out", + output_str: Some("hello\n"), }); // Ugly parentheses due to whitespace delimiting problem. -itest!(_030_eval_ts { +itest!(eval_ts { args: "eval --quiet --ext=ts console.log((123)as(number))", // 'as' is a TS keyword only - output: "030_eval_ts.out", + output_str: Some("123\n"), }); -itest!(_041_dyn_import_eval { +itest!(dyn_import_eval { args: "eval import('./subdir/mod4.js').then(console.log)", - output: "041_dyn_import_eval.out", + output: "eval/dyn_import_eval.out", }); // Cannot write the expression to evaluate as "console.log(typeof gc)" // because itest! splits args on whitespace. itest!(v8_flags_eval { args: "eval --v8-flags=--expose-gc console.log(typeof(gc))", - output: "v8_flags.js.out", + output: "run/v8_flags.js.out", }); itest!(check_local_by_default { diff --git a/cli/tests/integration/flags_tests.rs b/cli/tests/integration/flags_tests.rs new file mode 100644 index 000000000..5e3814e22 --- /dev/null +++ b/cli/tests/integration/flags_tests.rs @@ -0,0 +1,45 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +use crate::itest; +use test_util as util; + +#[test] +fn help_flag() { + let status = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("--help") + .spawn() + .unwrap() + .wait() + .unwrap(); + assert!(status.success()); +} + +#[test] +fn version_short_flag() { + let status = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("-V") + .spawn() + .unwrap() + .wait() + .unwrap(); + assert!(status.success()); +} + +#[test] +fn version_long_flag() { + let status = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("--version") + .spawn() + .unwrap() + .wait() + .unwrap(); + assert!(status.success()); +} + +itest!(types { + args: "types", + output: "types/types.out", +}); diff --git a/cli/tests/integration/fmt_tests.rs b/cli/tests/integration/fmt_tests.rs index 048e9aa21..53b45de19 100644 --- a/cli/tests/integration/fmt_tests.rs +++ b/cli/tests/integration/fmt_tests.rs @@ -7,29 +7,29 @@ use test_util::TempDir; #[test] fn fmt_test() { let t = TempDir::new(); - let fixed_js = util::testdata_path().join("badly_formatted_fixed.js"); + let testdata_fmt_dir = util::testdata_path().join("fmt"); + let fixed_js = testdata_fmt_dir.join("badly_formatted_fixed.js"); let badly_formatted_original_js = - util::testdata_path().join("badly_formatted.mjs"); + testdata_fmt_dir.join("badly_formatted.mjs"); let badly_formatted_js = t.path().join("badly_formatted.js"); let badly_formatted_js_str = badly_formatted_js.to_str().unwrap(); std::fs::copy(&badly_formatted_original_js, &badly_formatted_js).unwrap(); - let fixed_md = util::testdata_path().join("badly_formatted_fixed.md"); - let badly_formatted_original_md = - util::testdata_path().join("badly_formatted.md"); + let fixed_md = testdata_fmt_dir.join("badly_formatted_fixed.md"); + let badly_formatted_original_md = testdata_fmt_dir.join("badly_formatted.md"); let badly_formatted_md = t.path().join("badly_formatted.md"); let badly_formatted_md_str = badly_formatted_md.to_str().unwrap(); std::fs::copy(&badly_formatted_original_md, &badly_formatted_md).unwrap(); - let fixed_json = util::testdata_path().join("badly_formatted_fixed.json"); + let fixed_json = testdata_fmt_dir.join("badly_formatted_fixed.json"); let badly_formatted_original_json = - util::testdata_path().join("badly_formatted.json"); + testdata_fmt_dir.join("badly_formatted.json"); let badly_formatted_json = t.path().join("badly_formatted.json"); let badly_formatted_json_str = badly_formatted_json.to_str().unwrap(); std::fs::copy(&badly_formatted_original_json, &badly_formatted_json).unwrap(); // First, check formatting by ignoring the badly formatted file. let status = util::deno_cmd() - .current_dir(util::testdata_path()) + .current_dir(&testdata_fmt_dir) .arg("fmt") .arg(format!( "--ignore={},{},{}", @@ -48,7 +48,7 @@ fn fmt_test() { // Check without ignore. let status = util::deno_cmd() - .current_dir(util::testdata_path()) + .current_dir(&testdata_fmt_dir) .arg("fmt") .arg("--check") .arg(badly_formatted_js_str) @@ -62,7 +62,7 @@ fn fmt_test() { // Format the source file. let status = util::deno_cmd() - .current_dir(util::testdata_path()) + .current_dir(&testdata_fmt_dir) .arg("fmt") .arg(badly_formatted_js_str) .arg(badly_formatted_md_str) diff --git a/cli/tests/integration/info_tests.rs b/cli/tests/integration/info_tests.rs index aa678cb6d..0cb875078 100644 --- a/cli/tests/integration/info_tests.rs +++ b/cli/tests/integration/info_tests.rs @@ -8,7 +8,7 @@ use test_util::TempDir; #[test] fn info_with_compiled_source() { let _g = util::http_server(); - let module_path = "http://127.0.0.1:4545/048_media_types_jsx.ts"; + let module_path = "http://127.0.0.1:4545/run/048_media_types_jsx.ts"; let t = TempDir::new(); let mut deno = util::deno_cmd() @@ -37,79 +37,79 @@ fn info_with_compiled_source() { assert_eq!(output.stderr, b""); } -itest!(_022_info_flag_script { - args: "info http://127.0.0.1:4545/019_media_types.ts", - output: "022_info_flag_script.out", +itest!(multiple_imports { + args: "info http://127.0.0.1:4545/run/019_media_types.ts", + output: "info/multiple_imports.out", http_server: true, }); -itest!(_031_info_ts_error { - args: "info 031_info_ts_error.ts", - output: "031_info_ts_error.out", +itest!(info_ts_error { + args: "info info/031_info_ts_error.ts", + output: "info/031_info_ts_error.out", }); -itest!(_041_info_flag { +itest!(info_flag { args: "info", - output: "041_info_flag.out", + output: "info/041_info_flag.out", }); -itest!(_042_info_flag_location { +itest!(info_flag_location { args: "info --location https://deno.land", - output: "041_info_flag_location.out", + output: "info/041_info_flag_location.out", }); itest!(info_json { args: "info --json --unstable", - output: "info_json.out", + output: "info/info_json.out", }); itest!(info_json_location { args: "info --json --unstable --location https://deno.land", - output: "info_json_location.out", + output: "info/info_json_location.out", }); -itest!(_049_info_flag_script_jsx { - args: "info http://127.0.0.1:4545/048_media_types_jsx.ts", - output: "049_info_flag_script_jsx.out", +itest!(info_flag_script_jsx { + args: "info http://127.0.0.1:4545/run/048_media_types_jsx.ts", + output: "info/049_info_flag_script_jsx.out", http_server: true, }); -itest!(_055_info_file_json { - args: "info --quiet --json --unstable 005_more_imports.ts", - output: "055_info_file_json.out", +itest!(json_file { + args: "info --quiet --json --unstable info/json_output/main.ts", + output: "info/json_output/main.out", exit_code: 0, }); -itest!(_065_import_map_info { +itest!(import_map_info { args: "info --quiet --import-map=import_maps/import_map.json import_maps/test.ts", - output: "065_import_map_info.out", + output: "info/065_import_map_info.out", }); -itest!(_076_info_json_deps_order { - args: "info --unstable --json 076_info_json_deps_order.ts", - output: "076_info_json_deps_order.out", +itest!(info_json_deps_order { + args: "info --unstable --json info/076_info_json_deps_order.ts", + output: "info/076_info_json_deps_order.out", }); itest!(info_missing_module { - args: "info error_009_missing_js_module.js", - output: "info_missing_module.out", + args: "info info/error_009_missing_js_module.js", + output: "info/info_missing_module.out", }); itest!(info_recursive_modules { - args: "info --quiet info_recursive_imports_test.ts", - output: "info_recursive_imports_test.out", + args: "info --quiet info/info_recursive_imports_test.ts", + output: "info/info_recursive_imports_test.out", exit_code: 0, }); itest!(info_type_import { - args: "info info_type_import.ts", - output: "info_type_import.out", + args: "info info/info_type_import.ts", + output: "info/info_type_import.out", }); itest!(_054_info_local_imports { - args: "info --quiet 005_more_imports.ts", - output: "054_info_local_imports.out", + args: "info --quiet run/005_more_imports.ts", + output: "info/054_info_local_imports.out", exit_code: 0, }); @@ -120,13 +120,13 @@ itest!(data_null_error { output: "info/data_null_error/data_null_error.out", }); -itest!(deno_info_types_header_direct { - args: "info --reload type_directives_01.ts", +itest!(types_header_direct { + args: "info --reload run/type_directives_01.ts", output: "info/types_header.out", http_server: true, }); -itest!(deno_info_with_config_override { +itest!(with_config_override { args: "info info/with_config/test.ts --config info/with_config/deno-override.json --import-map info/with_config/import_map.json", output: "info/with_config/with_config.out", }); diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index 7e75e852b..d49a8a814 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -4107,8 +4107,8 @@ fn lsp_diagnostics_warn_redirect() { severity: Some(lsp::DiagnosticSeverity::INFORMATION), code: Some(lsp::NumberOrString::String("redirect".to_string())), source: Some("deno".to_string()), - message: "The import of \"http://127.0.0.1:4545/x_deno_warning.js\" was redirected to \"http://127.0.0.1:4545/x_deno_warning_redirect.js\".".to_string(), - data: Some(json!({"specifier": "http://127.0.0.1:4545/x_deno_warning.js", "redirect": "http://127.0.0.1:4545/x_deno_warning_redirect.js"})), + message: "The import of \"http://127.0.0.1:4545/x_deno_warning.js\" was redirected to \"http://127.0.0.1:4545/lsp/x_deno_warning_redirect.js\".".to_string(), + data: Some(json!({"specifier": "http://127.0.0.1:4545/x_deno_warning.js", "redirect": "http://127.0.0.1:4545/lsp/x_deno_warning_redirect.js"})), ..Default::default() } ], diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs index 143bda819..373d04e70 100644 --- a/cli/tests/integration/mod.rs +++ b/cli/tests/integration/mod.rs @@ -1,22 +1,6 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -use crate::itest; -use deno_core::url; -use deno_runtime::deno_fetch::reqwest; -use deno_runtime::deno_net::ops_tls::TlsStream; -use deno_runtime::deno_tls::rustls; -use deno_runtime::deno_tls::rustls_pemfile; -use std::fs; -use std::io::BufReader; -use std::io::Cursor; -use std::io::{Read, Write}; -use std::process::Command; -use std::sync::Arc; use test_util as util; -use test_util::TempDir; -use tokio::task::LocalSet; -use trust_dns_client::serialize::txt::Lexer; -use trust_dns_client::serialize::txt::Parser; #[macro_export] macro_rules! itest( @@ -58,6 +42,8 @@ mod bench; mod bundle; #[path = "cache_tests.rs"] mod cache; +#[path = "cert_tests.rs"] +mod cert; #[path = "check_tests.rs"] mod check; #[path = "compile_tests.rs"] @@ -68,6 +54,8 @@ mod coverage; mod doc; #[path = "eval_tests.rs"] mod eval; +#[path = "flags_tests.rs"] +mod flags; #[path = "fmt_tests.rs"] mod fmt; #[path = "info_tests.rs"] @@ -101,917 +89,6 @@ mod watcher; #[path = "worker_tests.rs"] mod worker; -#[test] -fn help_flag() { - let status = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("--help") - .spawn() - .unwrap() - .wait() - .unwrap(); - assert!(status.success()); -} - -#[test] -fn version_short_flag() { - let status = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("-V") - .spawn() - .unwrap() - .wait() - .unwrap(); - assert!(status.success()); -} - -#[test] -fn version_long_flag() { - let status = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("--version") - .spawn() - .unwrap() - .wait() - .unwrap(); - assert!(status.success()); -} - -itest!(types { - args: "types", - output: "types.out", -}); - -#[test] -fn cache_test() { - let _g = util::http_server(); - let deno_dir = TempDir::new(); - let module_url = - url::Url::parse("http://localhost:4545/006_url_imports.ts").unwrap(); - let output = Command::new(util::deno_exe_path()) - .env("DENO_DIR", deno_dir.path()) - .current_dir(util::testdata_path()) - .arg("cache") - .arg("--check=all") - .arg("-L") - .arg("debug") - .arg(module_url.to_string()) - .output() - .expect("Failed to spawn script"); - assert!(output.status.success()); - - let prg = util::deno_exe_path(); - let output = Command::new(&prg) - .env("DENO_DIR", deno_dir.path()) - .env("HTTP_PROXY", "http://nil") - .env("NO_COLOR", "1") - .current_dir(util::testdata_path()) - .arg("run") - .arg(module_url.to_string()) - .output() - .expect("Failed to spawn script"); - - let str_output = std::str::from_utf8(&output.stdout).unwrap(); - - let module_output_path = util::testdata_path().join("006_url_imports.ts.out"); - let mut module_output = String::new(); - let mut module_output_file = fs::File::open(module_output_path).unwrap(); - module_output_file - .read_to_string(&mut module_output) - .unwrap(); - - assert_eq!(module_output, str_output); -} - -#[test] -fn cache_invalidation_test() { - let deno_dir = TempDir::new(); - let fixture_path = deno_dir.path().join("fixture.ts"); - { - let mut file = std::fs::File::create(fixture_path.clone()) - .expect("could not create fixture"); - file - .write_all(b"console.log(\"42\");") - .expect("could not write fixture"); - } - let output = Command::new(util::deno_exe_path()) - .env("DENO_DIR", deno_dir.path()) - .current_dir(util::testdata_path()) - .arg("run") - .arg(fixture_path.to_str().unwrap()) - .output() - .expect("Failed to spawn script"); - assert!(output.status.success()); - let actual = std::str::from_utf8(&output.stdout).unwrap(); - assert_eq!(actual, "42\n"); - { - let mut file = std::fs::File::create(fixture_path.clone()) - .expect("could not create fixture"); - file - .write_all(b"console.log(\"43\");") - .expect("could not write fixture"); - } - let output = Command::new(util::deno_exe_path()) - .env("DENO_DIR", deno_dir.path()) - .current_dir(util::testdata_path()) - .arg("run") - .arg(fixture_path.to_str().unwrap()) - .output() - .expect("Failed to spawn script"); - assert!(output.status.success()); - let actual = std::str::from_utf8(&output.stdout).unwrap(); - assert_eq!(actual, "43\n"); -} - -#[test] -fn cache_invalidation_test_no_check() { - let deno_dir = TempDir::new(); - let fixture_path = deno_dir.path().join("fixture.ts"); - { - let mut file = std::fs::File::create(fixture_path.clone()) - .expect("could not create fixture"); - file - .write_all(b"console.log(\"42\");") - .expect("could not write fixture"); - } - let output = Command::new(util::deno_exe_path()) - .env("DENO_DIR", deno_dir.path()) - .current_dir(util::testdata_path()) - .arg("run") - .arg("--no-check") - .arg(fixture_path.to_str().unwrap()) - .output() - .expect("Failed to spawn script"); - assert!(output.status.success()); - let actual = std::str::from_utf8(&output.stdout).unwrap(); - assert_eq!(actual, "42\n"); - { - let mut file = std::fs::File::create(fixture_path.clone()) - .expect("could not create fixture"); - file - .write_all(b"console.log(\"43\");") - .expect("could not write fixture"); - } - let output = Command::new(util::deno_exe_path()) - .env("DENO_DIR", deno_dir.path()) - .current_dir(util::testdata_path()) - .arg("run") - .arg("--no-check") - .arg(fixture_path.to_str().unwrap()) - .output() - .expect("Failed to spawn script"); - assert!(output.status.success()); - let actual = std::str::from_utf8(&output.stdout).unwrap(); - assert_eq!(actual, "43\n"); -} - -#[test] -fn ts_dependency_recompilation() { - let t = TempDir::new(); - let ats = t.path().join("a.ts"); - - std::fs::write( - &ats, - " - import { foo } from \"./b.ts\"; - - function print(str: string): void { - console.log(str); - } - - print(foo);", - ) - .unwrap(); - - let bts = t.path().join("b.ts"); - std::fs::write( - &bts, - " - export const foo = \"foo\";", - ) - .unwrap(); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .env("NO_COLOR", "1") - .arg("run") - .arg("--check") - .arg(&ats) - .output() - .expect("failed to spawn script"); - - let stdout_output = std::str::from_utf8(&output.stdout).unwrap().trim(); - let stderr_output = std::str::from_utf8(&output.stderr).unwrap().trim(); - - assert!(stdout_output.ends_with("foo")); - assert!(stderr_output.starts_with("Check")); - - // Overwrite contents of b.ts and run again - std::fs::write( - &bts, - " - export const foo = 5;", - ) - .expect("error writing file"); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .env("NO_COLOR", "1") - .arg("run") - .arg("--check") - .arg(&ats) - .output() - .expect("failed to spawn script"); - - let stdout_output = std::str::from_utf8(&output.stdout).unwrap().trim(); - let stderr_output = std::str::from_utf8(&output.stderr).unwrap().trim(); - - // error: TS2345 [ERROR]: Argument of type '5' is not assignable to parameter of type 'string'. - assert!(stderr_output.contains("TS2345")); - assert!(!output.status.success()); - assert!(stdout_output.is_empty()); -} - -#[test] -fn ts_no_recheck_on_redirect() { - let deno_dir = util::new_deno_dir(); - let e = util::deno_exe_path(); - - let redirect_ts = util::testdata_path().join("017_import_redirect.ts"); - assert!(redirect_ts.is_file()); - let mut cmd = Command::new(e.clone()); - cmd.env("DENO_DIR", deno_dir.path()); - let mut initial = cmd - .current_dir(util::testdata_path()) - .arg("run") - .arg("--check") - .arg(redirect_ts.clone()) - .spawn() - .expect("failed to span script"); - let status_initial = - initial.wait().expect("failed to wait for child process"); - assert!(status_initial.success()); - - let mut cmd = Command::new(e); - cmd.env("DENO_DIR", deno_dir.path()); - let output = cmd - .current_dir(util::testdata_path()) - .arg("run") - .arg("--check") - .arg(redirect_ts) - .output() - .expect("failed to spawn script"); - - assert!(std::str::from_utf8(&output.stderr).unwrap().is_empty()); -} - -#[test] -fn timeout_clear() { - // https://github.com/denoland/deno/issues/7599 - - use std::time::Duration; - use std::time::Instant; - - let source_code = r#" -const handle = setTimeout(() => { - console.log("timeout finish"); -}, 10000); -clearTimeout(handle); -console.log("finish"); -"#; - - let mut p = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg("-") - .stdin(std::process::Stdio::piped()) - .spawn() - .unwrap(); - let stdin = p.stdin.as_mut().unwrap(); - stdin.write_all(source_code.as_bytes()).unwrap(); - let start = Instant::now(); - let status = p.wait().unwrap(); - let end = Instant::now(); - assert!(status.success()); - // check that program did not run for 10 seconds - // for timeout to clear - assert!(end - start < Duration::new(10, 0)); -} - -#[test] -fn broken_stdout() { - let (reader, writer) = os_pipe::pipe().unwrap(); - // drop the reader to create a broken pipe - drop(reader); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("eval") - .arg("console.log(3.14)") - .stdout(writer) - .stderr(std::process::Stdio::piped()) - .spawn() - .unwrap() - .wait_with_output() - .unwrap(); - - assert!(!output.status.success()); - let stderr = std::str::from_utf8(output.stderr.as_ref()).unwrap().trim(); - assert!(stderr.contains("Uncaught BrokenPipe")); - assert!(!stderr.contains("panic")); -} - -itest!(error_cause { - args: "run error_cause.ts", - output: "error_cause.ts.out", - exit_code: 1, -}); - -itest!(error_cause_recursive { - args: "run error_cause_recursive.ts", - output: "error_cause_recursive.ts.out", - exit_code: 1, -}); - -itest_flaky!(cafile_url_imports { - args: "run --quiet --reload --cert tls/RootCA.pem cafile_url_imports.ts", - output: "cafile_url_imports.ts.out", - http_server: true, -}); - -itest_flaky!(cafile_ts_fetch { - args: - "run --quiet --reload --allow-net --cert tls/RootCA.pem cafile_ts_fetch.ts", - output: "cafile_ts_fetch.ts.out", - http_server: true, -}); - -itest_flaky!(cafile_eval { - args: "eval --cert tls/RootCA.pem fetch('https://localhost:5545/cafile_ts_fetch.ts.out').then(r=>r.text()).then(t=>console.log(t.trimEnd()))", - output: "cafile_ts_fetch.ts.out", - http_server: true, -}); - -itest_flaky!(cafile_info { - args: - "info --quiet --cert tls/RootCA.pem https://localhost:5545/cafile_info.ts", - output: "cafile_info.ts.out", - http_server: true, -}); - -itest_flaky!(cafile_url_imports_unsafe_ssl { - args: "run --quiet --reload --unsafely-ignore-certificate-errors=localhost cafile_url_imports.ts", - output: "cafile_url_imports_unsafe_ssl.ts.out", - http_server: true, -}); - -itest_flaky!(cafile_ts_fetch_unsafe_ssl { - args: - "run --quiet --reload --allow-net --unsafely-ignore-certificate-errors cafile_ts_fetch.ts", - output: "cafile_ts_fetch_unsafe_ssl.ts.out", - http_server: true, -}); - -itest!(deno_land_unsafe_ssl { - args: - "run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=deno.land deno_land_unsafe_ssl.ts", - output: "deno_land_unsafe_ssl.ts.out", -}); - -itest!(ip_address_unsafe_ssl { - args: - "run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=1.1.1.1 ip_address_unsafe_ssl.ts", - output: "ip_address_unsafe_ssl.ts.out", -}); - -itest!(localhost_unsafe_ssl { - args: - "run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=deno.land cafile_url_imports.ts", - output: "localhost_unsafe_ssl.ts.out", - http_server: true, - exit_code: 1, -}); - -#[flaky_test::flaky_test] -fn cafile_env_fetch() { - use deno_core::url::Url; - let _g = util::http_server(); - let deno_dir = TempDir::new(); - let module_url = - Url::parse("https://localhost:5545/cafile_url_imports.ts").unwrap(); - let cafile = util::testdata_path().join("tls/RootCA.pem"); - let output = Command::new(util::deno_exe_path()) - .env("DENO_DIR", deno_dir.path()) - .env("DENO_CERT", cafile) - .current_dir(util::testdata_path()) - .arg("cache") - .arg(module_url.to_string()) - .output() - .expect("Failed to spawn script"); - assert!(output.status.success()); -} - -#[flaky_test::flaky_test] -fn cafile_fetch() { - use deno_core::url::Url; - let _g = util::http_server(); - let deno_dir = TempDir::new(); - let module_url = - Url::parse("http://localhost:4545/cafile_url_imports.ts").unwrap(); - let cafile = util::testdata_path().join("tls/RootCA.pem"); - let output = Command::new(util::deno_exe_path()) - .env("DENO_DIR", deno_dir.path()) - .current_dir(util::testdata_path()) - .arg("cache") - .arg("--cert") - .arg(cafile) - .arg(module_url.to_string()) - .output() - .expect("Failed to spawn script"); - assert!(output.status.success()); - let out = std::str::from_utf8(&output.stdout).unwrap(); - assert_eq!(out, ""); -} - -#[flaky_test::flaky_test] -fn cafile_install_remote_module() { - let _g = util::http_server(); - let temp_dir = TempDir::new(); - let bin_dir = temp_dir.path().join("bin"); - std::fs::create_dir(&bin_dir).unwrap(); - let deno_dir = TempDir::new(); - let cafile = util::testdata_path().join("tls/RootCA.pem"); - - let install_output = Command::new(util::deno_exe_path()) - .env("DENO_DIR", deno_dir.path()) - .current_dir(util::testdata_path()) - .arg("install") - .arg("--cert") - .arg(cafile) - .arg("--root") - .arg(temp_dir.path()) - .arg("-n") - .arg("echo_test") - .arg("https://localhost:5545/echo.ts") - .output() - .expect("Failed to spawn script"); - println!("{}", std::str::from_utf8(&install_output.stdout).unwrap()); - eprintln!("{}", std::str::from_utf8(&install_output.stderr).unwrap()); - assert!(install_output.status.success()); - - let mut echo_test_path = bin_dir.join("echo_test"); - if cfg!(windows) { - echo_test_path = echo_test_path.with_extension("cmd"); - } - assert!(echo_test_path.exists()); - - let output = Command::new(echo_test_path) - .current_dir(temp_dir.path()) - .arg("foo") - .env("PATH", util::target_dir()) - .output() - .expect("failed to spawn script"); - let stdout = std::str::from_utf8(&output.stdout).unwrap().trim(); - assert!(stdout.ends_with("foo")); -} - -#[flaky_test::flaky_test] -fn cafile_bundle_remote_exports() { - let _g = util::http_server(); - - // First we have to generate a bundle of some remote module that has exports. - let mod1 = "https://localhost:5545/subdir/mod1.ts"; - let cafile = util::testdata_path().join("tls/RootCA.pem"); - let t = TempDir::new(); - let bundle = t.path().join("mod1.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg("--cert") - .arg(cafile) - .arg(mod1) - .arg(&bundle) - .spawn() - .expect("failed to spawn script"); - let status = deno.wait().expect("failed to wait for the child process"); - assert!(status.success()); - assert!(bundle.is_file()); - - // Now we try to use that bundle from another module. - let test = t.path().join("test.js"); - std::fs::write( - &test, - " - import { printHello3 } from \"./mod1.bundle.js\"; - printHello3(); ", - ) - .expect("error writing file"); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg("--check") - .arg(&test) - .output() - .expect("failed to spawn script"); - // check the output of the test.ts program. - assert!(std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .ends_with("Hello")); - assert_eq!(output.stderr, b""); -} - -#[test] -fn websocket() { - let _g = util::http_server(); - - let script = util::testdata_path().join("websocket_test.ts"); - let root_ca = util::testdata_path().join("tls/RootCA.pem"); - let status = util::deno_cmd() - .arg("test") - .arg("--unstable") - .arg("--allow-net") - .arg("--cert") - .arg(root_ca) - .arg(script) - .spawn() - .unwrap() - .wait() - .unwrap(); - - assert!(status.success()); -} - -#[test] -fn websocketstream() { - let _g = util::http_server(); - - let script = util::testdata_path().join("websocketstream_test.ts"); - let root_ca = util::testdata_path().join("tls/RootCA.pem"); - let status = util::deno_cmd() - .arg("test") - .arg("--unstable") - .arg("--allow-net") - .arg("--cert") - .arg(root_ca) - .arg(script) - .spawn() - .unwrap() - .wait() - .unwrap(); - - assert!(status.success()); -} - -#[test] -fn websocketstream_ping() { - use deno_runtime::deno_websocket::tokio_tungstenite::tungstenite; - let _g = util::http_server(); - - let script = util::testdata_path().join("websocketstream_ping_test.ts"); - let root_ca = util::testdata_path().join("tls/RootCA.pem"); - let mut child = util::deno_cmd() - .arg("test") - .arg("--unstable") - .arg("--allow-net") - .arg("--cert") - .arg(root_ca) - .arg(script) - .stdout(std::process::Stdio::piped()) - .spawn() - .unwrap(); - - let server = std::net::TcpListener::bind("127.0.0.1:4513").unwrap(); - let (stream, _) = server.accept().unwrap(); - let mut socket = tungstenite::accept(stream).unwrap(); - socket - .write_message(tungstenite::Message::Text(String::from("A"))) - .unwrap(); - socket - .write_message(tungstenite::Message::Ping(vec![])) - .unwrap(); - socket - .write_message(tungstenite::Message::Text(String::from("B"))) - .unwrap(); - let message = socket.read_message().unwrap(); - assert_eq!(message, tungstenite::Message::Pong(vec![])); - socket - .write_message(tungstenite::Message::Text(String::from("C"))) - .unwrap(); - socket.close(None).unwrap(); - - assert!(child.wait().unwrap().success()); -} - -#[test] -fn websocket_server_multi_field_connection_header() { - let script = util::testdata_path() - .join("websocket_server_multi_field_connection_header_test.ts"); - let root_ca = util::testdata_path().join("tls/RootCA.pem"); - let mut child = util::deno_cmd() - .arg("run") - .arg("--unstable") - .arg("--allow-net") - .arg("--cert") - .arg(root_ca) - .arg(script) - .stdout(std::process::Stdio::piped()) - .spawn() - .unwrap(); - - let stdout = child.stdout.as_mut().unwrap(); - let mut buffer = [0; 5]; - let read = stdout.read(&mut buffer).unwrap(); - assert_eq!(read, 5); - let msg = std::str::from_utf8(&buffer).unwrap(); - assert_eq!(msg, "READY"); - - let req = http::request::Builder::new() - .header(http::header::CONNECTION, "keep-alive, Upgrade") - .uri("ws://localhost:4319") - .body(()) - .unwrap(); - let (mut socket, _) = - deno_runtime::deno_websocket::tokio_tungstenite::tungstenite::connect(req) - .unwrap(); - let message = socket.read_message().unwrap(); - assert_eq!(message, deno_runtime::deno_websocket::tokio_tungstenite::tungstenite::Message::Close(None)); - socket.close(None).unwrap(); - assert!(child.wait().unwrap().success()); -} - -// TODO(bartlomieju): this should use `deno run`, not `deno test`; but the -// test hangs then. https://github.com/denoland/deno/issues/14283 -#[test] -#[ignore] -fn websocket_server_idletimeout() { - let script = util::testdata_path().join("websocket_server_idletimeout.ts"); - let root_ca = util::testdata_path().join("tls/RootCA.pem"); - let mut child = util::deno_cmd() - .arg("test") - .arg("--unstable") - .arg("--allow-net") - .arg("--cert") - .arg(root_ca) - .arg(script) - .stdout(std::process::Stdio::piped()) - .spawn() - .unwrap(); - - let stdout = child.stdout.as_mut().unwrap(); - let mut buffer = [0; 5]; - let read = stdout.read(&mut buffer).unwrap(); - assert_eq!(read, 5); - let msg = std::str::from_utf8(&buffer).unwrap(); - assert_eq!(msg, "READY"); - - let req = http::request::Builder::new() - .uri("ws://localhost:4509") - .body(()) - .unwrap(); - let (_ws, _request) = - deno_runtime::deno_websocket::tokio_tungstenite::tungstenite::connect(req) - .unwrap(); - - assert!(child.wait().unwrap().success()); -} - -#[cfg(not(windows))] -#[test] -fn set_raw_should_not_panic_on_no_tty() { - let output = util::deno_cmd() - .arg("eval") - .arg("--unstable") - .arg("Deno.setRaw(Deno.stdin.rid, true)") - // stdin set to piped so it certainly does not refer to TTY - .stdin(std::process::Stdio::piped()) - // stderr is piped so we can capture output. - .stderr(std::process::Stdio::piped()) - .spawn() - .unwrap() - .wait_with_output() - .unwrap(); - assert!(!output.status.success()); - let stderr = std::str::from_utf8(&output.stderr).unwrap().trim(); - assert!(stderr.contains("BadResource")); -} - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn test_resolve_dns() { - use std::net::SocketAddr; - use std::str::FromStr; - use std::sync::Arc; - use std::time::Duration; - use tokio::net::TcpListener; - use tokio::net::UdpSocket; - use tokio::sync::oneshot; - use trust_dns_server::authority::Catalog; - use trust_dns_server::authority::ZoneType; - use trust_dns_server::proto::rr::Name; - use trust_dns_server::store::in_memory::InMemoryAuthority; - use trust_dns_server::ServerFuture; - - const DNS_PORT: u16 = 4553; - - // Setup DNS server for testing - async fn run_dns_server(tx: oneshot::Sender<()>) { - let zone_file = - fs::read_to_string(util::testdata_path().join("resolve_dns.zone.in")) - .unwrap(); - let lexer = Lexer::new(&zone_file); - let records = Parser::new().parse( - lexer, - Some(Name::from_str("example.com").unwrap()), - None, - ); - if records.is_err() { - panic!("failed to parse: {:?}", records.err()) - } - let (origin, records) = records.unwrap(); - let authority = Box::new(Arc::new( - InMemoryAuthority::new(origin, records, ZoneType::Primary, false) - .unwrap(), - )); - let mut catalog: Catalog = Catalog::new(); - catalog.upsert(Name::root().into(), authority); - - let mut server_fut = ServerFuture::new(catalog); - let socket_addr = SocketAddr::from(([127, 0, 0, 1], DNS_PORT)); - let tcp_listener = TcpListener::bind(socket_addr).await.unwrap(); - let udp_socket = UdpSocket::bind(socket_addr).await.unwrap(); - server_fut.register_socket(udp_socket); - server_fut.register_listener(tcp_listener, Duration::from_secs(2)); - - // Notifies that the DNS server is ready - tx.send(()).unwrap(); - - server_fut.block_until_done().await.unwrap(); - } - - let (ready_tx, ready_rx) = oneshot::channel(); - let dns_server_fut = run_dns_server(ready_tx); - let handle = tokio::spawn(dns_server_fut); - - // Waits for the DNS server to be ready - ready_rx.await.unwrap(); - - // Pass: `--allow-net` - { - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .env("NO_COLOR", "1") - .arg("run") - .arg("--check") - .arg("--allow-net") - .arg("resolve_dns.ts") - .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .spawn() - .unwrap() - .wait_with_output() - .unwrap(); - let err = String::from_utf8_lossy(&output.stderr); - let out = String::from_utf8_lossy(&output.stdout); - println!("{}", err); - assert!(output.status.success()); - assert!(err.starts_with("Check file")); - - let expected = - std::fs::read_to_string(util::testdata_path().join("resolve_dns.ts.out")) - .unwrap(); - assert_eq!(expected, out); - } - - // Pass: `--allow-net=127.0.0.1:4553` - { - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .env("NO_COLOR", "1") - .arg("run") - .arg("--check") - .arg("--allow-net=127.0.0.1:4553") - .arg("resolve_dns.ts") - .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .spawn() - .unwrap() - .wait_with_output() - .unwrap(); - let err = String::from_utf8_lossy(&output.stderr); - let out = String::from_utf8_lossy(&output.stdout); - assert!(output.status.success()); - assert!(err.starts_with("Check file")); - - let expected = - std::fs::read_to_string(util::testdata_path().join("resolve_dns.ts.out")) - .unwrap(); - assert_eq!(expected, out); - } - - // Permission error: `--allow-net=deno.land` - { - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .env("NO_COLOR", "1") - .arg("run") - .arg("--check") - .arg("--allow-net=deno.land") - .arg("resolve_dns.ts") - .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .spawn() - .unwrap() - .wait_with_output() - .unwrap(); - let err = String::from_utf8_lossy(&output.stderr); - let out = String::from_utf8_lossy(&output.stdout); - assert!(!output.status.success()); - assert!(err.starts_with("Check file")); - assert!(err.contains(r#"error: Uncaught PermissionDenied: Requires net access to "127.0.0.1:4553""#)); - assert!(out.is_empty()); - } - - // Permission error: no permission specified - { - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .env("NO_COLOR", "1") - .arg("run") - .arg("--check") - .arg("resolve_dns.ts") - .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .spawn() - .unwrap() - .wait_with_output() - .unwrap(); - let err = String::from_utf8_lossy(&output.stderr); - let out = String::from_utf8_lossy(&output.stdout); - assert!(!output.status.success()); - assert!(err.starts_with("Check file")); - assert!(err.contains(r#"error: Uncaught PermissionDenied: Requires net access to "127.0.0.1:4553""#)); - assert!(out.is_empty()); - } - - handle.abort(); -} - -#[test] -fn typecheck_declarations_ns() { - let output = util::deno_cmd() - .arg("test") - .arg("--doc") - .arg(util::root_path().join("cli/dts/lib.deno.ns.d.ts")) - .output() - .unwrap(); - println!("stdout: {}", String::from_utf8(output.stdout).unwrap()); - println!("stderr: {}", String::from_utf8(output.stderr).unwrap()); - assert!(output.status.success()); -} - -#[test] -fn typecheck_declarations_unstable() { - let output = util::deno_cmd() - .arg("test") - .arg("--doc") - .arg("--unstable") - .arg(util::root_path().join("cli/dts/lib.deno.unstable.d.ts")) - .output() - .unwrap(); - println!("stdout: {}", String::from_utf8(output.stdout).unwrap()); - println!("stderr: {}", String::from_utf8(output.stderr).unwrap()); - assert!(output.status.success()); -} - -#[test] -fn typecheck_core() { - let deno_dir = TempDir::new(); - let test_file = deno_dir.path().join("test_deno_core_types.ts"); - std::fs::write( - &test_file, - format!( - "import \"{}\";", - deno_core::resolve_path( - util::root_path() - .join("core/lib.deno_core.d.ts") - .to_str() - .unwrap() - ) - .unwrap() - ), - ) - .unwrap(); - let output = util::deno_cmd_with_deno_dir(&deno_dir) - .arg("run") - .arg(test_file.to_str().unwrap()) - .output() - .unwrap(); - println!("stdout: {}", String::from_utf8(output.stdout).unwrap()); - println!("stderr: {}", String::from_utf8(output.stderr).unwrap()); - assert!(output.status.success()); -} - #[test] fn js_unit_tests_lint() { let status = util::deno_cmd() @@ -1047,211 +124,3 @@ fn js_unit_tests() { assert_eq!(Some(0), status.code()); assert!(status.success()); } - -#[test] -fn basic_auth_tokens() { - let _g = util::http_server(); - - let output = util::deno_cmd() - .current_dir(util::root_path()) - .arg("run") - .arg("http://127.0.0.1:4554/001_hello.js") - .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .spawn() - .unwrap() - .wait_with_output() - .unwrap(); - - assert!(!output.status.success()); - - let stdout_str = std::str::from_utf8(&output.stdout).unwrap().trim(); - assert!(stdout_str.is_empty()); - - let stderr_str = std::str::from_utf8(&output.stderr).unwrap().trim(); - eprintln!("{}", stderr_str); - - assert!(stderr_str - .contains("Module not found \"http://127.0.0.1:4554/001_hello.js\".")); - - let output = util::deno_cmd() - .current_dir(util::root_path()) - .arg("run") - .arg("http://127.0.0.1:4554/001_hello.js") - .env("DENO_AUTH_TOKENS", "testuser123:testpassabc@127.0.0.1:4554") - .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .spawn() - .unwrap() - .wait_with_output() - .unwrap(); - - let stderr_str = std::str::from_utf8(&output.stderr).unwrap().trim(); - eprintln!("{}", stderr_str); - - assert!(output.status.success()); - - let stdout_str = std::str::from_utf8(&output.stdout).unwrap().trim(); - assert_eq!(util::strip_ansi_codes(stdout_str), "Hello World"); -} - -#[tokio::test] -async fn listen_tls_alpn() { - // TLS streams require the presence of an ambient local task set to gracefully - // close dropped connections in the background. - LocalSet::new() - .run_until(async { - let mut child = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg("--unstable") - .arg("--quiet") - .arg("--allow-net") - .arg("--allow-read") - .arg("./listen_tls_alpn.ts") - .arg("4504") - .stdout(std::process::Stdio::piped()) - .spawn() - .unwrap(); - let stdout = child.stdout.as_mut().unwrap(); - let mut msg = [0; 5]; - let read = stdout.read(&mut msg).unwrap(); - assert_eq!(read, 5); - assert_eq!(&msg, b"READY"); - - let mut reader = &mut BufReader::new(Cursor::new(include_bytes!( - "../testdata/tls/RootCA.crt" - ))); - let certs = rustls_pemfile::certs(&mut reader).unwrap(); - let mut root_store = rustls::RootCertStore::empty(); - root_store.add_parsable_certificates(&certs); - let mut cfg = rustls::ClientConfig::builder() - .with_safe_defaults() - .with_root_certificates(root_store) - .with_no_client_auth(); - cfg.alpn_protocols.push(b"foobar".to_vec()); - let cfg = Arc::new(cfg); - - let hostname = rustls::ServerName::try_from("localhost").unwrap(); - - let tcp_stream = tokio::net::TcpStream::connect("localhost:4504") - .await - .unwrap(); - let mut tls_stream = - TlsStream::new_client_side(tcp_stream, cfg, hostname); - - tls_stream.handshake().await.unwrap(); - - let (_, rustls_connection) = tls_stream.get_ref(); - let alpn = rustls_connection.alpn_protocol().unwrap(); - assert_eq!(alpn, b"foobar"); - - let status = child.wait().unwrap(); - assert!(status.success()); - }) - .await; -} - -#[tokio::test] -async fn listen_tls_alpn_fail() { - // TLS streams require the presence of an ambient local task set to gracefully - // close dropped connections in the background. - LocalSet::new() - .run_until(async { - let mut child = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg("--unstable") - .arg("--quiet") - .arg("--allow-net") - .arg("--allow-read") - .arg("./listen_tls_alpn_fail.ts") - .arg("4505") - .stdout(std::process::Stdio::piped()) - .spawn() - .unwrap(); - let stdout = child.stdout.as_mut().unwrap(); - let mut msg = [0; 5]; - let read = stdout.read(&mut msg).unwrap(); - assert_eq!(read, 5); - assert_eq!(&msg, b"READY"); - - let mut reader = &mut BufReader::new(Cursor::new(include_bytes!( - "../testdata/tls/RootCA.crt" - ))); - let certs = rustls_pemfile::certs(&mut reader).unwrap(); - let mut root_store = rustls::RootCertStore::empty(); - root_store.add_parsable_certificates(&certs); - let mut cfg = rustls::ClientConfig::builder() - .with_safe_defaults() - .with_root_certificates(root_store) - .with_no_client_auth(); - cfg.alpn_protocols.push(b"boofar".to_vec()); - let cfg = Arc::new(cfg); - - let hostname = rustls::ServerName::try_from("localhost").unwrap(); - - let tcp_stream = tokio::net::TcpStream::connect("localhost:4505") - .await - .unwrap(); - let mut tls_stream = - TlsStream::new_client_side(tcp_stream, cfg, hostname); - - tls_stream.handshake().await.unwrap_err(); - - let (_, rustls_connection) = tls_stream.get_ref(); - assert!(rustls_connection.alpn_protocol().is_none()); - - let status = child.wait().unwrap(); - assert!(status.success()); - }) - .await; -} - -#[tokio::test] -async fn http2_request_url() { - // TLS streams require the presence of an ambient local task set to gracefully - // close dropped connections in the background. - LocalSet::new() - .run_until(async { - let mut child = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg("--unstable") - .arg("--quiet") - .arg("--allow-net") - .arg("--allow-read") - .arg("./http2_request_url.ts") - .arg("4506") - .stdout(std::process::Stdio::piped()) - .spawn() - .unwrap(); - let stdout = child.stdout.as_mut().unwrap(); - let mut buffer = [0; 5]; - let read = stdout.read(&mut buffer).unwrap(); - assert_eq!(read, 5); - let msg = std::str::from_utf8(&buffer).unwrap(); - assert_eq!(msg, "READY"); - - let cert = reqwest::Certificate::from_pem(include_bytes!( - "../testdata/tls/RootCA.crt" - )) - .unwrap(); - - let client = reqwest::Client::builder() - .add_root_certificate(cert) - .http2_prior_knowledge() - .build() - .unwrap(); - - let res = client.get("http://127.0.0.1:4506").send().await.unwrap(); - assert_eq!(200, res.status()); - - let body = res.text().await.unwrap(); - assert_eq!(body, "http://127.0.0.1:4506/"); - - child.kill().unwrap(); - child.wait().unwrap(); - }) - .await; -} diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index cdeb36c9c..44c7ec08f 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -160,9 +160,9 @@ fn pty_complete_expression() { fn pty_complete_imports() { util::with_pty(&["repl"], |mut console| { // single quotes - console.write_line("import './001_hel\t'"); + console.write_line("import './run/001_hel\t'"); // double quotes - console.write_line("import { output } from \"./045_out\t\""); + console.write_line("import { output } from \"./run/045_out\t\""); console.write_line("output('testing output');"); console.write_line("close();"); @@ -179,7 +179,7 @@ fn pty_complete_imports() { // ensure when the directory changes that the suggestions come from the cwd util::with_pty(&["repl"], |mut console| { console.write_line("Deno.chdir('./subdir');"); - console.write_line("import '../001_hel\t'"); + console.write_line("import '../run/001_hel\t'"); console.write_line("close();"); let output = console.read_all_output(); @@ -750,7 +750,7 @@ fn eval_flag_runtime_error() { fn eval_file_flag_valid_input() { let (out, err) = util::run_and_collect_output_with_args( true, - vec!["repl", "--eval-file=./001_hello.js"], + vec!["repl", "--eval-file=./run/001_hello.js"], None, None, false, @@ -789,7 +789,7 @@ fn eval_file_flag_http_input() { fn eval_file_flag_multiple_files() { let (out, err) = util::run_and_collect_output_with_args( true, - vec!["repl", "--eval-file=http://127.0.0.1:4545/import_type.ts,./tsc/d.ts,http://127.0.0.1:4545/type_definitions/foo.js"], + vec!["repl", "--eval-file=http://127.0.0.1:4545/repl/import_type.ts,./tsc/d.ts,http://127.0.0.1:4545/type_definitions/foo.js"], Some(vec!["b.method1=v4", "b.method1()+foo.toUpperCase()"]), None, true, diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index d4dfbb32b..55dac8573 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -1,10 +1,16 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::url; +use deno_runtime::deno_fetch::reqwest; +use std::io::Read; +use std::io::Write; use std::process::Command; use std::process::Stdio; use test_util as util; use test_util::TempDir; +use tokio::task::LocalSet; +use trust_dns_client::serialize::txt::Lexer; +use trust_dns_client::serialize::txt::Parser; use util::assert_contains; itest!(stdout_write_all { @@ -24,248 +30,251 @@ itest!(stdout_write_sync_async { }); itest!(_001_hello { - args: "run --reload 001_hello.js", - output: "001_hello.js.out", + args: "run --reload run/001_hello.js", + output: "run/001_hello.js.out", }); itest!(_002_hello { - args: "run --quiet --reload 002_hello.ts", - output: "002_hello.ts.out", + args: "run --quiet --reload run/002_hello.ts", + output: "run/002_hello.ts.out", }); itest!(_003_relative_import { - args: "run --quiet --reload 003_relative_import.ts", - output: "003_relative_import.ts.out", + args: "run --quiet --reload run/003_relative_import.ts", + output: "run/003_relative_import.ts.out", }); itest!(_004_set_timeout { - args: "run --quiet --reload 004_set_timeout.ts", - output: "004_set_timeout.ts.out", + args: "run --quiet --reload run/004_set_timeout.ts", + output: "run/004_set_timeout.ts.out", }); itest!(_005_more_imports { - args: "run --quiet --reload 005_more_imports.ts", - output: "005_more_imports.ts.out", + args: "run --quiet --reload run/005_more_imports.ts", + output: "run/005_more_imports.ts.out", }); itest!(_006_url_imports { - args: "run --quiet --reload 006_url_imports.ts", - output: "006_url_imports.ts.out", + args: "run --quiet --reload run/006_url_imports.ts", + output: "run/006_url_imports.ts.out", http_server: true, }); itest!(_012_async { - args: "run --quiet --reload 012_async.ts", - output: "012_async.ts.out", + args: "run --quiet --reload run/012_async.ts", + output: "run/012_async.ts.out", }); itest!(_013_dynamic_import { - args: "run --quiet --reload --allow-read 013_dynamic_import.ts", - output: "013_dynamic_import.ts.out", + args: "run --quiet --reload --allow-read run/013_dynamic_import.ts", + output: "run/013_dynamic_import.ts.out", }); itest!(_014_duplicate_import { - args: "run --quiet --reload --allow-read 014_duplicate_import.ts ", - output: "014_duplicate_import.ts.out", + args: "run --quiet --reload --allow-read run/014_duplicate_import.ts ", + output: "run/014_duplicate_import.ts.out", }); itest!(_015_duplicate_parallel_import { - args: "run --quiet --reload --allow-read 015_duplicate_parallel_import.js", - output: "015_duplicate_parallel_import.js.out", + args: + "run --quiet --reload --allow-read run/015_duplicate_parallel_import.js", + output: "run/015_duplicate_parallel_import.js.out", }); itest!(_016_double_await { - args: "run --quiet --allow-read --reload 016_double_await.ts", - output: "016_double_await.ts.out", + args: "run --quiet --allow-read --reload run/016_double_await.ts", + output: "run/016_double_await.ts.out", }); itest!(_017_import_redirect { - args: "run --quiet --reload 017_import_redirect.ts", - output: "017_import_redirect.ts.out", + args: "run --quiet --reload run/017_import_redirect.ts", + output: "run/017_import_redirect.ts.out", }); itest!(_017_import_redirect_nocheck { - args: "run --quiet --reload --no-check 017_import_redirect.ts", - output: "017_import_redirect.ts.out", + args: "run --quiet --reload --no-check run/017_import_redirect.ts", + output: "run/017_import_redirect.ts.out", }); itest!(_017_import_redirect_info { - args: "info --quiet --reload 017_import_redirect.ts", - output: "017_import_redirect_info.out", + args: "info --quiet --reload run/017_import_redirect.ts", + output: "run/017_import_redirect_info.out", }); itest!(_018_async_catch { - args: "run --quiet --reload 018_async_catch.ts", - output: "018_async_catch.ts.out", + args: "run --quiet --reload run/018_async_catch.ts", + output: "run/018_async_catch.ts.out", }); itest!(_019_media_types { - args: "run --reload 019_media_types.ts", - output: "019_media_types.ts.out", + args: "run --reload run/019_media_types.ts", + output: "run/019_media_types.ts.out", http_server: true, }); itest!(_020_json_modules { - args: "run --reload 020_json_modules.ts", - output: "020_json_modules.ts.out", + args: "run --reload run/020_json_modules.ts", + output: "run/020_json_modules.ts.out", exit_code: 1, }); itest!(_021_mjs_modules { - args: "run --quiet --reload 021_mjs_modules.ts", - output: "021_mjs_modules.ts.out", + args: "run --quiet --reload run/021_mjs_modules.ts", + output: "run/021_mjs_modules.ts.out", }); itest!(_023_no_ext { - args: "run --reload --check 023_no_ext", - output: "023_no_ext.out", + args: "run --reload --check run/023_no_ext", + output: "run/023_no_ext.out", }); // TODO(lucacasonato): remove --unstable when permissions goes stable itest!(_025_hrtime { - args: "run --quiet --allow-hrtime --unstable --reload 025_hrtime.ts", - output: "025_hrtime.ts.out", + args: "run --quiet --allow-hrtime --unstable --reload run/025_hrtime.ts", + output: "run/025_hrtime.ts.out", }); itest!(_025_reload_js_type_error { - args: "run --quiet --reload 025_reload_js_type_error.js", - output: "025_reload_js_type_error.js.out", + args: "run --quiet --reload run/025_reload_js_type_error.js", + output: "run/025_reload_js_type_error.js.out", }); itest!(_026_redirect_javascript { - args: "run --quiet --reload 026_redirect_javascript.js", - output: "026_redirect_javascript.js.out", + args: "run --quiet --reload run/026_redirect_javascript.js", + output: "run/026_redirect_javascript.js.out", http_server: true, }); itest!(_027_redirect_typescript { - args: "run --quiet --reload 027_redirect_typescript.ts", - output: "027_redirect_typescript.ts.out", + args: "run --quiet --reload run/027_redirect_typescript.ts", + output: "run/027_redirect_typescript.ts.out", http_server: true, }); itest!(_028_args { - args: "run --quiet --reload 028_args.ts --arg1 val1 --arg2=val2 -- arg3 arg4", - output: "028_args.ts.out", + args: + "run --quiet --reload run/028_args.ts --arg1 val1 --arg2=val2 -- arg3 arg4", + output: "run/028_args.ts.out", }); itest!(_033_import_map { args: "run --quiet --reload --import-map=import_maps/import_map.json import_maps/test.ts", - output: "033_import_map.out", + output: "run/033_import_map.out", }); itest!(_033_import_map_remote { args: "run --quiet --reload --import-map=http://127.0.0.1:4545/import_maps/import_map_remote.json --unstable import_maps/test_remote.ts", - output: "033_import_map_remote.out", + output: "run/033_import_map_remote.out", http_server: true, }); -itest!(_034_onload { - args: "run --quiet --reload 034_onload/main.ts", - output: "034_onload.out", +itest!(onload { + args: "run --quiet --reload run/onload/main.ts", + output: "run/onload/main.out", }); itest!(_035_cached_only_flag { - args: "run --reload --check --cached-only http://127.0.0.1:4545/019_media_types.ts", - output: "035_cached_only_flag.out", + args: "run --reload --check --cached-only http://127.0.0.1:4545/run/019_media_types.ts", + output: "run/035_cached_only_flag.out", exit_code: 1, http_server: true, }); itest!(_038_checkjs { // checking if JS file is run through TS compiler - args: "run --reload --config checkjs.tsconfig.json --check 038_checkjs.js", + args: + "run --reload --config run/checkjs.tsconfig.json --check run/038_checkjs.js", exit_code: 1, - output: "038_checkjs.js.out", + output: "run/038_checkjs.js.out", }); itest!(_042_dyn_import_evalcontext { - args: "run --quiet --allow-read --reload 042_dyn_import_evalcontext.ts", - output: "042_dyn_import_evalcontext.ts.out", + args: "run --quiet --allow-read --reload run/042_dyn_import_evalcontext.ts", + output: "run/042_dyn_import_evalcontext.ts.out", }); itest!(_044_bad_resource { - args: "run --quiet --reload --allow-read 044_bad_resource.ts", - output: "044_bad_resource.ts.out", + args: "run --quiet --reload --allow-read run/044_bad_resource.ts", + output: "run/044_bad_resource.ts.out", exit_code: 1, }); // TODO(bartlomieju): remove --unstable once Deno.spawn is stabilized itest!(_045_proxy { - args: "run -L debug --unstable --allow-net --allow-env --allow-run --allow-read --reload --quiet 045_proxy_test.ts", - output: "045_proxy_test.ts.out", + args: "run -L debug --unstable --allow-net --allow-env --allow-run --allow-read --reload --quiet run/045_proxy_test.ts", + output: "run/045_proxy_test.ts.out", http_server: true, }); itest!(_046_tsx { - args: "run --quiet --reload 046_jsx_test.tsx", - output: "046_jsx_test.tsx.out", + args: "run --quiet --reload run/046_jsx_test.tsx", + output: "run/046_jsx_test.tsx.out", }); itest!(_047_jsx { - args: "run --quiet --reload 047_jsx_test.jsx", - output: "047_jsx_test.jsx.out", + args: "run --quiet --reload run/047_jsx_test.jsx", + output: "run/047_jsx_test.jsx.out", }); itest!(_048_media_types_jsx { - args: "run --reload 048_media_types_jsx.ts", - output: "048_media_types_jsx.ts.out", + args: "run --reload run/048_media_types_jsx.ts", + output: "run/048_media_types_jsx.ts.out", http_server: true, }); itest!(_052_no_remote_flag { args: - "run --reload --check --no-remote http://127.0.0.1:4545/019_media_types.ts", - output: "052_no_remote_flag.out", + "run --reload --check --no-remote http://127.0.0.1:4545/run/019_media_types.ts", + output: "run/052_no_remote_flag.out", exit_code: 1, http_server: true, }); itest!(_056_make_temp_file_write_perm { args: - "run --quiet --allow-read --allow-write=./subdir/ 056_make_temp_file_write_perm.ts", - output: "056_make_temp_file_write_perm.out", + "run --quiet --allow-read --allow-write=./subdir/ run/056_make_temp_file_write_perm.ts", + output: "run/056_make_temp_file_write_perm.out", }); itest!(_058_tasks_microtasks_close { - args: "run --quiet 058_tasks_microtasks_close.ts", - output: "058_tasks_microtasks_close.ts.out", + args: "run --quiet run/058_tasks_microtasks_close.ts", + output: "run/058_tasks_microtasks_close.ts.out", }); itest!(_059_fs_relative_path_perm { - args: "run 059_fs_relative_path_perm.ts", - output: "059_fs_relative_path_perm.ts.out", + args: "run run/059_fs_relative_path_perm.ts", + output: "run/059_fs_relative_path_perm.ts.out", exit_code: 1, }); itest!(_070_location { - args: "run --location https://foo/bar?baz#bat 070_location.ts", - output: "070_location.ts.out", + args: "run --location https://foo/bar?baz#bat run/070_location.ts", + output: "run/070_location.ts.out", }); itest!(_071_location_unset { - args: "run 071_location_unset.ts", - output: "071_location_unset.ts.out", + args: "run run/071_location_unset.ts", + output: "run/071_location_unset.ts.out", }); itest!(_072_location_relative_fetch { - args: "run --location http://127.0.0.1:4545/ --allow-net 072_location_relative_fetch.ts", - output: "072_location_relative_fetch.ts.out", + args: "run --location http://127.0.0.1:4545/ --allow-net run/072_location_relative_fetch.ts", + output: "run/072_location_relative_fetch.ts.out", http_server: true, }); -// tests the serialization of webstorage (both localStorage and sessionStorage) -itest!(webstorage_serialization { - args: "run webstorage/serialization.ts", - output: "webstorage/serialization.ts.out", -}); - // tests the beforeunload event itest!(beforeunload_event { - args: "run before_unload.js", - output: "before_unload.js.out", + args: "run run/before_unload.js", + output: "run/before_unload.js.out", +}); + +// tests the serialization of webstorage (both localStorage and sessionStorage) +itest!(webstorage_serialization { + args: "run run/webstorage/serialization.ts", + output: "run/webstorage/serialization.ts.out", }); // tests to ensure that when `--location` is set, all code shares the same @@ -280,7 +289,7 @@ fn webstorage_location_shares_origin() { .arg("run") .arg("--location") .arg("https://example.com/a.ts") - .arg("webstorage/fixture.ts") + .arg("run/webstorage/fixture.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -295,7 +304,7 @@ fn webstorage_location_shares_origin() { .arg("run") .arg("--location") .arg("https://example.com/b.ts") - .arg("webstorage/logger.ts") + .arg("run/webstorage/logger.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -316,8 +325,8 @@ fn webstorage_config_file() { .current_dir(util::testdata_path()) .arg("run") .arg("--config") - .arg("webstorage/config_a.jsonc") - .arg("webstorage/fixture.ts") + .arg("run/webstorage/config_a.jsonc") + .arg("run/webstorage/fixture.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -331,8 +340,8 @@ fn webstorage_config_file() { .current_dir(util::testdata_path()) .arg("run") .arg("--config") - .arg("webstorage/config_b.jsonc") - .arg("webstorage/logger.ts") + .arg("run/webstorage/config_b.jsonc") + .arg("run/webstorage/logger.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -346,8 +355,8 @@ fn webstorage_config_file() { .current_dir(util::testdata_path()) .arg("run") .arg("--config") - .arg("webstorage/config_a.jsonc") - .arg("webstorage/logger.ts") + .arg("run/webstorage/config_a.jsonc") + .arg("run/webstorage/logger.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -370,8 +379,8 @@ fn webstorage_location_precedes_config() { .arg("--location") .arg("https://example.com/a.ts") .arg("--config") - .arg("webstorage/config_a.jsonc") - .arg("webstorage/fixture.ts") + .arg("run/webstorage/config_a.jsonc") + .arg("run/webstorage/fixture.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -387,8 +396,8 @@ fn webstorage_location_precedes_config() { .arg("--location") .arg("https://example.com/b.ts") .arg("--config") - .arg("webstorage/config_b.jsonc") - .arg("webstorage/logger.ts") + .arg("run/webstorage/config_b.jsonc") + .arg("run/webstorage/logger.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -408,7 +417,7 @@ fn webstorage_main_module() { let output = deno_cmd .current_dir(util::testdata_path()) .arg("run") - .arg("webstorage/fixture.ts") + .arg("run/webstorage/fixture.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -421,7 +430,7 @@ fn webstorage_main_module() { let output = deno_cmd .current_dir(util::testdata_path()) .arg("run") - .arg("webstorage/logger.ts") + .arg("run/webstorage/logger.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -434,7 +443,7 @@ fn webstorage_main_module() { let output = deno_cmd .current_dir(util::testdata_path()) .arg("run") - .arg("webstorage/fixture.ts") + .arg("run/webstorage/fixture.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -445,36 +454,37 @@ fn webstorage_main_module() { } itest!(_075_import_local_query_hash { - args: "run 075_import_local_query_hash.ts", - output: "075_import_local_query_hash.ts.out", + args: "run run/075_import_local_query_hash.ts", + output: "run/075_import_local_query_hash.ts.out", }); itest!(_077_fetch_empty { - args: "run -A 077_fetch_empty.ts", - output: "077_fetch_empty.ts.out", + args: "run -A run/077_fetch_empty.ts", + output: "run/077_fetch_empty.ts.out", exit_code: 1, }); itest!(_078_unload_on_exit { - args: "run 078_unload_on_exit.ts", - output: "078_unload_on_exit.ts.out", + args: "run run/078_unload_on_exit.ts", + output: "run/078_unload_on_exit.ts.out", exit_code: 1, }); itest!(_079_location_authentication { - args: "run --location https://foo:bar@baz/qux 079_location_authentication.ts", - output: "079_location_authentication.ts.out", + args: + "run --location https://foo:bar@baz/qux run/079_location_authentication.ts", + output: "run/079_location_authentication.ts.out", }); itest!(_081_location_relative_fetch_redirect { - args: "run --location http://127.0.0.1:4546/ --allow-net 081_location_relative_fetch_redirect.ts", - output: "081_location_relative_fetch_redirect.ts.out", + args: "run --location http://127.0.0.1:4546/ --allow-net run/081_location_relative_fetch_redirect.ts", + output: "run/081_location_relative_fetch_redirect.ts.out", http_server: true, }); itest!(_082_prepare_stack_trace_throw { - args: "run 082_prepare_stack_trace_throw.js", - output: "082_prepare_stack_trace_throw.js.out", + args: "run run/082_prepare_stack_trace_throw.js", + output: "run/082_prepare_stack_trace_throw.js.out", exit_code: 1, }); @@ -482,9 +492,10 @@ itest!(_082_prepare_stack_trace_throw { fn _083_legacy_external_source_map() { let _g = util::http_server(); let deno_dir = TempDir::new(); - let module_url = - url::Url::parse("http://localhost:4545/083_legacy_external_source_map.ts") - .unwrap(); + let module_url = url::Url::parse( + "http://localhost:4545/run/083_legacy_external_source_map.ts", + ) + .unwrap(); // Write a faulty old external source map. let faulty_map_path = deno_dir.path().join("gen/http/localhost_PORT4545/9576bd5febd0587c5c4d88d57cb3ac8ebf2600c529142abe3baa9a751d20c334.js.map"); std::fs::create_dir_all(faulty_map_path.parent().unwrap()).unwrap(); @@ -505,35 +516,35 @@ fn _083_legacy_external_source_map() { assert_eq!(out, ""); } -itest!(_085_dynamic_import_async_error { - args: "run --allow-read 085_dynamic_import_async_error.ts", - output: "085_dynamic_import_async_error.ts.out", +itest!(dynamic_import_async_error { + args: "run --allow-read run/dynamic_import_async_error/main.ts", + output: "run/dynamic_import_async_error/main.out", }); -itest!(_086_dynamic_import_already_rejected { - args: "run --allow-read 086_dynamic_import_already_rejected.ts", - output: "086_dynamic_import_already_rejected.ts.out", +itest!(dynamic_import_already_rejected { + args: "run --allow-read run/dynamic_import_already_rejected/main.ts", + output: "run/dynamic_import_already_rejected/main.out", }); -itest!(_087_no_check_imports_not_used_as_values { - args: "run --config preserve_imports.tsconfig.json --no-check 087_no_check_imports_not_used_as_values.ts", - output: "087_no_check_imports_not_used_as_values.ts.out", +itest!(no_check_imports_not_used_as_values { + args: "run --config run/no_check_imports_not_used_as_values/preserve_imports.tsconfig.json --no-check run/no_check_imports_not_used_as_values/main.ts", + output: "run/no_check_imports_not_used_as_values/main.out", }); itest!(_088_dynamic_import_already_evaluating { - args: "run --allow-read 088_dynamic_import_already_evaluating.ts", - output: "088_dynamic_import_already_evaluating.ts.out", + args: "run --allow-read run/088_dynamic_import_already_evaluating.ts", + output: "run/088_dynamic_import_already_evaluating.ts.out", }); // TODO(bartlomieju): remove --unstable once Deno.spawn is stabilized itest!(_089_run_allow_list { - args: "run --unstable --allow-run=curl 089_run_allow_list.ts", - output: "089_run_allow_list.ts.out", + args: "run --unstable --allow-run=curl run/089_run_allow_list.ts", + output: "run/089_run_allow_list.ts.out", }); #[test] fn _090_run_permissions_request() { - let args = "run --quiet 090_run_permissions_request.ts"; + let args = "run --quiet run/090_run_permissions_request.ts"; use util::PtyData::*; util::test_pty2(args, vec![ Output("âš ï¸ ï¸Deno requests run access to \"ls\". Run again with --allow-run to bypass this prompt.\r\n Allow? [y/n (y = yes allow, n = no deny)]"), @@ -547,159 +558,161 @@ fn _090_run_permissions_request() { } itest!(_091_use_define_for_class_fields { - args: "run --check 091_use_define_for_class_fields.ts", - output: "091_use_define_for_class_fields.ts.out", + args: "run --check run/091_use_define_for_class_fields.ts", + output: "run/091_use_define_for_class_fields.ts.out", exit_code: 1, }); itest!(_092_import_map_unmapped_bare_specifier { - args: "run --import-map import_maps/import_map.json 092_import_map_unmapped_bare_specifier.ts", - output: "092_import_map_unmapped_bare_specifier.ts.out", + args: "run --import-map import_maps/import_map.json run/092_import_map_unmapped_bare_specifier.ts", + output: "run/092_import_map_unmapped_bare_specifier.ts.out", exit_code: 1, }); itest!(js_import_detect { - args: "run --quiet --reload js_import_detect.ts", - output: "js_import_detect.ts.out", + args: "run --quiet --reload run/js_import_detect.ts", + output: "run/js_import_detect.ts.out", exit_code: 0, }); itest!(blob_gc_finalization { - args: "run blob_gc_finalization.js", - output: "blob_gc_finalization.js.out", + args: "run run/blob_gc_finalization.js", + output: "run/blob_gc_finalization.js.out", exit_code: 0, }); itest!(fetch_response_finalization { - args: "run --v8-flags=--expose-gc --allow-net fetch_response_finalization.js", - output: "fetch_response_finalization.js.out", + args: + "run --v8-flags=--expose-gc --allow-net run/fetch_response_finalization.js", + output: "run/fetch_response_finalization.js.out", http_server: true, exit_code: 0, }); itest!(import_type { - args: "run --reload import_type.ts", - output: "import_type.ts.out", + args: "run --reload run/import_type.ts", + output: "run/import_type.ts.out", }); itest!(import_type_no_check { - args: "run --reload --no-check import_type.ts", - output: "import_type.ts.out", + args: "run --reload --no-check run/import_type.ts", + output: "run/import_type.ts.out", }); itest!(private_field_presence { - args: "run --reload private_field_presence.ts", - output: "private_field_presence.ts.out", + args: "run --reload run/private_field_presence.ts", + output: "run/private_field_presence.ts.out", }); itest!(private_field_presence_no_check { - args: "run --reload --no-check private_field_presence.ts", - output: "private_field_presence.ts.out", + args: "run --reload --no-check run/private_field_presence.ts", + output: "run/private_field_presence.ts.out", }); itest!(lock_write_requires_lock { args: "run --lock-write some_file.ts", - output: "lock_write_requires_lock.out", + output: "run/lock_write_requires_lock.out", exit_code: 1, }); // TODO(bartlomieju): remove --unstable once Deno.spawn is stabilized itest!(lock_write_fetch { args: - "run --quiet --allow-read --allow-write --allow-env --allow-run --unstable lock_write_fetch.ts", - output: "lock_write_fetch.ts.out", + "run --quiet --allow-read --allow-write --allow-env --allow-run --unstable run/lock_write_fetch/main.ts", + output: "run/lock_write_fetch/main.out", http_server: true, exit_code: 0, }); itest!(lock_check_ok { args: - "run --lock=lock_check_ok.json http://127.0.0.1:4545/003_relative_import.ts", - output: "003_relative_import.ts.out", + "run --lock=run/lock_check_ok.json http://127.0.0.1:4545/run/003_relative_import.ts", + output: "run/003_relative_import.ts.out", http_server: true, }); itest!(lock_check_ok2 { - args: "run --lock=lock_check_ok2.json 019_media_types.ts", - output: "019_media_types.ts.out", + args: "run --lock=run/lock_check_ok2.json run/019_media_types.ts", + output: "run/019_media_types.ts.out", http_server: true, }); itest!(lock_dynamic_imports { - args: "run --lock=lock_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/013_dynamic_import.ts", - output: "lock_dynamic_imports.out", + args: "run --lock=run/lock_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/run/013_dynamic_import.ts", + output: "run/lock_dynamic_imports.out", exit_code: 10, http_server: true, }); itest!(lock_check_err { - args: "run --lock=lock_check_err.json http://127.0.0.1:4545/003_relative_import.ts", - output: "lock_check_err.out", + args: "run --lock=run/lock_check_err.json http://127.0.0.1:4545/run/003_relative_import.ts", + output: "run/lock_check_err.out", exit_code: 10, http_server: true, }); itest!(lock_check_err2 { - args: "run --lock=lock_check_err2.json 019_media_types.ts", - output: "lock_check_err2.out", + args: "run --lock=run/lock_check_err2.json run/019_media_types.ts", + output: "run/lock_check_err2.out", exit_code: 10, http_server: true, }); itest!(mts_dmts_mjs { args: "run subdir/import.mts", - output: "mts_dmts_mjs.out", + output: "run/mts_dmts_mjs.out", }); itest!(mts_dmts_mjs_no_check { args: "run --no-check subdir/import.mts", - output: "mts_dmts_mjs.out", + output: "run/mts_dmts_mjs.out", }); itest!(async_error { exit_code: 1, - args: "run --reload async_error.ts", - output: "async_error.ts.out", + args: "run --reload run/async_error.ts", + output: "run/async_error.ts.out", }); itest!(config { - args: "run --reload --config config.tsconfig.json --check config.ts", - output: "config.ts.out", + args: + "run --reload --config run/config/tsconfig.json --check run/config/main.ts", + output: "run/config/main.out", }); itest!(config_types { args: - "run --reload --quiet --config config_types.tsconfig.json config_types.ts", - output: "config_types.ts.out", + "run --reload --quiet --config run/config_types/tsconfig.json run/config_types/main.ts", + output: "run/config_types/main.out", }); itest!(config_types_remote { http_server: true, - args: "run --reload --quiet --config config_types_remote.tsconfig.json config_types.ts", - output: "config_types.ts.out", + args: "run --reload --quiet --config run/config_types/remote.tsconfig.json run/config_types/main.ts", + output: "run/config_types/main.out", }); itest!(empty_typescript { - args: "run --reload --check subdir/empty.ts", - output_str: Some("Check file:[WILDCARD]/subdir/empty.ts\n"), + args: "run --reload --check run/empty.ts", + output_str: Some("Check file:[WILDCARD]/run/empty.ts\n"), }); itest!(error_001 { - args: "run --reload error_001.ts", + args: "run --reload run/error_001.ts", exit_code: 1, - output: "error_001.ts.out", + output: "run/error_001.ts.out", }); itest!(error_002 { - args: "run --reload error_002.ts", + args: "run --reload run/error_002.ts", exit_code: 1, - output: "error_002.ts.out", + output: "run/error_002.ts.out", }); itest!(error_003_typescript { - args: "run --reload --check error_003_typescript.ts", + args: "run --reload --check run/error_003_typescript.ts", exit_code: 1, - output: "error_003_typescript.ts.out", + output: "run/error_003_typescript.ts.out", }); // Supposing that we've already attempted to run error_003_typescript.ts @@ -707,820 +720,816 @@ itest!(error_003_typescript { // should result in the same output. // https://github.com/denoland/deno/issues/2436 itest!(error_003_typescript2 { - args: "run --check error_003_typescript.ts", + args: "run --check run/error_003_typescript.ts", exit_code: 1, - output: "error_003_typescript.ts.out", + output: "run/error_003_typescript.ts.out", }); itest!(error_004_missing_module { - args: "run --reload error_004_missing_module.ts", + args: "run --reload run/error_004_missing_module.ts", exit_code: 1, - output: "error_004_missing_module.ts.out", + output: "run/error_004_missing_module.ts.out", }); itest!(error_005_missing_dynamic_import { - args: "run --reload --allow-read --quiet error_005_missing_dynamic_import.ts", + args: + "run --reload --allow-read --quiet run/error_005_missing_dynamic_import.ts", exit_code: 1, - output: "error_005_missing_dynamic_import.ts.out", + output: "run/error_005_missing_dynamic_import.ts.out", }); itest!(error_006_import_ext_failure { - args: "run --reload error_006_import_ext_failure.ts", + args: "run --reload run/error_006_import_ext_failure.ts", exit_code: 1, - output: "error_006_import_ext_failure.ts.out", + output: "run/error_006_import_ext_failure.ts.out", }); itest!(error_007_any { - args: "run --reload error_007_any.ts", + args: "run --reload run/error_007_any.ts", exit_code: 1, - output: "error_007_any.ts.out", + output: "run/error_007_any.ts.out", }); itest!(error_008_checkjs { - args: "run --reload error_008_checkjs.js", + args: "run --reload run/error_008_checkjs.js", exit_code: 1, - output: "error_008_checkjs.js.out", + output: "run/error_008_checkjs.js.out", }); itest!(error_009_extensions_error { - args: "run error_009_extensions_error.js", - output: "error_009_extensions_error.js.out", + args: "run run/error_009_extensions_error.js", + output: "run/error_009_extensions_error.js.out", exit_code: 1, }); itest!(error_011_bad_module_specifier { - args: "run --reload error_011_bad_module_specifier.ts", + args: "run --reload run/error_011_bad_module_specifier.ts", exit_code: 1, - output: "error_011_bad_module_specifier.ts.out", + output: "run/error_011_bad_module_specifier.ts.out", }); itest!(error_012_bad_dynamic_import_specifier { - args: "run --reload --check error_012_bad_dynamic_import_specifier.ts", + args: "run --reload --check run/error_012_bad_dynamic_import_specifier.ts", exit_code: 1, - output: "error_012_bad_dynamic_import_specifier.ts.out", + output: "run/error_012_bad_dynamic_import_specifier.ts.out", }); itest!(error_013_missing_script { args: "run --reload missing_file_name", exit_code: 1, - output: "error_013_missing_script.out", + output: "run/error_013_missing_script.out", }); itest!(error_014_catch_dynamic_import_error { - args: "run --reload --allow-read error_014_catch_dynamic_import_error.js", - output: "error_014_catch_dynamic_import_error.js.out", + args: + "run --reload --allow-read run/error_014_catch_dynamic_import_error.js", + output: "run/error_014_catch_dynamic_import_error.js.out", }); itest!(error_015_dynamic_import_permissions { - args: "run --reload --quiet error_015_dynamic_import_permissions.js", - output: "error_015_dynamic_import_permissions.out", + args: "run --reload --quiet run/error_015_dynamic_import_permissions.js", + output: "run/error_015_dynamic_import_permissions.out", exit_code: 1, http_server: true, }); // We have an allow-net flag but not allow-read, it should still result in error. itest!(error_016_dynamic_import_permissions2 { - args: "run --reload --allow-net error_016_dynamic_import_permissions2.js", - output: "error_016_dynamic_import_permissions2.out", + args: "run --reload --allow-net run/error_016_dynamic_import_permissions2.js", + output: "run/error_016_dynamic_import_permissions2.out", exit_code: 1, http_server: true, }); itest!(error_017_hide_long_source_ts { - args: "run --reload --check error_017_hide_long_source_ts.ts", - output: "error_017_hide_long_source_ts.ts.out", + args: "run --reload --check run/error_017_hide_long_source_ts.ts", + output: "run/error_017_hide_long_source_ts.ts.out", exit_code: 1, }); itest!(error_018_hide_long_source_js { - args: "run error_018_hide_long_source_js.js", - output: "error_018_hide_long_source_js.js.out", + args: "run run/error_018_hide_long_source_js.js", + output: "run/error_018_hide_long_source_js.js.out", exit_code: 1, }); itest!(error_019_stack_function { - args: "run error_019_stack_function.ts", - output: "error_019_stack_function.ts.out", + args: "run run/error_019_stack_function.ts", + output: "run/error_019_stack_function.ts.out", exit_code: 1, }); itest!(error_020_stack_constructor { - args: "run error_020_stack_constructor.ts", - output: "error_020_stack_constructor.ts.out", + args: "run run/error_020_stack_constructor.ts", + output: "run/error_020_stack_constructor.ts.out", exit_code: 1, }); itest!(error_021_stack_method { - args: "run error_021_stack_method.ts", - output: "error_021_stack_method.ts.out", + args: "run run/error_021_stack_method.ts", + output: "run/error_021_stack_method.ts.out", exit_code: 1, }); itest!(error_022_stack_custom_error { - args: "run error_022_stack_custom_error.ts", - output: "error_022_stack_custom_error.ts.out", + args: "run run/error_022_stack_custom_error.ts", + output: "run/error_022_stack_custom_error.ts.out", exit_code: 1, }); itest!(error_023_stack_async { - args: "run error_023_stack_async.ts", - output: "error_023_stack_async.ts.out", + args: "run run/error_023_stack_async.ts", + output: "run/error_023_stack_async.ts.out", exit_code: 1, }); itest!(error_024_stack_promise_all { - args: "run error_024_stack_promise_all.ts", - output: "error_024_stack_promise_all.ts.out", + args: "run run/error_024_stack_promise_all.ts", + output: "run/error_024_stack_promise_all.ts.out", exit_code: 1, }); itest!(error_025_tab_indent { - args: "run error_025_tab_indent", - output: "error_025_tab_indent.out", + args: "run run/error_025_tab_indent", + output: "run/error_025_tab_indent.out", exit_code: 1, }); itest!(error_026_remote_import_error { - args: "run error_026_remote_import_error.ts", - output: "error_026_remote_import_error.ts.out", + args: "run run/error_026_remote_import_error.ts", + output: "run/error_026_remote_import_error.ts.out", exit_code: 1, http_server: true, }); itest!(error_for_await { - args: "run --reload --check error_for_await.ts", - output: "error_for_await.ts.out", + args: "run --reload --check run/error_for_await.ts", + output: "run/error_for_await.ts.out", exit_code: 1, }); itest!(error_missing_module_named_import { - args: "run --reload error_missing_module_named_import.ts", - output: "error_missing_module_named_import.ts.out", + args: "run --reload run/error_missing_module_named_import.ts", + output: "run/error_missing_module_named_import.ts.out", exit_code: 1, }); itest!(error_no_check { - args: "run --reload --no-check error_no_check.ts", - output: "error_no_check.ts.out", + args: "run --reload --no-check run/error_no_check.ts", + output: "run/error_no_check.ts.out", exit_code: 1, }); itest!(error_syntax { - args: "run --reload error_syntax.js", + args: "run --reload run/error_syntax.js", exit_code: 1, - output: "error_syntax.js.out", + output: "run/error_syntax.js.out", }); itest!(error_syntax_empty_trailing_line { - args: "run --reload error_syntax_empty_trailing_line.mjs", + args: "run --reload run/error_syntax_empty_trailing_line.mjs", exit_code: 1, - output: "error_syntax_empty_trailing_line.mjs.out", + output: "run/error_syntax_empty_trailing_line.mjs.out", }); itest!(error_type_definitions { - args: "run --reload --check error_type_definitions.ts", + args: "run --reload --check run/error_type_definitions.ts", exit_code: 1, - output: "error_type_definitions.ts.out", + output: "run/error_type_definitions.ts.out", }); itest!(error_local_static_import_from_remote_ts { - args: "run --reload http://localhost:4545/error_local_static_import_from_remote.ts", + args: "run --reload http://localhost:4545/run/error_local_static_import_from_remote.ts", exit_code: 1, http_server: true, - output: "error_local_static_import_from_remote.ts.out", + output: "run/error_local_static_import_from_remote.ts.out", }); itest!(error_local_static_import_from_remote_js { - args: "run --reload http://localhost:4545/error_local_static_import_from_remote.js", + args: "run --reload http://localhost:4545/run/error_local_static_import_from_remote.js", exit_code: 1, http_server: true, - output: "error_local_static_import_from_remote.js.out", + output: "run/error_local_static_import_from_remote.js.out", }); itest!(exit_error42 { exit_code: 42, - args: "run --quiet --reload exit_error42.ts", - output: "exit_error42.ts.out", + args: "run --quiet --reload run/exit_error42.ts", + output: "run/exit_error42.ts.out", }); itest!(set_exit_code_0 { - args: "run --no-check --unstable set_exit_code_0.ts", - output: "empty.out", + args: "run --no-check --unstable run/set_exit_code_0.ts", + output_str: Some(""), exit_code: 0, }); itest!(set_exit_code_1 { - args: "run --no-check --unstable set_exit_code_1.ts", - output: "empty.out", + args: "run --no-check --unstable run/set_exit_code_1.ts", + output_str: Some(""), exit_code: 42, }); itest!(set_exit_code_2 { - args: "run --no-check --unstable set_exit_code_2.ts", - output: "empty.out", + args: "run --no-check --unstable run/set_exit_code_2.ts", + output_str: Some(""), exit_code: 42, }); itest!(op_exit_op_set_exit_code_in_worker { - args: "run --no-check --unstable --allow-read op_exit_op_set_exit_code_in_worker.ts", + args: "run --no-check --unstable --allow-read run/op_exit_op_set_exit_code_in_worker.ts", exit_code: 21, - output: "empty.out", + output_str: Some(""), }); itest!(deno_exit_tampering { - args: "run --no-check --unstable deno_exit_tampering.ts", - output: "empty.out", + args: "run --no-check --unstable run/deno_exit_tampering.ts", + output_str: Some(""), exit_code: 42, }); itest!(heapstats { - args: "run --quiet --unstable --v8-flags=--expose-gc heapstats.js", - output: "heapstats.js.out", + args: "run --quiet --unstable --v8-flags=--expose-gc run/heapstats.js", + output: "run/heapstats.js.out", }); itest!(finalization_registry { args: - "run --quiet --unstable --v8-flags=--expose-gc finalization_registry.js", - output: "finalization_registry.js.out", + "run --quiet --unstable --v8-flags=--expose-gc run/finalization_registry.js", + output: "run/finalization_registry.js.out", }); itest!(https_import { - args: "run --quiet --reload --cert tls/RootCA.pem https_import.ts", - output: "https_import.ts.out", + args: "run --quiet --reload --cert tls/RootCA.pem run/https_import.ts", + output: "run/https_import.ts.out", http_server: true, }); itest!(if_main { - args: "run --quiet --reload if_main.ts", - output: "if_main.ts.out", + args: "run --quiet --reload run/if_main.ts", + output: "run/if_main.ts.out", }); itest!(import_meta { - args: "run --quiet --reload --import-map=import_meta.importmap.json import_meta.ts", - output: "import_meta.ts.out", + args: "run --quiet --reload --import-map=run/import_meta/importmap.json run/import_meta/main.ts", + output: "run/import_meta/main.out", }); itest!(main_module { - args: "run --quiet --allow-read --reload main_module.ts", - output: "main_module.ts.out", + args: "run --quiet --allow-read --reload run/main_module/main.ts", + output: "run/main_module/main.out", }); itest!(no_check { - args: "run --quiet --reload --no-check 006_url_imports.ts", - output: "006_url_imports.ts.out", + args: "run --quiet --reload --no-check run/006_url_imports.ts", + output: "run/006_url_imports.ts.out", http_server: true, }); itest!(no_check_decorators { - args: "run --quiet --reload --no-check no_check_decorators.ts", - output: "no_check_decorators.ts.out", + args: "run --quiet --reload --no-check run/no_check_decorators.ts", + output: "run/no_check_decorators.ts.out", }); itest!(check_remote { - args: "run --quiet --reload --check=all no_check_remote.ts", - output: "no_check_remote.ts.disabled.out", + args: "run --quiet --reload --check=all run/no_check_remote.ts", + output: "run/no_check_remote.ts.disabled.out", exit_code: 1, http_server: true, }); itest!(no_check_remote { - args: "run --quiet --reload --no-check=remote no_check_remote.ts", - output: "no_check_remote.ts.enabled.out", + args: "run --quiet --reload --no-check=remote run/no_check_remote.ts", + output: "run/no_check_remote.ts.enabled.out", http_server: true, }); itest!(runtime_decorators { - args: "run --quiet --reload --no-check runtime_decorators.ts", - output: "runtime_decorators.ts.out", + args: "run --quiet --reload --no-check run/runtime_decorators.ts", + output: "run/runtime_decorators.ts.out", }); itest!(seed_random { - args: "run --seed=100 seed_random.js", - output: "seed_random.js.out", + args: "run --seed=100 run/seed_random.js", + output: "run/seed_random.js.out", }); itest!(type_definitions { - args: "run --reload type_definitions.ts", - output: "type_definitions.ts.out", + args: "run --reload run/type_definitions.ts", + output: "run/type_definitions.ts.out", }); itest!(type_definitions_for_export { - args: "run --reload --check type_definitions_for_export.ts", - output: "type_definitions_for_export.ts.out", + args: "run --reload --check run/type_definitions_for_export.ts", + output: "run/type_definitions_for_export.ts.out", exit_code: 1, }); itest!(type_directives_01 { - args: "run --reload --check=all -L debug type_directives_01.ts", - output: "type_directives_01.ts.out", + args: "run --reload --check=all -L debug run/type_directives_01.ts", + output: "run/type_directives_01.ts.out", http_server: true, }); itest!(type_directives_02 { - args: "run --reload --check=all -L debug type_directives_02.ts", - output: "type_directives_02.ts.out", + args: "run --reload --check=all -L debug run/type_directives_02.ts", + output: "run/type_directives_02.ts.out", }); itest!(type_directives_js_main { - args: "run --reload -L debug type_directives_js_main.js", - output: "type_directives_js_main.js.out", + args: "run --reload -L debug run/type_directives_js_main.js", + output: "run/type_directives_js_main.js.out", exit_code: 0, }); itest!(type_directives_redirect { - args: "run --reload --check type_directives_redirect.ts", - output: "type_directives_redirect.ts.out", + args: "run --reload --check run/type_directives_redirect.ts", + output: "run/type_directives_redirect.ts.out", http_server: true, }); itest!(type_headers_deno_types { - args: "run --reload --check type_headers_deno_types.ts", - output: "type_headers_deno_types.ts.out", + args: "run --reload --check run/type_headers_deno_types.ts", + output: "run/type_headers_deno_types.ts.out", http_server: true, }); itest!(ts_type_imports { - args: "run --reload --check ts_type_imports.ts", - output: "ts_type_imports.ts.out", + args: "run --reload --check run/ts_type_imports.ts", + output: "run/ts_type_imports.ts.out", exit_code: 1, }); itest!(ts_decorators { - args: "run --reload --check ts_decorators.ts", - output: "ts_decorators.ts.out", + args: "run --reload --check run/ts_decorators.ts", + output: "run/ts_decorators.ts.out", }); itest!(ts_type_only_import { - args: "run --reload --check ts_type_only_import.ts", - output: "ts_type_only_import.ts.out", + args: "run --reload --check run/ts_type_only_import.ts", + output: "run/ts_type_only_import.ts.out", }); itest!(swc_syntax_error { - args: "run --reload --check swc_syntax_error.ts", - output: "swc_syntax_error.ts.out", + args: "run --reload --check run/swc_syntax_error.ts", + output: "run/swc_syntax_error.ts.out", exit_code: 1, }); itest!(unbuffered_stderr { - args: "run --reload unbuffered_stderr.ts", - output: "unbuffered_stderr.ts.out", + args: "run --reload run/unbuffered_stderr.ts", + output: "run/unbuffered_stderr.ts.out", }); itest!(unbuffered_stdout { - args: "run --quiet --reload unbuffered_stdout.ts", - output: "unbuffered_stdout.ts.out", + args: "run --quiet --reload run/unbuffered_stdout.ts", + output: "run/unbuffered_stdout.ts.out", }); itest!(v8_flags_run { - args: "run --v8-flags=--expose-gc v8_flags.js", - output: "v8_flags.js.out", + args: "run --v8-flags=--expose-gc run/v8_flags.js", + output: "run/v8_flags.js.out", }); itest!(v8_flags_unrecognized { args: "repl --v8-flags=--foo,bar,--trace-gc,-baz", - output: "v8_flags_unrecognized.out", + output: "run/v8_flags_unrecognized.out", exit_code: 1, }); itest!(v8_help { args: "repl --v8-flags=--help", - output: "v8_help.out", + output: "run/v8_help.out", }); itest!(unsupported_dynamic_import_scheme { args: "eval import('xxx:')", - output: "unsupported_dynamic_import_scheme.out", + output: "run/unsupported_dynamic_import_scheme.out", exit_code: 1, }); itest!(wasm { - args: "run --quiet wasm.ts", - output: "wasm.ts.out", + args: "run --quiet run/wasm.ts", + output: "run/wasm.ts.out", }); itest!(wasm_shared { - args: "run --quiet wasm_shared.ts", - output: "wasm_shared.out", + args: "run --quiet run/wasm_shared.ts", + output: "run/wasm_shared.out", }); itest!(wasm_async { - args: "run wasm_async.js", - output: "wasm_async.out", + args: "run run/wasm_async.js", + output: "run/wasm_async.out", }); itest!(wasm_unreachable { - args: "run --allow-read wasm_unreachable.js", - output: "wasm_unreachable.out", + args: "run --allow-read run/wasm_unreachable.js", + output: "run/wasm_unreachable.out", exit_code: 1, }); itest!(wasm_url { - args: "run --quiet --allow-net=localhost:4545 wasm_url.js", - output: "wasm_url.out", + args: "run --quiet --allow-net=localhost:4545 run/wasm_url.js", + output: "run/wasm_url.out", exit_code: 1, http_server: true, }); itest!(weakref { - args: "run --quiet --reload weakref.ts", - output: "weakref.ts.out", + args: "run --quiet --reload run/weakref.ts", + output: "run/weakref.ts.out", }); itest!(top_level_await_order { - args: "run --allow-read top_level_await_order.js", - output: "top_level_await_order.out", + args: "run --allow-read run/top_level_await/order.js", + output: "run/top_level_await/order.out", }); itest!(top_level_await_loop { - args: "run --allow-read top_level_await_loop.js", - output: "top_level_await_loop.out", + args: "run --allow-read run/top_level_await/loop.js", + output: "run/top_level_await/loop.out", }); itest!(top_level_await_circular { - args: "run --allow-read top_level_await_circular.js", - output: "top_level_await_circular.out", + args: "run --allow-read run/top_level_await/circular.js", + output: "run/top_level_await/circular.out", exit_code: 1, }); // Regression test for https://github.com/denoland/deno/issues/11238. itest!(top_level_await_nested { - args: "run --allow-read top_level_await_nested/main.js", - output: "top_level_await_nested.out", + args: "run --allow-read run/top_level_await/nested/main.js", + output: "run/top_level_await/nested.out", }); itest!(top_level_await_unresolved { - args: "run top_level_await_unresolved.js", - output: "top_level_await_unresolved.out", + args: "run run/top_level_await/unresolved.js", + output: "run/top_level_await/unresolved.out", exit_code: 1, }); itest!(top_level_await { - args: "run --allow-read top_level_await.js", - output: "top_level_await.out", + args: "run --allow-read run/top_level_await/top_level_await.js", + output: "run/top_level_await/top_level_await.out", }); itest!(top_level_await_ts { - args: "run --quiet --allow-read top_level_await.ts", - output: "top_level_await.out", + args: "run --quiet --allow-read run/top_level_await/top_level_await.ts", + output: "run/top_level_await/top_level_await.out", }); itest!(top_level_for_await { - args: "run --quiet top_level_for_await.js", - output: "top_level_for_await.out", + args: "run --quiet run/top_level_await/top_level_for_await.js", + output: "run/top_level_await/top_level_for_await.out", }); itest!(top_level_for_await_ts { - args: "run --quiet top_level_for_await.ts", - output: "top_level_for_await.out", + args: "run --quiet run/top_level_await/top_level_for_await.ts", + output: "run/top_level_await/top_level_for_await.out", }); itest!(unstable_disabled { - args: "run --reload --check unstable.ts", + args: "run --reload --check run/unstable.ts", exit_code: 1, - output: "unstable_disabled.out", + output: "run/unstable_disabled.out", }); itest!(unstable_enabled { - args: "run --quiet --reload --unstable unstable.ts", - output: "unstable_enabled.out", + args: "run --quiet --reload --unstable run/unstable.ts", + output: "run/unstable_enabled.out", }); itest!(unstable_disabled_js { - args: "run --reload unstable.js", - output: "unstable_disabled_js.out", + args: "run --reload run/unstable.js", + output: "run/unstable_disabled_js.out", }); itest!(unstable_enabled_js { - args: "run --quiet --reload --unstable unstable.ts", - output: "unstable_enabled_js.out", + args: "run --quiet --reload --unstable run/unstable.ts", + output: "run/unstable_enabled_js.out", }); itest!(unstable_worker { - args: "run --reload --unstable --quiet --allow-read unstable_worker.ts", - output: "unstable_worker.ts.out", + args: "run --reload --unstable --quiet --allow-read run/unstable_worker.ts", + output: "run/unstable_worker.ts.out", }); -itest!(_053_import_compression { - args: "run --quiet --reload --allow-net 053_import_compression/main.ts", - output: "053_import_compression.out", +itest!(import_compression { + args: "run --quiet --reload --allow-net run/import_compression/main.ts", + output: "run/import_compression/main.out", http_server: true, }); itest!(disallow_http_from_https_js { - args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/disallow_http_from_https.js", - output: "disallow_http_from_https_js.out", + args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/run/disallow_http_from_https.js", + output: "run/disallow_http_from_https_js.out", http_server: true, exit_code: 1, }); itest!(disallow_http_from_https_ts { - args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/disallow_http_from_https.ts", - output: "disallow_http_from_https_ts.out", + args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/run/disallow_http_from_https.ts", + output: "run/disallow_http_from_https_ts.out", http_server: true, exit_code: 1, }); itest!(dynamic_import_conditional { - args: "run --quiet --reload dynamic_import_conditional.js", - output: "dynamic_import_conditional.js.out", + args: "run --quiet --reload run/dynamic_import_conditional.js", + output: "run/dynamic_import_conditional.js.out", }); itest!(tsx_imports { - args: "run --reload --check tsx_imports.ts", - output: "tsx_imports.ts.out", + args: "run --reload --check run/tsx_imports/tsx_imports.ts", + output: "run/tsx_imports/tsx_imports.ts.out", }); itest!(fix_dynamic_import_errors { - args: "run --reload fix_dynamic_import_errors.js", - output: "fix_dynamic_import_errors.js.out", + args: "run --reload run/fix_dynamic_import_errors.js", + output: "run/fix_dynamic_import_errors.js.out", }); itest!(fix_emittable_skipped { - args: "run --reload fix_emittable_skipped.js", - output: "fix_emittable_skipped.ts.out", + args: "run --reload run/fix_emittable_skipped.js", + output: "run/fix_emittable_skipped.ts.out", }); itest!(fix_exotic_specifiers { - args: "run --quiet --reload fix_exotic_specifiers.ts", - output: "fix_exotic_specifiers.ts.out", + args: "run --quiet --reload run/fix_exotic_specifiers.ts", + output: "run/fix_exotic_specifiers.ts.out", }); itest!(fix_js_import_js { - args: "run --quiet --reload fix_js_import_js.ts", - output: "fix_js_import_js.ts.out", + args: "run --quiet --reload run/fix_js_import_js.ts", + output: "run/fix_js_import_js.ts.out", }); itest!(fix_js_imports { - args: "run --quiet --reload fix_js_imports.ts", - output: "fix_js_imports.ts.out", + args: "run --quiet --reload run/fix_js_imports.ts", + output: "run/fix_js_imports.ts.out", }); itest!(fix_tsc_file_exists { args: "run --quiet --reload tsc/test.js", - output: "fix_tsc_file_exists.out", + output: "run/fix_tsc_file_exists.out", }); itest!(fix_worker_dispatchevent { - args: "run --quiet --reload fix_worker_dispatchevent.ts", - output: "fix_worker_dispatchevent.ts.out", + args: "run --quiet --reload run/fix_worker_dispatchevent.ts", + output: "run/fix_worker_dispatchevent.ts.out", }); itest!(es_private_fields { - args: "run --quiet --reload es_private_fields.js", - output: "es_private_fields.js.out", + args: "run --quiet --reload run/es_private_fields.js", + output: "run/es_private_fields.js.out", }); itest!(cjs_imports { - args: "run --quiet --reload cjs_imports.ts", - output: "cjs_imports.ts.out", + args: "run --quiet --reload run/cjs_imports/main.ts", + output: "run/cjs_imports/main.out", }); itest!(ts_import_from_js { - args: "run --quiet --reload ts_import_from_js.js", - output: "ts_import_from_js.js.out", + args: "run --quiet --reload run/ts_import_from_js/main.js", + output: "run/ts_import_from_js/main.out", http_server: true, }); itest!(jsx_import_from_ts { - args: "run --quiet --reload jsx_import_from_ts.ts", - output: "jsx_import_from_ts.ts.out", + args: "run --quiet --reload run/jsx_import_from_ts.ts", + output: "run/jsx_import_from_ts.ts.out", }); itest!(jsx_import_source_pragma { - args: "run --reload jsx_import_source_pragma.tsx", - output: "jsx_import_source.out", + args: "run --reload run/jsx_import_source_pragma.tsx", + output: "run/jsx_import_source.out", http_server: true, }); itest!(jsx_import_source_pragma_with_config { - args: "run --reload --config jsx/deno-jsx.jsonc jsx_import_source_pragma.tsx", - output: "jsx_import_source.out", + args: + "run --reload --config jsx/deno-jsx.jsonc run/jsx_import_source_pragma.tsx", + output: "run/jsx_import_source.out", http_server: true, }); itest!(jsx_import_source_pragma_with_dev_config { args: - "run --reload --config jsx/deno-jsxdev.jsonc jsx_import_source_pragma.tsx", - output: "jsx_import_source_dev.out", + "run --reload --config jsx/deno-jsxdev.jsonc run/jsx_import_source_pragma.tsx", + output: "run/jsx_import_source_dev.out", http_server: true, }); itest!(jsx_import_source_no_pragma { args: - "run --reload --config jsx/deno-jsx.jsonc jsx_import_source_no_pragma.tsx", - output: "jsx_import_source.out", + "run --reload --config jsx/deno-jsx.jsonc run/jsx_import_source_no_pragma.tsx", + output: "run/jsx_import_source.out", http_server: true, }); itest!(jsx_import_source_no_pragma_dev { - args: "run --reload --config jsx/deno-jsxdev.jsonc jsx_import_source_no_pragma.tsx", - output: "jsx_import_source_dev.out", + args: "run --reload --config jsx/deno-jsxdev.jsonc run/jsx_import_source_no_pragma.tsx", + output: "run/jsx_import_source_dev.out", http_server: true, }); itest!(jsx_import_source_pragma_import_map { - args: "run --reload --import-map jsx/import-map.json jsx_import_source_pragma_import_map.tsx", - output: "jsx_import_source_import_map.out", + args: "run --reload --import-map jsx/import-map.json run/jsx_import_source_pragma_import_map.tsx", + output: "run/jsx_import_source_import_map.out", http_server: true, }); itest!(jsx_import_source_pragma_import_map_dev { - args: "run --reload --import-map jsx/import-map.json --config jsx/deno-jsxdev-import-map.jsonc jsx_import_source_pragma_import_map.tsx", - output: "jsx_import_source_import_map_dev.out", + args: "run --reload --import-map jsx/import-map.json --config jsx/deno-jsxdev-import-map.jsonc run/jsx_import_source_pragma_import_map.tsx", + output: "run/jsx_import_source_import_map_dev.out", http_server: true, }); itest!(jsx_import_source_import_map { - args: "run --reload --import-map jsx/import-map.json --config jsx/deno-jsx-import-map.jsonc jsx_import_source_no_pragma.tsx", - output: "jsx_import_source_import_map.out", + args: "run --reload --import-map jsx/import-map.json --config jsx/deno-jsx-import-map.jsonc run/jsx_import_source_no_pragma.tsx", + output: "run/jsx_import_source_import_map.out", http_server: true, }); itest!(jsx_import_source_import_map_dev { - args: "run --reload --import-map jsx/import-map.json --config jsx/deno-jsxdev-import-map.jsonc jsx_import_source_no_pragma.tsx", - output: "jsx_import_source_import_map_dev.out", + args: "run --reload --import-map jsx/import-map.json --config jsx/deno-jsxdev-import-map.jsonc run/jsx_import_source_no_pragma.tsx", + output: "run/jsx_import_source_import_map_dev.out", http_server: true, }); itest!(jsx_import_source_import_map_scoped { args: "run --reload --import-map jsx/import-map-scoped.json --config jsx/deno-jsx-import-map.jsonc subdir/jsx_import_source_no_pragma.tsx", - output: "jsx_import_source_import_map.out", + output: "run/jsx_import_source_import_map.out", http_server: true, }); itest!(jsx_import_source_import_map_scoped_dev { args: "run --reload --import-map jsx/import-map-scoped.json --config jsx/deno-jsxdev-import-map.jsonc subdir/jsx_import_source_no_pragma.tsx", - output: "jsx_import_source_import_map_dev.out", + output: "run/jsx_import_source_import_map_dev.out", http_server: true, }); itest!(jsx_import_source_pragma_no_check { - args: "run --reload --no-check jsx_import_source_pragma.tsx", - output: "jsx_import_source.out", + args: "run --reload --no-check run/jsx_import_source_pragma.tsx", + output: "run/jsx_import_source.out", http_server: true, }); itest!(jsx_import_source_pragma_with_config_no_check { - args: "run --reload --config jsx/deno-jsx.jsonc --no-check jsx_import_source_pragma.tsx", - output: "jsx_import_source.out", + args: "run --reload --config jsx/deno-jsx.jsonc --no-check run/jsx_import_source_pragma.tsx", + output: "run/jsx_import_source.out", http_server: true, }); -// itest!(jsx_import_source_pragma_with_dev_config_no_check { -// args: -// "run --reload --config jsx/deno-jsxdev.jsonc --no-check jsx_import_source_pragma.tsx", -// output: "jsx_import_source_dev.out", -// http_server: true, -// }); - itest!(jsx_import_source_no_pragma_no_check { args: - "run --reload --config jsx/deno-jsx.jsonc --no-check jsx_import_source_no_pragma.tsx", - output: "jsx_import_source.out", + "run --reload --config jsx/deno-jsx.jsonc --no-check run/jsx_import_source_no_pragma.tsx", + output: "run/jsx_import_source.out", http_server: true, }); -// itest!(jsx_import_source_no_pragma_dev_no_check { -// args: "run --reload --config jsx/deno-jsxdev.jsonc --no-check jsx_import_source_no_pragma.tsx", -// output: "jsx_import_source_dev.out", -// http_server: true, -// }); - itest!(jsx_import_source_pragma_import_map_no_check { - args: "run --reload --import-map jsx/import-map.json --no-check jsx_import_source_pragma_import_map.tsx", - output: "jsx_import_source_import_map.out", + args: "run --reload --import-map jsx/import-map.json --no-check run/jsx_import_source_pragma_import_map.tsx", + output: "run/jsx_import_source_import_map.out", http_server: true, }); -// itest!(jsx_import_source_pragma_import_map_dev_no_check { -// args: "run --reload --import-map jsx/import-map.json --config jsx/deno-jsxdev-import-map.jsonc --no-check jsx_import_source_pragma_import_map.tsx", -// output: "jsx_import_source_import_map_dev.out", -// http_server: true, -// }); - itest!(jsx_import_source_import_map_no_check { - args: "run --reload --import-map jsx/import-map.json --config jsx/deno-jsx-import-map.jsonc --no-check jsx_import_source_no_pragma.tsx", - output: "jsx_import_source_import_map.out", + args: "run --reload --import-map jsx/import-map.json --config jsx/deno-jsx-import-map.jsonc --no-check run/jsx_import_source_no_pragma.tsx", + output: "run/jsx_import_source_import_map.out", http_server: true, }); -// itest!(jsx_import_source_import_map_dev_no_check { -// args: "run --reload --import-map jsx/import-map.json --config jsx/deno-jsxdev-import-map.jsonc --no-check jsx_import_source_no_pragma.tsx", -// output: "jsx_import_source_import_map_dev.out", -// http_server: true, -// }); +itest!(jsx_import_source_error { + args: "run --config jsx/deno-jsx-error.jsonc --check run/jsx_import_source_no_pragma.tsx", + output: "run/jsx_import_source_error.out", + exit_code: 1, +}); // TODO(#11128): Flaky. Re-enable later. // itest!(single_compile_with_reload { -// args: "run --reload --allow-read single_compile_with_reload.ts", -// output: "single_compile_with_reload.ts.out", +// args: "run --relcert/oad --allow-read run/single_compile_with_reload.ts", +// output: "run/single_compile_with_reload.ts.out", // }); itest!(proto_exploit { - args: "run proto_exploit.js", - output: "proto_exploit.js.out", + args: "run run/proto_exploit.js", + output: "run/proto_exploit.js.out", }); itest!(reference_types { - args: "run --reload --quiet reference_types.ts", - output: "reference_types.ts.out", + args: "run --reload --quiet run/reference_types.ts", + output: "run/reference_types.ts.out", }); itest!(references_types_remote { http_server: true, - args: "run --reload --quiet reference_types_remote.ts", - output: "reference_types_remote.ts.out", + args: "run --reload --quiet run/reference_types_remote.ts", + output: "run/reference_types_remote.ts.out", +}); + +itest!(reference_types_error { + args: + "run --config run/checkjs.tsconfig.json --check run/reference_types_error.js", + output: "run/reference_types_error.js.out", + exit_code: 1, +}); + +itest!(reference_types_error_no_check { + args: "run --no-check run/reference_types_error.js", + output_str: Some(""), }); itest!(import_data_url_error_stack { - args: "run --quiet --reload import_data_url_error_stack.ts", - output: "import_data_url_error_stack.ts.out", + args: "run --quiet --reload run/import_data_url_error_stack.ts", + output: "run/import_data_url_error_stack.ts.out", exit_code: 1, }); itest!(import_data_url_import_relative { - args: "run --quiet --reload import_data_url_import_relative.ts", - output: "import_data_url_import_relative.ts.out", + args: "run --quiet --reload run/import_data_url_import_relative.ts", + output: "run/import_data_url_import_relative.ts.out", exit_code: 1, }); itest!(import_data_url_import_map { - args: "run --quiet --reload --import-map import_maps/import_map.json import_data_url.ts", - output: "import_data_url.ts.out", + args: "run --quiet --reload --import-map import_maps/import_map.json run/import_data_url.ts", + output: "run/import_data_url.ts.out", }); itest!(import_data_url_imports { - args: "run --quiet --reload import_data_url_imports.ts", - output: "import_data_url_imports.ts.out", + args: "run --quiet --reload run/import_data_url_imports.ts", + output: "run/import_data_url_imports.ts.out", http_server: true, }); itest!(import_data_url_jsx { - args: "run --quiet --reload import_data_url_jsx.ts", - output: "import_data_url_jsx.ts.out", + args: "run --quiet --reload run/import_data_url_jsx.ts", + output: "run/import_data_url_jsx.ts.out", }); itest!(import_data_url { - args: "run --quiet --reload import_data_url.ts", - output: "import_data_url.ts.out", + args: "run --quiet --reload run/import_data_url.ts", + output: "run/import_data_url.ts.out", }); itest!(import_dynamic_data_url { - args: "run --quiet --reload import_dynamic_data_url.ts", - output: "import_dynamic_data_url.ts.out", + args: "run --quiet --reload run/import_dynamic_data_url.ts", + output: "run/import_dynamic_data_url.ts.out", }); itest!(import_blob_url_error_stack { - args: "run --quiet --reload import_blob_url_error_stack.ts", - output: "import_blob_url_error_stack.ts.out", + args: "run --quiet --reload run/import_blob_url_error_stack.ts", + output: "run/import_blob_url_error_stack.ts.out", exit_code: 1, }); itest!(import_blob_url_import_relative { - args: "run --quiet --reload import_blob_url_import_relative.ts", - output: "import_blob_url_import_relative.ts.out", + args: "run --quiet --reload run/import_blob_url_import_relative.ts", + output: "run/import_blob_url_import_relative.ts.out", exit_code: 1, }); itest!(import_blob_url_imports { args: - "run --quiet --reload --allow-net=localhost:4545 import_blob_url_imports.ts", - output: "import_blob_url_imports.ts.out", + "run --quiet --reload --allow-net=localhost:4545 run/import_blob_url_imports.ts", + output: "run/import_blob_url_imports.ts.out", http_server: true, }); itest!(import_blob_url_jsx { - args: "run --quiet --reload import_blob_url_jsx.ts", - output: "import_blob_url_jsx.ts.out", + args: "run --quiet --reload run/import_blob_url_jsx.ts", + output: "run/import_blob_url_jsx.ts.out", }); itest!(import_blob_url { - args: "run --quiet --reload import_blob_url.ts", - output: "import_blob_url.ts.out", + args: "run --quiet --reload run/import_blob_url.ts", + output: "run/import_blob_url.ts.out", }); itest!(import_file_with_colon { - args: "run --quiet --reload import_file_with_colon.ts", - output: "import_file_with_colon.ts.out", + args: "run --quiet --reload run/import_file_with_colon.ts", + output: "run/import_file_with_colon.ts.out", http_server: true, }); itest!(import_extensionless { - args: "run --quiet --reload import_extensionless.ts", - output: "import_extensionless.ts.out", + args: "run --quiet --reload run/import_extensionless.ts", + output: "run/import_extensionless.ts.out", http_server: true, }); itest!(classic_workers_event_loop { args: - "run --enable-testing-features-do-not-use classic_workers_event_loop.js", - output: "classic_workers_event_loop.js.out", + "run --enable-testing-features-do-not-use run/classic_workers_event_loop.js", + output: "run/classic_workers_event_loop.js.out", }); // FIXME(bartlomieju): disabled, because this test is very flaky on CI // itest!(local_sources_not_cached_in_memory { -// args: "run --allow-read --allow-write no_mem_cache.js", -// output: "no_mem_cache.js.out", +// args: "run --allow-read --allow-write run/no_mem_cache.js", +// output: "run/no_mem_cache.js.out", // }); // This test checks that inline source map data is used. It uses a hand crafted @@ -1529,8 +1538,8 @@ itest!(classic_workers_event_loop { // Source line is not remapped because no inline source contents are included in // the sourcemap and the file is not present in the dependency graph. itest!(inline_js_source_map_2 { - args: "run --quiet inline_js_source_map_2.js", - output: "inline_js_source_map_2.js.out", + args: "run --quiet run/inline_js_source_map_2.js", + output: "run/inline_js_source_map_2.js.out", exit_code: 1, }); @@ -1540,8 +1549,8 @@ itest!(inline_js_source_map_2 { // Source line remapped using th inline source contents that are included in the // inline source map. itest!(inline_js_source_map_2_with_inline_contents { - args: "run --quiet inline_js_source_map_2_with_inline_contents.js", - output: "inline_js_source_map_2_with_inline_contents.js.out", + args: "run --quiet run/inline_js_source_map_2_with_inline_contents.js", + output: "run/inline_js_source_map_2_with_inline_contents.js.out", exit_code: 1, }); @@ -1552,8 +1561,8 @@ itest!(inline_js_source_map_2_with_inline_contents { // was not commented out. The source line is remapped using source contents that // from the module graph. itest!(inline_js_source_map_with_contents_from_graph { - args: "run --quiet inline_js_source_map_with_contents_from_graph.js", - output: "inline_js_source_map_with_contents_from_graph.js.out", + args: "run --quiet run/inline_js_source_map_with_contents_from_graph.js", + output: "run/inline_js_source_map_with_contents_from_graph.js.out", exit_code: 1, http_server: true, }); @@ -1564,78 +1573,62 @@ itest!(inline_js_source_map_with_contents_from_graph { // `program_state.maybe_import_map` to access the import map underneath. itest!(error_import_map_unable_to_load { args: "run --import-map=import_maps/does_not_exist.json import_maps/test.ts", - output: "error_import_map_unable_to_load.out", + output: "run/error_import_map_unable_to_load.out", exit_code: 1, }); // Test that setting `self` in the main thread to some other value doesn't break // the world. itest!(replace_self { - args: "run replace_self.js", - output: "replace_self.js.out", + args: "run run/replace_self.js", + output: "run/replace_self.js.out", }); itest!(worker_event_handler_test { - args: "run --quiet --reload --allow-read worker_event_handler_test.js", - output: "worker_event_handler_test.js.out", + args: "run --quiet --reload --allow-read run/worker_event_handler_test.js", + output: "run/worker_event_handler_test.js.out", }); itest!(worker_close_race { - args: "run --quiet --reload --allow-read worker_close_race.js", - output: "worker_close_race.js.out", + args: "run --quiet --reload --allow-read run/worker_close_race.js", + output: "run/worker_close_race.js.out", }); itest!(worker_drop_handle_race { - args: "run --quiet --reload --allow-read worker_drop_handle_race.js", - output: "worker_drop_handle_race.js.out", + args: "run --quiet --reload --allow-read run/worker_drop_handle_race.js", + output: "run/worker_drop_handle_race.js.out", exit_code: 1, }); itest!(worker_drop_handle_race_terminate { - args: "run --unstable worker_drop_handle_race_terminate.js", - output: "worker_drop_handle_race_terminate.js.out", + args: "run --unstable run/worker_drop_handle_race_terminate.js", + output: "run/worker_drop_handle_race_terminate.js.out", }); itest!(worker_close_nested { - args: "run --quiet --reload --allow-read worker_close_nested.js", - output: "worker_close_nested.js.out", + args: "run --quiet --reload --allow-read run/worker_close_nested.js", + output: "run/worker_close_nested.js.out", }); itest!(worker_message_before_close { - args: "run --quiet --reload --allow-read worker_message_before_close.js", - output: "worker_message_before_close.js.out", + args: "run --quiet --reload --allow-read run/worker_message_before_close.js", + output: "run/worker_message_before_close.js.out", }); itest!(worker_close_in_wasm_reactions { - args: "run --quiet --reload --allow-read worker_close_in_wasm_reactions.js", - output: "worker_close_in_wasm_reactions.js.out", -}); - -itest!(reference_types_error { - args: "run --config checkjs.tsconfig.json --check reference_types_error.js", - output: "reference_types_error.js.out", - exit_code: 1, -}); - -itest!(reference_types_error_no_check { - args: "run --no-check reference_types_error.js", - output_str: Some(""), -}); - -itest!(jsx_import_source_error { - args: "run --config jsx/deno-jsx-error.jsonc --check jsx_import_source_no_pragma.tsx", - output: "jsx_import_source_error.out", - exit_code: 1, + args: + "run --quiet --reload --allow-read run/worker_close_in_wasm_reactions.js", + output: "run/worker_close_in_wasm_reactions.js.out", }); itest!(shebang_tsc { - args: "run --quiet shebang.ts", - output: "shebang.ts.out", + args: "run --quiet --check run/shebang.ts", + output: "run/shebang.ts.out", }); itest!(shebang_swc { - args: "run --quiet --no-check shebang.ts", - output: "shebang.ts.out", + args: "run --quiet run/shebang.ts", + output: "run/shebang.ts.out", }); itest!(shebang_with_json_imports_tsc { @@ -1655,7 +1648,7 @@ fn no_validate_asm() { let output = util::deno_cmd() .current_dir(util::testdata_path()) .arg("run") - .arg("no_validate_asm.js") + .arg("run/no_validate_asm.js") .stderr(Stdio::piped()) .stdout(Stdio::piped()) .spawn() @@ -1673,7 +1666,7 @@ fn exec_path() { .current_dir(util::testdata_path()) .arg("run") .arg("--allow-read") - .arg("exec_path.ts") + .arg("run/exec_path.ts") .stdout(Stdio::piped()) .spawn() .unwrap() @@ -1701,7 +1694,7 @@ fn run_deno_script_constrained( script_path: std::path::PathBuf, constraints: WinProcConstraints, ) -> Result<(), i64> { - let file_path = "DenoWinRunner.ps1"; + let file_path = "assets/DenoWinRunner.ps1"; let constraints = match constraints { WinProcConstraints::NoStdIn => "1", WinProcConstraints::NoStdOut => "2", @@ -1799,7 +1792,7 @@ fn rust_log() { let output = util::deno_cmd() .current_dir(util::testdata_path()) .arg("run") - .arg("001_hello.js") + .arg("run/001_hello.js") .stderr(Stdio::piped()) .spawn() .unwrap() @@ -1812,7 +1805,7 @@ fn rust_log() { let output = util::deno_cmd() .current_dir(util::testdata_path()) .arg("run") - .arg("001_hello.js") + .arg("run/001_hello.js") .env("RUST_LOG", "debug") .stderr(Stdio::piped()) .spawn() @@ -1833,7 +1826,7 @@ fn dont_cache_on_check_fail() { .arg("run") .arg("--check=all") .arg("--reload") - .arg("error_003_typescript.ts") + .arg("run/error_003_typescript.ts") .stderr(Stdio::piped()) .spawn() .unwrap() @@ -1847,7 +1840,7 @@ fn dont_cache_on_check_fail() { .current_dir(util::testdata_path()) .arg("run") .arg("--check=all") - .arg("error_003_typescript.ts") + .arg("run/error_003_typescript.ts") .stderr(Stdio::piped()) .spawn() .unwrap() @@ -1869,7 +1862,7 @@ mod permissions { .arg("run") .arg("--unstable") .arg(format!("--allow-{0}", permission)) - .arg("permission_test.ts") + .arg("run/permission_test.ts") .arg(format!("{0}Required", permission)) .spawn() .unwrap() @@ -1885,7 +1878,10 @@ mod permissions { for permission in &util::PERMISSION_VARIANTS { let (_, err) = util::run_and_collect_output( false, - &format!("run --unstable permission_test.ts {0}Required", permission), + &format!( + "run --unstable run/permission_test.ts {0}Required", + permission + ), None, None, false, @@ -1909,9 +1905,9 @@ mod permissions { .into_string() .unwrap() )) - .arg("complex_permissions_test.ts") + .arg("run/complex_permissions_test.ts") .arg(permission) - .arg("complex_permissions_test.ts") + .arg("run/complex_permissions_test.ts") .spawn() .unwrap() .wait() @@ -1927,7 +1923,7 @@ mod permissions { let (_, err) = util::run_and_collect_output( false, &format!( - "run --allow-{0}={1} complex_permissions_test.ts {0} {2}", + "run --allow-{0}={1} run/complex_permissions_test.ts {0} {2}", permission, util::testdata_path() .into_os_string() @@ -1962,9 +1958,9 @@ mod permissions { .into_string() .unwrap() )) - .arg("complex_permissions_test.ts") + .arg("run/complex_permissions_test.ts") .arg(permission) - .arg("complex_permissions_test.ts") + .arg("run/complex_permissions_test.ts") .spawn() .unwrap() .wait() @@ -1989,7 +1985,7 @@ mod permissions { let (_, err) = util::run_and_collect_output( false, &format!( - "run --allow-{0}={1},{2} complex_permissions_test.ts {0} {3}", + "run --allow-{0}={1},{2} run/complex_permissions_test.ts {0} {3}", permission, test_dir, js_dir, @@ -2024,9 +2020,9 @@ mod permissions { .current_dir(&util::testdata_path()) .arg("run") .arg(format!("--allow-{0}={1},{2}", permission, test_dir, js_dir)) - .arg("complex_permissions_test.ts") + .arg("run/complex_permissions_test.ts") .arg(permission) - .arg("complex_permissions_test.ts") + .arg("run/complex_permissions_test.ts") .spawn() .unwrap() .wait() @@ -2043,9 +2039,9 @@ mod permissions { .current_dir(&util::testdata_path()) .arg("run") .arg(format!("--allow-{0}=.", permission)) - .arg("complex_permissions_test.ts") + .arg("run/complex_permissions_test.ts") .arg(permission) - .arg("complex_permissions_test.ts") + .arg("run/complex_permissions_test.ts") .spawn() .unwrap() .wait() @@ -2062,9 +2058,9 @@ mod permissions { .current_dir(&util::testdata_path()) .arg("run") .arg(format!("--allow-{0}=tls/../", permission)) - .arg("complex_permissions_test.ts") + .arg("run/complex_permissions_test.ts") .arg(permission) - .arg("complex_permissions_test.ts") + .arg("run/complex_permissions_test.ts") .spawn() .unwrap() .wait() @@ -2077,7 +2073,7 @@ mod permissions { fn net_fetch_allow_localhost_4545() { let (_, err) = util::run_and_collect_output( true, - "run --allow-net=localhost:4545 complex_permissions_test.ts netFetch http://localhost:4545/", + "run --allow-net=localhost:4545 run/complex_permissions_test.ts netFetch http://localhost:4545/", None, None, true, @@ -2089,7 +2085,7 @@ mod permissions { fn net_fetch_allow_deno_land() { let (_, err) = util::run_and_collect_output( false, - "run --allow-net=deno.land complex_permissions_test.ts netFetch http://localhost:4545/", + "run --allow-net=deno.land run/complex_permissions_test.ts netFetch http://localhost:4545/", None, None, true, @@ -2101,7 +2097,7 @@ mod permissions { fn net_fetch_localhost_4545_fail() { let (_, err) = util::run_and_collect_output( false, - "run --allow-net=localhost:4545 complex_permissions_test.ts netFetch http://localhost:4546/", + "run --allow-net=localhost:4545 run/complex_permissions_test.ts netFetch http://localhost:4546/", None, None, true, @@ -2113,7 +2109,7 @@ mod permissions { fn net_fetch_localhost() { let (_, err) = util::run_and_collect_output( true, - "run --allow-net=localhost complex_permissions_test.ts netFetch http://localhost:4545/ http://localhost:4546/ http://localhost:4547/", + "run --allow-net=localhost run/complex_permissions_test.ts netFetch http://localhost:4545/ http://localhost:4546/ http://localhost:4547/", None, None, true, @@ -2125,7 +2121,7 @@ mod permissions { fn net_connect_allow_localhost_ip_4555() { let (_, err) = util::run_and_collect_output( true, - "run --allow-net=127.0.0.1:4545 complex_permissions_test.ts netConnect 127.0.0.1:4545", + "run --allow-net=127.0.0.1:4545 run/complex_permissions_test.ts netConnect 127.0.0.1:4545", None, None, true, @@ -2137,7 +2133,7 @@ mod permissions { fn net_connect_allow_deno_land() { let (_, err) = util::run_and_collect_output( false, - "run --allow-net=deno.land complex_permissions_test.ts netConnect 127.0.0.1:4546", + "run --allow-net=deno.land run/complex_permissions_test.ts netConnect 127.0.0.1:4546", None, None, true, @@ -2149,7 +2145,7 @@ mod permissions { fn net_connect_allow_localhost_ip_4545_fail() { let (_, err) = util::run_and_collect_output( false, - "run --allow-net=127.0.0.1:4545 complex_permissions_test.ts netConnect 127.0.0.1:4546", + "run --allow-net=127.0.0.1:4545 run/complex_permissions_test.ts netConnect 127.0.0.1:4546", None, None, true, @@ -2161,7 +2157,7 @@ mod permissions { fn net_connect_allow_localhost_ip() { let (_, err) = util::run_and_collect_output( true, - "run --allow-net=127.0.0.1 complex_permissions_test.ts netConnect 127.0.0.1:4545 127.0.0.1:4546 127.0.0.1:4547", + "run --allow-net=127.0.0.1 run/complex_permissions_test.ts netConnect 127.0.0.1:4545 127.0.0.1:4546 127.0.0.1:4547", None, None, true, @@ -2173,7 +2169,7 @@ mod permissions { fn net_listen_allow_localhost_4555() { let (_, err) = util::run_and_collect_output( true, - "run --allow-net=localhost:4558 complex_permissions_test.ts netListen localhost:4558", + "run --allow-net=localhost:4558 run/complex_permissions_test.ts netListen localhost:4558", None, None, false, @@ -2185,7 +2181,7 @@ mod permissions { fn net_listen_allow_deno_land() { let (_, err) = util::run_and_collect_output( false, - "run --allow-net=deno.land complex_permissions_test.ts netListen localhost:4545", + "run --allow-net=deno.land run/complex_permissions_test.ts netListen localhost:4545", None, None, false, @@ -2197,7 +2193,7 @@ mod permissions { fn net_listen_allow_localhost_4555_fail() { let (_, err) = util::run_and_collect_output( false, - "run --allow-net=localhost:4555 complex_permissions_test.ts netListen localhost:4556", + "run --allow-net=localhost:4555 run/complex_permissions_test.ts netListen localhost:4556", None, None, false, @@ -2211,7 +2207,7 @@ mod permissions { // target/debug/test_server let (_, err) = util::run_and_collect_output( true, - "run --allow-net=localhost complex_permissions_test.ts netListen localhost:4600", + "run --allow-net=localhost run/complex_permissions_test.ts netListen localhost:4600", None, None, false, @@ -2221,7 +2217,7 @@ mod permissions { #[test] fn _061_permissions_request() { - let args = "run --quiet 061_permissions_request.ts"; + let args = "run --quiet run/061_permissions_request.ts"; use util::PtyData::*; util::test_pty2(args, vec![ Output("âš ï¸ ï¸Deno requests read access to \"foo\". Run again with --allow-read to bypass this prompt.\r\n Allow? [y/n (y = yes allow, n = no deny)] "), @@ -2236,7 +2232,7 @@ mod permissions { #[test] fn _062_permissions_request_global() { - let args = "run --quiet 062_permissions_request_global.ts"; + let args = "run --quiet run/062_permissions_request_global.ts"; use util::PtyData::*; util::test_pty2(args, vec![ Output("âš ï¸ ï¸Deno requests read access. Run again with --allow-read to bypass this prompt.\r\n Allow? [y/n (y = yes allow, n = no deny)] "), @@ -2248,18 +2244,18 @@ mod permissions { } itest!(_063_permissions_revoke { - args: "run --allow-read=foo,bar 063_permissions_revoke.ts", - output: "063_permissions_revoke.ts.out", + args: "run --allow-read=foo,bar run/063_permissions_revoke.ts", + output: "run/063_permissions_revoke.ts.out", }); itest!(_064_permissions_revoke_global { - args: "run --allow-read=foo,bar 064_permissions_revoke_global.ts", - output: "064_permissions_revoke_global.ts.out", + args: "run --allow-read=foo,bar run/064_permissions_revoke_global.ts", + output: "run/064_permissions_revoke_global.ts.out", }); #[test] fn _066_prompt() { - let args = "run --quiet --unstable 066_prompt.ts"; + let args = "run --quiet --unstable run/066_prompt.ts"; use util::PtyData::*; util::test_pty2( args, @@ -2337,25 +2333,25 @@ mod permissions { } itest!(tls_starttls { - args: "run --quiet --reload --allow-net --allow-read --unstable --cert tls/RootCA.pem tls_starttls.js", - output: "tls.out", + args: "run --quiet --reload --allow-net --allow-read --unstable --cert tls/RootCA.pem run/tls_starttls.js", + output: "run/tls.out", }); itest!(tls_connecttls { - args: "run --quiet --reload --allow-net --allow-read --cert tls/RootCA.pem tls_connecttls.js", - output: "tls.out", + args: "run --quiet --reload --allow-net --allow-read --cert tls/RootCA.pem run/tls_connecttls.js", + output: "run/tls.out", }); itest!(byte_order_mark { - args: "run --no-check byte_order_mark.ts", - output: "byte_order_mark.out", + args: "run --no-check run/byte_order_mark.ts", + output: "run/byte_order_mark.out", }); #[test] fn issue9750() { use util::PtyData::*; util::test_pty2( - "run --prompt issue9750.js", + "run --prompt run/issue9750.js", vec![ Output("Enter 'yy':\r\n"), Input("yy\n"), @@ -2370,20 +2366,20 @@ fn issue9750() { // Regression test for https://github.com/denoland/deno/issues/11451. itest!(dom_exception_formatting { - args: "run dom_exception_formatting.ts", - output: "dom_exception_formatting.ts.out", + args: "run run/dom_exception_formatting.ts", + output: "run/dom_exception_formatting.ts.out", exit_code: 1, }); itest!(long_data_url_formatting { - args: "run long_data_url_formatting.ts", - output: "long_data_url_formatting.ts.out", + args: "run run/long_data_url_formatting.ts", + output: "run/long_data_url_formatting.ts.out", exit_code: 1, }); itest!(eval_context_throw_dom_exception { - args: "run eval_context_throw_dom_exception.js", - output: "eval_context_throw_dom_exception.js.out", + args: "run run/eval_context_throw_dom_exception.js", + output: "run/eval_context_throw_dom_exception.js.out", }); /// Regression test for https://github.com/denoland/deno/issues/12740. @@ -2459,8 +2455,8 @@ fn issue12807() { } itest!(issue_13562 { - args: "run issue13562.ts", - output: "issue13562.ts.out", + args: "run run/issue13562.ts", + output: "run/issue13562.ts.out", }); itest!(import_assertions_static_import { @@ -2497,12 +2493,12 @@ itest!(import_assertions_type_check { }); itest!(delete_window { - args: "run delete_window.js", + args: "run run/delete_window.js", output_str: Some("true\n"), }); itest!(colors_without_global_this { - args: "run colors_without_globalThis.js", + args: "run run/colors_without_globalThis.js", output_str: Some("true\n"), }); @@ -2524,166 +2520,166 @@ itest!(config_not_auto_discovered_for_remote_script { }); itest!(wasm_streaming_panic_test { - args: "run wasm_streaming_panic_test.js", - output: "wasm_streaming_panic_test.js.out", + args: "run run/wasm_streaming_panic_test.js", + output: "run/wasm_streaming_panic_test.js.out", exit_code: 1, }); // Regression test for https://github.com/denoland/deno/issues/13897. itest!(fetch_async_error_stack { - args: "run --quiet -A fetch_async_error_stack.ts", - output: "fetch_async_error_stack.ts.out", + args: "run --quiet -A run/fetch_async_error_stack.ts", + output: "run/fetch_async_error_stack.ts.out", exit_code: 1, }); itest!(unstable_ffi_1 { - args: "run unstable_ffi_1.js", - output: "unstable_ffi_1.js.out", + args: "run run/ffi/unstable_ffi_1.js", + output: "run/ffi/unstable_ffi_1.js.out", exit_code: 70, }); itest!(unstable_ffi_2 { - args: "run unstable_ffi_2.js", - output: "unstable_ffi_2.js.out", + args: "run run/ffi/unstable_ffi_2.js", + output: "run/ffi/unstable_ffi_2.js.out", exit_code: 70, }); itest!(unstable_ffi_3 { - args: "run unstable_ffi_3.js", - output: "unstable_ffi_3.js.out", + args: "run run/ffi/unstable_ffi_3.js", + output: "run/ffi/unstable_ffi_3.js.out", exit_code: 70, }); itest!(unstable_ffi_4 { - args: "run unstable_ffi_4.js", - output: "unstable_ffi_4.js.out", + args: "run run/ffi/unstable_ffi_4.js", + output: "run/ffi/unstable_ffi_4.js.out", exit_code: 70, }); itest!(unstable_ffi_5 { - args: "run unstable_ffi_5.js", - output: "unstable_ffi_5.js.out", + args: "run run/ffi/unstable_ffi_5.js", + output: "run/ffi/unstable_ffi_5.js.out", exit_code: 70, }); itest!(unstable_ffi_6 { - args: "run unstable_ffi_6.js", - output: "unstable_ffi_6.js.out", + args: "run run/ffi/unstable_ffi_6.js", + output: "run/ffi/unstable_ffi_6.js.out", exit_code: 70, }); itest!(unstable_ffi_7 { - args: "run unstable_ffi_7.js", - output: "unstable_ffi_7.js.out", + args: "run run/ffi/unstable_ffi_7.js", + output: "run/ffi/unstable_ffi_7.js.out", exit_code: 70, }); itest!(unstable_ffi_8 { - args: "run unstable_ffi_8.js", - output: "unstable_ffi_8.js.out", + args: "run run/ffi/unstable_ffi_8.js", + output: "run/ffi/unstable_ffi_8.js.out", exit_code: 70, }); itest!(unstable_ffi_9 { - args: "run unstable_ffi_9.js", - output: "unstable_ffi_9.js.out", + args: "run run/ffi/unstable_ffi_9.js", + output: "run/ffi/unstable_ffi_9.js.out", exit_code: 70, }); itest!(unstable_ffi_10 { - args: "run unstable_ffi_10.js", - output: "unstable_ffi_10.js.out", + args: "run run/ffi/unstable_ffi_10.js", + output: "run/ffi/unstable_ffi_10.js.out", exit_code: 70, }); itest!(unstable_ffi_11 { - args: "run unstable_ffi_11.js", - output: "unstable_ffi_11.js.out", + args: "run run/ffi/unstable_ffi_11.js", + output: "run/ffi/unstable_ffi_11.js.out", exit_code: 70, }); itest!(unstable_ffi_12 { - args: "run unstable_ffi_12.js", - output: "unstable_ffi_12.js.out", + args: "run run/ffi/unstable_ffi_12.js", + output: "run/ffi/unstable_ffi_12.js.out", exit_code: 70, }); itest!(unstable_ffi_13 { - args: "run unstable_ffi_13.js", - output: "unstable_ffi_13.js.out", + args: "run run/ffi/unstable_ffi_13.js", + output: "run/ffi/unstable_ffi_13.js.out", exit_code: 70, }); itest!(unstable_ffi_14 { - args: "run unstable_ffi_14.js", - output: "unstable_ffi_14.js.out", + args: "run run/ffi/unstable_ffi_14.js", + output: "run/ffi/unstable_ffi_14.js.out", exit_code: 70, }); itest!(unstable_ffi_15 { - args: "run unstable_ffi_15.js", - output: "unstable_ffi_15.js.out", + args: "run run/ffi/unstable_ffi_15.js", + output: "run/ffi/unstable_ffi_15.js.out", exit_code: 70, }); itest!(future_check2 { - args: "run --check future_check.ts", - output: "future_check2.out", + args: "run --check run/future_check.ts", + output: "run/future_check2.out", }); itest!(event_listener_error { - args: "run --quiet event_listener_error.ts", - output: "event_listener_error.ts.out", + args: "run --quiet run/event_listener_error.ts", + output: "run/event_listener_error.ts.out", exit_code: 1, }); itest!(event_listener_error_handled { - args: "run --quiet event_listener_error_handled.ts", - output: "event_listener_error_handled.ts.out", + args: "run --quiet run/event_listener_error_handled.ts", + output: "run/event_listener_error_handled.ts.out", }); // https://github.com/denoland/deno/pull/14159#issuecomment-1092285446 itest!(event_listener_error_immediate_exit { - args: "run --quiet event_listener_error_immediate_exit.ts", - output: "event_listener_error_immediate_exit.ts.out", + args: "run --quiet run/event_listener_error_immediate_exit.ts", + output: "run/event_listener_error_immediate_exit.ts.out", exit_code: 1, }); // https://github.com/denoland/deno/pull/14159#issuecomment-1092285446 itest!(event_listener_error_immediate_exit_worker { args: - "run --quiet --unstable -A event_listener_error_immediate_exit_worker.ts", - output: "event_listener_error_immediate_exit_worker.ts.out", + "run --quiet --unstable -A run/event_listener_error_immediate_exit_worker.ts", + output: "run/event_listener_error_immediate_exit_worker.ts.out", exit_code: 1, }); itest!(set_timeout_error { - args: "run --quiet set_timeout_error.ts", - output: "set_timeout_error.ts.out", + args: "run --quiet run/set_timeout_error.ts", + output: "run/set_timeout_error.ts.out", exit_code: 1, }); itest!(set_timeout_error_handled { - args: "run --quiet set_timeout_error_handled.ts", - output: "set_timeout_error_handled.ts.out", + args: "run --quiet run/set_timeout_error_handled.ts", + output: "run/set_timeout_error_handled.ts.out", }); itest!(aggregate_error { - args: "run --quiet aggregate_error.ts", - output: "aggregate_error.out", + args: "run --quiet run/aggregate_error.ts", + output: "run/aggregate_error.out", exit_code: 1, }); itest!(complex_error { - args: "run --quiet complex_error.ts", - output: "complex_error.ts.out", + args: "run --quiet run/complex_error.ts", + output: "run/complex_error.ts.out", exit_code: 1, }); // Regression test for https://github.com/denoland/deno/issues/12143. itest!(js_root_with_ts_check { - args: "run --quiet --check js_root_with_ts_check.js", - output: "js_root_with_ts_check.js.out", + args: "run --quiet --check run/js_root_with_ts_check.js", + output: "run/js_root_with_ts_check.js.out", exit_code: 1, }); @@ -2719,13 +2715,13 @@ fn check_local_then_remote() { // Regression test for https://github.com/denoland/deno/issues/15163 itest!(check_js_points_to_ts { - args: "run --quiet --check --config checkjs.tsconfig.json run/check_js_points_to_ts/test.js", + args: "run --quiet --check --config run/checkjs.tsconfig.json run/check_js_points_to_ts/test.js", output: "run/check_js_points_to_ts/test.js.out", exit_code: 1, }); itest!(no_prompt_flag { - args: "run --quiet --unstable --no-prompt no_prompt.ts", + args: "run --quiet --unstable --no-prompt run/no_prompt.ts", output_str: Some(""), }); @@ -2735,7 +2731,7 @@ fn deno_no_prompt_environment_variable() { .current_dir(util::testdata_path()) .arg("run") .arg("--unstable") - .arg("no_prompt.ts") + .arg("run/no_prompt.ts") .env("DENO_NO_PROMPT", "1") .spawn() .unwrap() @@ -2745,53 +2741,53 @@ fn deno_no_prompt_environment_variable() { } itest!(report_error { - args: "run --quiet report_error.ts", - output: "report_error.ts.out", + args: "run --quiet run/report_error.ts", + output: "run/report_error.ts.out", exit_code: 1, }); itest!(report_error_handled { - args: "run --quiet report_error_handled.ts", - output: "report_error_handled.ts.out", + args: "run --quiet run/report_error_handled.ts", + output: "run/report_error_handled.ts.out", }); // Regression test for https://github.com/denoland/deno/issues/15513. itest!(report_error_end_of_program { - args: "run --quiet report_error_end_of_program.ts", - output: "report_error_end_of_program.ts.out", + args: "run --quiet run/report_error_end_of_program.ts", + output: "run/report_error_end_of_program.ts.out", exit_code: 1, }); itest!(queue_microtask_error { - args: "run --quiet queue_microtask_error.ts", - output: "queue_microtask_error.ts.out", + args: "run --quiet run/queue_microtask_error.ts", + output: "run/queue_microtask_error.ts.out", exit_code: 1, }); itest!(queue_microtask_error_handled { - args: "run --quiet queue_microtask_error_handled.ts", - output: "queue_microtask_error_handled.ts.out", + args: "run --quiet run/queue_microtask_error_handled.ts", + output: "run/queue_microtask_error_handled.ts.out", }); itest!(spawn_stdout_inherit { - args: "run --quiet --unstable -A spawn_stdout_inherit.ts", - output: "spawn_stdout_inherit.ts.out", + args: "run --quiet --unstable -A run/spawn_stdout_inherit.ts", + output: "run/spawn_stdout_inherit.ts.out", }); itest!(error_name_non_string { - args: "run --quiet error_name_non_string.js", - output: "error_name_non_string.js.out", + args: "run --quiet run/error_name_non_string.js", + output: "run/error_name_non_string.js.out", exit_code: 1, }); itest!(custom_inspect_url { - args: "run custom_inspect_url.js", - output: "custom_inspect_url.js.out", + args: "run run/custom_inspect_url.js", + output: "run/custom_inspect_url.js.out", }); itest!(config_json_import { - args: "run --quiet -c jsx/deno-jsx.json config_json_import.ts", - output: "config_json_import.ts.out", + args: "run --quiet -c jsx/deno-jsx.json run/config_json_import.ts", + output: "run/config_json_import.ts.out", http_server: true, }); @@ -2815,39 +2811,732 @@ fn running_declaration_files() { } itest!(test_and_bench_are_noops_in_run { - args: "run test_and_bench_in_run.js", + args: "run run/test_and_bench_in_run.js", output_str: Some(""), }); itest!(followup_dyn_import_resolved { - args: "run --unstable --allow-read followup_dyn_import_resolves/main.ts", - output: "followup_dyn_import_resolves/main.ts.out", + args: "run --unstable --allow-read run/followup_dyn_import_resolves/main.ts", + output: "run/followup_dyn_import_resolves/main.ts.out", }); itest!(unhandled_rejection { - args: "run --check unhandled_rejection.ts", - output: "unhandled_rejection.ts.out", + args: "run --check run/unhandled_rejection.ts", + output: "run/unhandled_rejection.ts.out", }); itest!(unhandled_rejection_sync_error { - args: "run --check unhandled_rejection_sync_error.ts", - output: "unhandled_rejection_sync_error.ts.out", + args: "run --check run/unhandled_rejection_sync_error.ts", + output: "run/unhandled_rejection_sync_error.ts.out", }); itest!(nested_error { - args: "run nested_error.ts", - output: "nested_error.ts.out", + args: "run run/nested_error.ts", + output: "run/nested_error.ts.out", exit_code: 1, }); itest!(node_env_var_allowlist_with_unstable_flag { - args: "run --unstable --no-prompt node_env_var_allowlist.ts", - output: "node_env_var_allowlist_with_unstable_flag.ts.out", + args: "run --unstable --no-prompt run/node_env_var_allowlist.ts", + output: "run/node_env_var_allowlist_with_unstable_flag.ts.out", exit_code: 1, }); itest!(node_env_var_allowlist_without_unstable_flag { - args: "run --no-prompt node_env_var_allowlist.ts", - output: "node_env_var_allowlist_without_unstable_flag.ts.out", + args: "run --no-prompt run/node_env_var_allowlist.ts", + output: "run/node_env_var_allowlist_without_unstable_flag.ts.out", exit_code: 1, }); + +#[test] +fn cache_test() { + let _g = util::http_server(); + let deno_dir = TempDir::new(); + let module_url = + url::Url::parse("http://localhost:4545/run/006_url_imports.ts").unwrap(); + let output = Command::new(util::deno_exe_path()) + .env("DENO_DIR", deno_dir.path()) + .current_dir(util::testdata_path()) + .arg("cache") + .arg("--check=all") + .arg("-L") + .arg("debug") + .arg(module_url.to_string()) + .output() + .expect("Failed to spawn script"); + assert!(output.status.success()); + + let prg = util::deno_exe_path(); + let output = Command::new(&prg) + .env("DENO_DIR", deno_dir.path()) + .env("HTTP_PROXY", "http://nil") + .env("NO_COLOR", "1") + .current_dir(util::testdata_path()) + .arg("run") + .arg(module_url.to_string()) + .output() + .expect("Failed to spawn script"); + + let str_output = std::str::from_utf8(&output.stdout).unwrap(); + + let module_output_path = + util::testdata_path().join("run/006_url_imports.ts.out"); + let mut module_output = String::new(); + let mut module_output_file = std::fs::File::open(module_output_path).unwrap(); + module_output_file + .read_to_string(&mut module_output) + .unwrap(); + + assert_eq!(module_output, str_output); +} + +#[test] +fn cache_invalidation_test() { + let deno_dir = TempDir::new(); + let fixture_path = deno_dir.path().join("fixture.ts"); + { + let mut file = std::fs::File::create(fixture_path.clone()) + .expect("could not create fixture"); + file + .write_all(b"console.log(\"42\");") + .expect("could not write fixture"); + } + let output = Command::new(util::deno_exe_path()) + .env("DENO_DIR", deno_dir.path()) + .current_dir(util::testdata_path()) + .arg("run") + .arg(fixture_path.to_str().unwrap()) + .output() + .expect("Failed to spawn script"); + assert!(output.status.success()); + let actual = std::str::from_utf8(&output.stdout).unwrap(); + assert_eq!(actual, "42\n"); + { + let mut file = std::fs::File::create(fixture_path.clone()) + .expect("could not create fixture"); + file + .write_all(b"console.log(\"43\");") + .expect("could not write fixture"); + } + let output = Command::new(util::deno_exe_path()) + .env("DENO_DIR", deno_dir.path()) + .current_dir(util::testdata_path()) + .arg("run") + .arg(fixture_path.to_str().unwrap()) + .output() + .expect("Failed to spawn script"); + assert!(output.status.success()); + let actual = std::str::from_utf8(&output.stdout).unwrap(); + assert_eq!(actual, "43\n"); +} + +#[test] +fn cache_invalidation_test_no_check() { + let deno_dir = TempDir::new(); + let fixture_path = deno_dir.path().join("fixture.ts"); + { + let mut file = std::fs::File::create(fixture_path.clone()) + .expect("could not create fixture"); + file + .write_all(b"console.log(\"42\");") + .expect("could not write fixture"); + } + let output = Command::new(util::deno_exe_path()) + .env("DENO_DIR", deno_dir.path()) + .current_dir(util::testdata_path()) + .arg("run") + .arg("--no-check") + .arg(fixture_path.to_str().unwrap()) + .output() + .expect("Failed to spawn script"); + assert!(output.status.success()); + let actual = std::str::from_utf8(&output.stdout).unwrap(); + assert_eq!(actual, "42\n"); + { + let mut file = std::fs::File::create(fixture_path.clone()) + .expect("could not create fixture"); + file + .write_all(b"console.log(\"43\");") + .expect("could not write fixture"); + } + let output = Command::new(util::deno_exe_path()) + .env("DENO_DIR", deno_dir.path()) + .current_dir(util::testdata_path()) + .arg("run") + .arg("--no-check") + .arg(fixture_path.to_str().unwrap()) + .output() + .expect("Failed to spawn script"); + assert!(output.status.success()); + let actual = std::str::from_utf8(&output.stdout).unwrap(); + assert_eq!(actual, "43\n"); +} + +#[test] +fn ts_dependency_recompilation() { + let t = TempDir::new(); + let ats = t.path().join("a.ts"); + + std::fs::write( + &ats, + " + import { foo } from \"./b.ts\"; + + function print(str: string): void { + console.log(str); + } + + print(foo);", + ) + .unwrap(); + + let bts = t.path().join("b.ts"); + std::fs::write( + &bts, + " + export const foo = \"foo\";", + ) + .unwrap(); + + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .env("NO_COLOR", "1") + .arg("run") + .arg("--check") + .arg(&ats) + .output() + .expect("failed to spawn script"); + + let stdout_output = std::str::from_utf8(&output.stdout).unwrap().trim(); + let stderr_output = std::str::from_utf8(&output.stderr).unwrap().trim(); + + assert!(stdout_output.ends_with("foo")); + assert!(stderr_output.starts_with("Check")); + + // Overwrite contents of b.ts and run again + std::fs::write( + &bts, + " + export const foo = 5;", + ) + .expect("error writing file"); + + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .env("NO_COLOR", "1") + .arg("run") + .arg("--check") + .arg(&ats) + .output() + .expect("failed to spawn script"); + + let stdout_output = std::str::from_utf8(&output.stdout).unwrap().trim(); + let stderr_output = std::str::from_utf8(&output.stderr).unwrap().trim(); + + // error: TS2345 [ERROR]: Argument of type '5' is not assignable to parameter of type 'string'. + assert!(stderr_output.contains("TS2345")); + assert!(!output.status.success()); + assert!(stdout_output.is_empty()); +} + +#[test] +fn basic_auth_tokens() { + let _g = util::http_server(); + + let output = util::deno_cmd() + .current_dir(util::root_path()) + .arg("run") + .arg("http://127.0.0.1:4554/run/001_hello.js") + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + + assert!(!output.status.success()); + + let stdout_str = std::str::from_utf8(&output.stdout).unwrap().trim(); + assert!(stdout_str.is_empty()); + + let stderr_str = std::str::from_utf8(&output.stderr).unwrap().trim(); + eprintln!("{}", stderr_str); + + assert!(stderr_str + .contains("Module not found \"http://127.0.0.1:4554/run/001_hello.js\".")); + + let output = util::deno_cmd() + .current_dir(util::root_path()) + .arg("run") + .arg("http://127.0.0.1:4554/run/001_hello.js") + .env("DENO_AUTH_TOKENS", "testuser123:testpassabc@127.0.0.1:4554") + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + + let stderr_str = std::str::from_utf8(&output.stderr).unwrap().trim(); + eprintln!("{}", stderr_str); + + assert!(output.status.success()); + + let stdout_str = std::str::from_utf8(&output.stdout).unwrap().trim(); + assert_eq!(util::strip_ansi_codes(stdout_str), "Hello World"); +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn test_resolve_dns() { + use std::net::SocketAddr; + use std::str::FromStr; + use std::sync::Arc; + use std::time::Duration; + use tokio::net::TcpListener; + use tokio::net::UdpSocket; + use tokio::sync::oneshot; + use trust_dns_server::authority::Catalog; + use trust_dns_server::authority::ZoneType; + use trust_dns_server::proto::rr::Name; + use trust_dns_server::store::in_memory::InMemoryAuthority; + use trust_dns_server::ServerFuture; + + const DNS_PORT: u16 = 4553; + + // Setup DNS server for testing + async fn run_dns_server(tx: oneshot::Sender<()>) { + let zone_file = std::fs::read_to_string( + util::testdata_path().join("run/resolve_dns.zone.in"), + ) + .unwrap(); + let lexer = Lexer::new(&zone_file); + let records = Parser::new().parse( + lexer, + Some(Name::from_str("example.com").unwrap()), + None, + ); + if records.is_err() { + panic!("failed to parse: {:?}", records.err()) + } + let (origin, records) = records.unwrap(); + let authority = Box::new(Arc::new( + InMemoryAuthority::new(origin, records, ZoneType::Primary, false) + .unwrap(), + )); + let mut catalog: Catalog = Catalog::new(); + catalog.upsert(Name::root().into(), authority); + + let mut server_fut = ServerFuture::new(catalog); + let socket_addr = SocketAddr::from(([127, 0, 0, 1], DNS_PORT)); + let tcp_listener = TcpListener::bind(socket_addr).await.unwrap(); + let udp_socket = UdpSocket::bind(socket_addr).await.unwrap(); + server_fut.register_socket(udp_socket); + server_fut.register_listener(tcp_listener, Duration::from_secs(2)); + + // Notifies that the DNS server is ready + tx.send(()).unwrap(); + + server_fut.block_until_done().await.unwrap(); + } + + let (ready_tx, ready_rx) = oneshot::channel(); + let dns_server_fut = run_dns_server(ready_tx); + let handle = tokio::spawn(dns_server_fut); + + // Waits for the DNS server to be ready + ready_rx.await.unwrap(); + + // Pass: `--allow-net` + { + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .env("NO_COLOR", "1") + .arg("run") + .arg("--check") + .arg("--allow-net") + .arg("run/resolve_dns.ts") + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + let err = String::from_utf8_lossy(&output.stderr); + let out = String::from_utf8_lossy(&output.stdout); + println!("{}", err); + assert!(output.status.success()); + assert!(err.starts_with("Check file")); + + let expected = std::fs::read_to_string( + util::testdata_path().join("run/resolve_dns.ts.out"), + ) + .unwrap(); + assert_eq!(expected, out); + } + + // Pass: `--allow-net=127.0.0.1:4553` + { + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .env("NO_COLOR", "1") + .arg("run") + .arg("--check") + .arg("--allow-net=127.0.0.1:4553") + .arg("run/resolve_dns.ts") + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + let err = String::from_utf8_lossy(&output.stderr); + let out = String::from_utf8_lossy(&output.stdout); + assert!(output.status.success()); + assert!(err.starts_with("Check file")); + + let expected = std::fs::read_to_string( + util::testdata_path().join("run/resolve_dns.ts.out"), + ) + .unwrap(); + assert_eq!(expected, out); + } + + // Permission error: `--allow-net=deno.land` + { + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .env("NO_COLOR", "1") + .arg("run") + .arg("--check") + .arg("--allow-net=deno.land") + .arg("run/resolve_dns.ts") + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + let err = String::from_utf8_lossy(&output.stderr); + let out = String::from_utf8_lossy(&output.stdout); + assert!(!output.status.success()); + assert!(err.starts_with("Check file")); + assert!(err.contains(r#"error: Uncaught PermissionDenied: Requires net access to "127.0.0.1:4553""#)); + assert!(out.is_empty()); + } + + // Permission error: no permission specified + { + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .env("NO_COLOR", "1") + .arg("run") + .arg("--check") + .arg("run/resolve_dns.ts") + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + let err = String::from_utf8_lossy(&output.stderr); + let out = String::from_utf8_lossy(&output.stdout); + assert!(!output.status.success()); + assert!(err.starts_with("Check file")); + assert!(err.contains(r#"error: Uncaught PermissionDenied: Requires net access to "127.0.0.1:4553""#)); + assert!(out.is_empty()); + } + + handle.abort(); +} + +#[tokio::test] +async fn http2_request_url() { + // TLS streams require the presence of an ambient local task set to gracefully + // close dropped connections in the background. + LocalSet::new() + .run_until(async { + let mut child = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("run") + .arg("--unstable") + .arg("--quiet") + .arg("--allow-net") + .arg("--allow-read") + .arg("./run/http2_request_url.ts") + .arg("4506") + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap(); + let stdout = child.stdout.as_mut().unwrap(); + let mut buffer = [0; 5]; + let read = stdout.read(&mut buffer).unwrap(); + assert_eq!(read, 5); + let msg = std::str::from_utf8(&buffer).unwrap(); + assert_eq!(msg, "READY"); + + let cert = reqwest::Certificate::from_pem(include_bytes!( + "../testdata/tls/RootCA.crt" + )) + .unwrap(); + + let client = reqwest::Client::builder() + .add_root_certificate(cert) + .http2_prior_knowledge() + .build() + .unwrap(); + + let res = client.get("http://127.0.0.1:4506").send().await.unwrap(); + assert_eq!(200, res.status()); + + let body = res.text().await.unwrap(); + assert_eq!(body, "http://127.0.0.1:4506/"); + + child.kill().unwrap(); + child.wait().unwrap(); + }) + .await; +} + +#[cfg(not(windows))] +#[test] +fn set_raw_should_not_panic_on_no_tty() { + let output = util::deno_cmd() + .arg("eval") + .arg("--unstable") + .arg("Deno.setRaw(Deno.stdin.rid, true)") + // stdin set to piped so it certainly does not refer to TTY + .stdin(std::process::Stdio::piped()) + // stderr is piped so we can capture output. + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(!output.status.success()); + let stderr = std::str::from_utf8(&output.stderr).unwrap().trim(); + assert!(stderr.contains("BadResource")); +} + +#[test] +fn timeout_clear() { + // https://github.com/denoland/deno/issues/7599 + + use std::time::Duration; + use std::time::Instant; + + let source_code = r#" +const handle = setTimeout(() => { + console.log("timeout finish"); +}, 10000); +clearTimeout(handle); +console.log("finish"); +"#; + + let mut p = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("run") + .arg("-") + .stdin(std::process::Stdio::piped()) + .spawn() + .unwrap(); + let stdin = p.stdin.as_mut().unwrap(); + stdin.write_all(source_code.as_bytes()).unwrap(); + let start = Instant::now(); + let status = p.wait().unwrap(); + let end = Instant::now(); + assert!(status.success()); + // check that program did not run for 10 seconds + // for timeout to clear + assert!(end - start < Duration::new(10, 0)); +} + +#[test] +fn broken_stdout() { + let (reader, writer) = os_pipe::pipe().unwrap(); + // drop the reader to create a broken pipe + drop(reader); + + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("eval") + .arg("console.log(3.14)") + .stdout(writer) + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + + assert!(!output.status.success()); + let stderr = std::str::from_utf8(output.stderr.as_ref()).unwrap().trim(); + assert!(stderr.contains("Uncaught BrokenPipe")); + assert!(!stderr.contains("panic")); +} + +itest!(error_cause { + args: "run run/error_cause.ts", + output: "run/error_cause.ts.out", + exit_code: 1, +}); + +itest!(error_cause_recursive { + args: "run run/error_cause_recursive.ts", + output: "run/error_cause_recursive.ts.out", + exit_code: 1, +}); + +#[test] +fn websocket() { + let _g = util::http_server(); + + let script = util::testdata_path().join("run/websocket_test.ts"); + let root_ca = util::testdata_path().join("tls/RootCA.pem"); + let status = util::deno_cmd() + .arg("test") + .arg("--unstable") + .arg("--allow-net") + .arg("--cert") + .arg(root_ca) + .arg(script) + .spawn() + .unwrap() + .wait() + .unwrap(); + + assert!(status.success()); +} + +#[test] +fn websocketstream() { + let _g = util::http_server(); + + let script = util::testdata_path().join("run/websocketstream_test.ts"); + let root_ca = util::testdata_path().join("tls/RootCA.pem"); + let status = util::deno_cmd() + .arg("test") + .arg("--unstable") + .arg("--allow-net") + .arg("--cert") + .arg(root_ca) + .arg(script) + .spawn() + .unwrap() + .wait() + .unwrap(); + + assert!(status.success()); +} + +#[test] +fn websocketstream_ping() { + use deno_runtime::deno_websocket::tokio_tungstenite::tungstenite; + let _g = util::http_server(); + + let script = util::testdata_path().join("run/websocketstream_ping_test.ts"); + let root_ca = util::testdata_path().join("tls/RootCA.pem"); + let mut child = util::deno_cmd() + .arg("test") + .arg("--unstable") + .arg("--allow-net") + .arg("--cert") + .arg(root_ca) + .arg(script) + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap(); + + let server = std::net::TcpListener::bind("127.0.0.1:4513").unwrap(); + let (stream, _) = server.accept().unwrap(); + let mut socket = tungstenite::accept(stream).unwrap(); + socket + .write_message(tungstenite::Message::Text(String::from("A"))) + .unwrap(); + socket + .write_message(tungstenite::Message::Ping(vec![])) + .unwrap(); + socket + .write_message(tungstenite::Message::Text(String::from("B"))) + .unwrap(); + let message = socket.read_message().unwrap(); + assert_eq!(message, tungstenite::Message::Pong(vec![])); + socket + .write_message(tungstenite::Message::Text(String::from("C"))) + .unwrap(); + socket.close(None).unwrap(); + + assert!(child.wait().unwrap().success()); +} + +#[test] +fn websocket_server_multi_field_connection_header() { + let script = util::testdata_path() + .join("run/websocket_server_multi_field_connection_header_test.ts"); + let root_ca = util::testdata_path().join("tls/RootCA.pem"); + let mut child = util::deno_cmd() + .arg("run") + .arg("--unstable") + .arg("--allow-net") + .arg("--cert") + .arg(root_ca) + .arg(script) + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap(); + + let stdout = child.stdout.as_mut().unwrap(); + let mut buffer = [0; 5]; + let read = stdout.read(&mut buffer).unwrap(); + assert_eq!(read, 5); + let msg = std::str::from_utf8(&buffer).unwrap(); + assert_eq!(msg, "READY"); + + let req = http::request::Builder::new() + .header(http::header::CONNECTION, "keep-alive, Upgrade") + .uri("ws://localhost:4319") + .body(()) + .unwrap(); + let (mut socket, _) = + deno_runtime::deno_websocket::tokio_tungstenite::tungstenite::connect(req) + .unwrap(); + let message = socket.read_message().unwrap(); + assert_eq!(message, deno_runtime::deno_websocket::tokio_tungstenite::tungstenite::Message::Close(None)); + socket.close(None).unwrap(); + assert!(child.wait().unwrap().success()); +} + +// TODO(bartlomieju): this should use `deno run`, not `deno test`; but the +// test hangs then. https://github.com/denoland/deno/issues/14283 +#[test] +#[ignore] +fn websocket_server_idletimeout() { + let script = + util::testdata_path().join("run/websocket_server_idletimeout.ts"); + let root_ca = util::testdata_path().join("tls/RootCA.pem"); + let mut child = util::deno_cmd() + .arg("test") + .arg("--unstable") + .arg("--allow-net") + .arg("--cert") + .arg(root_ca) + .arg(script) + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap(); + + let stdout = child.stdout.as_mut().unwrap(); + let mut buffer = [0; 5]; + let read = stdout.read(&mut buffer).unwrap(); + assert_eq!(read, 5); + let msg = std::str::from_utf8(&buffer).unwrap(); + assert_eq!(msg, "READY"); + + let req = http::request::Builder::new() + .uri("ws://localhost:4509") + .body(()) + .unwrap(); + let (_ws, _request) = + deno_runtime::deno_websocket::tokio_tungstenite::tungstenite::connect(req) + .unwrap(); + + assert!(child.wait().unwrap().success()); +} diff --git a/cli/tests/integration/vendor_tests.rs b/cli/tests/integration/vendor_tests.rs index 54809dacf..b3a3f441f 100644 --- a/cli/tests/integration/vendor_tests.rs +++ b/cli/tests/integration/vendor_tests.rs @@ -347,6 +347,7 @@ fn existing_import_map_mixed_with_remote() { .arg("--output") .arg("vendor2") .stderr(Stdio::piped()) + .stdout(Stdio::piped()) .spawn() .unwrap(); let output = deno.wait_with_output().unwrap(); diff --git a/cli/tests/integration/watcher_tests.rs b/cli/tests/integration/watcher_tests.rs index b69379427..efc1b186b 100644 --- a/cli/tests/integration/watcher_tests.rs +++ b/cli/tests/integration/watcher_tests.rs @@ -242,15 +242,15 @@ fn lint_all_files_on_each_change_test() { #[test] fn fmt_watch_test() { + let fmt_testdata_path = util::testdata_path().join("fmt"); let t = TempDir::new(); - let fixed = util::testdata_path().join("badly_formatted_fixed.js"); - let badly_formatted_original = - util::testdata_path().join("badly_formatted.mjs"); + let fixed = fmt_testdata_path.join("badly_formatted_fixed.js"); + let badly_formatted_original = fmt_testdata_path.join("badly_formatted.mjs"); let badly_formatted = t.path().join("badly_formatted.js"); std::fs::copy(&badly_formatted_original, &badly_formatted).unwrap(); let mut child = util::deno_cmd() - .current_dir(util::testdata_path()) + .current_dir(&fmt_testdata_path) .arg("fmt") .arg(&badly_formatted) .arg("--watch") @@ -291,10 +291,10 @@ fn fmt_watch_test() { #[test] fn fmt_watch_without_args_test() { + let fmt_testdata_path = util::testdata_path().join("fmt"); let t = TempDir::new(); - let fixed = util::testdata_path().join("badly_formatted_fixed.js"); - let badly_formatted_original = - util::testdata_path().join("badly_formatted.mjs"); + let fixed = fmt_testdata_path.join("badly_formatted_fixed.js"); + let badly_formatted_original = fmt_testdata_path.join("badly_formatted.mjs"); let badly_formatted = t.path().join("badly_formatted.js"); std::fs::copy(&badly_formatted_original, &badly_formatted).unwrap(); @@ -339,15 +339,15 @@ fn fmt_watch_without_args_test() { #[test] fn fmt_check_all_files_on_each_change_test() { let t = TempDir::new(); - let badly_formatted_original = - util::testdata_path().join("badly_formatted.mjs"); + let fmt_testdata_path = util::testdata_path().join("fmt"); + let badly_formatted_original = fmt_testdata_path.join("badly_formatted.mjs"); let badly_formatted_1 = t.path().join("badly_formatted_1.js"); let badly_formatted_2 = t.path().join("badly_formatted_2.js"); std::fs::copy(&badly_formatted_original, &badly_formatted_1).unwrap(); std::fs::copy(&badly_formatted_original, &badly_formatted_2).unwrap(); let mut child = util::deno_cmd() - .current_dir(util::testdata_path()) + .current_dir(&fmt_testdata_path) .arg("fmt") .arg(&t.path()) .arg("--watch") diff --git a/cli/tests/integration/worker_tests.rs b/cli/tests/integration/worker_tests.rs index 63d5ccbd3..b864c15da 100644 --- a/cli/tests/integration/worker_tests.rs +++ b/cli/tests/integration/worker_tests.rs @@ -41,20 +41,20 @@ itest!(nonexistent_worker { }); itest!(_084_worker_custom_inspect { - args: "run --allow-read 084_worker_custom_inspect.ts", - output: "084_worker_custom_inspect.ts.out", + args: "run --allow-read workers/custom_inspect/main.ts", + output: "workers/custom_inspect/main.out", }); itest!(error_worker_permissions_local { - args: "run --reload error_worker_permissions_local.ts", - output: "error_worker_permissions_local.ts.out", + args: "run --reload workers/error_worker_permissions_local.ts", + output: "workers/error_worker_permissions_local.ts.out", exit_code: 1, }); itest!(error_worker_permissions_remote { - args: "run --reload error_worker_permissions_remote.ts", + args: "run --reload workers/error_worker_permissions_remote.ts", http_server: true, - output: "error_worker_permissions_remote.ts.out", + output: "workers/error_worker_permissions_remote.ts.out", exit_code: 1, }); diff --git a/cli/tests/testdata/001_hello.js b/cli/tests/testdata/001_hello.js deleted file mode 100644 index accefceba..000000000 --- a/cli/tests/testdata/001_hello.js +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello World"); diff --git a/cli/tests/testdata/001_hello.js.out b/cli/tests/testdata/001_hello.js.out deleted file mode 100644 index 557db03de..000000000 --- a/cli/tests/testdata/001_hello.js.out +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/cli/tests/testdata/002_hello.ts b/cli/tests/testdata/002_hello.ts deleted file mode 100644 index accefceba..000000000 --- a/cli/tests/testdata/002_hello.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello World"); diff --git a/cli/tests/testdata/002_hello.ts.out b/cli/tests/testdata/002_hello.ts.out deleted file mode 100644 index 557db03de..000000000 --- a/cli/tests/testdata/002_hello.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/cli/tests/testdata/003_relative_import.ts b/cli/tests/testdata/003_relative_import.ts deleted file mode 100644 index 01d5d7faa..000000000 --- a/cli/tests/testdata/003_relative_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello } from "./subdir/print_hello.ts"; - -printHello(); diff --git a/cli/tests/testdata/003_relative_import.ts.out b/cli/tests/testdata/003_relative_import.ts.out deleted file mode 100644 index 699b756ed..000000000 --- a/cli/tests/testdata/003_relative_import.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -Hello diff --git a/cli/tests/testdata/004_set_timeout.ts b/cli/tests/testdata/004_set_timeout.ts deleted file mode 100644 index 214b25086..000000000 --- a/cli/tests/testdata/004_set_timeout.ts +++ /dev/null @@ -1,11 +0,0 @@ -setTimeout(() => { - console.log("World"); -}, 10); - -console.log("Hello"); - -const id = setTimeout(() => { - console.log("Not printed"); -}, 10000); - -clearTimeout(id); diff --git a/cli/tests/testdata/004_set_timeout.ts.out b/cli/tests/testdata/004_set_timeout.ts.out deleted file mode 100644 index f9264f7fb..000000000 --- a/cli/tests/testdata/004_set_timeout.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Hello -World diff --git a/cli/tests/testdata/005_more_imports.ts b/cli/tests/testdata/005_more_imports.ts deleted file mode 100644 index 0266bf46c..000000000 --- a/cli/tests/testdata/005_more_imports.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { printHello3, returnsFoo2, returnsHi } from "./subdir/mod1.ts"; - -printHello3(); - -if (returnsHi() !== "Hi") { - throw Error("Unexpected"); -} - -if (returnsFoo2() !== "Foo") { - throw Error("Unexpected"); -} diff --git a/cli/tests/testdata/005_more_imports.ts.out b/cli/tests/testdata/005_more_imports.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/testdata/005_more_imports.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/testdata/006_url_imports.ts b/cli/tests/testdata/006_url_imports.ts deleted file mode 100644 index 4036f27ed..000000000 --- a/cli/tests/testdata/006_url_imports.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello } from "http://localhost:4545/subdir/mod2.ts"; -printHello(); -console.log("success"); diff --git a/cli/tests/testdata/006_url_imports.ts.out b/cli/tests/testdata/006_url_imports.ts.out deleted file mode 100644 index 989ce33e9..000000000 --- a/cli/tests/testdata/006_url_imports.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Hello -success diff --git a/cli/tests/testdata/012_async.ts b/cli/tests/testdata/012_async.ts deleted file mode 100644 index 536197b68..000000000 --- a/cli/tests/testdata/012_async.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Check that we can use the async keyword. -async function main() { - await new Promise((resolve) => { - console.log("2"); - setTimeout(resolve, 100); - }); - console.log("3"); -} - -console.log("1"); -main(); diff --git a/cli/tests/testdata/012_async.ts.out b/cli/tests/testdata/012_async.ts.out deleted file mode 100644 index 01e79c32a..000000000 --- a/cli/tests/testdata/012_async.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -1 -2 -3 diff --git a/cli/tests/testdata/013_dynamic_import.ts b/cli/tests/testdata/013_dynamic_import.ts deleted file mode 100644 index d4dc55152..000000000 --- a/cli/tests/testdata/013_dynamic_import.ts +++ /dev/null @@ -1,15 +0,0 @@ -(async () => { - const { returnsHi, returnsFoo2, printHello3 } = await import( - "./subdir/mod1.ts" - ); - - printHello3(); - - if (returnsHi() !== "Hi") { - throw Error("Unexpected"); - } - - if (returnsFoo2() !== "Foo") { - throw Error("Unexpected"); - } -})(); diff --git a/cli/tests/testdata/013_dynamic_import.ts.out b/cli/tests/testdata/013_dynamic_import.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/testdata/013_dynamic_import.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/testdata/014_duplicate_import.ts b/cli/tests/testdata/014_duplicate_import.ts deleted file mode 100644 index 88f934526..000000000 --- a/cli/tests/testdata/014_duplicate_import.ts +++ /dev/null @@ -1,9 +0,0 @@ -// with all the imports of the same module, the module should only be -// instantiated once -import "./subdir/auto_print_hello.ts"; - -import "./subdir/auto_print_hello.ts"; - -(async () => { - await import("./subdir/auto_print_hello.ts"); -})(); diff --git a/cli/tests/testdata/014_duplicate_import.ts.out b/cli/tests/testdata/014_duplicate_import.ts.out deleted file mode 100644 index 4effa19f4..000000000 --- a/cli/tests/testdata/014_duplicate_import.ts.out +++ /dev/null @@ -1 +0,0 @@ -hello! diff --git a/cli/tests/testdata/015_duplicate_parallel_import.js b/cli/tests/testdata/015_duplicate_parallel_import.js deleted file mode 100644 index 172eeaf53..000000000 --- a/cli/tests/testdata/015_duplicate_parallel_import.js +++ /dev/null @@ -1,20 +0,0 @@ -// Importing the same module in parallel, the module should only be -// instantiated once. - -const promises = new Array(100) - .fill(null) - .map(() => import("./subdir/mod1.ts")); - -Promise.all(promises).then((imports) => { - const mod = imports.reduce((first, cur) => { - if (typeof first !== "object") { - throw new Error("Expected an object."); - } - if (first !== cur) { - throw new Error("More than one instance of the same module."); - } - return first; - }); - - mod.printHello3(); -}); diff --git a/cli/tests/testdata/015_duplicate_parallel_import.js.out b/cli/tests/testdata/015_duplicate_parallel_import.js.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/testdata/015_duplicate_parallel_import.js.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/testdata/016_double_await.ts b/cli/tests/testdata/016_double_await.ts deleted file mode 100644 index 457a53ff3..000000000 --- a/cli/tests/testdata/016_double_await.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This is to test if Deno would die at 2nd await -// See https://github.com/denoland/deno/issues/919 -(async () => { - const currDirInfo = await Deno.stat("."); - const parentDirInfo = await Deno.stat(".."); - console.log(currDirInfo.isDirectory); - console.log(parentDirInfo.isFile); -})(); diff --git a/cli/tests/testdata/016_double_await.ts.out b/cli/tests/testdata/016_double_await.ts.out deleted file mode 100644 index da29283aa..000000000 --- a/cli/tests/testdata/016_double_await.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -true -false diff --git a/cli/tests/testdata/017_import_redirect.ts b/cli/tests/testdata/017_import_redirect.ts deleted file mode 100644 index 1265dd4ed..000000000 --- a/cli/tests/testdata/017_import_redirect.ts +++ /dev/null @@ -1,4 +0,0 @@ -// http -> https redirect would happen: -import { printHello } from "http://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts"; - -printHello(); diff --git a/cli/tests/testdata/017_import_redirect.ts.out b/cli/tests/testdata/017_import_redirect.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/testdata/017_import_redirect.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/testdata/017_import_redirect_info.out b/cli/tests/testdata/017_import_redirect_info.out deleted file mode 100644 index d3a2e86fc..000000000 --- a/cli/tests/testdata/017_import_redirect_info.out +++ /dev/null @@ -1,6 +0,0 @@ -local: [WILDCARD]017_import_redirect.ts -type: TypeScript -dependencies: 1 unique (total 278B) - -file:///[WILDCARD]/017_import_redirect.ts ([WILDCARD]) -└── https://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts ([WILDCARD]) diff --git a/cli/tests/testdata/018_async_catch.ts b/cli/tests/testdata/018_async_catch.ts deleted file mode 100644 index ac43a52e8..000000000 --- a/cli/tests/testdata/018_async_catch.ts +++ /dev/null @@ -1,14 +0,0 @@ -function fn(): Promise { - throw new Error("message"); -} -async function call() { - try { - console.log("before await fn()"); - await fn(); - console.log("after await fn()"); - } catch (_error) { - console.log("catch"); - } - console.log("after try-catch"); -} -call().catch(() => console.log("outer catch")); diff --git a/cli/tests/testdata/018_async_catch.ts.out b/cli/tests/testdata/018_async_catch.ts.out deleted file mode 100644 index 4fc219973..000000000 --- a/cli/tests/testdata/018_async_catch.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -before await fn() -catch -after try-catch diff --git a/cli/tests/testdata/019_media_types.ts b/cli/tests/testdata/019_media_types.ts deleted file mode 100644 index d985bd249..000000000 --- a/cli/tests/testdata/019_media_types.ts +++ /dev/null @@ -1,24 +0,0 @@ -// When run against the test HTTP server, it will serve different media types -// based on the URL containing `.t#.` strings, which exercises the different -// mapping of media types end to end. - -import { loaded as loadedTs1 } from "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; -import { loaded as loadedTs2 } from "http://localhost:4545/subdir/mt_video_vdn.t2.ts"; -import { loaded as loadedTs3 } from "http://localhost:4545/subdir/mt_video_mp2t.t3.ts"; -import { loaded as loadedTs4 } from "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts"; -import { loaded as loadedJs1 } from "http://localhost:4545/subdir/mt_text_javascript.j1.js"; -import { loaded as loadedJs2 } from "http://localhost:4545/subdir/mt_application_ecmascript.j2.js"; -import { loaded as loadedJs3 } from "http://localhost:4545/subdir/mt_text_ecmascript.j3.js"; -import { loaded as loadedJs4 } from "http://localhost:4545/subdir/mt_application_x_javascript.j4.js"; - -console.log( - "success", - loadedTs1, - loadedTs2, - loadedTs3, - loadedTs4, - loadedJs1, - loadedJs2, - loadedJs3, - loadedJs4, -); diff --git a/cli/tests/testdata/019_media_types.ts.out b/cli/tests/testdata/019_media_types.ts.out deleted file mode 100644 index b3e94678c..000000000 --- a/cli/tests/testdata/019_media_types.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]success true true true true true true true true diff --git a/cli/tests/testdata/020_json_modules.ts b/cli/tests/testdata/020_json_modules.ts deleted file mode 100644 index fdc85c440..000000000 --- a/cli/tests/testdata/020_json_modules.ts +++ /dev/null @@ -1,2 +0,0 @@ -import config from "./subdir/config.json"; -console.log(JSON.stringify(config)); diff --git a/cli/tests/testdata/020_json_modules.ts.out b/cli/tests/testdata/020_json_modules.ts.out deleted file mode 100644 index da33c40bf..000000000 --- a/cli/tests/testdata/020_json_modules.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: Expected a JavaScript or TypeScript module, but identified a Json module. Consider importing Json modules with an import assertion with the type of "json". - Specifier: [WILDCARD]/subdir/config.json -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/021_mjs_modules.ts b/cli/tests/testdata/021_mjs_modules.ts deleted file mode 100644 index 6052b9081..000000000 --- a/cli/tests/testdata/021_mjs_modules.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { isMod5 } from "./subdir/mod5.mjs"; -console.log(isMod5); diff --git a/cli/tests/testdata/021_mjs_modules.ts.out b/cli/tests/testdata/021_mjs_modules.ts.out deleted file mode 100644 index 27ba77dda..000000000 --- a/cli/tests/testdata/021_mjs_modules.ts.out +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/cli/tests/testdata/022_info_flag_script.out b/cli/tests/testdata/022_info_flag_script.out deleted file mode 100644 index e86b7dda4..000000000 --- a/cli/tests/testdata/022_info_flag_script.out +++ /dev/null @@ -1,14 +0,0 @@ -[WILDCARD] -local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD] -type: TypeScript -dependencies: 8 unique (total [WILDCARD]) - -http://127.0.0.1:4545/019_media_types.ts ([WILDCARD]) -├── http://localhost:4545/subdir/mt_application_ecmascript.j2.js ([WILDCARD]) -├── http://localhost:4545/subdir/mt_application_x_javascript.j4.js ([WILDCARD]) -├── http://localhost:4545/subdir/mt_application_x_typescript.t4.ts ([WILDCARD]) -├── http://localhost:4545/subdir/mt_text_ecmascript.j3.js ([WILDCARD]) -├── http://localhost:4545/subdir/mt_text_javascript.j1.js ([WILDCARD]) -├── http://localhost:4545/subdir/mt_text_typescript.t1.ts ([WILDCARD]) -├── http://localhost:4545/subdir/mt_video_mp2t.t3.ts ([WILDCARD]) -└── http://localhost:4545/subdir/mt_video_vdn.t2.ts ([WILDCARD]) diff --git a/cli/tests/testdata/023_no_ext b/cli/tests/testdata/023_no_ext deleted file mode 100644 index 0dcfb6209..000000000 --- a/cli/tests/testdata/023_no_ext +++ /dev/null @@ -1,2 +0,0 @@ -import * as mod4 from "./subdir/mod4.js"; -console.log(mod4.isMod4); diff --git a/cli/tests/testdata/023_no_ext.out b/cli/tests/testdata/023_no_ext.out deleted file mode 100644 index 27ba77dda..000000000 --- a/cli/tests/testdata/023_no_ext.out +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/cli/tests/testdata/024_import_no_ext_with_headers.ts b/cli/tests/testdata/024_import_no_ext_with_headers.ts deleted file mode 100644 index c8621d0e6..000000000 --- a/cli/tests/testdata/024_import_no_ext_with_headers.ts +++ /dev/null @@ -1 +0,0 @@ -import "./023_no_ext_with_headers"; diff --git a/cli/tests/testdata/024_import_no_ext_with_headers.ts.out b/cli/tests/testdata/024_import_no_ext_with_headers.ts.out deleted file mode 100644 index e427984d4..000000000 --- a/cli/tests/testdata/024_import_no_ext_with_headers.ts.out +++ /dev/null @@ -1 +0,0 @@ -HELLO diff --git a/cli/tests/testdata/025_hrtime.ts b/cli/tests/testdata/025_hrtime.ts deleted file mode 100644 index b69d61488..000000000 --- a/cli/tests/testdata/025_hrtime.ts +++ /dev/null @@ -1,5 +0,0 @@ -window.onload = async () => { - console.log(performance.now() % 2 !== 0); - await Deno.permissions.revoke({ name: "hrtime" }); - console.log(performance.now() % 2 === 0); -}; diff --git a/cli/tests/testdata/025_hrtime.ts.out b/cli/tests/testdata/025_hrtime.ts.out deleted file mode 100644 index bb101b641..000000000 --- a/cli/tests/testdata/025_hrtime.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -true -true diff --git a/cli/tests/testdata/025_reload_js_type_error.js b/cli/tests/testdata/025_reload_js_type_error.js deleted file mode 100644 index 3b7c23cc9..000000000 --- a/cli/tests/testdata/025_reload_js_type_error.js +++ /dev/null @@ -1,6 +0,0 @@ -// deno-lint-ignore-file -// There was a bug where if this was executed with --reload it would throw a -// type error. -window.test = null; -test = console; -test.log("hello"); diff --git a/cli/tests/testdata/025_reload_js_type_error.js.out b/cli/tests/testdata/025_reload_js_type_error.js.out deleted file mode 100644 index ce0136250..000000000 --- a/cli/tests/testdata/025_reload_js_type_error.js.out +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/cli/tests/testdata/026_redirect_javascript.js b/cli/tests/testdata/026_redirect_javascript.js deleted file mode 100644 index 226a6b622..000000000 --- a/cli/tests/testdata/026_redirect_javascript.js +++ /dev/null @@ -1,2 +0,0 @@ -import { value } from "http://localhost:4547/redirects/redirect3.js"; -console.log(value); diff --git a/cli/tests/testdata/026_redirect_javascript.js.out b/cli/tests/testdata/026_redirect_javascript.js.out deleted file mode 100644 index 290864299..000000000 --- a/cli/tests/testdata/026_redirect_javascript.js.out +++ /dev/null @@ -1 +0,0 @@ -3 imports 1 diff --git a/cli/tests/testdata/027_redirect_typescript.ts b/cli/tests/testdata/027_redirect_typescript.ts deleted file mode 100644 index 584341975..000000000 --- a/cli/tests/testdata/027_redirect_typescript.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { value } from "http://localhost:4547/redirects/redirect4.ts"; -console.log(value); diff --git a/cli/tests/testdata/027_redirect_typescript.ts.out b/cli/tests/testdata/027_redirect_typescript.ts.out deleted file mode 100644 index 480d4e8ca..000000000 --- a/cli/tests/testdata/027_redirect_typescript.ts.out +++ /dev/null @@ -1 +0,0 @@ -4 imports 1 diff --git a/cli/tests/testdata/028_args.ts b/cli/tests/testdata/028_args.ts deleted file mode 100644 index ec41d52f9..000000000 --- a/cli/tests/testdata/028_args.ts +++ /dev/null @@ -1,3 +0,0 @@ -Deno.args.forEach((arg) => { - console.log(arg); -}); diff --git a/cli/tests/testdata/028_args.ts.out b/cli/tests/testdata/028_args.ts.out deleted file mode 100644 index 0f1b5c59e..000000000 --- a/cli/tests/testdata/028_args.ts.out +++ /dev/null @@ -1,6 +0,0 @@ ---arg1 -val1 ---arg2=val2 --- -arg3 -arg4 diff --git a/cli/tests/testdata/029_eval.out b/cli/tests/testdata/029_eval.out deleted file mode 100644 index ce0136250..000000000 --- a/cli/tests/testdata/029_eval.out +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/cli/tests/testdata/030_eval_ts.out b/cli/tests/testdata/030_eval_ts.out deleted file mode 100644 index 190a18037..000000000 --- a/cli/tests/testdata/030_eval_ts.out +++ /dev/null @@ -1 +0,0 @@ -123 diff --git a/cli/tests/testdata/031_info_ts_error.out b/cli/tests/testdata/031_info_ts_error.out deleted file mode 100644 index 2dc7bb4e8..000000000 --- a/cli/tests/testdata/031_info_ts_error.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD] -local: [WILDCARD]031_info_ts_error.ts -type: TypeScript -dependencies: 0 unique (total [WILDCARD]) -[WILDCARD]031_info_ts_error.ts ([WILDCARD]) diff --git a/cli/tests/testdata/031_info_ts_error.ts b/cli/tests/testdata/031_info_ts_error.ts deleted file mode 100644 index 9b7492dbe..000000000 --- a/cli/tests/testdata/031_info_ts_error.ts +++ /dev/null @@ -1 +0,0 @@ -const _foo: string = 1; diff --git a/cli/tests/testdata/033_import_map.out b/cli/tests/testdata/033_import_map.out deleted file mode 100644 index e9b9160e9..000000000 --- a/cli/tests/testdata/033_import_map.out +++ /dev/null @@ -1,7 +0,0 @@ -Hello from remapped moment! -Hello from remapped moment dir! -Hello from remapped lodash! -Hello from remapped lodash dir! -Hello from remapped Vue! -Hello from scoped moment! -Hello from scoped! diff --git a/cli/tests/testdata/033_import_map_remote.out b/cli/tests/testdata/033_import_map_remote.out deleted file mode 100644 index 804fa0d57..000000000 --- a/cli/tests/testdata/033_import_map_remote.out +++ /dev/null @@ -1,5 +0,0 @@ -Hello from remapped moment! -Hello from remapped moment dir! -Hello from remapped lodash! -Hello from remapped lodash dir! -Hello from remapped Vue! diff --git a/cli/tests/testdata/034_onload.out b/cli/tests/testdata/034_onload.out deleted file mode 100644 index 9b1f454c9..000000000 --- a/cli/tests/testdata/034_onload.out +++ /dev/null @@ -1,11 +0,0 @@ -log from nest_imported script -log from imported script -log from main -got load event in event handler (nest_imported) -got load event in event handler (imported) -got load event in event handler (main) -got load event in onload function -got unload event in event handler (nest_imported) -got unload event in event handler (imported) -got unload event in event handler (main) -got unload event in onunload function diff --git a/cli/tests/testdata/034_onload/imported.ts b/cli/tests/testdata/034_onload/imported.ts deleted file mode 100644 index a176d4200..000000000 --- a/cli/tests/testdata/034_onload/imported.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-window-prefix -import { assert } from "../../../../test_util/std/testing/asserts.ts"; -import "./nest_imported.ts"; - -const handler = (e: Event) => { - assert(!e.cancelable); - console.log(`got ${e.type} event in event handler (imported)`); -}; - -window.addEventListener("load", handler); -window.addEventListener("unload", handler); -console.log("log from imported script"); diff --git a/cli/tests/testdata/034_onload/main.ts b/cli/tests/testdata/034_onload/main.ts deleted file mode 100644 index df6713105..000000000 --- a/cli/tests/testdata/034_onload/main.ts +++ /dev/null @@ -1,27 +0,0 @@ -// deno-lint-ignore-file no-window-prefix no-prototype-builtins -import { assert } from "../../../../test_util/std/testing/asserts.ts"; -import "./imported.ts"; - -assert(window.hasOwnProperty("onload")); -assert(window.onload === null); - -const eventHandler = (e: Event) => { - assert(!e.cancelable); - console.log(`got ${e.type} event in event handler (main)`); -}; - -window.addEventListener("load", eventHandler); - -window.addEventListener("unload", eventHandler); - -window.onload = (e: Event) => { - assert(!e.cancelable); - console.log(`got ${e.type} event in onload function`); -}; - -window.onunload = (e: Event) => { - assert(!e.cancelable); - console.log(`got ${e.type} event in onunload function`); -}; - -console.log("log from main"); diff --git a/cli/tests/testdata/034_onload/nest_imported.ts b/cli/tests/testdata/034_onload/nest_imported.ts deleted file mode 100644 index e461dd9b1..000000000 --- a/cli/tests/testdata/034_onload/nest_imported.ts +++ /dev/null @@ -1,11 +0,0 @@ -// deno-lint-ignore-file no-window-prefix -import { assert } from "../../../../test_util/std/testing/asserts.ts"; - -const handler = (e: Event) => { - assert(!e.cancelable); - console.log(`got ${e.type} event in event handler (nest_imported)`); -}; - -window.addEventListener("load", handler); -window.addEventListener("unload", handler); -console.log("log from nest_imported script"); diff --git a/cli/tests/testdata/035_cached_only_flag.out b/cli/tests/testdata/035_cached_only_flag.out deleted file mode 100644 index 10c8611fa..000000000 --- a/cli/tests/testdata/035_cached_only_flag.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Specifier not found in cache: "http://127.0.0.1:4545/019_media_types.ts", --cached-only is specified. - -Caused by: - Specifier not found in cache: "http://127.0.0.1:4545/019_media_types.ts", --cached-only is specified. diff --git a/cli/tests/testdata/036_import_map_fetch.out b/cli/tests/testdata/036_import_map_fetch.out deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/testdata/037_fetch_multiple.out b/cli/tests/testdata/037_fetch_multiple.out deleted file mode 100644 index 09c6c0f60..000000000 --- a/cli/tests/testdata/037_fetch_multiple.out +++ /dev/null @@ -1,5 +0,0 @@ -Download http://localhost:4545/subdir/mod2.ts -Download http://localhost:4545/subdir/print_hello.ts -Check [WILDCARD]/fetch/test.ts -Download http://localhost:4545/subdir/mt_text_typescript.t1.ts -Check [WILDCARD]/fetch/other.ts diff --git a/cli/tests/testdata/038_checkjs.js b/cli/tests/testdata/038_checkjs.js deleted file mode 100644 index f0856d94c..000000000 --- a/cli/tests/testdata/038_checkjs.js +++ /dev/null @@ -1,5 +0,0 @@ -// console.log intentionally misspelled to trigger a type error -consol.log("hello world!"); - -// the following error should be ignored and not output to the console -const foo = new Foo(); diff --git a/cli/tests/testdata/038_checkjs.js.out b/cli/tests/testdata/038_checkjs.js.out deleted file mode 100644 index 4ea473e4f..000000000 --- a/cli/tests/testdata/038_checkjs.js.out +++ /dev/null @@ -1,22 +0,0 @@ -[WILDCARD] -error: TS2552 [ERROR]: Cannot find name 'consol'. Did you mean 'console'? -consol.log("hello world!"); -~~~~~~ - at [WILDCARD]/038_checkjs.js:2:1 - - 'console' is declared here. - declare var console: Console; - ~~~~~~~ - at [WILDCARD] - -TS2552 [ERROR]: Cannot find name 'Foo'. Did you mean 'foo'? -const foo = new Foo(); - ~~~ - at [WILDCARD]/038_checkjs.js:5:17 - - 'foo' is declared here. - const foo = new Foo(); - ~~~ - at [WILDCARD]/038_checkjs.js:5:7 - -Found 2 errors. diff --git a/cli/tests/testdata/041_dyn_import_eval.out b/cli/tests/testdata/041_dyn_import_eval.out deleted file mode 100644 index a1d6c3687..000000000 --- a/cli/tests/testdata/041_dyn_import_eval.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -Module { isMod4: true } diff --git a/cli/tests/testdata/041_info_flag.out b/cli/tests/testdata/041_info_flag.out deleted file mode 100644 index 3506a29e4..000000000 --- a/cli/tests/testdata/041_info_flag.out +++ /dev/null @@ -1,6 +0,0 @@ -DENO_DIR location: [WILDCARD] -Remote modules cache: [WILDCARD]deps -npm modules cache: [WILDCARD]npm -Emitted modules cache: [WILDCARD]gen -Language server registries cache: [WILDCARD]registries -Origin storage: [WILDCARD]location_data diff --git a/cli/tests/testdata/041_info_flag_location.out b/cli/tests/testdata/041_info_flag_location.out deleted file mode 100644 index b9e72f659..000000000 --- a/cli/tests/testdata/041_info_flag_location.out +++ /dev/null @@ -1,7 +0,0 @@ -DENO_DIR location: [WILDCARD] -Remote modules cache: [WILDCARD]deps -npm modules cache: [WILDCARD]npm -Emitted modules cache: [WILDCARD]gen -Language server registries cache: [WILDCARD]registries -Origin storage: [WILDCARD]location_data[WILDCARD] -Local Storage: [WILDCARD]location_data[WILDCARD]local_storage diff --git a/cli/tests/testdata/042_dyn_import_evalcontext.ts b/cli/tests/testdata/042_dyn_import_evalcontext.ts deleted file mode 100644 index ccda3a972..000000000 --- a/cli/tests/testdata/042_dyn_import_evalcontext.ts +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-expect-error "Deno.core" is not a public interface -Deno.core.evalContext( - "(async () => console.log(await import('./subdir/mod4.js')))()", -); diff --git a/cli/tests/testdata/042_dyn_import_evalcontext.ts.out b/cli/tests/testdata/042_dyn_import_evalcontext.ts.out deleted file mode 100644 index 12a45b8da..000000000 --- a/cli/tests/testdata/042_dyn_import_evalcontext.ts.out +++ /dev/null @@ -1 +0,0 @@ -Module { isMod4: true } diff --git a/cli/tests/testdata/044_bad_resource.ts b/cli/tests/testdata/044_bad_resource.ts deleted file mode 100644 index 05e1354dc..000000000 --- a/cli/tests/testdata/044_bad_resource.ts +++ /dev/null @@ -1,3 +0,0 @@ -const file = await Deno.open("044_bad_resource.ts", { read: true }); -file.close(); -await file.seek(10, 0); diff --git a/cli/tests/testdata/044_bad_resource.ts.out b/cli/tests/testdata/044_bad_resource.ts.out deleted file mode 100644 index c9912711d..000000000 --- a/cli/tests/testdata/044_bad_resource.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Uncaught[WILDCARD] BadResource: Bad resource ID -[WILDCARD] diff --git a/cli/tests/testdata/045_mod.ts b/cli/tests/testdata/045_mod.ts deleted file mode 100644 index b5f2a0b5b..000000000 --- a/cli/tests/testdata/045_mod.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { output } from "./045_output.ts"; - -if (import.meta.main) { - output("Hello!"); -} diff --git a/cli/tests/testdata/045_output.ts b/cli/tests/testdata/045_output.ts deleted file mode 100644 index 398760ca0..000000000 --- a/cli/tests/testdata/045_output.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function output(text: string) { - console.log(text); -} diff --git a/cli/tests/testdata/045_programmatic_proxy_client.ts b/cli/tests/testdata/045_programmatic_proxy_client.ts deleted file mode 100644 index 039c6e9ae..000000000 --- a/cli/tests/testdata/045_programmatic_proxy_client.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. - -const client = Deno.createHttpClient({ - proxy: { - url: "http://localhost:4555", - basicAuth: { username: "username", password: "password" }, - }, -}); - -const res = await fetch( - "http://localhost:4545/045_mod.ts", - { client }, -); -console.log(`Response http: ${await res.text()}`); - -client.close(); diff --git a/cli/tests/testdata/045_proxy_client.ts b/cli/tests/testdata/045_proxy_client.ts deleted file mode 100644 index 9d068bc48..000000000 --- a/cli/tests/testdata/045_proxy_client.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -const res = await fetch( - "http://localhost:4545/045_mod.ts", -); -console.log(`Response http: ${await res.text()}`); diff --git a/cli/tests/testdata/045_proxy_test.ts b/cli/tests/testdata/045_proxy_test.ts deleted file mode 100644 index 6a4e72aff..000000000 --- a/cli/tests/testdata/045_proxy_test.ts +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -import { Server } from "../../../test_util/std/http/server.ts"; -import { assertEquals } from "../../../test_util/std/testing/asserts.ts"; - -const addr = Deno.args[1] || "localhost:4555"; - -async function proxyServer() { - const [hostname, p] = addr.split(":"); - const port = parseInt(p ?? 4555); - const server = new Server({ hostname, port, handler }); - console.log(`Proxy server listening on http://${addr}/`); - await server.listenAndServe(); -} - -async function handler(req: Request): Promise { - console.log(`Proxy request to: ${req.url}`); - const headers = new Headers(req.headers); - const proxyAuthorization = headers.get("proxy-authorization"); - if (proxyAuthorization) { - console.log(`proxy-authorization: ${proxyAuthorization}`); - headers.delete("proxy-authorization"); - } - const resp = await fetch(req.url, { - method: req.method, - headers: headers, - }); - return new Response(new Uint8Array(await resp.arrayBuffer()), { - status: resp.status, - headers: resp.headers, - }); -} - -async function testFetch() { - const { code } = await Deno.spawn(Deno.execPath(), { - args: [ - "run", - "--quiet", - "--reload", - "--allow-net", - "045_proxy_client.ts", - ], - env: { - HTTP_PROXY: `http://${addr}`, - }, - }); - - assertEquals(code, 0); -} - -async function testModuleDownload() { - const { code } = await Deno.spawn(Deno.execPath(), { - args: [ - "cache", - "--reload", - "--quiet", - "http://localhost:4545/045_mod.ts", - ], - env: { - HTTP_PROXY: `http://${addr}`, - }, - }); - - assertEquals(code, 0); -} - -async function testFetchNoProxy() { - const { code } = await Deno.spawn(Deno.execPath(), { - args: [ - "run", - "--quiet", - "--reload", - "--allow-net", - "045_proxy_client.ts", - ], - env: { - HTTP_PROXY: "http://not.exising.proxy.server", - NO_PROXY: "localhost", - }, - }); - - assertEquals(code, 0); -} - -async function testModuleDownloadNoProxy() { - const { code } = await Deno.spawn(Deno.execPath(), { - args: [ - "cache", - "--reload", - "--quiet", - "http://localhost:4545/045_mod.ts", - ], - env: { - HTTP_PROXY: "http://not.exising.proxy.server", - NO_PROXY: "localhost", - }, - }); - - assertEquals(code, 0); -} - -async function testFetchProgrammaticProxy() { - const { code } = await Deno.spawn(Deno.execPath(), { - args: [ - "run", - "--quiet", - "--reload", - "--allow-net=localhost:4545,localhost:4555", - "--unstable", - "045_programmatic_proxy_client.ts", - ], - }); - assertEquals(code, 0); -} - -proxyServer(); -await testFetch(); -await testModuleDownload(); -await testFetchNoProxy(); -await testModuleDownloadNoProxy(); -await testFetchProgrammaticProxy(); -Deno.exit(0); diff --git a/cli/tests/testdata/045_proxy_test.ts.out b/cli/tests/testdata/045_proxy_test.ts.out deleted file mode 100644 index 4ebf97dee..000000000 --- a/cli/tests/testdata/045_proxy_test.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -Proxy server listening on [WILDCARD] -Proxy request to: http://localhost:4545/045_mod.ts -Proxy request to: http://localhost:4545/045_mod.ts -Proxy request to: http://localhost:4545/045_output.ts -Proxy request to: http://localhost:4545/045_mod.ts -proxy-authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= diff --git a/cli/tests/testdata/046_jsx_test.tsx b/cli/tests/testdata/046_jsx_test.tsx deleted file mode 100644 index 5ed3ff2fa..000000000 --- a/cli/tests/testdata/046_jsx_test.tsx +++ /dev/null @@ -1,14 +0,0 @@ -declare global { - export namespace JSX { - interface IntrinsicElements { - [elemName: string]: any; - } - } -} -const React = { - createElement(factory: any, props: any, ...children: any[]) { - return { factory, props, children }; - }, -}; -const View = () =>
land
; -console.log(); diff --git a/cli/tests/testdata/046_jsx_test.tsx.out b/cli/tests/testdata/046_jsx_test.tsx.out deleted file mode 100644 index 85cfe824b..000000000 --- a/cli/tests/testdata/046_jsx_test.tsx.out +++ /dev/null @@ -1 +0,0 @@ -{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/testdata/047_jsx_test.jsx b/cli/tests/testdata/047_jsx_test.jsx deleted file mode 100644 index 4c2314072..000000000 --- a/cli/tests/testdata/047_jsx_test.jsx +++ /dev/null @@ -1,7 +0,0 @@ -const React = { - createElement(factory, props, ...children) { - return { factory, props, children }; - }, -}; -const View = () =>
land
; -console.log(); diff --git a/cli/tests/testdata/047_jsx_test.jsx.out b/cli/tests/testdata/047_jsx_test.jsx.out deleted file mode 100644 index 85cfe824b..000000000 --- a/cli/tests/testdata/047_jsx_test.jsx.out +++ /dev/null @@ -1 +0,0 @@ -{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/testdata/048_media_types_jsx.ts b/cli/tests/testdata/048_media_types_jsx.ts deleted file mode 100644 index 8dcd0ad68..000000000 --- a/cli/tests/testdata/048_media_types_jsx.ts +++ /dev/null @@ -1,32 +0,0 @@ -// When run against the test HTTP server, it will serve different media types -// based on the URL containing `.t#.` strings, which exercises the different -// mapping of media types end to end. -import { loaded as loadedTsx1 } from "http://localhost:4545/subdir/mt_text_typescript_tsx.t1.tsx"; -import { loaded as loadedTsx2 } from "http://localhost:4545/subdir/mt_video_vdn_tsx.t2.tsx"; -import { loaded as loadedTsx3 } from "http://localhost:4545/subdir/mt_video_mp2t_tsx.t3.tsx"; -import { loaded as loadedTsx4 } from "http://localhost:4545/subdir/mt_application_x_typescript_tsx.t4.tsx"; -import { loaded as loadedJsx1 } from "http://localhost:4545/subdir/mt_text_javascript_jsx.j1.jsx"; -import { loaded as loadedJsx2 } from "http://localhost:4545/subdir/mt_application_ecmascript_jsx.j2.jsx"; -import { loaded as loadedJsx3 } from "http://localhost:4545/subdir/mt_text_ecmascript_jsx.j3.jsx"; -import { loaded as loadedJsx4 } from "http://localhost:4545/subdir/mt_application_x_javascript_jsx.j4.jsx"; - -declare global { - namespace JSX { - interface IntrinsicElements { - // deno-lint-ignore no-explicit-any - [elemName: string]: any; - } - } -} - -console.log( - "success", - loadedTsx1, - loadedTsx2, - loadedTsx3, - loadedTsx4, - loadedJsx1, - loadedJsx2, - loadedJsx3, - loadedJsx4, -); diff --git a/cli/tests/testdata/048_media_types_jsx.ts.out b/cli/tests/testdata/048_media_types_jsx.ts.out deleted file mode 100644 index 266cc5741..000000000 --- a/cli/tests/testdata/048_media_types_jsx.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -success true true true true true true true true diff --git a/cli/tests/testdata/049_info_flag_script_jsx.out b/cli/tests/testdata/049_info_flag_script_jsx.out deleted file mode 100644 index 860d127fe..000000000 --- a/cli/tests/testdata/049_info_flag_script_jsx.out +++ /dev/null @@ -1,14 +0,0 @@ -[WILDCARD] -local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD] -type: TypeScript -dependencies: 8 unique (total [WILDCARD]) - -http://127.0.0.1:4545/048_media_types_jsx.ts ([WILDCARD]) -├── http://localhost:4545/subdir/mt_application_ecmascript_jsx.j2.jsx ([WILDCARD]) -├── http://localhost:4545/subdir/mt_application_x_javascript_jsx.j4.jsx ([WILDCARD]) -├── http://localhost:4545/subdir/mt_application_x_typescript_tsx.t4.tsx ([WILDCARD]) -├── http://localhost:4545/subdir/mt_text_ecmascript_jsx.j3.jsx ([WILDCARD]) -├── http://localhost:4545/subdir/mt_text_javascript_jsx.j1.jsx ([WILDCARD]) -├── http://localhost:4545/subdir/mt_text_typescript_tsx.t1.tsx ([WILDCARD]) -├── http://localhost:4545/subdir/mt_video_mp2t_tsx.t3.tsx ([WILDCARD]) -└── http://localhost:4545/subdir/mt_video_vdn_tsx.t2.tsx ([WILDCARD]) diff --git a/cli/tests/testdata/052_no_remote_flag.out b/cli/tests/testdata/052_no_remote_flag.out deleted file mode 100644 index 712fcf3d6..000000000 --- a/cli/tests/testdata/052_no_remote_flag.out +++ /dev/null @@ -1,4 +0,0 @@ -error: A remote specifier was requested: "http://127.0.0.1:4545/019_media_types.ts", but --no-remote is specified. - -Caused by: - A remote specifier was requested: "http://127.0.0.1:4545/019_media_types.ts", but --no-remote is specified. diff --git a/cli/tests/testdata/053_import_compression.out b/cli/tests/testdata/053_import_compression.out deleted file mode 100644 index 371994979..000000000 --- a/cli/tests/testdata/053_import_compression.out +++ /dev/null @@ -1,4 +0,0 @@ -gzip -brotli -console.log('gzip') -console.log('brotli'); diff --git a/cli/tests/testdata/053_import_compression/brotli b/cli/tests/testdata/053_import_compression/brotli deleted file mode 100644 index 65f679d57..000000000 --- a/cli/tests/testdata/053_import_compression/brotli +++ /dev/null @@ -1,2 +0,0 @@ -‹ -€console.log('brotli'); \ No newline at end of file diff --git a/cli/tests/testdata/053_import_compression/gziped b/cli/tests/testdata/053_import_compression/gziped deleted file mode 100644 index 9f9a7bc69..000000000 Binary files a/cli/tests/testdata/053_import_compression/gziped and /dev/null differ diff --git a/cli/tests/testdata/053_import_compression/main.ts b/cli/tests/testdata/053_import_compression/main.ts deleted file mode 100644 index 1ff1b0c83..000000000 --- a/cli/tests/testdata/053_import_compression/main.ts +++ /dev/null @@ -1,13 +0,0 @@ -import "http://127.0.0.1:4545/053_import_compression/gziped"; -import "http://127.0.0.1:4545/053_import_compression/brotli"; - -console.log( - await fetch( - "http://127.0.0.1:4545/053_import_compression/gziped", - ).then((res) => res.text()), -); -console.log( - await fetch( - "http://127.0.0.1:4545/053_import_compression/brotli", - ).then((res) => res.text()), -); diff --git a/cli/tests/testdata/054_info_local_imports.out b/cli/tests/testdata/054_info_local_imports.out deleted file mode 100644 index cde5ff3ab..000000000 --- a/cli/tests/testdata/054_info_local_imports.out +++ /dev/null @@ -1,8 +0,0 @@ -local: [WILDCARD]005_more_imports.ts -type: TypeScript -dependencies: 3 unique (total [WILDCARD]) - -file://[WILDCARD]/005_more_imports.ts ([WILDCARD]) -└─┬ file://[WILDCARD]/subdir/mod1.ts ([WILDCARD]) - └─┬ file://[WILDCARD]/subdir/subdir2/mod2.ts ([WILDCARD]) - └── file://[WILDCARD]/subdir/print_hello.ts ([WILDCARD]) diff --git a/cli/tests/testdata/055_info_file_json.out b/cli/tests/testdata/055_info_file_json.out deleted file mode 100644 index 2dc10a0c2..000000000 --- a/cli/tests/testdata/055_info_file_json.out +++ /dev/null @@ -1,90 +0,0 @@ -{ - "roots": [ - "file://[WILDCARD]/005_more_imports.ts" - ], - "modules": [ - { - "dependencies": [ - { - "specifier": "./subdir/mod1.ts", - "code": { - "specifier": "file://[WILDCARD]/subdir/mod1.ts", - "span": { - "start": { - "line": 0, - "character": 52 - }, - "end": { - "line": 0, - "character": 70 - } - } - } - } - ], - "kind": "esm", - "local": "[WILDCARD]005_more_imports.ts", - [WILDCARD] - "mediaType": "TypeScript", - "specifier": "file://[WILDCARD]/005_more_imports.ts" - }, - { - "dependencies": [ - { - "specifier": "./subdir2/mod2.ts", - "code": { - "specifier": "file://[WILDCARD]/subdir/subdir2/mod2.ts", - "span": { - "start": { - "line": 0, - "character": 40 - }, - "end": { - "line": 0, - "character": 59 - } - } - } - } - ], - "kind": "esm", - "local": "[WILDCARD]mod1.ts", - [WILDCARD] - "mediaType": "TypeScript", - "specifier": "file://[WILDCARD]/subdir/mod1.ts" - }, - { - "kind": "esm", - "local": "[WILDCARD]print_hello.ts", - [WILDCARD] - "mediaType": "TypeScript", - "specifier": "file://[WILDCARD]/subdir/print_hello.ts" - }, - { - "dependencies": [ - { - "specifier": "../print_hello.ts", - "code": { - "specifier": "file://[WILDCARD]/subdir/print_hello.ts", - "span": { - "start": { - "line": 0, - "character": 27 - }, - "end": { - "line": 0, - "character": 46 - } - } - } - } - ], - "kind": "esm", - "local": "[WILDCARD]mod2.ts", - [WILDCARD] - "mediaType": "TypeScript", - "specifier": "file://[WILDCARD]/subdir/subdir2/mod2.ts" - } - ], - "redirects": {} -} diff --git a/cli/tests/testdata/056_make_temp_file_write_perm.out b/cli/tests/testdata/056_make_temp_file_write_perm.out deleted file mode 100644 index c56aae43f..000000000 --- a/cli/tests/testdata/056_make_temp_file_write_perm.out +++ /dev/null @@ -1 +0,0 @@ -good [WILDCARD]subdir[WILDCARD] diff --git a/cli/tests/testdata/056_make_temp_file_write_perm.ts b/cli/tests/testdata/056_make_temp_file_write_perm.ts deleted file mode 100644 index c0deda8a2..000000000 --- a/cli/tests/testdata/056_make_temp_file_write_perm.ts +++ /dev/null @@ -1,9 +0,0 @@ -const path = await Deno.makeTempFile({ dir: `subdir` }); -try { - if (!path.match(/^subdir[/\\][^/\\]+/)) { - throw Error("bad " + path); - } - console.log("good", path); -} finally { - await Deno.remove(path); -} diff --git a/cli/tests/testdata/058_tasks_microtasks_close.ts b/cli/tests/testdata/058_tasks_microtasks_close.ts deleted file mode 100644 index 38e156044..000000000 --- a/cli/tests/testdata/058_tasks_microtasks_close.ts +++ /dev/null @@ -1,19 +0,0 @@ -// deno-lint-ignore-file no-window-prefix -console.log("sync 1"); -setTimeout(() => { - console.log("setTimeout 1"); - Promise.resolve().then(() => { - console.log("Promise resolve in setTimeout 1"); - }); -}); -Promise.resolve().then(() => { - console.log("promise 1"); -}); -window.close(); -console.log("sync 2"); -setTimeout(() => { - console.log("setTimeout 2"); -}); -setTimeout(() => { - console.log("setTimeout 3"); -}, 100); diff --git a/cli/tests/testdata/058_tasks_microtasks_close.ts.out b/cli/tests/testdata/058_tasks_microtasks_close.ts.out deleted file mode 100644 index 218273cab..000000000 --- a/cli/tests/testdata/058_tasks_microtasks_close.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -sync 1 -sync 2 -promise 1 -setTimeout 1 -Promise resolve in setTimeout 1 -setTimeout 2 diff --git a/cli/tests/testdata/059_fs_relative_path_perm.ts b/cli/tests/testdata/059_fs_relative_path_perm.ts deleted file mode 100644 index 26630fe1c..000000000 --- a/cli/tests/testdata/059_fs_relative_path_perm.ts +++ /dev/null @@ -1,2 +0,0 @@ -// The permission error message shouldn't include the CWD. -Deno.readFileSync("non-existent"); diff --git a/cli/tests/testdata/059_fs_relative_path_perm.ts.out b/cli/tests/testdata/059_fs_relative_path_perm.ts.out deleted file mode 100644 index b55412137..000000000 --- a/cli/tests/testdata/059_fs_relative_path_perm.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]error: Uncaught PermissionDenied: Requires read access to "non-existent", run again with the --allow-read flag -Deno.readFileSync("non-existent"); - ^ - at [WILDCARD] diff --git a/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts b/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts deleted file mode 100644 index 854c1b464..000000000 --- a/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts +++ /dev/null @@ -1,6 +0,0 @@ -// deno-lint-ignore-file -export namespace NS { - export function test(name: string, fn: Function): void; - export function test(options: object): void; - export function test(name: string | object, fn?: Function): void {} -} diff --git a/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts.out b/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts.out deleted file mode 100644 index 2cd36931c..000000000 --- a/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts.out +++ /dev/null @@ -1,9 +0,0 @@ -Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:3:2 - -function test(name: string, fn: Function): void - -Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:4:2 - -function test(options: object): void - - diff --git a/cli/tests/testdata/061_permissions_request.ts b/cli/tests/testdata/061_permissions_request.ts deleted file mode 100644 index c31e7ac42..000000000 --- a/cli/tests/testdata/061_permissions_request.ts +++ /dev/null @@ -1,9 +0,0 @@ -const status1 = - (await Deno.permissions.request({ name: "read", path: "foo" })).state; -const status2 = - (await Deno.permissions.query({ name: "read", path: "bar" })).state; -const status3 = - (await Deno.permissions.request({ name: "read", path: "bar" })).state; -console.log(status1); -console.log(status2); -console.log(status3); diff --git a/cli/tests/testdata/062_permissions_request_global.ts b/cli/tests/testdata/062_permissions_request_global.ts deleted file mode 100644 index e431bc31b..000000000 --- a/cli/tests/testdata/062_permissions_request_global.ts +++ /dev/null @@ -1,6 +0,0 @@ -const status1 = await Deno.permissions.request({ name: "read" }); -console.log(status1); -const status2 = await Deno.permissions.query({ name: "read", path: "foo" }); -console.log(status2); -const status3 = await Deno.permissions.query({ name: "read", path: "bar" }); -console.log(status3); diff --git a/cli/tests/testdata/063_permissions_revoke.ts b/cli/tests/testdata/063_permissions_revoke.ts deleted file mode 100644 index a81eee7cb..000000000 --- a/cli/tests/testdata/063_permissions_revoke.ts +++ /dev/null @@ -1,6 +0,0 @@ -const status1 = await Deno.permissions.revoke({ name: "read", path: "foo" }); -console.log(status1); -const status2 = await Deno.permissions.query({ name: "read", path: "bar" }); -console.log(status2); -const status3 = await Deno.permissions.revoke({ name: "read", path: "bar" }); -console.log(status3); diff --git a/cli/tests/testdata/063_permissions_revoke.ts.out b/cli/tests/testdata/063_permissions_revoke.ts.out deleted file mode 100644 index bbd64c557..000000000 --- a/cli/tests/testdata/063_permissions_revoke.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]PermissionStatus { state: "prompt", onchange: null } -PermissionStatus { state: "granted", onchange: null } -PermissionStatus { state: "prompt", onchange: null } diff --git a/cli/tests/testdata/064_permissions_revoke_global.ts b/cli/tests/testdata/064_permissions_revoke_global.ts deleted file mode 100644 index a9b1fcd40..000000000 --- a/cli/tests/testdata/064_permissions_revoke_global.ts +++ /dev/null @@ -1,6 +0,0 @@ -const status1 = await Deno.permissions.revoke({ name: "read" }); -console.log(status1); -const status2 = await Deno.permissions.query({ name: "read", path: "foo" }); -console.log(status2); -const status3 = await Deno.permissions.query({ name: "read", path: "bar" }); -console.log(status3); diff --git a/cli/tests/testdata/064_permissions_revoke_global.ts.out b/cli/tests/testdata/064_permissions_revoke_global.ts.out deleted file mode 100644 index f7e389a76..000000000 --- a/cli/tests/testdata/064_permissions_revoke_global.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]PermissionStatus { state: "prompt", onchange: null } -PermissionStatus { state: "prompt", onchange: null } -PermissionStatus { state: "prompt", onchange: null } diff --git a/cli/tests/testdata/065_import_map_info.out b/cli/tests/testdata/065_import_map_info.out deleted file mode 100644 index 8771d0594..000000000 --- a/cli/tests/testdata/065_import_map_info.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD] -local: [WILDCARD]test.ts -type: TypeScript -dependencies: 7 unique (total [WILDCARD]) -[WILDCARD] diff --git a/cli/tests/testdata/066_prompt.ts b/cli/tests/testdata/066_prompt.ts deleted file mode 100644 index e3daa7ac0..000000000 --- a/cli/tests/testdata/066_prompt.ts +++ /dev/null @@ -1,21 +0,0 @@ -const name0 = prompt("What is your name?", "Jane Doe"); // Answer John Doe -console.log(`Your name is ${name0}.`); -const name1 = prompt("What is your name?", "Jane Doe"); // Answer with default -console.log(`Your name is ${name1}.`); -const input = prompt(); // Answer foo -console.log(`Your input is ${input}.`); -const answer0 = confirm("Question 0"); // Answer y -console.log(`Your answer is ${answer0}`); -const answer1 = confirm("Question 1"); // Answer n -console.log(`Your answer is ${answer1}`); -const answer2 = confirm("Question 2"); // Answer with yes (returns false) -console.log(`Your answer is ${answer2}`); -const answer3 = confirm(); // Answer with default -console.log(`Your answer is ${answer3}`); -const windows = prompt("What is Windows EOL?"); -console.log(`Your answer is ${JSON.stringify(windows)}`); -alert("Hi"); -alert(); -console.log("The end of test"); -const eof = prompt("What is EOF?"); -console.log(`Your answer is ${JSON.stringify(eof)}`); diff --git a/cli/tests/testdata/070_location.ts b/cli/tests/testdata/070_location.ts deleted file mode 100644 index 05e5abdf1..000000000 --- a/cli/tests/testdata/070_location.ts +++ /dev/null @@ -1,18 +0,0 @@ -// deno-lint-ignore-file no-global-assign -console.log(Location); -console.log(Location.prototype); -console.log(location); -try { - location = {}; -} catch (error) { - if (error instanceof Error) { - console.log(error.toString()); - } -} -try { - location.hostname = "bar"; -} catch (error) { - if (error instanceof Error) { - console.log(error.toString()); - } -} diff --git a/cli/tests/testdata/070_location.ts.out b/cli/tests/testdata/070_location.ts.out deleted file mode 100644 index 692d7c976..000000000 --- a/cli/tests/testdata/070_location.ts.out +++ /dev/null @@ -1,16 +0,0 @@ -[WILDCARD][Function: Location] -Location {} -Location { - hash: "#bat", - host: "foo", - hostname: "foo", - href: "https://foo/bar?baz#bat", - origin: "https://foo", - pathname: "/bar", - port: "", - protocol: "https:", - search: "?baz" -} -NotSupportedError: Cannot set "location". -NotSupportedError: Cannot set "location.hostname". -[WILDCARD] diff --git a/cli/tests/testdata/071_location_unset.ts b/cli/tests/testdata/071_location_unset.ts deleted file mode 100644 index f560d2716..000000000 --- a/cli/tests/testdata/071_location_unset.ts +++ /dev/null @@ -1,16 +0,0 @@ -console.log(Location); -console.log(Location.prototype); -console.log(location); - -globalThis.location = { - hash: "#bat", - host: "foo", - hostname: "foo", - href: "https://foo/bar?baz#bat", - origin: "https://foo", - pathname: "/bar", - port: "", - protocol: "https:", - search: "?baz", -}; -console.log(location.pathname); diff --git a/cli/tests/testdata/071_location_unset.ts.out b/cli/tests/testdata/071_location_unset.ts.out deleted file mode 100644 index 99f87a7fc..000000000 --- a/cli/tests/testdata/071_location_unset.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD][Function: Location] -Location {} -undefined -/bar -[WILDCARD] diff --git a/cli/tests/testdata/072_location_relative_fetch.ts b/cli/tests/testdata/072_location_relative_fetch.ts deleted file mode 100644 index d4764bf7f..000000000 --- a/cli/tests/testdata/072_location_relative_fetch.ts +++ /dev/null @@ -1,2 +0,0 @@ -const response = await fetch("fetch/hello.txt"); -console.log(await response.text()); diff --git a/cli/tests/testdata/072_location_relative_fetch.ts.out b/cli/tests/testdata/072_location_relative_fetch.ts.out deleted file mode 100644 index 8151f6f88..000000000 --- a/cli/tests/testdata/072_location_relative_fetch.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]Hello, world! - diff --git a/cli/tests/testdata/075_import_local_query_hash.ts b/cli/tests/testdata/075_import_local_query_hash.ts deleted file mode 100644 index 99c7ceab4..000000000 --- a/cli/tests/testdata/075_import_local_query_hash.ts +++ /dev/null @@ -1,2 +0,0 @@ -import "./001_hello.js?a=b#c"; -import "./002_hello.ts?a=b#c"; diff --git a/cli/tests/testdata/075_import_local_query_hash.ts.out b/cli/tests/testdata/075_import_local_query_hash.ts.out deleted file mode 100644 index 340777742..000000000 --- a/cli/tests/testdata/075_import_local_query_hash.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]Hello World -Hello World diff --git a/cli/tests/testdata/076_info_json_deps_order.out b/cli/tests/testdata/076_info_json_deps_order.out deleted file mode 100644 index db890ef02..000000000 --- a/cli/tests/testdata/076_info_json_deps_order.out +++ /dev/null @@ -1,163 +0,0 @@ -{ - "roots": [ - "file://[WILDCARD]/076_info_json_deps_order.ts" - ], - "modules": [ - { - "dependencies": [ - { - "specifier": "./recursive_imports/A.ts", - "code": { - "specifier": "file://[WILDCARD]/recursive_imports/A.ts", - "span": { - "start": { - "line": 1, - "character": 18 - }, - "end": { - "line": 1, - "character": 44 - } - } - } - } - ], - "kind": "esm", - "local": "[WILDCARD]076_info_json_deps_order.ts", - [WILDCARD] - "mediaType": "TypeScript", - "specifier": "file://[WILDCARD]/076_info_json_deps_order.ts" - }, - { - "dependencies": [ - { - "specifier": "./B.ts", - "code": { - "specifier": "file://[WILDCARD]/recursive_imports/B.ts", - "span": { - "start": { - "line": 0, - "character": 18 - }, - "end": { - "line": 0, - "character": 26 - } - } - } - }, - { - "specifier": "./common.ts", - "code": { - "specifier": "file://[WILDCARD]/recursive_imports/common.ts", - "span": { - "start": { - "line": 1, - "character": 22 - }, - "end": { - "line": 1, - "character": 35 - } - } - } - } - ], - "kind": "esm", - "local": "[WILDCARD]A.ts", - [WILDCARD] - "mediaType": "TypeScript", - "specifier": "file://[WILDCARD]/recursive_imports/A.ts" - }, - { - "dependencies": [ - { - "specifier": "./C.ts", - "code": { - "specifier": "file://[WILDCARD]/recursive_imports/C.ts", - "span": { - "start": { - "line": 0, - "character": 18 - }, - "end": { - "line": 0, - "character": 26 - } - } - } - }, - { - "specifier": "./common.ts", - "code": { - "specifier": "file://[WILDCARD]/recursive_imports/common.ts", - "span": { - "start": { - "line": 1, - "character": 22 - }, - "end": { - "line": 1, - "character": 35 - } - } - } - } - ], - "kind": "esm", - "local": "[WILDCARD]B.ts", - [WILDCARD] - "mediaType": "TypeScript", - "specifier": "file://[WILDCARD]/recursive_imports/B.ts" - }, - { - "dependencies": [ - { - "specifier": "./A.ts", - "code": { - "specifier": "file://[WILDCARD]/recursive_imports/A.ts", - "span": { - "start": { - "line": 0, - "character": 18 - }, - "end": { - "line": 0, - "character": 26 - } - } - } - }, - { - "specifier": "./common.ts", - "code": { - "specifier": "file://[WILDCARD]/recursive_imports/common.ts", - "span": { - "start": { - "line": 1, - "character": 22 - }, - "end": { - "line": 1, - "character": 35 - } - } - } - } - ], - "kind": "esm", - "local": "[WILDCARD]C.ts", - [WILDCARD] - "mediaType": "TypeScript", - "specifier": "file://[WILDCARD]/recursive_imports/C.ts" - }, - { - "kind": "esm", - "local": "[WILDCARD]common.ts", - [WILDCARD] - "mediaType": "TypeScript", - "specifier": "file://[WILDCARD]/recursive_imports/common.ts" - } - ], - "redirects": {} -} diff --git a/cli/tests/testdata/076_info_json_deps_order.ts b/cli/tests/testdata/076_info_json_deps_order.ts deleted file mode 100644 index b1ae75e68..000000000 --- a/cli/tests/testdata/076_info_json_deps_order.ts +++ /dev/null @@ -1,2 +0,0 @@ -// deno-lint-ignore no-unused-vars -import { A } from "./recursive_imports/A.ts"; diff --git a/cli/tests/testdata/077_fetch_empty.ts b/cli/tests/testdata/077_fetch_empty.ts deleted file mode 100644 index b10a9094e..000000000 --- a/cli/tests/testdata/077_fetch_empty.ts +++ /dev/null @@ -1 +0,0 @@ -await fetch(""); diff --git a/cli/tests/testdata/077_fetch_empty.ts.out b/cli/tests/testdata/077_fetch_empty.ts.out deleted file mode 100644 index e546cfcec..000000000 --- a/cli/tests/testdata/077_fetch_empty.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Uncaught TypeError: Invalid URL -[WILDCARD] diff --git a/cli/tests/testdata/078_unload_on_exit.ts b/cli/tests/testdata/078_unload_on_exit.ts deleted file mode 100644 index 43d33eb25..000000000 --- a/cli/tests/testdata/078_unload_on_exit.ts +++ /dev/null @@ -1,9 +0,0 @@ -window.onunload = () => { - console.log("onunload is called"); - // This second exit call doesn't trigger unload event, - // and therefore actually stops the process. - Deno.exit(1); - console.log("This doesn't show up in console"); -}; -// This exit call triggers the above unload event handler. -Deno.exit(0); diff --git a/cli/tests/testdata/078_unload_on_exit.ts.out b/cli/tests/testdata/078_unload_on_exit.ts.out deleted file mode 100644 index e213f9632..000000000 --- a/cli/tests/testdata/078_unload_on_exit.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]onunload is called diff --git a/cli/tests/testdata/079_location_authentication.ts b/cli/tests/testdata/079_location_authentication.ts deleted file mode 100644 index 4989312ac..000000000 --- a/cli/tests/testdata/079_location_authentication.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(location.href); diff --git a/cli/tests/testdata/079_location_authentication.ts.out b/cli/tests/testdata/079_location_authentication.ts.out deleted file mode 100644 index bb2458497..000000000 --- a/cli/tests/testdata/079_location_authentication.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -https://baz/qux -[WILDCARD] diff --git a/cli/tests/testdata/081_location_relative_fetch_redirect.ts b/cli/tests/testdata/081_location_relative_fetch_redirect.ts deleted file mode 100644 index 742ef0afb..000000000 --- a/cli/tests/testdata/081_location_relative_fetch_redirect.ts +++ /dev/null @@ -1,2 +0,0 @@ -const response = await fetch("/"); -console.log(response.url); diff --git a/cli/tests/testdata/081_location_relative_fetch_redirect.ts.out b/cli/tests/testdata/081_location_relative_fetch_redirect.ts.out deleted file mode 100644 index f62b93195..000000000 --- a/cli/tests/testdata/081_location_relative_fetch_redirect.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]http://localhost:4545/ diff --git a/cli/tests/testdata/082_prepare_stack_trace_throw.js b/cli/tests/testdata/082_prepare_stack_trace_throw.js deleted file mode 100644 index 8137bfdc8..000000000 --- a/cli/tests/testdata/082_prepare_stack_trace_throw.js +++ /dev/null @@ -1,6 +0,0 @@ -Error.prepareStackTrace = () => { - console.trace(); - throw new Error("foo"); -}; - -new Error("bar").stack; diff --git a/cli/tests/testdata/082_prepare_stack_trace_throw.js.out b/cli/tests/testdata/082_prepare_stack_trace_throw.js.out deleted file mode 100644 index 751b7c971..000000000 --- a/cli/tests/testdata/082_prepare_stack_trace_throw.js.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Uncaught Error: foo -[WILDCARD] diff --git a/cli/tests/testdata/083_legacy_external_source_map.ts b/cli/tests/testdata/083_legacy_external_source_map.ts deleted file mode 100644 index 73d267b87..000000000 --- a/cli/tests/testdata/083_legacy_external_source_map.ts +++ /dev/null @@ -1,2 +0,0 @@ -// - -throw new Error("foo"); diff --git a/cli/tests/testdata/084_worker_custom_inspect.ts b/cli/tests/testdata/084_worker_custom_inspect.ts deleted file mode 100644 index 27e27e51f..000000000 --- a/cli/tests/testdata/084_worker_custom_inspect.ts +++ /dev/null @@ -1,4 +0,0 @@ -new Worker( - import.meta.resolve("./084_worker_custom_inspect_worker.ts"), - { type: "module" }, -); diff --git a/cli/tests/testdata/084_worker_custom_inspect.ts.out b/cli/tests/testdata/084_worker_custom_inspect.ts.out deleted file mode 100644 index b34300c40..000000000 --- a/cli/tests/testdata/084_worker_custom_inspect.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]ReadableStream { locked: false } -[WILDCARD] diff --git a/cli/tests/testdata/084_worker_custom_inspect_worker.ts b/cli/tests/testdata/084_worker_custom_inspect_worker.ts deleted file mode 100644 index 5be82724e..000000000 --- a/cli/tests/testdata/084_worker_custom_inspect_worker.ts +++ /dev/null @@ -1,2 +0,0 @@ -console.log(new ReadableStream()); -close(); diff --git a/cli/tests/testdata/085_dynamic_import_async_error.ts b/cli/tests/testdata/085_dynamic_import_async_error.ts deleted file mode 100644 index 998e7ed3e..000000000 --- a/cli/tests/testdata/085_dynamic_import_async_error.ts +++ /dev/null @@ -1,7 +0,0 @@ -try { - await import("./delayed_error.ts"); -} catch (error) { - if (error instanceof Error) { - console.log(`Caught: ${error.stack}`); - } -} diff --git a/cli/tests/testdata/085_dynamic_import_async_error.ts.out b/cli/tests/testdata/085_dynamic_import_async_error.ts.out deleted file mode 100644 index 974c2e426..000000000 --- a/cli/tests/testdata/085_dynamic_import_async_error.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]Caught: Error: foo - at [WILDCARD]/delayed_error.ts:[WILDCARD] diff --git a/cli/tests/testdata/086_dynamic_import_already_rejected.ts b/cli/tests/testdata/086_dynamic_import_already_rejected.ts deleted file mode 100644 index 249de8d8b..000000000 --- a/cli/tests/testdata/086_dynamic_import_already_rejected.ts +++ /dev/null @@ -1,15 +0,0 @@ -try { - await import("./error_001.ts"); -} catch (error) { - if (error instanceof Error) { - console.log(`Caught: ${error.stack}`); - } -} - -try { - await import("./error_001.ts"); -} catch (error) { - if (error instanceof Error) { - console.log(`Caught: ${error.stack}`); - } -} diff --git a/cli/tests/testdata/086_dynamic_import_already_rejected.ts.out b/cli/tests/testdata/086_dynamic_import_already_rejected.ts.out deleted file mode 100644 index c3eb66f9e..000000000 --- a/cli/tests/testdata/086_dynamic_import_already_rejected.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]Caught: Error: bad - at [WILDCARD]/error_001.ts:[WILDCARD] -Caught: Error: bad - at [WILDCARD]/error_001.ts:[WILDCARD] diff --git a/cli/tests/testdata/087_hello.ts b/cli/tests/testdata/087_hello.ts deleted file mode 100644 index 1a9d8f114..000000000 --- a/cli/tests/testdata/087_hello.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type SomeType = unknown; -console.log("Hello, world!"); diff --git a/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts b/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts deleted file mode 100644 index 64a13f9b1..000000000 --- a/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { SomeType } from "./087_hello.ts"; - -const string: SomeType = "Hi!"; -console.log(string); diff --git a/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts.out b/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts.out deleted file mode 100644 index f744c4183..000000000 --- a/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]Hello, world! -Hi! diff --git a/cli/tests/testdata/088_dynamic_import_already_evaluating.ts b/cli/tests/testdata/088_dynamic_import_already_evaluating.ts deleted file mode 100644 index 272163a5d..000000000 --- a/cli/tests/testdata/088_dynamic_import_already_evaluating.ts +++ /dev/null @@ -1,2 +0,0 @@ -import("./088_dynamic_import_target.ts").then(() => console.log(3)); -import("./088_dynamic_import_target.ts").then(() => console.log(3)); diff --git a/cli/tests/testdata/088_dynamic_import_already_evaluating.ts.out b/cli/tests/testdata/088_dynamic_import_already_evaluating.ts.out deleted file mode 100644 index a36dd11e7..000000000 --- a/cli/tests/testdata/088_dynamic_import_already_evaluating.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]1 -2 -3 -3 diff --git a/cli/tests/testdata/088_dynamic_import_target.ts b/cli/tests/testdata/088_dynamic_import_target.ts deleted file mode 100644 index 226f1851a..000000000 --- a/cli/tests/testdata/088_dynamic_import_target.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await new Promise((r) => setTimeout(r, 100)); -console.log(2); diff --git a/cli/tests/testdata/089_run_allow_list.ts b/cli/tests/testdata/089_run_allow_list.ts deleted file mode 100644 index d7bc8e195..000000000 --- a/cli/tests/testdata/089_run_allow_list.ts +++ /dev/null @@ -1,12 +0,0 @@ -try { - await Deno.spawn("ls"); -} catch (e) { - console.log(e); -} - -const { success } = await Deno.spawn("curl", { - args: ["--help"], - stdout: "null", - stderr: "inherit", -}); -console.log(success); diff --git a/cli/tests/testdata/089_run_allow_list.ts.out b/cli/tests/testdata/089_run_allow_list.ts.out deleted file mode 100644 index 68a4a2ac5..000000000 --- a/cli/tests/testdata/089_run_allow_list.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]PermissionDenied: Requires run access to "ls", run again with the --allow-run flag -[WILDCARD] -true diff --git a/cli/tests/testdata/090_run_permissions_request.ts b/cli/tests/testdata/090_run_permissions_request.ts deleted file mode 100644 index 8ecad2b3b..000000000 --- a/cli/tests/testdata/090_run_permissions_request.ts +++ /dev/null @@ -1,18 +0,0 @@ -const status1 = - (await Deno.permissions.request({ name: "run", command: "ls" })).state; -if (status1 != "granted") { - throw Error(`unexpected status1 ${status1}`); -} -const status2 = - (await Deno.permissions.query({ name: "run", command: "cat" })).state; -if (status2 != "prompt") { - throw Error(`unexpected status2 ${status2}`); -} -const status3 = - (await Deno.permissions.request({ name: "run", command: "cat" })).state; -if (status3 != "denied") { - throw Error(`unexpected status3 ${status3}`); -} -console.log(status1); -console.log(status2); -console.log(status3); diff --git a/cli/tests/testdata/091_use_define_for_class_fields.ts b/cli/tests/testdata/091_use_define_for_class_fields.ts deleted file mode 100644 index 46be3ac0b..000000000 --- a/cli/tests/testdata/091_use_define_for_class_fields.ts +++ /dev/null @@ -1,4 +0,0 @@ -class _A { - b = this.a; - constructor(public a: unknown) {} -} diff --git a/cli/tests/testdata/091_use_define_for_class_fields.ts.out b/cli/tests/testdata/091_use_define_for_class_fields.ts.out deleted file mode 100644 index 08f94a967..000000000 --- a/cli/tests/testdata/091_use_define_for_class_fields.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]error: TS2729 [ERROR]: Property 'a' is used before its initialization. - b = this.a; - ^ -[WILDCARD] diff --git a/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts b/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts deleted file mode 100644 index 87684430d..000000000 --- a/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts +++ /dev/null @@ -1 +0,0 @@ -await import("unmapped"); diff --git a/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts.out b/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts.out deleted file mode 100644 index 6e82ad410..000000000 --- a/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -[WILDCARD] -error: Uncaught (in promise) TypeError: Relative import path "unmapped" not prefixed with / or ./ or ../ and not in import map from "file://[WILDCARD]/092_import_map_unmapped_bare_specifier.ts" - at file://[WILDCARD]/092_import_map_unmapped_bare_specifier.ts:1:14 - -await import("unmapped"); -^ - at async file://[WILDCARD]/092_import_map_unmapped_bare_specifier.ts:1:1 diff --git a/cli/tests/testdata/095_cache_with_bare_import.ts b/cli/tests/testdata/095_cache_with_bare_import.ts deleted file mode 100644 index c0748305d..000000000 --- a/cli/tests/testdata/095_cache_with_bare_import.ts +++ /dev/null @@ -1 +0,0 @@ -import "foo"; diff --git a/cli/tests/testdata/095_cache_with_bare_import.ts.out b/cli/tests/testdata/095_cache_with_bare_import.ts.out deleted file mode 100644 index 2668a6e08..000000000 --- a/cli/tests/testdata/095_cache_with_bare_import.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ - at file:///[WILDCARD]/095_cache_with_bare_import.ts:[WILDCARD] diff --git a/cli/tests/testdata/Component.tsx b/cli/tests/testdata/Component.tsx deleted file mode 100644 index 81dfd6957..000000000 --- a/cli/tests/testdata/Component.tsx +++ /dev/null @@ -1 +0,0 @@ -import "./046_jsx_test.tsx"; diff --git a/cli/tests/testdata/DenoWinRunner.cs b/cli/tests/testdata/DenoWinRunner.cs deleted file mode 100644 index 2f9e9f89f..000000000 --- a/cli/tests/testdata/DenoWinRunner.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Threading.Tasks; - -[Flags] -public enum DenoConstraints : int -{ - None = 0, - NoStdin = 1, - NoStdout = 2, - NoStderr = 4 -} - -public class DenoWinRunner -{ - private const int STD_INPUT_HANDLE = -10; - private const int STD_OUTPUT_HANDLE = -11; - private const int STD_ERROR_HANDLE = -12; - - private const int FILE_NOT_FOUND = 2; - private const int WAIT_TIMEOUT = 258; - - [DllImport("kernel32.dll")] - private static extern void SetStdHandle(int nStdHandle, IntPtr handle); - - /// - /// Runs Deno.exe under the specified constraints - /// - /// Path to the Deno.exe file. Can be absolute or relative - /// Path to the script file Deno should run. - /// The constraints to apply to the Deno process - /// How long to wait for the Deno process to exit - /// The deno.exe exit code, or an exit code provided by the test runner - public static int RunDenoScript(string pathToDenoExe, string pathToTestScript, DenoConstraints constraints, uint timeoutMilliseconds = 1000) - { - try - { - if (!File.Exists(pathToDenoExe)) - { - Console.Error.WriteLine("Cannot find Deno.exe at " + pathToDenoExe); - return FILE_NOT_FOUND; - } - - if (!File.Exists(pathToTestScript)) - { - Console.Error.WriteLine("Cannot find test script at " + pathToTestScript); - return FILE_NOT_FOUND; - } - - ProcessStartInfo startInfo = new ProcessStartInfo(pathToDenoExe) - { - ErrorDialog = false, - UseShellExecute = false, - Arguments = @"run -A " + pathToTestScript, - RedirectStandardInput = !constraints.HasFlag(DenoConstraints.NoStdin), - RedirectStandardOutput = !constraints.HasFlag(DenoConstraints.NoStdout), - RedirectStandardError = !constraints.HasFlag(DenoConstraints.NoStderr) - }; - - startInfo.Environment.Add("RUST_BACKTRACE", "1"); - - if (constraints.HasFlag(DenoConstraints.NoStdin)) - { - SetStdHandle(STD_INPUT_HANDLE, (IntPtr)null); - } - - if (constraints.HasFlag(DenoConstraints.NoStdout)) - { - SetStdHandle(STD_OUTPUT_HANDLE, (IntPtr)null); - } - - if (constraints.HasFlag(DenoConstraints.NoStderr)) - { - SetStdHandle(STD_ERROR_HANDLE, (IntPtr)null); - } - - Process process = new Process { StartInfo = startInfo }; - process.Start(); - - Task stdErrTask = startInfo.RedirectStandardError ? - process.StandardError.ReadToEndAsync() : Task.FromResult(null); - Task stdOutTask = startInfo.RedirectStandardOutput ? - process.StandardOutput.ReadToEndAsync() : Task.FromResult(null); - - if (!process.WaitForExit((int)timeoutMilliseconds)) - { - Console.Error.WriteLine("Timed out waiting for Deno process to exit"); - try - { - process.Kill(); - } - catch - { - // Kill might fail, either because the process already exited or due to some other error - Console.Error.WriteLine("Failure killing the Deno process - possible Zombie Deno.exe process"); - } - return WAIT_TIMEOUT; - } - - // If the Deno process wrote to STDERR - append it to our STDERR - if (!constraints.HasFlag(DenoConstraints.NoStderr)) - { - string error = stdErrTask.Result; - if (!string.IsNullOrWhiteSpace(error)) - { - Console.Error.WriteLine(error); - } - } - - return process.ExitCode; - - } - catch (Win32Exception ex) - { - Console.Error.WriteLine("Win32Exception: code = " + ex.ErrorCode + ", message: " + ex.Message); - return ex.NativeErrorCode; - } - catch (Exception ex) - { - Console.Error.WriteLine("Exception: message: " + ex.Message); - return -1; - } - } -} diff --git a/cli/tests/testdata/DenoWinRunner.ps1 b/cli/tests/testdata/DenoWinRunner.ps1 deleted file mode 100644 index 203b5d36c..000000000 --- a/cli/tests/testdata/DenoWinRunner.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -$Source = [IO.File]::ReadAllText("$PSScriptRoot\DenoWinRunner.cs") -$denoExePath = $args[0] -$scriptPath = $args[1] -$constraints = $args[2] -$timeout = 5000; -Add-Type -TypeDefinition $Source -Language CSharp -Write-Output("Running Deno script: " + $args[1]) -$code = [DenoWinRunner]::RunDenoScript($denoExePath, $scriptPath, $constraints, $timeout) -Write-Output("Deno.exe or the test wrapper has exited with code: $code") -exit $code diff --git a/cli/tests/testdata/aggregate_error.out b/cli/tests/testdata/aggregate_error.out deleted file mode 100644 index 7d0c09c70..000000000 --- a/cli/tests/testdata/aggregate_error.out +++ /dev/null @@ -1,18 +0,0 @@ -AggregateError: Multiple errors. - at [WILDCARD]/aggregate_error.ts:1:24 - -AggregateError: Multiple errors. - Error: Error message 1. - at [WILDCARD]/aggregate_error.ts:2:3 - Error: Error message 2. - at [WILDCARD]/aggregate_error.ts:3:3 - at [WILDCARD]/aggregate_error.ts:1:24 - -error: Uncaught AggregateError: Multiple errors. - Error: Error message 1. - at [WILDCARD]/aggregate_error.ts:2:3 - Error: Error message 2. - at [WILDCARD]/aggregate_error.ts:3:3 -const aggregateError = new AggregateError([ - ^ - at [WILDCARD]/aggregate_error.ts:1:24 diff --git a/cli/tests/testdata/aggregate_error.ts b/cli/tests/testdata/aggregate_error.ts deleted file mode 100644 index ce4b54376..000000000 --- a/cli/tests/testdata/aggregate_error.ts +++ /dev/null @@ -1,9 +0,0 @@ -const aggregateError = new AggregateError([ - new Error("Error message 1."), - new Error("Error message 2."), -], "Multiple errors."); -console.log(aggregateError.stack); -console.log(); -console.log(aggregateError); -console.log(); -throw aggregateError; diff --git a/cli/tests/testdata/assets/DenoWinRunner.cs b/cli/tests/testdata/assets/DenoWinRunner.cs new file mode 100644 index 000000000..2f9e9f89f --- /dev/null +++ b/cli/tests/testdata/assets/DenoWinRunner.cs @@ -0,0 +1,127 @@ +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +[Flags] +public enum DenoConstraints : int +{ + None = 0, + NoStdin = 1, + NoStdout = 2, + NoStderr = 4 +} + +public class DenoWinRunner +{ + private const int STD_INPUT_HANDLE = -10; + private const int STD_OUTPUT_HANDLE = -11; + private const int STD_ERROR_HANDLE = -12; + + private const int FILE_NOT_FOUND = 2; + private const int WAIT_TIMEOUT = 258; + + [DllImport("kernel32.dll")] + private static extern void SetStdHandle(int nStdHandle, IntPtr handle); + + /// + /// Runs Deno.exe under the specified constraints + /// + /// Path to the Deno.exe file. Can be absolute or relative + /// Path to the script file Deno should run. + /// The constraints to apply to the Deno process + /// How long to wait for the Deno process to exit + /// The deno.exe exit code, or an exit code provided by the test runner + public static int RunDenoScript(string pathToDenoExe, string pathToTestScript, DenoConstraints constraints, uint timeoutMilliseconds = 1000) + { + try + { + if (!File.Exists(pathToDenoExe)) + { + Console.Error.WriteLine("Cannot find Deno.exe at " + pathToDenoExe); + return FILE_NOT_FOUND; + } + + if (!File.Exists(pathToTestScript)) + { + Console.Error.WriteLine("Cannot find test script at " + pathToTestScript); + return FILE_NOT_FOUND; + } + + ProcessStartInfo startInfo = new ProcessStartInfo(pathToDenoExe) + { + ErrorDialog = false, + UseShellExecute = false, + Arguments = @"run -A " + pathToTestScript, + RedirectStandardInput = !constraints.HasFlag(DenoConstraints.NoStdin), + RedirectStandardOutput = !constraints.HasFlag(DenoConstraints.NoStdout), + RedirectStandardError = !constraints.HasFlag(DenoConstraints.NoStderr) + }; + + startInfo.Environment.Add("RUST_BACKTRACE", "1"); + + if (constraints.HasFlag(DenoConstraints.NoStdin)) + { + SetStdHandle(STD_INPUT_HANDLE, (IntPtr)null); + } + + if (constraints.HasFlag(DenoConstraints.NoStdout)) + { + SetStdHandle(STD_OUTPUT_HANDLE, (IntPtr)null); + } + + if (constraints.HasFlag(DenoConstraints.NoStderr)) + { + SetStdHandle(STD_ERROR_HANDLE, (IntPtr)null); + } + + Process process = new Process { StartInfo = startInfo }; + process.Start(); + + Task stdErrTask = startInfo.RedirectStandardError ? + process.StandardError.ReadToEndAsync() : Task.FromResult(null); + Task stdOutTask = startInfo.RedirectStandardOutput ? + process.StandardOutput.ReadToEndAsync() : Task.FromResult(null); + + if (!process.WaitForExit((int)timeoutMilliseconds)) + { + Console.Error.WriteLine("Timed out waiting for Deno process to exit"); + try + { + process.Kill(); + } + catch + { + // Kill might fail, either because the process already exited or due to some other error + Console.Error.WriteLine("Failure killing the Deno process - possible Zombie Deno.exe process"); + } + return WAIT_TIMEOUT; + } + + // If the Deno process wrote to STDERR - append it to our STDERR + if (!constraints.HasFlag(DenoConstraints.NoStderr)) + { + string error = stdErrTask.Result; + if (!string.IsNullOrWhiteSpace(error)) + { + Console.Error.WriteLine(error); + } + } + + return process.ExitCode; + + } + catch (Win32Exception ex) + { + Console.Error.WriteLine("Win32Exception: code = " + ex.ErrorCode + ", message: " + ex.Message); + return ex.NativeErrorCode; + } + catch (Exception ex) + { + Console.Error.WriteLine("Exception: message: " + ex.Message); + return -1; + } + } +} diff --git a/cli/tests/testdata/assets/DenoWinRunner.ps1 b/cli/tests/testdata/assets/DenoWinRunner.ps1 new file mode 100644 index 000000000..203b5d36c --- /dev/null +++ b/cli/tests/testdata/assets/DenoWinRunner.ps1 @@ -0,0 +1,10 @@ +$Source = [IO.File]::ReadAllText("$PSScriptRoot\DenoWinRunner.cs") +$denoExePath = $args[0] +$scriptPath = $args[1] +$constraints = $args[2] +$timeout = 5000; +Add-Type -TypeDefinition $Source -Language CSharp +Write-Output("Running Deno script: " + $args[1]) +$code = [DenoWinRunner]::RunDenoScript($denoExePath, $scriptPath, $constraints, $timeout) +Write-Output("Deno.exe or the test wrapper has exited with code: $code") +exit $code diff --git a/cli/tests/testdata/assets/deno_dom_0.1.3-alpha2.wasm b/cli/tests/testdata/assets/deno_dom_0.1.3-alpha2.wasm new file mode 100644 index 000000000..6dd9d0e91 Binary files /dev/null and b/cli/tests/testdata/assets/deno_dom_0.1.3-alpha2.wasm differ diff --git a/cli/tests/testdata/assets/fixture.json b/cli/tests/testdata/assets/fixture.json new file mode 100644 index 000000000..56e056b6a --- /dev/null +++ b/cli/tests/testdata/assets/fixture.json @@ -0,0 +1,14 @@ +{ + "name": "deno", + "private": true, + "devDependencies": { + "@types/prettier": "1.16.1", + "@typescript-eslint/eslint-plugin": "2.5.0", + "@typescript-eslint/parser": "2.5.0", + "eslint": "5.15.1", + "eslint-config-prettier": "4.1.0", + "magic-string": "0.25.2", + "prettier": "1.17.1", + "typescript": "3.6.3" + } +} diff --git a/cli/tests/testdata/assets/hello.txt b/cli/tests/testdata/assets/hello.txt new file mode 100644 index 000000000..6769dd60b --- /dev/null +++ b/cli/tests/testdata/assets/hello.txt @@ -0,0 +1 @@ +Hello world! \ No newline at end of file diff --git a/cli/tests/testdata/assets/unreachable.wasm b/cli/tests/testdata/assets/unreachable.wasm new file mode 100644 index 000000000..a4110ee39 Binary files /dev/null and b/cli/tests/testdata/assets/unreachable.wasm differ diff --git a/cli/tests/testdata/async_error.ts b/cli/tests/testdata/async_error.ts deleted file mode 100644 index b55c73aeb..000000000 --- a/cli/tests/testdata/async_error.ts +++ /dev/null @@ -1,9 +0,0 @@ -console.log("hello"); -// deno-lint-ignore require-await -const foo = async (): Promise => { - console.log("before error"); - throw Error("error"); -}; - -foo(); -console.log("world"); diff --git a/cli/tests/testdata/async_error.ts.out b/cli/tests/testdata/async_error.ts.out deleted file mode 100644 index b424f9072..000000000 --- a/cli/tests/testdata/async_error.ts.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD]hello -before error -world -error: Uncaught (in promise) Error: error - throw Error("error"); - ^ - at foo ([WILDCARD]/async_error.ts:5:9) - at [WILDCARD]/async_error.ts:8:1 diff --git a/cli/tests/testdata/badly_formatted.json b/cli/tests/testdata/badly_formatted.json deleted file mode 100644 index f2bacf73d..000000000 --- a/cli/tests/testdata/badly_formatted.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - - - "key1": "value1", - "key2": true, - "key3": ["value2", "value3", false], - "keys": { - "more": "values" - } - - -} \ No newline at end of file diff --git a/cli/tests/testdata/badly_formatted.md b/cli/tests/testdata/badly_formatted.md deleted file mode 100644 index 26afe483b..000000000 --- a/cli/tests/testdata/badly_formatted.md +++ /dev/null @@ -1,46 +0,0 @@ -# Hello Markdown - -```js -console.log("Hello World" - -) -``` - -```javascript -console.log("Hello World2" - -) -``` - -```ts - -function hello(name: string ) { - console.log(name); -}; - -hello( "alice"); -``` - -```typescript -function foo(): number { - return 2; -} -``` - -```jsonc - -{ - // Comment in JSON - "key": "value", - "key2": - "value2", -} - -``` - -```json -{ - "numbers": - ["1", "2"] -} -``` \ No newline at end of file diff --git a/cli/tests/testdata/badly_formatted.mjs b/cli/tests/testdata/badly_formatted.mjs deleted file mode 100644 index bc515a330..000000000 --- a/cli/tests/testdata/badly_formatted.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Deliberately using .mjs to avoid triggering dprint -console.log("Hello World" - -) diff --git a/cli/tests/testdata/badly_formatted_fixed.js b/cli/tests/testdata/badly_formatted_fixed.js deleted file mode 100644 index e9062ba85..000000000 --- a/cli/tests/testdata/badly_formatted_fixed.js +++ /dev/null @@ -1,2 +0,0 @@ -// Deliberately using .mjs to avoid triggering dprint -console.log("Hello World"); diff --git a/cli/tests/testdata/badly_formatted_fixed.json b/cli/tests/testdata/badly_formatted_fixed.json deleted file mode 100644 index 0d697a2c6..000000000 --- a/cli/tests/testdata/badly_formatted_fixed.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "key1": "value1", - "key2": true, - "key3": ["value2", "value3", false], - "keys": { - "more": "values" - } -} diff --git a/cli/tests/testdata/badly_formatted_fixed.md b/cli/tests/testdata/badly_formatted_fixed.md deleted file mode 100644 index 8ba74cac3..000000000 --- a/cli/tests/testdata/badly_formatted_fixed.md +++ /dev/null @@ -1,37 +0,0 @@ -# Hello Markdown - -```js -console.log("Hello World"); -``` - -```javascript -console.log("Hello World2"); -``` - -```ts -function hello(name: string) { - console.log(name); -} - -hello("alice"); -``` - -```typescript -function foo(): number { - return 2; -} -``` - -```jsonc -{ - // Comment in JSON - "key": "value", - "key2": "value2" -} -``` - -```json -{ - "numbers": ["1", "2"] -} -``` diff --git a/cli/tests/testdata/before_unload.js b/cli/tests/testdata/before_unload.js deleted file mode 100644 index 2572e512b..000000000 --- a/cli/tests/testdata/before_unload.js +++ /dev/null @@ -1,21 +0,0 @@ -let count = 0; - -console.log("0"); - -globalThis.addEventListener("beforeunload", (e) => { - console.log("GOT EVENT"); - if (count === 0 || count === 1) { - e.preventDefault(); - setTimeout(() => { - console.log("3"); - }, 100); - } - - count++; -}); - -console.log("1"); - -setTimeout(() => { - console.log("2"); -}, 100); diff --git a/cli/tests/testdata/before_unload.js.out b/cli/tests/testdata/before_unload.js.out deleted file mode 100644 index f1f2ab49a..000000000 --- a/cli/tests/testdata/before_unload.js.out +++ /dev/null @@ -1,8 +0,0 @@ -0 -1 -2 -GOT EVENT -3 -GOT EVENT -3 -GOT EVENT diff --git a/cli/tests/testdata/benches/response_string_perf.js b/cli/tests/testdata/benches/response_string_perf.js new file mode 100644 index 000000000..f55376c77 --- /dev/null +++ b/cli/tests/testdata/benches/response_string_perf.js @@ -0,0 +1,34 @@ +const mixed = "@Ä€à¹ðŸ˜€"; + +function generateRandom(bytes) { + let result = ""; + let i = 0; + while (i < bytes) { + const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); + switch (toAdd) { + case 0: + result += mixed[0]; + i++; + break; + case 1: + result += mixed[1]; + i++; + break; + case 2: + result += mixed[2]; + i++; + break; + case 3: + result += mixed[3]; + result += mixed[4]; + i += 2; + break; + } + } + return result; +} + +const randomData = generateRandom(1024); +for (let i = 0; i < 10_000; i++) { + new Response(randomData); +} diff --git a/cli/tests/testdata/benches/text_decoder_perf.js b/cli/tests/testdata/benches/text_decoder_perf.js new file mode 100644 index 000000000..2e52b1f8b --- /dev/null +++ b/cli/tests/testdata/benches/text_decoder_perf.js @@ -0,0 +1,38 @@ +const mixed = new TextEncoder().encode("@Ä€à¹ðŸ˜€"); + +function generateRandom(bytes) { + const result = new Uint8Array(bytes); + let i = 0; + while (i < bytes) { + const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); + switch (toAdd) { + case 0: + result[i] = mixed[0]; + i++; + break; + case 1: + result[i] = mixed[1]; + result[i + 1] = mixed[2]; + i += 2; + break; + case 2: + result[i] = mixed[3]; + result[i + 1] = mixed[4]; + result[i + 2] = mixed[5]; + i += 3; + break; + case 3: + result[i] = mixed[6]; + result[i + 1] = mixed[7]; + result[i + 2] = mixed[8]; + result[i + 3] = mixed[9]; + i += 4; + break; + } + } + return result; +} + +const randomData = generateRandom(1024); +const decoder = new TextDecoder(); +for (let i = 0; i < 10_000; i++) decoder.decode(randomData); diff --git a/cli/tests/testdata/benches/text_encoder_into_perf.js b/cli/tests/testdata/benches/text_encoder_into_perf.js new file mode 100644 index 000000000..8d60e9f00 --- /dev/null +++ b/cli/tests/testdata/benches/text_encoder_into_perf.js @@ -0,0 +1,34 @@ +const mixed = "@Ä€à¹ðŸ˜€"; + +function generateRandom(bytes) { + let result = ""; + let i = 0; + while (i < bytes) { + const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); + switch (toAdd) { + case 0: + result += mixed[0]; + i++; + break; + case 1: + result += mixed[1]; + i++; + break; + case 2: + result += mixed[2]; + i++; + break; + case 3: + result += mixed[3]; + result += mixed[4]; + i += 2; + break; + } + } + return result; +} + +const randomData = generateRandom(1024); +const encoder = new TextEncoder(); +const targetBuffer = new Uint8Array(randomData.length * 4); +for (let i = 0; i < 10_000; i++) encoder.encodeInto(randomData, targetBuffer); diff --git a/cli/tests/testdata/benches/text_encoder_perf.js b/cli/tests/testdata/benches/text_encoder_perf.js new file mode 100644 index 000000000..6f61f019e --- /dev/null +++ b/cli/tests/testdata/benches/text_encoder_perf.js @@ -0,0 +1,33 @@ +const mixed = "@Ä€à¹ðŸ˜€"; + +function generateRandom(bytes) { + let result = ""; + let i = 0; + while (i < bytes) { + const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); + switch (toAdd) { + case 0: + result += mixed[0]; + i++; + break; + case 1: + result += mixed[1]; + i++; + break; + case 2: + result += mixed[2]; + i++; + break; + case 3: + result += mixed[3]; + result += mixed[4]; + i += 2; + break; + } + } + return result; +} + +const randomData = generateRandom(1024); +const encoder = new TextEncoder(); +for (let i = 0; i < 10_000; i++) encoder.encode(randomData); diff --git a/cli/tests/testdata/blob_gc_finalization.js b/cli/tests/testdata/blob_gc_finalization.js deleted file mode 100644 index c721e6b45..000000000 --- a/cli/tests/testdata/blob_gc_finalization.js +++ /dev/null @@ -1,11 +0,0 @@ -// This test creates 128 blobs of 128 MB each. This will only work if the blobs -// and their backing data is GCed as expected. -for (let i = 0; i < 128; i++) { - // Create a 128MB byte array, and then a blob from it. - const buf = new Uint8Array(128 * 1024 * 1024); - new Blob([buf]); - // It is very important that there is a yield here, otherwise the finalizer - // for the blob is not called and the memory is not freed. - await new Promise((resolve) => setTimeout(resolve, 0)); -} -console.log("GCed all blobs"); diff --git a/cli/tests/testdata/blob_gc_finalization.js.out b/cli/tests/testdata/blob_gc_finalization.js.out deleted file mode 100644 index dcc4500f8..000000000 --- a/cli/tests/testdata/blob_gc_finalization.js.out +++ /dev/null @@ -1 +0,0 @@ -GCed all blobs diff --git a/cli/tests/testdata/bundle.test.out b/cli/tests/testdata/bundle.test.out deleted file mode 100644 index 6b1c109d3..000000000 --- a/cli/tests/testdata/bundle.test.out +++ /dev/null @@ -1,27 +0,0 @@ -[WILDCARD] -function printHello() { - console.log("Hello"); -} -function returnsFoo() { - return "Foo"; -} -function printHello2() { - printHello(); -} -function returnsHi() { - return "Hi"; -} -function returnsFoo2() { - return returnsFoo(); -} -function printHello3() { - printHello2(); -} -function throwsError() { - throw Error("exception from mod1"); -} -export { returnsHi as returnsHi }; -export { returnsFoo2 as returnsFoo2 }; -export { printHello3 as printHello3 }; -export { throwsError as throwsError }; - diff --git a/cli/tests/testdata/bundle/bare_imports/error_with_bare_import.ts b/cli/tests/testdata/bundle/bare_imports/error_with_bare_import.ts new file mode 100644 index 000000000..c0748305d --- /dev/null +++ b/cli/tests/testdata/bundle/bare_imports/error_with_bare_import.ts @@ -0,0 +1 @@ +import "foo"; diff --git a/cli/tests/testdata/bundle/bare_imports/error_with_bare_import.ts.out b/cli/tests/testdata/bundle/bare_imports/error_with_bare_import.ts.out new file mode 100644 index 000000000..44d063a5e --- /dev/null +++ b/cli/tests/testdata/bundle/bare_imports/error_with_bare_import.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ + at file:///[WILDCARD]/error_with_bare_import.ts:[WILDCARD] diff --git a/cli/tests/testdata/bundle/bundle.test.out b/cli/tests/testdata/bundle/bundle.test.out new file mode 100644 index 000000000..6b1c109d3 --- /dev/null +++ b/cli/tests/testdata/bundle/bundle.test.out @@ -0,0 +1,27 @@ +[WILDCARD] +function printHello() { + console.log("Hello"); +} +function returnsFoo() { + return "Foo"; +} +function printHello2() { + printHello(); +} +function returnsHi() { + return "Hi"; +} +function returnsFoo2() { + return returnsFoo(); +} +function printHello3() { + printHello2(); +} +function throwsError() { + throw Error("exception from mod1"); +} +export { returnsHi as returnsHi }; +export { returnsFoo2 as returnsFoo2 }; +export { printHello3 as printHello3 }; +export { throwsError as throwsError }; + diff --git a/cli/tests/testdata/bundle/check_local_by_default.out b/cli/tests/testdata/bundle/check_local_by_default.out deleted file mode 100644 index c4559d1fa..000000000 --- a/cli/tests/testdata/bundle/check_local_by_default.out +++ /dev/null @@ -1,6 +0,0 @@ -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -console.log(12); - diff --git a/cli/tests/testdata/bundle/check_local_by_default.ts b/cli/tests/testdata/bundle/check_local_by_default.ts deleted file mode 100644 index 2ae8c2692..000000000 --- a/cli/tests/testdata/bundle/check_local_by_default.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as a from "http://localhost:4545/subdir/type_error.ts"; - -console.log(a.a); diff --git a/cli/tests/testdata/bundle/check_local_by_default/no_errors.out b/cli/tests/testdata/bundle/check_local_by_default/no_errors.out new file mode 100644 index 000000000..c4559d1fa --- /dev/null +++ b/cli/tests/testdata/bundle/check_local_by_default/no_errors.out @@ -0,0 +1,6 @@ +// deno-fmt-ignore-file +// deno-lint-ignore-file +// This code was bundled using `deno bundle` and it's not recommended to edit it manually + +console.log(12); + diff --git a/cli/tests/testdata/bundle/check_local_by_default/no_errors.ts b/cli/tests/testdata/bundle/check_local_by_default/no_errors.ts new file mode 100644 index 000000000..2ae8c2692 --- /dev/null +++ b/cli/tests/testdata/bundle/check_local_by_default/no_errors.ts @@ -0,0 +1,3 @@ +import * as a from "http://localhost:4545/subdir/type_error.ts"; + +console.log(a.a); diff --git a/cli/tests/testdata/bundle/check_local_by_default/type_error.out b/cli/tests/testdata/bundle/check_local_by_default/type_error.out new file mode 100644 index 000000000..6d53e9498 --- /dev/null +++ b/cli/tests/testdata/bundle/check_local_by_default/type_error.out @@ -0,0 +1,4 @@ +error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'. +const b: "b" = 12; + ^ + at [WILDCARD]bundle/check_local_by_default/type_error.ts:3:7 diff --git a/cli/tests/testdata/bundle/check_local_by_default/type_error.ts b/cli/tests/testdata/bundle/check_local_by_default/type_error.ts new file mode 100644 index 000000000..5177ff944 --- /dev/null +++ b/cli/tests/testdata/bundle/check_local_by_default/type_error.ts @@ -0,0 +1,6 @@ +import * as a from "http://localhost:4545/subdir/type_error.ts"; + +const b: "b" = 12; + +console.log(a.a); +console.log(b); diff --git a/cli/tests/testdata/bundle/check_local_by_default2.out b/cli/tests/testdata/bundle/check_local_by_default2.out deleted file mode 100644 index 60f5760f8..000000000 --- a/cli/tests/testdata/bundle/check_local_by_default2.out +++ /dev/null @@ -1,4 +0,0 @@ -error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'. -const b: "b" = 12; - ^ - at [WILDCARD]bundle/check_local_by_default2.ts:3:7 diff --git a/cli/tests/testdata/bundle/check_local_by_default2.ts b/cli/tests/testdata/bundle/check_local_by_default2.ts deleted file mode 100644 index 5177ff944..000000000 --- a/cli/tests/testdata/bundle/check_local_by_default2.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as a from "http://localhost:4545/subdir/type_error.ts"; - -const b: "b" = 12; - -console.log(a.a); -console.log(b); diff --git a/cli/tests/testdata/bundle/decorators/ts_decorators.out b/cli/tests/testdata/bundle/decorators/ts_decorators.out new file mode 100644 index 000000000..2f503fdd0 --- /dev/null +++ b/cli/tests/testdata/bundle/decorators/ts_decorators.out @@ -0,0 +1,49 @@ +[WILDCARD] +// deno-fmt-ignore-file +// deno-lint-ignore-file +// This code was bundled using `deno bundle` and it's not recommended to edit it manually + +var __decorate = this && this.__decorate || function(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +function a() { + console.log("a(): evaluated"); + return (_target, _propertyKey, _descriptor)=>{ + console.log("a(): called"); + }; +} +class B { + method() { + console.log("method"); + } +} +__decorate([ + a() +], B.prototype, "method", null); +var __decorate1 = this && this.__decorate || function(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +function Decorator() { + return function(target, propertyKey, descriptor) { + const originalFn = descriptor.value; + descriptor.value = async function(...args) { + return await originalFn.apply(this, args); + }; + return descriptor; + }; +} +class SomeClass { + async test() {} +} +__decorate1([ + Decorator() +], SomeClass.prototype, "test", null); +new SomeClass().test(); +new B().method(); +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/bundle/decorators/ts_decorators.ts b/cli/tests/testdata/bundle/decorators/ts_decorators.ts new file mode 100644 index 000000000..61299bccf --- /dev/null +++ b/cli/tests/testdata/bundle/decorators/ts_decorators.ts @@ -0,0 +1,25 @@ +// deno-lint-ignore-file + +import { B } from "../../subdir/more_decorators.ts"; + +function Decorator() { + return function ( + target: Record, + propertyKey: string, + descriptor: TypedPropertyDescriptor, + ) { + const originalFn: Function = descriptor.value as Function; + descriptor.value = async function (...args: any[]) { + return await originalFn.apply(this, args); + }; + return descriptor; + }; +} + +class SomeClass { + @Decorator() + async test() {} +} + +new SomeClass().test(); +new B().method(); diff --git a/cli/tests/testdata/bundle/dynamic_import.ts b/cli/tests/testdata/bundle/dynamic_import.ts new file mode 100644 index 000000000..d8c7d08ec --- /dev/null +++ b/cli/tests/testdata/bundle/dynamic_import.ts @@ -0,0 +1,3 @@ +const mod1 = await import("http://localhost:4545/subdir/mod1.ts"); + +mod1.printHello3(); diff --git a/cli/tests/testdata/bundle/ignore_directives.test.out b/cli/tests/testdata/bundle/ignore_directives.test.out new file mode 100644 index 000000000..b69c2632c --- /dev/null +++ b/cli/tests/testdata/bundle/ignore_directives.test.out @@ -0,0 +1,6 @@ +[WILDCARD] +// deno-fmt-ignore-file +// deno-lint-ignore-file +// This code was bundled using `deno bundle` and it's not recommended to edit it manually + +[WILDCARD] diff --git a/cli/tests/testdata/bundle/import_map/import_map.json b/cli/tests/testdata/bundle/import_map/import_map.json new file mode 100644 index 000000000..c02f72718 --- /dev/null +++ b/cli/tests/testdata/bundle/import_map/import_map.json @@ -0,0 +1,5 @@ +{ + "imports": { + "mod2": "../../subdir/subdir2/mod2.ts" + } +} diff --git a/cli/tests/testdata/bundle/import_map/main.ts b/cli/tests/testdata/bundle/import_map/main.ts new file mode 100644 index 000000000..74834de20 --- /dev/null +++ b/cli/tests/testdata/bundle/import_map/main.ts @@ -0,0 +1,17 @@ +import { printHello2, returnsFoo } from "mod2"; + +export function returnsHi(): string { + return "Hi"; +} + +export function returnsFoo2(): string { + return returnsFoo(); +} + +export function printHello3() { + printHello2(); +} + +export function throwsError() { + throw Error("exception from mod1"); +} diff --git a/cli/tests/testdata/bundle/jsx.out b/cli/tests/testdata/bundle/jsx.out new file mode 100644 index 000000000..da83cde82 --- /dev/null +++ b/cli/tests/testdata/bundle/jsx.out @@ -0,0 +1,9 @@ +[WILDCARD] +const React = { + createElement () {} +}; +function app() { + return React.createElement("div", null, React.createElement("h2", null, "asdf")); +} +console.log(app); + diff --git a/cli/tests/testdata/bundle/lockfile/check_error.json b/cli/tests/testdata/bundle/lockfile/check_error.json new file mode 100644 index 000000000..a218d7000 --- /dev/null +++ b/cli/tests/testdata/bundle/lockfile/check_error.json @@ -0,0 +1,5 @@ +{ + "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" +} diff --git a/cli/tests/testdata/bundle/lockfile/check_error.out b/cli/tests/testdata/bundle/lockfile/check_error.out new file mode 100644 index 000000000..9299bc27e --- /dev/null +++ b/cli/tests/testdata/bundle/lockfile/check_error.out @@ -0,0 +1,4 @@ +[WILDCARD] +error: The source code is invalid, as it does not match the expected hash in the lock file. + Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts + Lock file: bundle/lockfile/check_error.json diff --git a/cli/tests/testdata/bundle_dynamic_import.ts b/cli/tests/testdata/bundle_dynamic_import.ts deleted file mode 100644 index d8c7d08ec..000000000 --- a/cli/tests/testdata/bundle_dynamic_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -const mod1 = await import("http://localhost:4545/subdir/mod1.ts"); - -mod1.printHello3(); diff --git a/cli/tests/testdata/bundle_ignore_directives.test.out b/cli/tests/testdata/bundle_ignore_directives.test.out deleted file mode 100644 index b69c2632c..000000000 --- a/cli/tests/testdata/bundle_ignore_directives.test.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD] -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -[WILDCARD] diff --git a/cli/tests/testdata/bundle_im.json b/cli/tests/testdata/bundle_im.json deleted file mode 100644 index 8ebc00c5b..000000000 --- a/cli/tests/testdata/bundle_im.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "imports": { - "mod2": "./subdir/subdir2/mod2.ts" - } -} diff --git a/cli/tests/testdata/bundle_im.ts b/cli/tests/testdata/bundle_im.ts deleted file mode 100644 index 74834de20..000000000 --- a/cli/tests/testdata/bundle_im.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { printHello2, returnsFoo } from "mod2"; - -export function returnsHi(): string { - return "Hi"; -} - -export function returnsFoo2(): string { - return returnsFoo(); -} - -export function printHello3() { - printHello2(); -} - -export function throwsError() { - throw Error("exception from mod1"); -} diff --git a/cli/tests/testdata/bundle_jsx.out b/cli/tests/testdata/bundle_jsx.out deleted file mode 100644 index da83cde82..000000000 --- a/cli/tests/testdata/bundle_jsx.out +++ /dev/null @@ -1,9 +0,0 @@ -[WILDCARD] -const React = { - createElement () {} -}; -function app() { - return React.createElement("div", null, React.createElement("h2", null, "asdf")); -} -console.log(app); - diff --git a/cli/tests/testdata/byte_order_mark.out b/cli/tests/testdata/byte_order_mark.out deleted file mode 100644 index 557db03de..000000000 --- a/cli/tests/testdata/byte_order_mark.out +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/cli/tests/testdata/byte_order_mark.ts b/cli/tests/testdata/byte_order_mark.ts deleted file mode 100644 index 40eb23c1d..000000000 --- a/cli/tests/testdata/byte_order_mark.ts +++ /dev/null @@ -1,4 +0,0 @@ -import "./001_hello.js"; -// Note this file starts with special byte order mark -// it's important that this file is a .ts typescript file which is passed to -// deno through `--no-check` mode. diff --git a/cli/tests/testdata/cache/036_import_map_fetch.out b/cli/tests/testdata/cache/036_import_map_fetch.out new file mode 100644 index 000000000..e69de29bb diff --git a/cli/tests/testdata/cache/037_fetch_multiple.out b/cli/tests/testdata/cache/037_fetch_multiple.out new file mode 100644 index 000000000..09c6c0f60 --- /dev/null +++ b/cli/tests/testdata/cache/037_fetch_multiple.out @@ -0,0 +1,5 @@ +Download http://localhost:4545/subdir/mod2.ts +Download http://localhost:4545/subdir/print_hello.ts +Check [WILDCARD]/fetch/test.ts +Download http://localhost:4545/subdir/mt_text_typescript.t1.ts +Check [WILDCARD]/fetch/other.ts diff --git a/cli/tests/testdata/cache/095_cache_with_bare_import.ts b/cli/tests/testdata/cache/095_cache_with_bare_import.ts new file mode 100644 index 000000000..c0748305d --- /dev/null +++ b/cli/tests/testdata/cache/095_cache_with_bare_import.ts @@ -0,0 +1 @@ +import "foo"; diff --git a/cli/tests/testdata/cache/095_cache_with_bare_import.ts.out b/cli/tests/testdata/cache/095_cache_with_bare_import.ts.out new file mode 100644 index 000000000..2668a6e08 --- /dev/null +++ b/cli/tests/testdata/cache/095_cache_with_bare_import.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ + at file:///[WILDCARD]/095_cache_with_bare_import.ts:[WILDCARD] diff --git a/cli/tests/testdata/cache/cache_extensionless.out b/cli/tests/testdata/cache/cache_extensionless.out new file mode 100644 index 000000000..3694c67cb --- /dev/null +++ b/cli/tests/testdata/cache/cache_extensionless.out @@ -0,0 +1,2 @@ +[WILDCARD] +Check http://localhost:4545/subdir/no_js_ext diff --git a/cli/tests/testdata/cache/cache_random_extension.out b/cli/tests/testdata/cache/cache_random_extension.out new file mode 100644 index 000000000..745a2e0e3 --- /dev/null +++ b/cli/tests/testdata/cache/cache_random_extension.out @@ -0,0 +1,2 @@ +[WILDCARD] +Check http://localhost:4545/subdir/no_js_ext@1.0.0 diff --git a/cli/tests/testdata/cache/ignore_require.js b/cli/tests/testdata/cache/ignore_require.js new file mode 100644 index 000000000..a8ef15021 --- /dev/null +++ b/cli/tests/testdata/cache/ignore_require.js @@ -0,0 +1,2 @@ +// deno-lint-ignore-file +require("invalid module specifier"); diff --git a/cli/tests/testdata/cache/performance_stats.out b/cli/tests/testdata/cache/performance_stats.out new file mode 100644 index 000000000..141829ee6 --- /dev/null +++ b/cli/tests/testdata/cache/performance_stats.out @@ -0,0 +1,16 @@ +[WILDCARD] +DEBUG RS - [WILDCARD] - Compilation statistics: + Files: [WILDCARD] + Nodes: [WILDCARD] + Identifiers: [WILDCARD] + Symbols: [WILDCARD] + Types: [WILDCARD] + Instantiations: [WILDCARD] + Parse time: [WILDCARD] + Bind time: [WILDCARD] + Check time: [WILDCARD] + Emit time: [WILDCARD] + Total TS time: [WILDCARD] + Compile time: [WILDCARD] + +[WILDCARD] diff --git a/cli/tests/testdata/cache/redirect_cache.out b/cli/tests/testdata/cache/redirect_cache.out new file mode 100644 index 000000000..8905c4529 --- /dev/null +++ b/cli/tests/testdata/cache/redirect_cache.out @@ -0,0 +1,5 @@ +Download http://localhost:4548/subdir/redirects/a.ts +Download http://localhost:4546/subdir/redirects/a.ts +Download http://localhost:4545/subdir/redirects/a.ts +Download http://localhost:4545/subdir/redirects/b.ts +Check http://localhost:4548/subdir/redirects/a.ts diff --git a/cli/tests/testdata/cache_extensionless.out b/cli/tests/testdata/cache_extensionless.out deleted file mode 100644 index 3694c67cb..000000000 --- a/cli/tests/testdata/cache_extensionless.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -Check http://localhost:4545/subdir/no_js_ext diff --git a/cli/tests/testdata/cache_random_extension.out b/cli/tests/testdata/cache_random_extension.out deleted file mode 100644 index 745a2e0e3..000000000 --- a/cli/tests/testdata/cache_random_extension.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -Check http://localhost:4545/subdir/no_js_ext@1.0.0 diff --git a/cli/tests/testdata/cafile_info.ts b/cli/tests/testdata/cafile_info.ts deleted file mode 100644 index b41873f73..000000000 --- a/cli/tests/testdata/cafile_info.ts +++ /dev/null @@ -1,24 +0,0 @@ -// When run against the test HTTP server, it will serve different media types -// based on the URL containing `.t#.` strings, which exercises the different -// mapping of media types end to end. - -import { loaded as loadedTs1 } from "https://localhost:5545/subdir/mt_text_typescript.t1.ts"; -import { loaded as loadedTs2 } from "https://localhost:5545/subdir/mt_video_vdn.t2.ts"; -import { loaded as loadedTs3 } from "https://localhost:5545/subdir/mt_video_mp2t.t3.ts"; -import { loaded as loadedTs4 } from "https://localhost:5545/subdir/mt_application_x_typescript.t4.ts"; -import { loaded as loadedJs1 } from "https://localhost:5545/subdir/mt_text_javascript.j1.js"; -import { loaded as loadedJs2 } from "https://localhost:5545/subdir/mt_application_ecmascript.j2.js"; -import { loaded as loadedJs3 } from "https://localhost:5545/subdir/mt_text_ecmascript.j3.js"; -import { loaded as loadedJs4 } from "https://localhost:5545/subdir/mt_application_x_javascript.j4.js"; - -console.log( - "success", - loadedTs1, - loadedTs2, - loadedTs3, - loadedTs4, - loadedJs1, - loadedJs2, - loadedJs3, - loadedJs4, -); diff --git a/cli/tests/testdata/cafile_info.ts.out b/cli/tests/testdata/cafile_info.ts.out deleted file mode 100644 index 3ce03961d..000000000 --- a/cli/tests/testdata/cafile_info.ts.out +++ /dev/null @@ -1,13 +0,0 @@ -local: [WILDCARD]https[WILDCARD]localhost_PORT5545[WILDCARD] -type: TypeScript -dependencies: 8 unique (total [WILDCARD]) - -https://localhost:5545/cafile_info.ts ([WILDCARD]) -├── https://localhost:5545/subdir/mt_application_ecmascript.j2.js ([WILDCARD]) -├── https://localhost:5545/subdir/mt_application_x_javascript.j4.js ([WILDCARD]) -├── https://localhost:5545/subdir/mt_application_x_typescript.t4.ts ([WILDCARD]) -├── https://localhost:5545/subdir/mt_text_ecmascript.j3.js ([WILDCARD]) -├── https://localhost:5545/subdir/mt_text_javascript.j1.js ([WILDCARD]) -├── https://localhost:5545/subdir/mt_text_typescript.t1.ts ([WILDCARD]) -├── https://localhost:5545/subdir/mt_video_mp2t.t3.ts ([WILDCARD]) -└── https://localhost:5545/subdir/mt_video_vdn.t2.ts ([WILDCARD]) diff --git a/cli/tests/testdata/cafile_ts_fetch.ts b/cli/tests/testdata/cafile_ts_fetch.ts deleted file mode 100644 index 03afb6d2f..000000000 --- a/cli/tests/testdata/cafile_ts_fetch.ts +++ /dev/null @@ -1,3 +0,0 @@ -fetch("https://localhost:5545/cafile_ts_fetch.ts.out") - .then((r) => r.text()) - .then((t) => console.log(t.trimEnd())); diff --git a/cli/tests/testdata/cafile_ts_fetch.ts.out b/cli/tests/testdata/cafile_ts_fetch.ts.out deleted file mode 100644 index 699b756ed..000000000 --- a/cli/tests/testdata/cafile_ts_fetch.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -Hello diff --git a/cli/tests/testdata/cafile_ts_fetch_unsafe_ssl.ts.out b/cli/tests/testdata/cafile_ts_fetch_unsafe_ssl.ts.out deleted file mode 100644 index a0934e584..000000000 --- a/cli/tests/testdata/cafile_ts_fetch_unsafe_ssl.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -DANGER: TLS certificate validation is disabled for all hostnames -[WILDCARD] -Hello diff --git a/cli/tests/testdata/cafile_url_imports.ts b/cli/tests/testdata/cafile_url_imports.ts deleted file mode 100644 index 2355a8628..000000000 --- a/cli/tests/testdata/cafile_url_imports.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello } from "https://localhost:5545/subdir/mod2.ts"; -printHello(); -console.log("success"); diff --git a/cli/tests/testdata/cafile_url_imports.ts.out b/cli/tests/testdata/cafile_url_imports.ts.out deleted file mode 100644 index 989ce33e9..000000000 --- a/cli/tests/testdata/cafile_url_imports.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Hello -success diff --git a/cli/tests/testdata/cafile_url_imports_unsafe_ssl.ts.out b/cli/tests/testdata/cafile_url_imports_unsafe_ssl.ts.out deleted file mode 100644 index daebcd766..000000000 --- a/cli/tests/testdata/cafile_url_imports_unsafe_ssl.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -DANGER: TLS certificate validation is disabled for: localhost -Hello -success diff --git a/cli/tests/testdata/cert/cafile_info.ts b/cli/tests/testdata/cert/cafile_info.ts new file mode 100644 index 000000000..b41873f73 --- /dev/null +++ b/cli/tests/testdata/cert/cafile_info.ts @@ -0,0 +1,24 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. + +import { loaded as loadedTs1 } from "https://localhost:5545/subdir/mt_text_typescript.t1.ts"; +import { loaded as loadedTs2 } from "https://localhost:5545/subdir/mt_video_vdn.t2.ts"; +import { loaded as loadedTs3 } from "https://localhost:5545/subdir/mt_video_mp2t.t3.ts"; +import { loaded as loadedTs4 } from "https://localhost:5545/subdir/mt_application_x_typescript.t4.ts"; +import { loaded as loadedJs1 } from "https://localhost:5545/subdir/mt_text_javascript.j1.js"; +import { loaded as loadedJs2 } from "https://localhost:5545/subdir/mt_application_ecmascript.j2.js"; +import { loaded as loadedJs3 } from "https://localhost:5545/subdir/mt_text_ecmascript.j3.js"; +import { loaded as loadedJs4 } from "https://localhost:5545/subdir/mt_application_x_javascript.j4.js"; + +console.log( + "success", + loadedTs1, + loadedTs2, + loadedTs3, + loadedTs4, + loadedJs1, + loadedJs2, + loadedJs3, + loadedJs4, +); diff --git a/cli/tests/testdata/cert/cafile_info.ts.out b/cli/tests/testdata/cert/cafile_info.ts.out new file mode 100644 index 000000000..4c7e6c6c7 --- /dev/null +++ b/cli/tests/testdata/cert/cafile_info.ts.out @@ -0,0 +1,13 @@ +local: [WILDCARD]https[WILDCARD]localhost_PORT5545[WILDCARD] +type: TypeScript +dependencies: 8 unique (total [WILDCARD]) + +https://localhost:5545/cert/cafile_info.ts ([WILDCARD]) +├── https://localhost:5545/subdir/mt_application_ecmascript.j2.js ([WILDCARD]) +├── https://localhost:5545/subdir/mt_application_x_javascript.j4.js ([WILDCARD]) +├── https://localhost:5545/subdir/mt_application_x_typescript.t4.ts ([WILDCARD]) +├── https://localhost:5545/subdir/mt_text_ecmascript.j3.js ([WILDCARD]) +├── https://localhost:5545/subdir/mt_text_javascript.j1.js ([WILDCARD]) +├── https://localhost:5545/subdir/mt_text_typescript.t1.ts ([WILDCARD]) +├── https://localhost:5545/subdir/mt_video_mp2t.t3.ts ([WILDCARD]) +└── https://localhost:5545/subdir/mt_video_vdn.t2.ts ([WILDCARD]) diff --git a/cli/tests/testdata/cert/cafile_ts_fetch.ts b/cli/tests/testdata/cert/cafile_ts_fetch.ts new file mode 100644 index 000000000..12fcda007 --- /dev/null +++ b/cli/tests/testdata/cert/cafile_ts_fetch.ts @@ -0,0 +1,3 @@ +fetch("https://localhost:5545/cert/cafile_ts_fetch.ts.out") + .then((r) => r.text()) + .then((t) => console.log(t.trimEnd())); diff --git a/cli/tests/testdata/cert/cafile_ts_fetch.ts.out b/cli/tests/testdata/cert/cafile_ts_fetch.ts.out new file mode 100644 index 000000000..699b756ed --- /dev/null +++ b/cli/tests/testdata/cert/cafile_ts_fetch.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +Hello diff --git a/cli/tests/testdata/cert/cafile_ts_fetch_unsafe_ssl.ts.out b/cli/tests/testdata/cert/cafile_ts_fetch_unsafe_ssl.ts.out new file mode 100644 index 000000000..a0934e584 --- /dev/null +++ b/cli/tests/testdata/cert/cafile_ts_fetch_unsafe_ssl.ts.out @@ -0,0 +1,3 @@ +DANGER: TLS certificate validation is disabled for all hostnames +[WILDCARD] +Hello diff --git a/cli/tests/testdata/cert/cafile_url_imports.ts b/cli/tests/testdata/cert/cafile_url_imports.ts new file mode 100644 index 000000000..2355a8628 --- /dev/null +++ b/cli/tests/testdata/cert/cafile_url_imports.ts @@ -0,0 +1,3 @@ +import { printHello } from "https://localhost:5545/subdir/mod2.ts"; +printHello(); +console.log("success"); diff --git a/cli/tests/testdata/cert/cafile_url_imports.ts.out b/cli/tests/testdata/cert/cafile_url_imports.ts.out new file mode 100644 index 000000000..989ce33e9 --- /dev/null +++ b/cli/tests/testdata/cert/cafile_url_imports.ts.out @@ -0,0 +1,2 @@ +Hello +success diff --git a/cli/tests/testdata/cert/cafile_url_imports_unsafe_ssl.ts.out b/cli/tests/testdata/cert/cafile_url_imports_unsafe_ssl.ts.out new file mode 100644 index 000000000..daebcd766 --- /dev/null +++ b/cli/tests/testdata/cert/cafile_url_imports_unsafe_ssl.ts.out @@ -0,0 +1,3 @@ +DANGER: TLS certificate validation is disabled for: localhost +Hello +success diff --git a/cli/tests/testdata/cert/deno_land_unsafe_ssl.ts b/cli/tests/testdata/cert/deno_land_unsafe_ssl.ts new file mode 100644 index 000000000..f5e8dcc80 --- /dev/null +++ b/cli/tests/testdata/cert/deno_land_unsafe_ssl.ts @@ -0,0 +1,2 @@ +const r = await fetch("https://google.com"); +console.log(r.status); diff --git a/cli/tests/testdata/cert/deno_land_unsafe_ssl.ts.out b/cli/tests/testdata/cert/deno_land_unsafe_ssl.ts.out new file mode 100644 index 000000000..cbf52b076 --- /dev/null +++ b/cli/tests/testdata/cert/deno_land_unsafe_ssl.ts.out @@ -0,0 +1,2 @@ +DANGER: TLS certificate validation is disabled for: deno.land +200 diff --git a/cli/tests/testdata/cert/ip_address_unsafe_ssl.ts b/cli/tests/testdata/cert/ip_address_unsafe_ssl.ts new file mode 100644 index 000000000..a3268888f --- /dev/null +++ b/cli/tests/testdata/cert/ip_address_unsafe_ssl.ts @@ -0,0 +1,2 @@ +const r = await fetch("https://1.1.1.1"); +console.log(r.status); diff --git a/cli/tests/testdata/cert/ip_address_unsafe_ssl.ts.out b/cli/tests/testdata/cert/ip_address_unsafe_ssl.ts.out new file mode 100644 index 000000000..d4ebb2617 --- /dev/null +++ b/cli/tests/testdata/cert/ip_address_unsafe_ssl.ts.out @@ -0,0 +1,2 @@ +DANGER: TLS certificate validation is disabled for: 1.1.1.1 +200 diff --git a/cli/tests/testdata/cert/listen_tls_alpn.ts b/cli/tests/testdata/cert/listen_tls_alpn.ts new file mode 100644 index 000000000..b3ade686e --- /dev/null +++ b/cli/tests/testdata/cert/listen_tls_alpn.ts @@ -0,0 +1,14 @@ +const listener = Deno.listenTls({ + port: Number(Deno.args[0]), + certFile: "./tls/localhost.crt", + keyFile: "./tls/localhost.key", + alpnProtocols: ["h2", "http/1.1", "foobar"], +}); + +console.log("READY"); + +const conn = await listener.accept() as Deno.TlsConn; +await conn.handshake(); +conn.close(); + +listener.close(); diff --git a/cli/tests/testdata/cert/listen_tls_alpn_fail.ts b/cli/tests/testdata/cert/listen_tls_alpn_fail.ts new file mode 100644 index 000000000..da60383f0 --- /dev/null +++ b/cli/tests/testdata/cert/listen_tls_alpn_fail.ts @@ -0,0 +1,20 @@ +import { assertRejects } from "../../../../test_util/std/testing/asserts.ts"; + +const listener = Deno.listenTls({ + port: Number(Deno.args[0]), + certFile: "./tls/localhost.crt", + keyFile: "./tls/localhost.key", + alpnProtocols: ["h2", "http/1.1", "foobar"], +}); + +console.log("READY"); + +const conn = await listener.accept() as Deno.TlsConn; +await assertRejects( + () => conn.handshake(), + Deno.errors.InvalidData, + "peer doesn't support any known protocol", +); +conn.close(); + +listener.close(); diff --git a/cli/tests/testdata/cert/localhost_unsafe_ssl.ts.out b/cli/tests/testdata/cert/localhost_unsafe_ssl.ts.out new file mode 100644 index 000000000..0bfaeb25d --- /dev/null +++ b/cli/tests/testdata/cert/localhost_unsafe_ssl.ts.out @@ -0,0 +1,3 @@ +DANGER: TLS certificate validation is disabled for: deno.land +error: error sending request for url (https://localhost:5545/subdir/mod2.ts): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer + at file:///[WILDCARD]/cafile_url_imports.ts:[WILDCARD] diff --git a/cli/tests/testdata/check/check_all.out b/cli/tests/testdata/check/check_all.out new file mode 100644 index 000000000..344264634 --- /dev/null +++ b/cli/tests/testdata/check/check_all.out @@ -0,0 +1,4 @@ +error: TS2322 [ERROR]: Type '12' is not assignable to type '"a"'. +export const a: "a" = 12; + ^ + at http://localhost:4545/subdir/type_error.ts:1:14 diff --git a/cli/tests/testdata/check/check_all.ts b/cli/tests/testdata/check/check_all.ts new file mode 100644 index 000000000..2ae8c2692 --- /dev/null +++ b/cli/tests/testdata/check/check_all.ts @@ -0,0 +1,3 @@ +import * as a from "http://localhost:4545/subdir/type_error.ts"; + +console.log(a.a); diff --git a/cli/tests/testdata/check/declaration_header_file_with_no_exports.ts b/cli/tests/testdata/check/declaration_header_file_with_no_exports.ts new file mode 100644 index 000000000..ef5da7a38 --- /dev/null +++ b/cli/tests/testdata/check/declaration_header_file_with_no_exports.ts @@ -0,0 +1,2 @@ +import * as foo from "./declaration_header_file_with_no_exports_js.js"; +console.log(foo); diff --git a/cli/tests/testdata/check/declaration_header_file_with_no_exports_js.d.ts b/cli/tests/testdata/check/declaration_header_file_with_no_exports_js.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/cli/tests/testdata/check/declaration_header_file_with_no_exports_js.js b/cli/tests/testdata/check/declaration_header_file_with_no_exports_js.js new file mode 100644 index 000000000..b8ae2bcef --- /dev/null +++ b/cli/tests/testdata/check/declaration_header_file_with_no_exports_js.js @@ -0,0 +1 @@ +/// diff --git a/cli/tests/testdata/check/module_detection_force.ts b/cli/tests/testdata/check/module_detection_force.ts new file mode 100644 index 000000000..185ceb816 --- /dev/null +++ b/cli/tests/testdata/check/module_detection_force.ts @@ -0,0 +1,3 @@ +const a = 1; +await import("./module_detection_force/import.ts"); +console.log(a); diff --git a/cli/tests/testdata/check/module_detection_force/import.ts b/cli/tests/testdata/check/module_detection_force/import.ts new file mode 100644 index 000000000..66b229870 --- /dev/null +++ b/cli/tests/testdata/check/module_detection_force/import.ts @@ -0,0 +1,2 @@ +const a = 2; +console.log(a); diff --git a/cli/tests/testdata/check/module_detection_force/main.ts b/cli/tests/testdata/check/module_detection_force/main.ts new file mode 100644 index 000000000..a55c9962b --- /dev/null +++ b/cli/tests/testdata/check/module_detection_force/main.ts @@ -0,0 +1,3 @@ +const a = 1; +await import("./import.ts"); +console.log(a); diff --git a/cli/tests/testdata/check_all.out b/cli/tests/testdata/check_all.out deleted file mode 100644 index 344264634..000000000 --- a/cli/tests/testdata/check_all.out +++ /dev/null @@ -1,4 +0,0 @@ -error: TS2322 [ERROR]: Type '12' is not assignable to type '"a"'. -export const a: "a" = 12; - ^ - at http://localhost:4545/subdir/type_error.ts:1:14 diff --git a/cli/tests/testdata/check_all.ts b/cli/tests/testdata/check_all.ts deleted file mode 100644 index 2ae8c2692..000000000 --- a/cli/tests/testdata/check_all.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as a from "http://localhost:4545/subdir/type_error.ts"; - -console.log(a.a); diff --git a/cli/tests/testdata/checkjs.tsconfig.json b/cli/tests/testdata/checkjs.tsconfig.json deleted file mode 100644 index 46d96db9e..000000000 --- a/cli/tests/testdata/checkjs.tsconfig.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "checkJs": true - } -} diff --git a/cli/tests/testdata/circular1.js b/cli/tests/testdata/circular1.js deleted file mode 100644 index 8b2cc4960..000000000 --- a/cli/tests/testdata/circular1.js +++ /dev/null @@ -1,2 +0,0 @@ -import "./circular2.js"; -console.log("circular1"); diff --git a/cli/tests/testdata/circular1.js.out b/cli/tests/testdata/circular1.js.out deleted file mode 100644 index 21f7fd585..000000000 --- a/cli/tests/testdata/circular1.js.out +++ /dev/null @@ -1,2 +0,0 @@ -circular2 -circular1 diff --git a/cli/tests/testdata/circular2.js b/cli/tests/testdata/circular2.js deleted file mode 100644 index 62127e04d..000000000 --- a/cli/tests/testdata/circular2.js +++ /dev/null @@ -1,2 +0,0 @@ -import "./circular1.js"; -console.log("circular2"); diff --git a/cli/tests/testdata/cjs_imports.ts b/cli/tests/testdata/cjs_imports.ts deleted file mode 100644 index d8b77c22e..000000000 --- a/cli/tests/testdata/cjs_imports.ts +++ /dev/null @@ -1 +0,0 @@ -import "./commonjs.cjs"; diff --git a/cli/tests/testdata/cjs_imports.ts.out b/cli/tests/testdata/cjs_imports.ts.out deleted file mode 100644 index 557db03de..000000000 --- a/cli/tests/testdata/cjs_imports.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/cli/tests/testdata/classic_workers_event_loop.js b/cli/tests/testdata/classic_workers_event_loop.js deleted file mode 100644 index 810a6df7f..000000000 --- a/cli/tests/testdata/classic_workers_event_loop.js +++ /dev/null @@ -1,4 +0,0 @@ -new Worker( - "data:application/javascript,setTimeout(() => {console.log('done'); self.close()}, 1000)", - { type: "classic" }, -); diff --git a/cli/tests/testdata/classic_workers_event_loop.js.out b/cli/tests/testdata/classic_workers_event_loop.js.out deleted file mode 100644 index 19f86f493..000000000 --- a/cli/tests/testdata/classic_workers_event_loop.js.out +++ /dev/null @@ -1 +0,0 @@ -done diff --git a/cli/tests/testdata/colors_without_globalThis.js b/cli/tests/testdata/colors_without_globalThis.js deleted file mode 100644 index f9d4b68fc..000000000 --- a/cli/tests/testdata/colors_without_globalThis.js +++ /dev/null @@ -1 +0,0 @@ -console.log(delete globalThis.globalThis); diff --git a/cli/tests/testdata/commonjs.cjs b/cli/tests/testdata/commonjs.cjs deleted file mode 100644 index 7df7d571e..000000000 --- a/cli/tests/testdata/commonjs.cjs +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello World"); \ No newline at end of file diff --git a/cli/tests/testdata/compile/args.ts b/cli/tests/testdata/compile/args.ts new file mode 100644 index 000000000..ec41d52f9 --- /dev/null +++ b/cli/tests/testdata/compile/args.ts @@ -0,0 +1,3 @@ +Deno.args.forEach((arg) => { + console.log(arg); +}); diff --git a/cli/tests/testdata/compile/standalone_error.ts b/cli/tests/testdata/compile/standalone_error.ts new file mode 100644 index 000000000..279398113 --- /dev/null +++ b/cli/tests/testdata/compile/standalone_error.ts @@ -0,0 +1,9 @@ +function boom() { + throw new Error("boom!"); +} + +function foo() { + boom(); +} + +foo(); diff --git a/cli/tests/testdata/compile/standalone_error_module_with_imports_1.ts b/cli/tests/testdata/compile/standalone_error_module_with_imports_1.ts new file mode 100644 index 000000000..bf38f7263 --- /dev/null +++ b/cli/tests/testdata/compile/standalone_error_module_with_imports_1.ts @@ -0,0 +1 @@ +import "./standalone_error_module_with_imports_2.ts"; diff --git a/cli/tests/testdata/compile/standalone_error_module_with_imports_2.ts b/cli/tests/testdata/compile/standalone_error_module_with_imports_2.ts new file mode 100644 index 000000000..ef052b512 --- /dev/null +++ b/cli/tests/testdata/compile/standalone_error_module_with_imports_2.ts @@ -0,0 +1,2 @@ +console.log("hello"); +throw new Error("boom!"); diff --git a/cli/tests/testdata/compile/standalone_follow_redirects.ts b/cli/tests/testdata/compile/standalone_follow_redirects.ts new file mode 100644 index 000000000..f0957bc3d --- /dev/null +++ b/cli/tests/testdata/compile/standalone_follow_redirects.ts @@ -0,0 +1,2 @@ +import "./standalone_follow_redirects_2.js"; +console.log("Hello"); diff --git a/cli/tests/testdata/compile/standalone_follow_redirects_2.js b/cli/tests/testdata/compile/standalone_follow_redirects_2.js new file mode 100644 index 000000000..c0130ef5a --- /dev/null +++ b/cli/tests/testdata/compile/standalone_follow_redirects_2.js @@ -0,0 +1,5 @@ +// unversioned import redirects with dependencies. +import { + assertNotEquals as _a, + assertStrictEquals as _b, +} from "https://deno.land/std/testing/asserts.ts"; diff --git a/cli/tests/testdata/compile/standalone_import_datauri.ts b/cli/tests/testdata/compile/standalone_import_datauri.ts new file mode 100644 index 000000000..68f348828 --- /dev/null +++ b/cli/tests/testdata/compile/standalone_import_datauri.ts @@ -0,0 +1,4 @@ +const c = await import( + "data:text/javascript;base64,ZXhwb3J0IGRlZmF1bHQgJ0hlbGxvIERlbm8hJw==" +); +console.log(c.default); // Output: "Hello Deno!" diff --git a/cli/tests/testdata/compile/standalone_import_map.json b/cli/tests/testdata/compile/standalone_import_map.json new file mode 100644 index 000000000..9e5b90bd7 --- /dev/null +++ b/cli/tests/testdata/compile/standalone_import_map.json @@ -0,0 +1,5 @@ +{ + "imports": { + "hello": "../run/001_hello.js" + } +} diff --git a/cli/tests/testdata/compile/standalone_import_map.ts b/cli/tests/testdata/compile/standalone_import_map.ts new file mode 100644 index 000000000..097b96356 --- /dev/null +++ b/cli/tests/testdata/compile/standalone_import_map.ts @@ -0,0 +1 @@ +import "hello"; diff --git a/cli/tests/testdata/compile/standalone_runtime_flags.ts b/cli/tests/testdata/compile/standalone_runtime_flags.ts new file mode 100644 index 000000000..0154c7f4e --- /dev/null +++ b/cli/tests/testdata/compile/standalone_runtime_flags.ts @@ -0,0 +1,3 @@ +console.log(Math.random()); +await Deno.stat("."); +await Deno.create("foo.txt"); diff --git a/cli/tests/testdata/complex_error.ts b/cli/tests/testdata/complex_error.ts deleted file mode 100644 index b462992ac..000000000 --- a/cli/tests/testdata/complex_error.ts +++ /dev/null @@ -1,18 +0,0 @@ -const error = new AggregateError( - [ - new AggregateError([new Error("qux1"), new Error("quux1")]), - new Error("bar1", { cause: new Error("baz1") }), - ], - "foo1", - { - cause: new AggregateError([ - new AggregateError([new Error("qux2"), new Error("quux2")]), - new Error("bar2", { cause: new Error("baz2") }), - ], "foo2"), - }, -); -console.log(error.stack); -console.log(); -console.log(error); -console.log(); -throw error; diff --git a/cli/tests/testdata/complex_error.ts.out b/cli/tests/testdata/complex_error.ts.out deleted file mode 100644 index eef1b7699..000000000 --- a/cli/tests/testdata/complex_error.ts.out +++ /dev/null @@ -1,44 +0,0 @@ -AggregateError: foo1 - at [WILDCARD]/complex_error.ts:1:15 - -AggregateError: foo1 - AggregateError - Error: qux1 - at [WILDCARD]/complex_error.ts:3:25 - Error: quux1 - at [WILDCARD]/complex_error.ts:3:44 - at [WILDCARD]/complex_error.ts:3:5 - Error: bar1 - at [WILDCARD]/complex_error.ts:4:5 - Caused by Error: baz1 - at [WILDCARD]/complex_error.ts:4:32 - at [WILDCARD]/complex_error.ts:1:15 -Caused by AggregateError: foo2 - at [WILDCARD]/complex_error.ts:8:12 - -error: Uncaught AggregateError: foo1 - AggregateError - Error: qux1 - at [WILDCARD]/complex_error.ts:3:25 - Error: quux1 - at [WILDCARD]/complex_error.ts:3:44 - at [WILDCARD]/complex_error.ts:3:5 - Error: bar1 - at [WILDCARD]/complex_error.ts:4:5 - Caused by: Error: baz1 - at [WILDCARD]/complex_error.ts:4:32 -const error = new AggregateError( - ^ - at [WILDCARD]/complex_error.ts:1:15 -Caused by: AggregateError: foo2 - AggregateError - Error: qux2 - at [WILDCARD]/complex_error.ts:9:27 - Error: quux2 - at [WILDCARD]/complex_error.ts:9:46 - at [WILDCARD]/complex_error.ts:9:7 - Error: bar2 - at [WILDCARD]/complex_error.ts:10:7 - Caused by: Error: baz2 - at [WILDCARD]/complex_error.ts:10:34 - at [WILDCARD]/complex_error.ts:8:12 diff --git a/cli/tests/testdata/complex_permissions_test.ts b/cli/tests/testdata/complex_permissions_test.ts deleted file mode 100644 index bae157246..000000000 --- a/cli/tests/testdata/complex_permissions_test.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -const name = Deno.args[0]; -// deno-lint-ignore no-explicit-any -const test: { [key: string]: (...args: any[]) => void | Promise } = { - read(files: string[]) { - files.forEach((file) => Deno.readFileSync(file)); - }, - write(files: string[]) { - files.forEach((file) => - Deno.writeFileSync(file, new Uint8Array(0), { append: true }) - ); - }, - netFetch(urls: string[]) { - urls.forEach((url) => fetch(url)); - }, - netListen(endpoints: string[]) { - endpoints.forEach((endpoint) => { - const index = endpoint.lastIndexOf(":"); - const [hostname, port] = [ - endpoint.substr(0, index), - endpoint.substr(index + 1), - ]; - const listener = Deno.listen({ - transport: "tcp", - hostname, - port: parseInt(port, 10), - }); - listener.close(); - }); - }, - async netConnect(endpoints: string[]) { - for (const endpoint of endpoints) { - const index = endpoint.lastIndexOf(":"); - const [hostname, port] = [ - endpoint.substr(0, index), - endpoint.substr(index + 1), - ]; - const listener = await Deno.connect({ - transport: "tcp", - hostname, - port: parseInt(port, 10), - }); - listener.close(); - } - }, -}; - -if (!test[name]) { - console.log("Unknown test:", name); - Deno.exit(1); -} - -test[name](Deno.args.slice(1)); diff --git a/cli/tests/testdata/config.ts b/cli/tests/testdata/config.ts deleted file mode 100644 index 51a61e447..000000000 --- a/cli/tests/testdata/config.ts +++ /dev/null @@ -1,5 +0,0 @@ -function foo(bar) { - return bar; -} - -foo(1); diff --git a/cli/tests/testdata/config.ts.out b/cli/tests/testdata/config.ts.out deleted file mode 100644 index 44b123f97..000000000 --- a/cli/tests/testdata/config.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]Unsupported compiler options in "[WILDCARD]config.tsconfig.json". - The following options were ignored: - module, target -Check [WILDCARD]/config.ts diff --git a/cli/tests/testdata/config.tsconfig.json b/cli/tests/testdata/config.tsconfig.json deleted file mode 100644 index 0f0881920..000000000 --- a/cli/tests/testdata/config.tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "module": "amd", - "strict": false, - "target": "es5" - } -} diff --git a/cli/tests/testdata/config_json_import.ts b/cli/tests/testdata/config_json_import.ts deleted file mode 100644 index d344c0fb7..000000000 --- a/cli/tests/testdata/config_json_import.ts +++ /dev/null @@ -1,2 +0,0 @@ -import config from "./jsx/deno-jsx.json" assert { type: "json" }; -console.log(config); diff --git a/cli/tests/testdata/config_json_import.ts.out b/cli/tests/testdata/config_json_import.ts.out deleted file mode 100644 index aa55be7d5..000000000 --- a/cli/tests/testdata/config_json_import.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -{ - compilerOptions: { jsx: "react-jsx", jsxImportSource: "http://localhost:4545/jsx" } -} diff --git a/cli/tests/testdata/config_types.ts b/cli/tests/testdata/config_types.ts deleted file mode 100644 index f1a8d6583..000000000 --- a/cli/tests/testdata/config_types.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(globalThis.a); diff --git a/cli/tests/testdata/config_types.ts.out b/cli/tests/testdata/config_types.ts.out deleted file mode 100644 index 417b7b537..000000000 --- a/cli/tests/testdata/config_types.ts.out +++ /dev/null @@ -1 +0,0 @@ -undefined diff --git a/cli/tests/testdata/config_types.tsconfig.json b/cli/tests/testdata/config_types.tsconfig.json deleted file mode 100644 index 3810d4534..000000000 --- a/cli/tests/testdata/config_types.tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "types": [ - "./subdir/types.d.ts" - ] - } -} diff --git a/cli/tests/testdata/config_types_remote.tsconfig.json b/cli/tests/testdata/config_types_remote.tsconfig.json deleted file mode 100644 index f40d5b1c4..000000000 --- a/cli/tests/testdata/config_types_remote.tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "types": [ - "http://localhost:4545/subdir/types.d.ts" - ] - } -} diff --git a/cli/tests/testdata/custom_inspect_url.js b/cli/tests/testdata/custom_inspect_url.js deleted file mode 100644 index 69aa2dc49..000000000 --- a/cli/tests/testdata/custom_inspect_url.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log([new URL("https://example.com/path")]); -console.log({ url: new URL("https://example.com/path") }); -console.log({ url: [new URL("https://example.com/path")] }); diff --git a/cli/tests/testdata/custom_inspect_url.js.out b/cli/tests/testdata/custom_inspect_url.js.out deleted file mode 100644 index 1c714e34e..000000000 --- a/cli/tests/testdata/custom_inspect_url.js.out +++ /dev/null @@ -1,47 +0,0 @@ -[ - URL { - href: "https://example.com/path", - origin: "https://example.com", - protocol: "https:", - username: "", - password: "", - host: "example.com", - hostname: "example.com", - port: "", - pathname: "/path", - hash: "", - search: "" - } -] -{ - url: URL { - href: "https://example.com/path", - origin: "https://example.com", - protocol: "https:", - username: "", - password: "", - host: "example.com", - hostname: "example.com", - port: "", - pathname: "/path", - hash: "", - search: "" - } -} -{ - url: [ - URL { - href: "https://example.com/path", - origin: "https://example.com", - protocol: "https:", - username: "", - password: "", - host: "example.com", - hostname: "example.com", - port: "", - pathname: "/path", - hash: "", - search: "" - } - ] -} diff --git a/cli/tests/testdata/declaration_header_file_with_no_exports.ts b/cli/tests/testdata/declaration_header_file_with_no_exports.ts deleted file mode 100644 index ef5da7a38..000000000 --- a/cli/tests/testdata/declaration_header_file_with_no_exports.ts +++ /dev/null @@ -1,2 +0,0 @@ -import * as foo from "./declaration_header_file_with_no_exports_js.js"; -console.log(foo); diff --git a/cli/tests/testdata/declaration_header_file_with_no_exports_js.d.ts b/cli/tests/testdata/declaration_header_file_with_no_exports_js.d.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/testdata/declaration_header_file_with_no_exports_js.js b/cli/tests/testdata/declaration_header_file_with_no_exports_js.js deleted file mode 100644 index b8ae2bcef..000000000 --- a/cli/tests/testdata/declaration_header_file_with_no_exports_js.js +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/cli/tests/testdata/delayed_error.ts b/cli/tests/testdata/delayed_error.ts deleted file mode 100644 index 76057e627..000000000 --- a/cli/tests/testdata/delayed_error.ts +++ /dev/null @@ -1,2 +0,0 @@ -await new Promise((r) => setTimeout(r, 100)); -throw new Error("foo"); diff --git a/cli/tests/testdata/delete_window.js b/cli/tests/testdata/delete_window.js deleted file mode 100644 index f2f16820d..000000000 --- a/cli/tests/testdata/delete_window.js +++ /dev/null @@ -1 +0,0 @@ -console.log(delete globalThis.window); diff --git a/cli/tests/testdata/deno_doc.ts b/cli/tests/testdata/deno_doc.ts deleted file mode 100644 index fb3c50957..000000000 --- a/cli/tests/testdata/deno_doc.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** Some JSDoc */ -export function foo() { -} diff --git a/cli/tests/testdata/deno_doc_builtin.out b/cli/tests/testdata/deno_doc_builtin.out deleted file mode 100644 index b4a90d6bc..000000000 --- a/cli/tests/testdata/deno_doc_builtin.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -namespace Deno -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/deno_dom_0.1.3-alpha2.wasm b/cli/tests/testdata/deno_dom_0.1.3-alpha2.wasm deleted file mode 100644 index 6dd9d0e91..000000000 Binary files a/cli/tests/testdata/deno_dom_0.1.3-alpha2.wasm and /dev/null differ diff --git a/cli/tests/testdata/deno_exit_tampering.ts b/cli/tests/testdata/deno_exit_tampering.ts deleted file mode 100644 index 3b24261e2..000000000 --- a/cli/tests/testdata/deno_exit_tampering.ts +++ /dev/null @@ -1,3 +0,0 @@ -delete globalThis.dispatchEvent; -delete EventTarget.prototype.dispatchEvent; -Deno.exit(42); diff --git a/cli/tests/testdata/deno_land_unsafe_ssl.ts b/cli/tests/testdata/deno_land_unsafe_ssl.ts deleted file mode 100644 index f5e8dcc80..000000000 --- a/cli/tests/testdata/deno_land_unsafe_ssl.ts +++ /dev/null @@ -1,2 +0,0 @@ -const r = await fetch("https://google.com"); -console.log(r.status); diff --git a/cli/tests/testdata/deno_land_unsafe_ssl.ts.out b/cli/tests/testdata/deno_land_unsafe_ssl.ts.out deleted file mode 100644 index cbf52b076..000000000 --- a/cli/tests/testdata/deno_land_unsafe_ssl.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -DANGER: TLS certificate validation is disabled for: deno.land -200 diff --git a/cli/tests/testdata/disallow_http_from_https.js b/cli/tests/testdata/disallow_http_from_https.js deleted file mode 100644 index bff407b5e..000000000 --- a/cli/tests/testdata/disallow_http_from_https.js +++ /dev/null @@ -1,2 +0,0 @@ -// Trying to import "http://", while this file is accessed by "https://" -import "http://localhost:4545/001_hello.js"; diff --git a/cli/tests/testdata/disallow_http_from_https.ts b/cli/tests/testdata/disallow_http_from_https.ts deleted file mode 100644 index bff407b5e..000000000 --- a/cli/tests/testdata/disallow_http_from_https.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Trying to import "http://", while this file is accessed by "https://" -import "http://localhost:4545/001_hello.js"; diff --git a/cli/tests/testdata/disallow_http_from_https_js.out b/cli/tests/testdata/disallow_http_from_https_js.out deleted file mode 100644 index e4f9e8d59..000000000 --- a/cli/tests/testdata/disallow_http_from_https_js.out +++ /dev/null @@ -1,3 +0,0 @@ -error: Modules imported via https are not allowed to import http modules. - Importing: http://localhost:4545/001_hello.js - at https://localhost:5545/disallow_http_from_https.js:2:8 diff --git a/cli/tests/testdata/disallow_http_from_https_ts.out b/cli/tests/testdata/disallow_http_from_https_ts.out deleted file mode 100644 index 3f885001f..000000000 --- a/cli/tests/testdata/disallow_http_from_https_ts.out +++ /dev/null @@ -1,3 +0,0 @@ -error: Modules imported via https are not allowed to import http modules. - Importing: http://localhost:4545/001_hello.js - at https://localhost:5545/disallow_http_from_https.ts:2:8 diff --git a/cli/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts b/cli/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts new file mode 100644 index 000000000..854c1b464 --- /dev/null +++ b/cli/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts @@ -0,0 +1,6 @@ +// deno-lint-ignore-file +export namespace NS { + export function test(name: string, fn: Function): void; + export function test(options: object): void; + export function test(name: string | object, fn?: Function): void {} +} diff --git a/cli/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts.out b/cli/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts.out new file mode 100644 index 000000000..2cd36931c --- /dev/null +++ b/cli/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts.out @@ -0,0 +1,9 @@ +Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:3:2 + +function test(name: string, fn: Function): void + +Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:4:2 + +function test(options: object): void + + diff --git a/cli/tests/testdata/doc/deno_doc.ts b/cli/tests/testdata/doc/deno_doc.ts new file mode 100644 index 000000000..fb3c50957 --- /dev/null +++ b/cli/tests/testdata/doc/deno_doc.ts @@ -0,0 +1,3 @@ +/** Some JSDoc */ +export function foo() { +} diff --git a/cli/tests/testdata/doc/deno_doc_builtin.out b/cli/tests/testdata/doc/deno_doc_builtin.out new file mode 100644 index 000000000..b4a90d6bc --- /dev/null +++ b/cli/tests/testdata/doc/deno_doc_builtin.out @@ -0,0 +1,3 @@ +[WILDCARD] +namespace Deno +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/dom_exception_formatting.ts b/cli/tests/testdata/dom_exception_formatting.ts deleted file mode 100644 index 0209ec81e..000000000 --- a/cli/tests/testdata/dom_exception_formatting.ts +++ /dev/null @@ -1 +0,0 @@ -throw new DOMException("foo", "SyntaxError"); diff --git a/cli/tests/testdata/dom_exception_formatting.ts.out b/cli/tests/testdata/dom_exception_formatting.ts.out deleted file mode 100644 index bcdd714ea..000000000 --- a/cli/tests/testdata/dom_exception_formatting.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]error: Uncaught SyntaxError: foo -[WILDCARD] - at file:///[WILDCARD]/dom_exception_formatting.ts:[WILDCARD] diff --git a/cli/tests/testdata/dynamic_import_conditional.js b/cli/tests/testdata/dynamic_import_conditional.js deleted file mode 100644 index 1b4193e3e..000000000 --- a/cli/tests/testdata/dynamic_import_conditional.js +++ /dev/null @@ -1,3 +0,0 @@ -const Worker = globalThis.Worker ?? (await import("worker_threads")).Worker; - -console.log(!!Worker); diff --git a/cli/tests/testdata/dynamic_import_conditional.js.out b/cli/tests/testdata/dynamic_import_conditional.js.out deleted file mode 100644 index 27ba77dda..000000000 --- a/cli/tests/testdata/dynamic_import_conditional.js.out +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/cli/tests/testdata/empty.out b/cli/tests/testdata/empty.out deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/testdata/error_001.ts b/cli/tests/testdata/error_001.ts deleted file mode 100644 index b01068bc0..000000000 --- a/cli/tests/testdata/error_001.ts +++ /dev/null @@ -1,9 +0,0 @@ -function foo(): never { - throw Error("bad"); -} - -function bar() { - foo(); -} - -bar(); diff --git a/cli/tests/testdata/error_001.ts.out b/cli/tests/testdata/error_001.ts.out deleted file mode 100644 index 25664a9a4..000000000 --- a/cli/tests/testdata/error_001.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught Error: bad - throw Error("bad"); - ^ - at foo ([WILDCARD]/error_001.ts:2:9) - at bar ([WILDCARD]/error_001.ts:6:3) - at [WILDCARD]/error_001.ts:9:1 diff --git a/cli/tests/testdata/error_002.ts b/cli/tests/testdata/error_002.ts deleted file mode 100644 index 6aa0fcc3b..000000000 --- a/cli/tests/testdata/error_002.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { throwsError } from "./subdir/mod1.ts"; - -function foo() { - throwsError(); -} - -foo(); diff --git a/cli/tests/testdata/error_002.ts.out b/cli/tests/testdata/error_002.ts.out deleted file mode 100644 index 96b9e602a..000000000 --- a/cli/tests/testdata/error_002.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught Error: exception from mod1 - throw Error("exception from mod1"); - ^ - at throwsError ([WILDCARD]/subdir/mod1.ts:16:9) - at foo ([WILDCARD]/error_002.ts:4:3) - at [WILDCARD]/error_002.ts:7:1 diff --git a/cli/tests/testdata/error_003_typescript.ts b/cli/tests/testdata/error_003_typescript.ts deleted file mode 100644 index e1f882123..000000000 --- a/cli/tests/testdata/error_003_typescript.ts +++ /dev/null @@ -1,20 +0,0 @@ -// deno-lint-ignore-file -let x = { - a: { - b: { - c() { - return { d: "hello" }; - }, - }, - }, -}; -let y = { - a: { - b: { - c() { - return { d: 1234 }; - }, - }, - }, -}; -x = y; diff --git a/cli/tests/testdata/error_003_typescript.ts.out b/cli/tests/testdata/error_003_typescript.ts.out deleted file mode 100644 index bbb2ec470..000000000 --- a/cli/tests/testdata/error_003_typescript.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -[WILDCARD] -error: TS2322 [ERROR]: Type '{ a: { b: { c(): { d: number; }; }; }; }' is not assignable to type '{ a: { b: { c(): { d: string; }; }; }; }'. - The types of 'a.b.c().d' are incompatible between these types. - Type 'number' is not assignable to type 'string'. -x = y; -^ - at [WILDCARD]/error_003_typescript.ts:20:1 diff --git a/cli/tests/testdata/error_004_missing_module.ts b/cli/tests/testdata/error_004_missing_module.ts deleted file mode 100644 index 82b281181..000000000 --- a/cli/tests/testdata/error_004_missing_module.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as badModule from "./bad-module.ts"; - -console.log(badModule); diff --git a/cli/tests/testdata/error_004_missing_module.ts.out b/cli/tests/testdata/error_004_missing_module.ts.out deleted file mode 100644 index 9a2cfb8a8..000000000 --- a/cli/tests/testdata/error_004_missing_module.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Module not found "file:///[WILDCARD]/bad-module.ts". - at file:///[WILDCARD]/error_004_missing_module.ts:1:28 diff --git a/cli/tests/testdata/error_005_missing_dynamic_import.ts b/cli/tests/testdata/error_005_missing_dynamic_import.ts deleted file mode 100644 index 8ea8ff94e..000000000 --- a/cli/tests/testdata/error_005_missing_dynamic_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -(async () => { - const _badModule = await import("./bad-module.ts"); -})(); diff --git a/cli/tests/testdata/error_005_missing_dynamic_import.ts.out b/cli/tests/testdata/error_005_missing_dynamic_import.ts.out deleted file mode 100644 index 55e4a8524..000000000 --- a/cli/tests/testdata/error_005_missing_dynamic_import.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in promise) TypeError: Module not found "[WILDCARD]/bad-module.ts". - const _badModule = await import("./bad-module.ts"); - ^ - at async file://[WILDCARD]/error_005_missing_dynamic_import.ts:2:22 diff --git a/cli/tests/testdata/error_006_import_ext_failure.ts b/cli/tests/testdata/error_006_import_ext_failure.ts deleted file mode 100644 index 3c32303a3..000000000 --- a/cli/tests/testdata/error_006_import_ext_failure.ts +++ /dev/null @@ -1 +0,0 @@ -import "./non-existent"; diff --git a/cli/tests/testdata/error_006_import_ext_failure.ts.out b/cli/tests/testdata/error_006_import_ext_failure.ts.out deleted file mode 100644 index 667579bd8..000000000 --- a/cli/tests/testdata/error_006_import_ext_failure.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Module not found "[WILDCARD]/non-existent". - at file:///[WILDCARD]/error_006_import_ext_failure.ts:1:8 diff --git a/cli/tests/testdata/error_007_any.ts b/cli/tests/testdata/error_007_any.ts deleted file mode 100644 index bfef1289b..000000000 --- a/cli/tests/testdata/error_007_any.ts +++ /dev/null @@ -1 +0,0 @@ -throw { foo: "bar" }; diff --git a/cli/tests/testdata/error_007_any.ts.out b/cli/tests/testdata/error_007_any.ts.out deleted file mode 100644 index b93ceb1d0..000000000 --- a/cli/tests/testdata/error_007_any.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]error: Uncaught { foo: "bar" } diff --git a/cli/tests/testdata/error_008_checkjs.js b/cli/tests/testdata/error_008_checkjs.js deleted file mode 100644 index f0856d94c..000000000 --- a/cli/tests/testdata/error_008_checkjs.js +++ /dev/null @@ -1,5 +0,0 @@ -// console.log intentionally misspelled to trigger a type error -consol.log("hello world!"); - -// the following error should be ignored and not output to the console -const foo = new Foo(); diff --git a/cli/tests/testdata/error_008_checkjs.js.out b/cli/tests/testdata/error_008_checkjs.js.out deleted file mode 100644 index e43187382..000000000 --- a/cli/tests/testdata/error_008_checkjs.js.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]error: Uncaught ReferenceError: consol is not defined -consol.log("hello world!"); -^ - at [WILDCARD]/error_008_checkjs.js:2:1 diff --git a/cli/tests/testdata/error_009_extensions_error.js b/cli/tests/testdata/error_009_extensions_error.js deleted file mode 100644 index 01b97ea38..000000000 --- a/cli/tests/testdata/error_009_extensions_error.js +++ /dev/null @@ -1,2 +0,0 @@ -// Missing arg. -new Event(); diff --git a/cli/tests/testdata/error_009_extensions_error.js.out b/cli/tests/testdata/error_009_extensions_error.js.out deleted file mode 100644 index 8510980f6..000000000 --- a/cli/tests/testdata/error_009_extensions_error.js.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught TypeError: Failed to construct 'Event': 1 argument required, but only 0 present. -new Event(); -^ - at [WILDCARD] - at new Event (deno:ext/web/[WILDCARD]) - at [WILDCARD] diff --git a/cli/tests/testdata/error_009_missing_js_module.disabled b/cli/tests/testdata/error_009_missing_js_module.disabled deleted file mode 100644 index 3156fc94b..000000000 --- a/cli/tests/testdata/error_009_missing_js_module.disabled +++ /dev/null @@ -1,4 +0,0 @@ -args: tests/error_009_missing_js_module.js -check_stderr: true -exit_code: 1 -output: tests/error_009_missing_js_module.js.out diff --git a/cli/tests/testdata/error_009_missing_js_module.js b/cli/tests/testdata/error_009_missing_js_module.js deleted file mode 100644 index e6ca88934..000000000 --- a/cli/tests/testdata/error_009_missing_js_module.js +++ /dev/null @@ -1 +0,0 @@ -import "./bad-module.js"; diff --git a/cli/tests/testdata/error_009_missing_js_module.js.out b/cli/tests/testdata/error_009_missing_js_module.js.out deleted file mode 100644 index edb08da1c..000000000 --- a/cli/tests/testdata/error_009_missing_js_module.js.out +++ /dev/null @@ -1 +0,0 @@ -Cannot resolve module "./bad-module.js" from "[WILDCARD]error_009_missing_js_module.js" diff --git a/cli/tests/testdata/error_010_nonexistent_arg.disabled b/cli/tests/testdata/error_010_nonexistent_arg.disabled deleted file mode 100644 index 9d183107c..000000000 --- a/cli/tests/testdata/error_010_nonexistent_arg.disabled +++ /dev/null @@ -1,4 +0,0 @@ -args: not-a-valid-filename.ts -output: tests/error_010_nonexistent_arg.out -exit_code: 1 -check_stderr: true diff --git a/cli/tests/testdata/error_010_nonexistent_arg.out b/cli/tests/testdata/error_010_nonexistent_arg.out deleted file mode 100644 index ef4f7b041..000000000 --- a/cli/tests/testdata/error_010_nonexistent_arg.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]Cannot resolve module "file:[WILDCARD]not-a-valid-filename.ts" from "." diff --git a/cli/tests/testdata/error_011_bad_module_specifier.ts b/cli/tests/testdata/error_011_bad_module_specifier.ts deleted file mode 100644 index 1c57e37a5..000000000 --- a/cli/tests/testdata/error_011_bad_module_specifier.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as badModule from "bad-module.ts"; - -console.log(badModule); diff --git a/cli/tests/testdata/error_011_bad_module_specifier.ts.out b/cli/tests/testdata/error_011_bad_module_specifier.ts.out deleted file mode 100644 index 81be915d1..000000000 --- a/cli/tests/testdata/error_011_bad_module_specifier.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Relative import path "bad-module.ts" not prefixed with / or ./ or ../ - at [WILDCARD]/error_011_bad_module_specifier.ts:1:28 diff --git a/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts b/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts deleted file mode 100644 index 5f39f407c..000000000 --- a/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts +++ /dev/null @@ -1,3 +0,0 @@ -(async () => { - const _badModule = await import("bad-module.ts"); -})(); diff --git a/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts.out b/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts.out deleted file mode 100644 index 7acd66713..000000000 --- a/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -Check [WILDCARD]error_012_bad_dynamic_import_specifier.ts -error: Uncaught (in promise) TypeError: Relative import path "bad-module.ts" not prefixed with / or ./ or ../ - at [WILDCARD]/error_012_bad_dynamic_import_specifier.ts:2:35 - - const _badModule = await import("bad-module.ts"); - ^ - at async [WILDCARD]/error_012_bad_dynamic_import_specifier.ts:2:22 diff --git a/cli/tests/testdata/error_013_missing_script.out b/cli/tests/testdata/error_013_missing_script.out deleted file mode 100644 index 7ee268de4..000000000 --- a/cli/tests/testdata/error_013_missing_script.out +++ /dev/null @@ -1 +0,0 @@ -error: Module not found "[WILDCARD]missing_file_name". diff --git a/cli/tests/testdata/error_014_catch_dynamic_import_error.js b/cli/tests/testdata/error_014_catch_dynamic_import_error.js deleted file mode 100644 index 483be7b1a..000000000 --- a/cli/tests/testdata/error_014_catch_dynamic_import_error.js +++ /dev/null @@ -1,31 +0,0 @@ -(async () => { - try { - await import("does not exist"); - } catch (err) { - console.log("Caught direct dynamic import error."); - console.log(err); - } - - try { - await import("./subdir/indirect_import_error.js"); - } catch (err) { - console.log("Caught indirect direct dynamic import error."); - console.log(err); - } - - try { - await import("./subdir/throws.js"); - } catch (err) { - console.log("Caught error thrown by dynamically imported module."); - console.log(err); - } - - try { - await import("./subdir/indirect_throws.js"); - } catch (err) { - console.log( - "Caught error thrown indirectly by dynamically imported module.", - ); - console.log(err); - } -})(); diff --git a/cli/tests/testdata/error_014_catch_dynamic_import_error.js.out b/cli/tests/testdata/error_014_catch_dynamic_import_error.js.out deleted file mode 100644 index 701ddc3b5..000000000 --- a/cli/tests/testdata/error_014_catch_dynamic_import_error.js.out +++ /dev/null @@ -1,15 +0,0 @@ -Caught direct dynamic import error. -TypeError: Relative import path "does not exist" not prefixed with / or ./ or ../ - at [WILDCARD]/error_014_catch_dynamic_import_error.js:3:18 - - at async [WILDCARD]/error_014_catch_dynamic_import_error.js:3:5 -Caught indirect direct dynamic import error. -TypeError: Relative import path "does not exist either" not prefixed with / or ./ or ../ - at [WILDCARD]/subdir/indirect_import_error.js:1:15 - at async [WILDCARD]/error_014_catch_dynamic_import_error.js:10:5 -Caught error thrown by dynamically imported module. -Error: An error - at [WILDCARD]/subdir/throws.js:6:7 -Caught error thrown indirectly by dynamically imported module. -Error: An error - at [WILDCARD]/subdir/throws.js:6:7 diff --git a/cli/tests/testdata/error_015_dynamic_import_permissions.js b/cli/tests/testdata/error_015_dynamic_import_permissions.js deleted file mode 100644 index 73da56fd8..000000000 --- a/cli/tests/testdata/error_015_dynamic_import_permissions.js +++ /dev/null @@ -1,3 +0,0 @@ -(async () => { - await import("http://localhost:4545/subdir/mod4.js"); -})(); diff --git a/cli/tests/testdata/error_015_dynamic_import_permissions.out b/cli/tests/testdata/error_015_dynamic_import_permissions.out deleted file mode 100644 index ef54f331b..000000000 --- a/cli/tests/testdata/error_015_dynamic_import_permissions.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires net access to "localhost:4545", run again with the --allow-net flag - await import("http://localhost:4545/subdir/mod4.js"); - ^ - at async file://[WILDCARD]/error_015_dynamic_import_permissions.js:2:3 diff --git a/cli/tests/testdata/error_016_dynamic_import_permissions2.js b/cli/tests/testdata/error_016_dynamic_import_permissions2.js deleted file mode 100644 index f018d4a2e..000000000 --- a/cli/tests/testdata/error_016_dynamic_import_permissions2.js +++ /dev/null @@ -1,5 +0,0 @@ -// If this is executed with --allow-net but not --allow-read the following -// import should cause a permission denied error. -(async () => { - await import("http://localhost:4545/subdir/evil_remote_import.js"); -})(); diff --git a/cli/tests/testdata/error_016_dynamic_import_permissions2.out b/cli/tests/testdata/error_016_dynamic_import_permissions2.out deleted file mode 100644 index 710871f41..000000000 --- a/cli/tests/testdata/error_016_dynamic_import_permissions2.out +++ /dev/null @@ -1,7 +0,0 @@ -[WILDCARD] -error: Uncaught (in promise) TypeError: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. - Importing: file:///c:/etc/passwd - at http://localhost:4545/subdir/evil_remote_import.js:3:15 - await import("http://localhost:4545/subdir/evil_remote_import.js"); - ^ - at async file://[WILDCARD]/error_016_dynamic_import_permissions2.js:4:3 diff --git a/cli/tests/testdata/error_017_hide_long_source_ts.ts b/cli/tests/testdata/error_017_hide_long_source_ts.ts deleted file mode 100644 index d61cb1277..000000000 --- a/cli/tests/testdata/error_017_hide_long_source_ts.ts +++ /dev/null @@ -1,3 +0,0 @@ -// deno-fmt-ignore-file -const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; -LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; diff --git a/cli/tests/testdata/error_017_hide_long_source_ts.ts.out b/cli/tests/testdata/error_017_hide_long_source_ts.ts.out deleted file mode 100644 index 917061ab9..000000000 --- a/cli/tests/testdata/error_017_hide_long_source_ts.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -error: TS2532 [ERROR]: Object is possibly 'undefined'. - at [WILDCARD]/error_017_hide_long_source_ts.ts:3:1 diff --git a/cli/tests/testdata/error_018_hide_long_source_js.js b/cli/tests/testdata/error_018_hide_long_source_js.js deleted file mode 100644 index d61cb1277..000000000 --- a/cli/tests/testdata/error_018_hide_long_source_js.js +++ /dev/null @@ -1,3 +0,0 @@ -// deno-fmt-ignore-file -const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; -LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; diff --git a/cli/tests/testdata/error_018_hide_long_source_js.js.out b/cli/tests/testdata/error_018_hide_long_source_js.js.out deleted file mode 100644 index cc98669a7..000000000 --- a/cli/tests/testdata/error_018_hide_long_source_js.js.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Uncaught TypeError: Cannot read properties of undefined (reading 'a') - at file:///[WILDCARD]/error_018_hide_long_source_js.js:3:206 diff --git a/cli/tests/testdata/error_019_stack_function.ts b/cli/tests/testdata/error_019_stack_function.ts deleted file mode 100644 index a6a69d146..000000000 --- a/cli/tests/testdata/error_019_stack_function.ts +++ /dev/null @@ -1,12 +0,0 @@ -function foo(): never { - throw new Error("function"); -} - -try { - foo(); -} catch (error) { - if (error instanceof Error) { - console.log(error.stack); - } - throw error; -} diff --git a/cli/tests/testdata/error_019_stack_function.ts.out b/cli/tests/testdata/error_019_stack_function.ts.out deleted file mode 100644 index 03967d12b..000000000 --- a/cli/tests/testdata/error_019_stack_function.ts.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD]Error: function - at foo ([WILDCARD]/error_019_stack_function.ts:[WILDCARD]) - at [WILDCARD]/error_019_stack_function.ts:[WILDCARD] -error: Uncaught Error: function - throw new Error("function"); - ^ - at foo ([WILDCARD]/error_019_stack_function.ts:[WILDCARD]) - at [WILDCARD]/error_019_stack_function.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_020_stack_constructor.ts b/cli/tests/testdata/error_020_stack_constructor.ts deleted file mode 100644 index 526d1a661..000000000 --- a/cli/tests/testdata/error_020_stack_constructor.ts +++ /dev/null @@ -1,14 +0,0 @@ -class A { - constructor() { - throw new Error("constructor"); - } -} - -try { - new A(); -} catch (error) { - if (error instanceof Error) { - console.log(error.stack); - } - throw error; -} diff --git a/cli/tests/testdata/error_020_stack_constructor.ts.out b/cli/tests/testdata/error_020_stack_constructor.ts.out deleted file mode 100644 index 01fdfb3c4..000000000 --- a/cli/tests/testdata/error_020_stack_constructor.ts.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD]Error: constructor - at new A ([WILDCARD]/error_020_stack_constructor.ts:[WILDCARD]) - at [WILDCARD]/error_020_stack_constructor.ts:[WILDCARD] -error: Uncaught Error: constructor - throw new Error("constructor"); - ^ - at new A ([WILDCARD]/error_020_stack_constructor.ts:[WILDCARD]) - at [WILDCARD]/error_020_stack_constructor.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_021_stack_method.ts b/cli/tests/testdata/error_021_stack_method.ts deleted file mode 100644 index b6ebe1f5e..000000000 --- a/cli/tests/testdata/error_021_stack_method.ts +++ /dev/null @@ -1,14 +0,0 @@ -class A { - m(): never { - throw new Error("method"); - } -} - -try { - new A().m(); -} catch (error) { - if (error instanceof Error) { - console.log(error.stack); - } - throw error; -} diff --git a/cli/tests/testdata/error_021_stack_method.ts.out b/cli/tests/testdata/error_021_stack_method.ts.out deleted file mode 100644 index 999f0aaa0..000000000 --- a/cli/tests/testdata/error_021_stack_method.ts.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD]Error: method - at A.m ([WILDCARD]/error_021_stack_method.ts:[WILDCARD]) - at [WILDCARD]/error_021_stack_method.ts:[WILDCARD] -error: Uncaught Error: method - throw new Error("method"); - ^ - at A.m ([WILDCARD]/error_021_stack_method.ts:[WILDCARD]) - at [WILDCARD]/error_021_stack_method.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_022_stack_custom_error.ts b/cli/tests/testdata/error_022_stack_custom_error.ts deleted file mode 100644 index b95743503..000000000 --- a/cli/tests/testdata/error_022_stack_custom_error.ts +++ /dev/null @@ -1,14 +0,0 @@ -class CustomError extends Error { - constructor() { - super(); - this.name = "CustomError"; - } - - get message(): string { - return "custom error"; - } -} - -const error = new CustomError(); -console.log(error.stack); -throw error; diff --git a/cli/tests/testdata/error_022_stack_custom_error.ts.out b/cli/tests/testdata/error_022_stack_custom_error.ts.out deleted file mode 100644 index 78b0dcaea..000000000 --- a/cli/tests/testdata/error_022_stack_custom_error.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]CustomError: custom error - at [WILDCARD]/error_022_stack_custom_error.ts:[WILDCARD] -error: Uncaught CustomError: custom error -const error = new CustomError(); - ^ - at [WILDCARD]/error_022_stack_custom_error.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_023_stack_async.ts b/cli/tests/testdata/error_023_stack_async.ts deleted file mode 100644 index fdabaa5df..000000000 --- a/cli/tests/testdata/error_023_stack_async.ts +++ /dev/null @@ -1,14 +0,0 @@ -const p = (async () => { - await Promise.resolve().then((): never => { - throw new Error("async"); - }); -})(); - -try { - await p; -} catch (error) { - if (error instanceof Error) { - console.log(error.stack); - } - throw error; -} diff --git a/cli/tests/testdata/error_023_stack_async.ts.out b/cli/tests/testdata/error_023_stack_async.ts.out deleted file mode 100644 index 95f0eae64..000000000 --- a/cli/tests/testdata/error_023_stack_async.ts.out +++ /dev/null @@ -1,10 +0,0 @@ -[WILDCARD]Error: async - at [WILDCARD]/error_023_stack_async.ts:[WILDCARD] - at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] - at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] -error: Uncaught Error: async - throw new Error("async"); - ^ - at [WILDCARD]/error_023_stack_async.ts:[WILDCARD] - at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] - at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_024_stack_promise_all.ts b/cli/tests/testdata/error_024_stack_promise_all.ts deleted file mode 100644 index 8ca7b203c..000000000 --- a/cli/tests/testdata/error_024_stack_promise_all.ts +++ /dev/null @@ -1,16 +0,0 @@ -const p = Promise.all([ - Promise.resolve(), - (async (): Promise => { - await Promise.resolve(); - throw new Error("Promise.all()"); - })(), -]); - -try { - await p; -} catch (error) { - if (error instanceof Error) { - console.log(error.stack); - } - throw error; -} diff --git a/cli/tests/testdata/error_024_stack_promise_all.ts.out b/cli/tests/testdata/error_024_stack_promise_all.ts.out deleted file mode 100644 index 6cd88715c..000000000 --- a/cli/tests/testdata/error_024_stack_promise_all.ts.out +++ /dev/null @@ -1,10 +0,0 @@ -[WILDCARD]Error: Promise.all() - at [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] - at async Promise.all (index 1) - at async [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] -error: Uncaught Error: Promise.all() - throw new Error("Promise.all()"); - ^ - at [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] - at async Promise.all (index 1) - at async [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_025_tab_indent b/cli/tests/testdata/error_025_tab_indent deleted file mode 100644 index 35a25bcea..000000000 --- a/cli/tests/testdata/error_025_tab_indent +++ /dev/null @@ -1,9 +0,0 @@ -function foo() { - throw Error("bad"); -} - -function bar() { - foo(); -} - -bar(); diff --git a/cli/tests/testdata/error_025_tab_indent.out b/cli/tests/testdata/error_025_tab_indent.out deleted file mode 100644 index f1466ce3f..000000000 --- a/cli/tests/testdata/error_025_tab_indent.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught Error: bad - throw Error("bad"); - ^ - at foo ([WILDCARD]/error_025_tab_indent:2:8) - at bar ([WILDCARD]/error_025_tab_indent:6:2) - at [WILDCARD]/error_025_tab_indent:9:1 diff --git a/cli/tests/testdata/error_026_remote_import_error.ts b/cli/tests/testdata/error_026_remote_import_error.ts deleted file mode 100644 index 2718e768a..000000000 --- a/cli/tests/testdata/error_026_remote_import_error.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/error_001.ts"; diff --git a/cli/tests/testdata/error_026_remote_import_error.ts.out b/cli/tests/testdata/error_026_remote_import_error.ts.out deleted file mode 100644 index bec0cf1c5..000000000 --- a/cli/tests/testdata/error_026_remote_import_error.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -[WILDCARD]error: Uncaught Error: bad - throw Error("bad"); - ^ - at foo (http://localhost:4545/error_001.ts:2:9) - at bar (http://localhost:4545/error_001.ts:6:3) - at http://localhost:4545/error_001.ts:9:1 -[WILDCARD] diff --git a/cli/tests/testdata/error_027_bundle_with_bare_import.ts b/cli/tests/testdata/error_027_bundle_with_bare_import.ts deleted file mode 100644 index c0748305d..000000000 --- a/cli/tests/testdata/error_027_bundle_with_bare_import.ts +++ /dev/null @@ -1 +0,0 @@ -import "foo"; diff --git a/cli/tests/testdata/error_027_bundle_with_bare_import.ts.out b/cli/tests/testdata/error_027_bundle_with_bare_import.ts.out deleted file mode 100644 index e2edd118a..000000000 --- a/cli/tests/testdata/error_027_bundle_with_bare_import.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ - at file:///[WILDCARD]/error_027_bundle_with_bare_import.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_cause.ts b/cli/tests/testdata/error_cause.ts deleted file mode 100644 index 385ce2a03..000000000 --- a/cli/tests/testdata/error_cause.ts +++ /dev/null @@ -1,14 +0,0 @@ -function a() { - // deno-lint-ignore no-explicit-any - throw new Error("foo", { cause: new Error("bar", { cause: "deno" as any }) }); -} - -function b() { - a(); -} - -function c() { - b(); -} - -c(); diff --git a/cli/tests/testdata/error_cause.ts.out b/cli/tests/testdata/error_cause.ts.out deleted file mode 100644 index 2aab020d9..000000000 --- a/cli/tests/testdata/error_cause.ts.out +++ /dev/null @@ -1,15 +0,0 @@ -[WILDCARD] -error: Uncaught Error: foo - throw new Error("foo", { cause: new Error("bar", { cause: "deno" as any }) }); - ^ - at a (file:///[WILDCARD]/error_cause.ts:3:9) - at b (file:///[WILDCARD]/error_cause.ts:7:3) - at c (file:///[WILDCARD]/error_cause.ts:11:3) - at file:///[WILDCARD]/error_cause.ts:14:1 -Caused by: Error: bar - at a (file:///[WILDCARD]/error_cause.ts:3:35) - at b (file:///[WILDCARD]/error_cause.ts:7:3) - at c (file:///[WILDCARD]/error_cause.ts:11:3) - at file:///[WILDCARD]/error_cause.ts:14:1 -Caused by: "deno" -[WILDCARD] diff --git a/cli/tests/testdata/error_cause_recursive.ts b/cli/tests/testdata/error_cause_recursive.ts deleted file mode 100644 index a6999b1ff..000000000 --- a/cli/tests/testdata/error_cause_recursive.ts +++ /dev/null @@ -1,4 +0,0 @@ -const x = new Error("foo"); -const y = new Error("bar", { cause: x }); -x.cause = y; -throw y; diff --git a/cli/tests/testdata/error_cause_recursive.ts.out b/cli/tests/testdata/error_cause_recursive.ts.out deleted file mode 100644 index ac729574d..000000000 --- a/cli/tests/testdata/error_cause_recursive.ts.out +++ /dev/null @@ -1,10 +0,0 @@ -[WILDCARD] -error: Uncaught Error: bar -const y = new Error("bar", { cause: x }); - ^ - at file:///[WILDCARD]/error_cause_recursive.ts:2:11 -Caused by: Error: foo - at file:///[WILDCARD]/error_cause_recursive.ts:1:11 -Caused by: Error: bar - at file:///[WILDCARD]/error_cause_recursive.ts:2:11 -[WILDCARD] diff --git a/cli/tests/testdata/error_for_await.ts b/cli/tests/testdata/error_for_await.ts deleted file mode 100644 index 64c81abe4..000000000 --- a/cli/tests/testdata/error_for_await.ts +++ /dev/null @@ -1,12 +0,0 @@ -const listener = Deno.listen({ port: 8080 }); - -for await (const conn of listener) { - handleConn(conn); -} - -function handleConn(conn: Deno.Conn) { - const httpConn = Deno.serveHttp(conn); - for await (const event of httpConn) { - event.respondWith(new Response("html", { status: 200 })); - } -} diff --git a/cli/tests/testdata/error_for_await.ts.out b/cli/tests/testdata/error_for_await.ts.out deleted file mode 100644 index db3cdecb4..000000000 --- a/cli/tests/testdata/error_for_await.ts.out +++ /dev/null @@ -1,10 +0,0 @@ -[WILDCARD] -error: TS1103 [ERROR]: 'for await' loops are only allowed within async functions and at the top levels of modules. - for await (const event of httpConn) { - ~~~~~ - at [WILDCARD]error_for_await.ts:9:7 - -TS1356 [ERROR]: Did you mean to mark this function as 'async'? - function handleConn(conn: Deno.Conn) { - ~~~~~~~~~~ - at [WILDCARD]error_for_await.ts:7:10 diff --git a/cli/tests/testdata/error_import_map_unable_to_load.out b/cli/tests/testdata/error_import_map_unable_to_load.out deleted file mode 100644 index 50760e438..000000000 --- a/cli/tests/testdata/error_import_map_unable_to_load.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Unable to load '[WILDCARD]' import map - -Caused by: - [WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/error_local_static_import_from_remote.js b/cli/tests/testdata/error_local_static_import_from_remote.js deleted file mode 100644 index eb7fd23ba..000000000 --- a/cli/tests/testdata/error_local_static_import_from_remote.js +++ /dev/null @@ -1 +0,0 @@ -import "file:///some/dir/file.js"; diff --git a/cli/tests/testdata/error_local_static_import_from_remote.js.out b/cli/tests/testdata/error_local_static_import_from_remote.js.out deleted file mode 100644 index 1ea10bd88..000000000 --- a/cli/tests/testdata/error_local_static_import_from_remote.js.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. - Importing: file:///some/dir/file.js - at http://localhost:4545/error_local_static_import_from_remote.js:1:8 diff --git a/cli/tests/testdata/error_local_static_import_from_remote.ts b/cli/tests/testdata/error_local_static_import_from_remote.ts deleted file mode 100644 index a831db0c4..000000000 --- a/cli/tests/testdata/error_local_static_import_from_remote.ts +++ /dev/null @@ -1 +0,0 @@ -import "file:///some/dir/file.ts"; diff --git a/cli/tests/testdata/error_local_static_import_from_remote.ts.out b/cli/tests/testdata/error_local_static_import_from_remote.ts.out deleted file mode 100644 index 7308c6f9d..000000000 --- a/cli/tests/testdata/error_local_static_import_from_remote.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. - Importing: file:///some/dir/file.ts - at http://localhost:4545/error_local_static_import_from_remote.ts:1:8 diff --git a/cli/tests/testdata/error_missing_module_named_import.ts b/cli/tests/testdata/error_missing_module_named_import.ts deleted file mode 100644 index 9eb5239ff..000000000 --- a/cli/tests/testdata/error_missing_module_named_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { a } from "./does_not_exist.js"; - -console.log(a); diff --git a/cli/tests/testdata/error_missing_module_named_import.ts.out b/cli/tests/testdata/error_missing_module_named_import.ts.out deleted file mode 100644 index 3dccaffb1..000000000 --- a/cli/tests/testdata/error_missing_module_named_import.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -error: Module not found "file://[WILDCARD]/does_not_exist.js". - at file:///[WILDCARD]/error_missing_module_named_import.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_name_non_string.js b/cli/tests/testdata/error_name_non_string.js deleted file mode 100644 index ae9609927..000000000 --- a/cli/tests/testdata/error_name_non_string.js +++ /dev/null @@ -1,8 +0,0 @@ -class ErrorNameNonString extends Error { - constructor() { - super(); - this.name = 42; - } -} - -throw new ErrorNameNonString(); diff --git a/cli/tests/testdata/error_name_non_string.js.out b/cli/tests/testdata/error_name_non_string.js.out deleted file mode 100644 index a77f336e9..000000000 --- a/cli/tests/testdata/error_name_non_string.js.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught Error -throw new ErrorNameNonString(); - ^ - at file:///[WILDCARD]/error_name_non_string.js:[WILDCARD] diff --git a/cli/tests/testdata/error_no_check.ts b/cli/tests/testdata/error_no_check.ts deleted file mode 100644 index db9257a1d..000000000 --- a/cli/tests/testdata/error_no_check.ts +++ /dev/null @@ -1 +0,0 @@ -export { AnInterface, isAnInterface } from "./subdir/type_and_code.ts"; diff --git a/cli/tests/testdata/error_no_check.ts.out b/cli/tests/testdata/error_no_check.ts.out deleted file mode 100644 index cac1367ba..000000000 --- a/cli/tests/testdata/error_no_check.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Uncaught SyntaxError: The requested module './subdir/type_and_code.ts' does not provide an export named 'AnInterface' -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/error_syntax.js b/cli/tests/testdata/error_syntax.js deleted file mode 100644 index c0414c356..000000000 --- a/cli/tests/testdata/error_syntax.js +++ /dev/null @@ -1,3 +0,0 @@ - -// deno-fmt-ignore-file -(the following is a syntax error ^^ ! ) diff --git a/cli/tests/testdata/error_syntax.js.out b/cli/tests/testdata/error_syntax.js.out deleted file mode 100644 index 6d3f05b8e..000000000 --- a/cli/tests/testdata/error_syntax.js.out +++ /dev/null @@ -1 +0,0 @@ -error: The module's source code could not be parsed: Expected ',', got 'following' at [WILDCARD]/error_syntax.js:3:6 diff --git a/cli/tests/testdata/error_syntax_empty_trailing_line.mjs b/cli/tests/testdata/error_syntax_empty_trailing_line.mjs deleted file mode 100644 index 864dfb0c7..000000000 --- a/cli/tests/testdata/error_syntax_empty_trailing_line.mjs +++ /dev/null @@ -1,2 +0,0 @@ -// Deliberately using .mjs to avoid triggering dprint -setTimeout(() => {}), diff --git a/cli/tests/testdata/error_syntax_empty_trailing_line.mjs.out b/cli/tests/testdata/error_syntax_empty_trailing_line.mjs.out deleted file mode 100644 index f4bbc6708..000000000 --- a/cli/tests/testdata/error_syntax_empty_trailing_line.mjs.out +++ /dev/null @@ -1 +0,0 @@ -error: The module's source code could not be parsed: Unexpected eof at [WILDCARD]/error_syntax_empty_trailing_line.mjs:2:22 diff --git a/cli/tests/testdata/error_type_definitions.ts b/cli/tests/testdata/error_type_definitions.ts deleted file mode 100644 index ceb11787e..000000000 --- a/cli/tests/testdata/error_type_definitions.ts +++ /dev/null @@ -1,5 +0,0 @@ -// @deno-types="./type_definitions/bar.d.ts" -import { Bar } from "./type_definitions/bar.js"; - -const bar = new Bar(); -console.log(bar); diff --git a/cli/tests/testdata/error_type_definitions.ts.out b/cli/tests/testdata/error_type_definitions.ts.out deleted file mode 100644 index 5e1d73ca4..000000000 --- a/cli/tests/testdata/error_type_definitions.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Relative import path "baz" not prefixed with / or ./ or ../ - at [WILDCARD]/type_definitions/bar.d.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_worker_permissions_local.ts b/cli/tests/testdata/error_worker_permissions_local.ts deleted file mode 100644 index ed938a025..000000000 --- a/cli/tests/testdata/error_worker_permissions_local.ts +++ /dev/null @@ -1,4 +0,0 @@ -new Worker( - import.meta.resolve("./subdeb/worker_types.ts"), - { type: "module" }, -); diff --git a/cli/tests/testdata/error_worker_permissions_local.ts.out b/cli/tests/testdata/error_worker_permissions_local.ts.out deleted file mode 100644 index e6404e8e3..000000000 --- a/cli/tests/testdata/error_worker_permissions_local.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -error: Uncaught (in worker "") Requires read access to "[WILDCARD]worker_types.ts", run again with the --allow-read flag -[WILDCARD] diff --git a/cli/tests/testdata/error_worker_permissions_remote.ts b/cli/tests/testdata/error_worker_permissions_remote.ts deleted file mode 100644 index 878c7080a..000000000 --- a/cli/tests/testdata/error_worker_permissions_remote.ts +++ /dev/null @@ -1,4 +0,0 @@ -new Worker( - "http://localhost:4545/subdir/worker_types.ts", - { type: "module" }, -); diff --git a/cli/tests/testdata/error_worker_permissions_remote.ts.out b/cli/tests/testdata/error_worker_permissions_remote.ts.out deleted file mode 100644 index 74c7c3974..000000000 --- a/cli/tests/testdata/error_worker_permissions_remote.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -error: Uncaught (in worker "") Requires net access to "localhost:4545", run again with the --allow-net flag -[WILDCARD] diff --git a/cli/tests/testdata/es_private_fields.js b/cli/tests/testdata/es_private_fields.js deleted file mode 100644 index b5f83e39c..000000000 --- a/cli/tests/testdata/es_private_fields.js +++ /dev/null @@ -1,15 +0,0 @@ -class Foo { - #field = "field"; - - setValue(val) { - this.#field = val; - } - - getValue() { - return this.#field; - } -} - -const bar = new Foo(); -bar.setValue("PRIVATE"); -console.log(bar.getValue()); diff --git a/cli/tests/testdata/es_private_fields.js.out b/cli/tests/testdata/es_private_fields.js.out deleted file mode 100644 index be1970b05..000000000 --- a/cli/tests/testdata/es_private_fields.js.out +++ /dev/null @@ -1 +0,0 @@ -PRIVATE diff --git a/cli/tests/testdata/esm_imports_a.js b/cli/tests/testdata/esm_imports_a.js deleted file mode 100644 index 673cd9aa3..000000000 --- a/cli/tests/testdata/esm_imports_a.js +++ /dev/null @@ -1,3 +0,0 @@ -import { retb } from "./esm_imports_b.js"; - -if (retb() != "b") throw Error(); diff --git a/cli/tests/testdata/esm_imports_b.js b/cli/tests/testdata/esm_imports_b.js deleted file mode 100644 index 840121368..000000000 --- a/cli/tests/testdata/esm_imports_b.js +++ /dev/null @@ -1,4 +0,0 @@ -// deno-lint-ignore-file -export function retb() { - return "b"; -} diff --git a/cli/tests/testdata/eval/dyn_import_eval.out b/cli/tests/testdata/eval/dyn_import_eval.out new file mode 100644 index 000000000..a1d6c3687 --- /dev/null +++ b/cli/tests/testdata/eval/dyn_import_eval.out @@ -0,0 +1,2 @@ +[WILDCARD] +Module { isMod4: true } diff --git a/cli/tests/testdata/eval_context_throw_dom_exception.js b/cli/tests/testdata/eval_context_throw_dom_exception.js deleted file mode 100644 index b8e99d498..000000000 --- a/cli/tests/testdata/eval_context_throw_dom_exception.js +++ /dev/null @@ -1,2 +0,0 @@ -const [, errorInfo] = Deno.core.evalContext('throw new DOMException("foo")'); -console.log(errorInfo); diff --git a/cli/tests/testdata/eval_context_throw_dom_exception.js.out b/cli/tests/testdata/eval_context_throw_dom_exception.js.out deleted file mode 100644 index 39e164083..000000000 --- a/cli/tests/testdata/eval_context_throw_dom_exception.js.out +++ /dev/null @@ -1 +0,0 @@ -{ thrown: DOMException: foo, isNativeError: true, isCompileError: false } diff --git a/cli/tests/testdata/event_listener_error.ts b/cli/tests/testdata/event_listener_error.ts deleted file mode 100644 index 1cbdf7bc2..000000000 --- a/cli/tests/testdata/event_listener_error.ts +++ /dev/null @@ -1,6 +0,0 @@ -addEventListener("foo", () => { - throw new Error("bar"); -}); -console.log(1); -dispatchEvent(new CustomEvent("foo")); -console.log(2); diff --git a/cli/tests/testdata/event_listener_error.ts.out b/cli/tests/testdata/event_listener_error.ts.out deleted file mode 100644 index a20a91dfd..000000000 --- a/cli/tests/testdata/event_listener_error.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -1 -error: Uncaught Error: bar - throw new Error("bar"); - ^ - at [WILDCARD]/event_listener_error.ts:2:9 - at [WILDCARD] - at [WILDCARD]/event_listener_error.ts:5:1 diff --git a/cli/tests/testdata/event_listener_error_handled.ts b/cli/tests/testdata/event_listener_error_handled.ts deleted file mode 100644 index c4c8fd1cd..000000000 --- a/cli/tests/testdata/event_listener_error_handled.ts +++ /dev/null @@ -1,23 +0,0 @@ -addEventListener("error", (event) => { - console.log({ - cancelable: event.cancelable, - message: event.message, - filename: event.filename?.slice?.(-100), - lineno: event.lineno, - colno: event.colno, - error: event.error, - }); - event.preventDefault(); -}); - -onerror = (event) => { - console.log("onerror() called", event.error); -}; - -addEventListener("foo", () => { - throw new Error("bar"); -}); - -console.log(1); -dispatchEvent(new CustomEvent("foo")); -console.log(2); diff --git a/cli/tests/testdata/event_listener_error_handled.ts.out b/cli/tests/testdata/event_listener_error_handled.ts.out deleted file mode 100644 index d3cf525c3..000000000 --- a/cli/tests/testdata/event_listener_error_handled.ts.out +++ /dev/null @@ -1,17 +0,0 @@ -1 -{ - cancelable: true, - message: "Uncaught Error: bar", - filename: "[WILDCARD]/event_listener_error_handled.ts", - lineno: 18, - colno: 9, - error: Error: bar - at [WILDCARD]/event_listener_error_handled.ts:18:9 - at [WILDCARD] - at [WILDCARD]/event_listener_error_handled.ts:22:1 -} -onerror() called Error: bar - at [WILDCARD]/event_listener_error_handled.ts:18:9 - at [WILDCARD] - at [WILDCARD]/event_listener_error_handled.ts:22:1 -2 diff --git a/cli/tests/testdata/event_listener_error_immediate_exit.ts b/cli/tests/testdata/event_listener_error_immediate_exit.ts deleted file mode 100644 index c9e94c01b..000000000 --- a/cli/tests/testdata/event_listener_error_immediate_exit.ts +++ /dev/null @@ -1,12 +0,0 @@ -addEventListener("foo", () => { - queueMicrotask(() => console.log("queueMicrotask")); - setTimeout(() => console.log("timer"), 0); - throw new Error("bar"); -}); -console.log(1); -// @ts-ignore Deno.core -Deno.core.setNextTickCallback(() => console.log("nextTick")); -// @ts-ignore Deno.core -Deno.core.setHasTickScheduled(true); -dispatchEvent(new CustomEvent("foo")); -console.log(2); diff --git a/cli/tests/testdata/event_listener_error_immediate_exit.ts.out b/cli/tests/testdata/event_listener_error_immediate_exit.ts.out deleted file mode 100644 index 1fb3ce76a..000000000 --- a/cli/tests/testdata/event_listener_error_immediate_exit.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -1 -queueMicrotask -error: Uncaught Error: bar - throw new Error("bar"); - ^ - at [WILDCARD]/event_listener_error_immediate_exit.ts:4:9[WILDCARD] - at [WILDCARD]/event_listener_error_immediate_exit.ts:11:1 diff --git a/cli/tests/testdata/event_listener_error_immediate_exit_worker.ts b/cli/tests/testdata/event_listener_error_immediate_exit_worker.ts deleted file mode 100644 index 58c45d1bb..000000000 --- a/cli/tests/testdata/event_listener_error_immediate_exit_worker.ts +++ /dev/null @@ -1,4 +0,0 @@ -new Worker( - import.meta.resolve("./event_listener_error_immediate_exit.ts"), - { type: "module" }, -); diff --git a/cli/tests/testdata/event_listener_error_immediate_exit_worker.ts.out b/cli/tests/testdata/event_listener_error_immediate_exit_worker.ts.out deleted file mode 100644 index 8bd312298..000000000 --- a/cli/tests/testdata/event_listener_error_immediate_exit_worker.ts.out +++ /dev/null @@ -1,8 +0,0 @@ -1 -error: Uncaught (in worker "") Error: bar - throw new Error("bar"); - ^ - at [WILDCARD]/event_listener_error_immediate_exit.ts:4:9 - at [WILDCARD]/event_listener_error_immediate_exit.ts:11:1 -error: Uncaught (in promise) Error: Unhandled error in child worker. - at [WILDCARD] diff --git a/cli/tests/testdata/exec_path.ts b/cli/tests/testdata/exec_path.ts deleted file mode 100644 index b70b23237..000000000 --- a/cli/tests/testdata/exec_path.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(Deno.execPath()); diff --git a/cli/tests/testdata/exit_error42.ts b/cli/tests/testdata/exit_error42.ts deleted file mode 100644 index e4db41f3a..000000000 --- a/cli/tests/testdata/exit_error42.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log("before"); -Deno.exit(42); -console.log("after"); diff --git a/cli/tests/testdata/exit_error42.ts.out b/cli/tests/testdata/exit_error42.ts.out deleted file mode 100644 index 90be1f305..000000000 --- a/cli/tests/testdata/exit_error42.ts.out +++ /dev/null @@ -1 +0,0 @@ -before diff --git a/cli/tests/testdata/export_type_def.ts b/cli/tests/testdata/export_type_def.ts deleted file mode 100644 index e33b70a64..000000000 --- a/cli/tests/testdata/export_type_def.ts +++ /dev/null @@ -1,2 +0,0 @@ -// @deno-types="./type_definitions/foo.d.ts" -export { foo } from "./type_definitions/foo.js"; diff --git a/cli/tests/testdata/fetch/hello.txt b/cli/tests/testdata/fetch/hello.txt deleted file mode 100644 index af5626b4a..000000000 --- a/cli/tests/testdata/fetch/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, world! diff --git a/cli/tests/testdata/fetch/other.ts b/cli/tests/testdata/fetch/other.ts deleted file mode 100644 index 91fe376b3..000000000 --- a/cli/tests/testdata/fetch/other.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; diff --git a/cli/tests/testdata/fetch/test.ts b/cli/tests/testdata/fetch/test.ts deleted file mode 100644 index baa52775d..000000000 --- a/cli/tests/testdata/fetch/test.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/subdir/mod2.ts"; diff --git a/cli/tests/testdata/fetch_async_error_stack.ts b/cli/tests/testdata/fetch_async_error_stack.ts deleted file mode 100644 index f583192c2..000000000 --- a/cli/tests/testdata/fetch_async_error_stack.ts +++ /dev/null @@ -1 +0,0 @@ -await fetch("https://nonexistent.deno.land/"); diff --git a/cli/tests/testdata/fetch_async_error_stack.ts.out b/cli/tests/testdata/fetch_async_error_stack.ts.out deleted file mode 100644 index 0a7b353e2..000000000 --- a/cli/tests/testdata/fetch_async_error_stack.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: error sending request for url[WILDCARD] -await fetch("https://nonexistent.deno.land/"); -^[WILDCARD] - at async fetch (deno:[WILDCARD]) - at async file:///[WILDCARD]/fetch_async_error_stack.ts:1:1 diff --git a/cli/tests/testdata/fetch_response_finalization.js b/cli/tests/testdata/fetch_response_finalization.js deleted file mode 100644 index dd7c355eb..000000000 --- a/cli/tests/testdata/fetch_response_finalization.js +++ /dev/null @@ -1,16 +0,0 @@ -async function doAFetch() { - const resp = await fetch("http://localhost:4545/README.md"); - console.log(Deno.resources()); // print the current resources - const _resp = resp; - // at this point resp can be GC'ed -} - -await doAFetch(); // create a resource - -globalThis.gc(); // force GC - -// It is very important that there is a yield here, otherwise the finalizer for -// the response body is not called and the resource is not closed. -await new Promise((resolve) => setTimeout(resolve, 0)); - -console.log(Deno.resources()); // print the current resources diff --git a/cli/tests/testdata/fetch_response_finalization.js.out b/cli/tests/testdata/fetch_response_finalization.js.out deleted file mode 100644 index 844a4e4b2..000000000 --- a/cli/tests/testdata/fetch_response_finalization.js.out +++ /dev/null @@ -1,2 +0,0 @@ -{ "0": "stdin", "1": "stdout", "2": "stderr", "5": "fetchResponseBody" } -{ "0": "stdin", "1": "stdout", "2": "stderr" } diff --git a/cli/tests/testdata/file_exists.ts b/cli/tests/testdata/file_exists.ts deleted file mode 100644 index 20de4d4f2..000000000 --- a/cli/tests/testdata/file_exists.ts +++ /dev/null @@ -1,6 +0,0 @@ -try { - await Deno.open(Deno.args[0]); - Deno.exit(0); -} catch (_e) { - Deno.exit(1); -} diff --git a/cli/tests/testdata/finalization_registry.js b/cli/tests/testdata/finalization_registry.js deleted file mode 100644 index 7d7d58149..000000000 --- a/cli/tests/testdata/finalization_registry.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -"use strict"; - -function assertEquals(a, b) { - if (a === b) return; - throw a + " does not equal " + b; -} - -const registry = new FinalizationRegistry((value) => { - assertEquals(value, "called!"); - Deno.core.print("FinalizationRegistry called!\n"); -}); - -(function () { - let x = {}; - registry.register(x, "called!"); - x = null; -})(); - -gc(); diff --git a/cli/tests/testdata/finalization_registry.js.out b/cli/tests/testdata/finalization_registry.js.out deleted file mode 100644 index fee61413a..000000000 --- a/cli/tests/testdata/finalization_registry.js.out +++ /dev/null @@ -1 +0,0 @@ -FinalizationRegistry called! diff --git a/cli/tests/testdata/fix_dynamic_import_errors.js b/cli/tests/testdata/fix_dynamic_import_errors.js deleted file mode 100644 index 317047ccb..000000000 --- a/cli/tests/testdata/fix_dynamic_import_errors.js +++ /dev/null @@ -1,7 +0,0 @@ -import("./dynamic_import/b.js").catch(() => { - console.log("caught import error from b.js"); -}); - -import("./dynamic_import/c.js").catch(() => { - console.log("caught import error from c.js"); -}); diff --git a/cli/tests/testdata/fix_dynamic_import_errors.js.out b/cli/tests/testdata/fix_dynamic_import_errors.js.out deleted file mode 100644 index e7856fb9c..000000000 --- a/cli/tests/testdata/fix_dynamic_import_errors.js.out +++ /dev/null @@ -1,2 +0,0 @@ -caught import error from [WILDCARD].js -caught import error from [WILDCARD].js diff --git a/cli/tests/testdata/fix_emittable_skipped.js b/cli/tests/testdata/fix_emittable_skipped.js deleted file mode 100644 index f61907b06..000000000 --- a/cli/tests/testdata/fix_emittable_skipped.js +++ /dev/null @@ -1,7 +0,0 @@ -/// - -import "./subdir/polyfill.ts"; - -export const a = "a"; - -console.log(globalThis.polyfill); diff --git a/cli/tests/testdata/fix_emittable_skipped.ts.out b/cli/tests/testdata/fix_emittable_skipped.ts.out deleted file mode 100644 index 108c2d67f..000000000 --- a/cli/tests/testdata/fix_emittable_skipped.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -[Function] diff --git a/cli/tests/testdata/fix_exotic_specifiers.ts b/cli/tests/testdata/fix_exotic_specifiers.ts deleted file mode 100644 index 101667b2a..000000000 --- a/cli/tests/testdata/fix_exotic_specifiers.ts +++ /dev/null @@ -1,3 +0,0 @@ -import clone from "https://jspm.dev/lodash@4/clone"; - -console.log(clone); diff --git a/cli/tests/testdata/fix_exotic_specifiers.ts.out b/cli/tests/testdata/fix_exotic_specifiers.ts.out deleted file mode 100644 index 7afdb808d..000000000 --- a/cli/tests/testdata/fix_exotic_specifiers.ts.out +++ /dev/null @@ -1 +0,0 @@ -[Function: clone] diff --git a/cli/tests/testdata/fix_js_import_js.ts b/cli/tests/testdata/fix_js_import_js.ts deleted file mode 100644 index c9f341748..000000000 --- a/cli/tests/testdata/fix_js_import_js.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { isMod4 } from "./subdir/mod6.js"; - -console.log(isMod4); diff --git a/cli/tests/testdata/fix_js_import_js.ts.out b/cli/tests/testdata/fix_js_import_js.ts.out deleted file mode 100644 index 27ba77dda..000000000 --- a/cli/tests/testdata/fix_js_import_js.ts.out +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/cli/tests/testdata/fix_js_imports.ts b/cli/tests/testdata/fix_js_imports.ts deleted file mode 100644 index 4770b1ab6..000000000 --- a/cli/tests/testdata/fix_js_imports.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as amdLike from "./subdir/amd_like.js"; - -console.log(amdLike); diff --git a/cli/tests/testdata/fix_js_imports.ts.out b/cli/tests/testdata/fix_js_imports.ts.out deleted file mode 100644 index 5e45122de..000000000 --- a/cli/tests/testdata/fix_js_imports.ts.out +++ /dev/null @@ -1 +0,0 @@ -Module {} diff --git a/cli/tests/testdata/fix_tsc_file_exists.out b/cli/tests/testdata/fix_tsc_file_exists.out deleted file mode 100644 index ce0136250..000000000 --- a/cli/tests/testdata/fix_tsc_file_exists.out +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/cli/tests/testdata/fix_worker_dispatchevent.ts b/cli/tests/testdata/fix_worker_dispatchevent.ts deleted file mode 100644 index 1b73b52dc..000000000 --- a/cli/tests/testdata/fix_worker_dispatchevent.ts +++ /dev/null @@ -1,43 +0,0 @@ -const code = ` -addEventListener("message", () => { - postMessage("pong"); -}); - -const context = new EventTarget(); - -Object.defineProperty(globalThis, "dispatchEvent", { - value: context.dispatchEvent.bind(context), - writable: true, - enumerable: true, - configurable: true, -}); - -postMessage("start"); -`; - -const blob = new Blob([code], { type: "application/javascript" }); - -const url = URL.createObjectURL(blob); - -const worker = new Worker(url, { type: "module" }); - -let terminated = false; - -worker.addEventListener("message", (evt) => { - if (evt.data === "start") { - worker.postMessage("ping"); - } else if (evt.data === "pong") { - worker.terminate(); - terminated = true; - console.log("success"); - } else { - throw new Error("unexpected message from worker"); - } -}); - -setTimeout(() => { - if (!terminated) { - worker.terminate(); - throw new Error("did not receive message from worker in time"); - } -}, 2000); diff --git a/cli/tests/testdata/fix_worker_dispatchevent.ts.out b/cli/tests/testdata/fix_worker_dispatchevent.ts.out deleted file mode 100644 index 2e9ba477f..000000000 --- a/cli/tests/testdata/fix_worker_dispatchevent.ts.out +++ /dev/null @@ -1 +0,0 @@ -success diff --git a/cli/tests/testdata/fixture.json b/cli/tests/testdata/fixture.json deleted file mode 100644 index 56e056b6a..000000000 --- a/cli/tests/testdata/fixture.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "deno", - "private": true, - "devDependencies": { - "@types/prettier": "1.16.1", - "@typescript-eslint/eslint-plugin": "2.5.0", - "@typescript-eslint/parser": "2.5.0", - "eslint": "5.15.1", - "eslint-config-prettier": "4.1.0", - "magic-string": "0.25.2", - "prettier": "1.17.1", - "typescript": "3.6.3" - } -} diff --git a/cli/tests/testdata/fmt/badly_formatted.json b/cli/tests/testdata/fmt/badly_formatted.json new file mode 100644 index 000000000..f2bacf73d --- /dev/null +++ b/cli/tests/testdata/fmt/badly_formatted.json @@ -0,0 +1,12 @@ +{ + + + "key1": "value1", + "key2": true, + "key3": ["value2", "value3", false], + "keys": { + "more": "values" + } + + +} \ No newline at end of file diff --git a/cli/tests/testdata/fmt/badly_formatted.md b/cli/tests/testdata/fmt/badly_formatted.md new file mode 100644 index 000000000..26afe483b --- /dev/null +++ b/cli/tests/testdata/fmt/badly_formatted.md @@ -0,0 +1,46 @@ +# Hello Markdown + +```js +console.log("Hello World" + +) +``` + +```javascript +console.log("Hello World2" + +) +``` + +```ts + +function hello(name: string ) { + console.log(name); +}; + +hello( "alice"); +``` + +```typescript +function foo(): number { + return 2; +} +``` + +```jsonc + +{ + // Comment in JSON + "key": "value", + "key2": + "value2", +} + +``` + +```json +{ + "numbers": + ["1", "2"] +} +``` \ No newline at end of file diff --git a/cli/tests/testdata/fmt/badly_formatted.mjs b/cli/tests/testdata/fmt/badly_formatted.mjs new file mode 100644 index 000000000..bc515a330 --- /dev/null +++ b/cli/tests/testdata/fmt/badly_formatted.mjs @@ -0,0 +1,4 @@ +// Deliberately using .mjs to avoid triggering dprint +console.log("Hello World" + +) diff --git a/cli/tests/testdata/fmt/badly_formatted_fixed.js b/cli/tests/testdata/fmt/badly_formatted_fixed.js new file mode 100644 index 000000000..e9062ba85 --- /dev/null +++ b/cli/tests/testdata/fmt/badly_formatted_fixed.js @@ -0,0 +1,2 @@ +// Deliberately using .mjs to avoid triggering dprint +console.log("Hello World"); diff --git a/cli/tests/testdata/fmt/badly_formatted_fixed.json b/cli/tests/testdata/fmt/badly_formatted_fixed.json new file mode 100644 index 000000000..0d697a2c6 --- /dev/null +++ b/cli/tests/testdata/fmt/badly_formatted_fixed.json @@ -0,0 +1,8 @@ +{ + "key1": "value1", + "key2": true, + "key3": ["value2", "value3", false], + "keys": { + "more": "values" + } +} diff --git a/cli/tests/testdata/fmt/badly_formatted_fixed.md b/cli/tests/testdata/fmt/badly_formatted_fixed.md new file mode 100644 index 000000000..8ba74cac3 --- /dev/null +++ b/cli/tests/testdata/fmt/badly_formatted_fixed.md @@ -0,0 +1,37 @@ +# Hello Markdown + +```js +console.log("Hello World"); +``` + +```javascript +console.log("Hello World2"); +``` + +```ts +function hello(name: string) { + console.log(name); +} + +hello("alice"); +``` + +```typescript +function foo(): number { + return 2; +} +``` + +```jsonc +{ + // Comment in JSON + "key": "value", + "key2": "value2" +} +``` + +```json +{ + "numbers": ["1", "2"] +} +``` diff --git a/cli/tests/testdata/fmt/with_config/subdir/a.ts b/cli/tests/testdata/fmt/with_config/subdir/a.ts index 50db0d2e1..4baf8d485 100644 --- a/cli/tests/testdata/fmt/with_config/subdir/a.ts +++ b/cli/tests/testdata/fmt/with_config/subdir/a.ts @@ -3,7 +3,7 @@ Deno.test( async function responseClone() { const response = await fetch( - 'http://localhost:4545/fixture.json', + 'http://localhost:4545/assets/fixture.json', ); const response1 = response.clone(); diff --git a/cli/tests/testdata/fmt/with_config/subdir/b.ts b/cli/tests/testdata/fmt/with_config/subdir/b.ts index 840198d89..d7eb08b09 100644 --- a/cli/tests/testdata/fmt/with_config/subdir/b.ts +++ b/cli/tests/testdata/fmt/with_config/subdir/b.ts @@ -3,10 +3,10 @@ Deno.test( { perms: { net: true } }, async function fetchBodyUsedCancelStream() { const response = await fetch( - "http://localhost:4545/fixture.json", + "http://localhost:4545/assets/fixture.json", ); assert(response.body !== null); - + assertEquals(response.bodyUsed, false); const promise = response.body.cancel(); assertEquals(response.bodyUsed, true); diff --git a/cli/tests/testdata/followup_dyn_import_resolves/main.ts b/cli/tests/testdata/followup_dyn_import_resolves/main.ts deleted file mode 100644 index a8508f942..000000000 --- a/cli/tests/testdata/followup_dyn_import_resolves/main.ts +++ /dev/null @@ -1,14 +0,0 @@ -// https://github.com/denoland/deno/issues/14726 - -// Any dynamic modules that are only pending on a TLA import should be resolved -// in the same event loop iteration as the imported module. - -// Long-running timer so the event loop doesn't have a next iteration for a -// while. -setTimeout(() => {}, 24 * 60 * 60 * 1000); - -await import("./sub1.ts"); - -// If we reach here, the test is passed. -console.log("Done."); -Deno.exit(); diff --git a/cli/tests/testdata/followup_dyn_import_resolves/main.ts.out b/cli/tests/testdata/followup_dyn_import_resolves/main.ts.out deleted file mode 100644 index a19976d4a..000000000 --- a/cli/tests/testdata/followup_dyn_import_resolves/main.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -sub2 -sub1 -Done. diff --git a/cli/tests/testdata/followup_dyn_import_resolves/sub1.ts b/cli/tests/testdata/followup_dyn_import_resolves/sub1.ts deleted file mode 100644 index d06c30221..000000000 --- a/cli/tests/testdata/followup_dyn_import_resolves/sub1.ts +++ /dev/null @@ -1,2 +0,0 @@ -await import("./sub2.ts"); -console.log("sub1"); diff --git a/cli/tests/testdata/followup_dyn_import_resolves/sub2.ts b/cli/tests/testdata/followup_dyn_import_resolves/sub2.ts deleted file mode 100644 index cce2b524c..000000000 --- a/cli/tests/testdata/followup_dyn_import_resolves/sub2.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("sub2"); diff --git a/cli/tests/testdata/future_check.ts b/cli/tests/testdata/future_check.ts deleted file mode 100644 index 4d41fe06a..000000000 --- a/cli/tests/testdata/future_check.ts +++ /dev/null @@ -1 +0,0 @@ -Deno.metrics(); diff --git a/cli/tests/testdata/future_check2.out b/cli/tests/testdata/future_check2.out deleted file mode 100644 index c626a5485..000000000 --- a/cli/tests/testdata/future_check2.out +++ /dev/null @@ -1 +0,0 @@ -Check [WILDCARD]/future_check.ts diff --git a/cli/tests/testdata/heapstats.js b/cli/tests/testdata/heapstats.js deleted file mode 100644 index 1f06e7f6e..000000000 --- a/cli/tests/testdata/heapstats.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -"use strict"; - -function allocTest(alloc, allocAssert, deallocAssert) { - // Helper func that GCs then returns memory usage - const sample = () => { - // deno-lint-ignore no-undef - gc(); - return Deno.memoryUsage(); - }; - const delta = (t1, t2) => t2.heapUsed - t1.heapUsed; - - // Sample "clean" heap usage - const t1 = sample(); - - // Alloc - // deno-lint-ignore no-unused-vars - let x = alloc(); - const t2 = sample(); - allocAssert(delta(t1, t2)); - - // Free - x = null; - const t3 = sample(); - deallocAssert(delta(t2, t3)); -} - -function main() { - // Large-array test, 1M slot array consumes ~4MB (4B per slot) - allocTest( - () => new Array(1e6), - (delta) => console.log("Allocated:", Math.round(delta / 1e6) + "MB"), - (delta) => console.log("Freed:", Math.round(delta / 1e6) + "MB"), - ); -} - -main(); diff --git a/cli/tests/testdata/heapstats.js.out b/cli/tests/testdata/heapstats.js.out deleted file mode 100644 index b75a755f8..000000000 --- a/cli/tests/testdata/heapstats.js.out +++ /dev/null @@ -1,2 +0,0 @@ -Allocated: 4MB -Freed: -4MB diff --git a/cli/tests/testdata/hello.txt b/cli/tests/testdata/hello.txt deleted file mode 100644 index 6769dd60b..000000000 --- a/cli/tests/testdata/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! \ No newline at end of file diff --git a/cli/tests/testdata/http2_request_url.ts b/cli/tests/testdata/http2_request_url.ts deleted file mode 100644 index 5acff8cc2..000000000 --- a/cli/tests/testdata/http2_request_url.ts +++ /dev/null @@ -1,12 +0,0 @@ -const listener = Deno.listen({ - port: Number(Deno.args[0]), -}); - -console.log("READY"); - -for await (const conn of listener) { - for await (const { request, respondWith } of Deno.serveHttp(conn)) { - const href = new URL(request.url).href; - respondWith(new Response(href)); - } -} diff --git a/cli/tests/testdata/https_import.ts b/cli/tests/testdata/https_import.ts deleted file mode 100644 index 3bcc90326..000000000 --- a/cli/tests/testdata/https_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello } from "https://localhost:5545/subdir/print_hello.ts"; - -printHello(); diff --git a/cli/tests/testdata/https_import.ts.out b/cli/tests/testdata/https_import.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/testdata/https_import.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/testdata/if_main.ts b/cli/tests/testdata/if_main.ts deleted file mode 100644 index 4dcfecea0..000000000 --- a/cli/tests/testdata/if_main.ts +++ /dev/null @@ -1,6 +0,0 @@ -if (import.meta.main) { - console.log("main"); -} else { - console.log("import.meta.url", import.meta.url); - throw Error("not main"); -} diff --git a/cli/tests/testdata/if_main.ts.out b/cli/tests/testdata/if_main.ts.out deleted file mode 100644 index ba2906d06..000000000 --- a/cli/tests/testdata/if_main.ts.out +++ /dev/null @@ -1 +0,0 @@ -main diff --git a/cli/tests/testdata/ignore_require.js b/cli/tests/testdata/ignore_require.js deleted file mode 100644 index a8ef15021..000000000 --- a/cli/tests/testdata/ignore_require.js +++ /dev/null @@ -1,2 +0,0 @@ -// deno-lint-ignore-file -require("invalid module specifier"); diff --git a/cli/tests/testdata/import_blob_url.ts b/cli/tests/testdata/import_blob_url.ts deleted file mode 100644 index 86bb634e1..000000000 --- a/cli/tests/testdata/import_blob_url.ts +++ /dev/null @@ -1,13 +0,0 @@ -const blob = new Blob( - ['export const a = "a";\n\nexport enum A {\n A,\n B,\n C,\n}\n'], - { - type: "application/typescript", - }, -); -const url = URL.createObjectURL(blob); - -const a = await import(url); - -console.log(a.a); -console.log(a.A); -console.log(a.A.A); diff --git a/cli/tests/testdata/import_blob_url.ts.out b/cli/tests/testdata/import_blob_url.ts.out deleted file mode 100644 index bfa0b9d94..000000000 --- a/cli/tests/testdata/import_blob_url.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -a -{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } -0 diff --git a/cli/tests/testdata/import_blob_url_error_stack.ts b/cli/tests/testdata/import_blob_url_error_stack.ts deleted file mode 100644 index f9c4f2e9d..000000000 --- a/cli/tests/testdata/import_blob_url_error_stack.ts +++ /dev/null @@ -1,13 +0,0 @@ -const blob = new Blob( - [ - "enum A {\n A,\n B,\n C,\n }\n \n export function a() {\n throw new Error(`Hello ${A.C}`);\n }\n ", - ], - { - type: "application/typescript", - }, -); -const url = URL.createObjectURL(blob); - -const { a } = await import(url); - -a(); diff --git a/cli/tests/testdata/import_blob_url_error_stack.ts.out b/cli/tests/testdata/import_blob_url_error_stack.ts.out deleted file mode 100644 index 52b76fd5c..000000000 --- a/cli/tests/testdata/import_blob_url_error_stack.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught (in promise) Error: Hello 2 - throw new Error(`Hello ${A.C}`); - ^ - at a (blob:null/[WILDCARD]:8:10) - at file:///[WILDCARD]/import_blob_url_error_stack.ts:13:1 -[WILDCARD] diff --git a/cli/tests/testdata/import_blob_url_import_relative.ts b/cli/tests/testdata/import_blob_url_import_relative.ts deleted file mode 100644 index ad130bdac..000000000 --- a/cli/tests/testdata/import_blob_url_import_relative.ts +++ /dev/null @@ -1,8 +0,0 @@ -const blob = new Blob(['export { a } from "./a.ts";'], { - type: "application/javascript", -}); -const url = URL.createObjectURL(blob); - -const a = await import(url); - -console.log(a); diff --git a/cli/tests/testdata/import_blob_url_import_relative.ts.out b/cli/tests/testdata/import_blob_url_import_relative.ts.out deleted file mode 100644 index 59a6f07fb..000000000 --- a/cli/tests/testdata/import_blob_url_import_relative.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: invalid URL: relative URL with a cannot-be-a-base base - at blob:null/[WILDCARD]:1:19 -const a = await import(url); - ^ - at async file://[WILDCARD]/import_blob_url_import_relative.ts:6:11 diff --git a/cli/tests/testdata/import_blob_url_imports.ts b/cli/tests/testdata/import_blob_url_imports.ts deleted file mode 100644 index a7c639152..000000000 --- a/cli/tests/testdata/import_blob_url_imports.ts +++ /dev/null @@ -1,11 +0,0 @@ -const blob = new Blob( - [ - 'export { printHello } from "http://localhost:4545/subdir/mod2.ts"', - ], - { type: "application/javascript" }, -); -const url = URL.createObjectURL(blob); - -const { printHello } = await import(url); - -printHello(); diff --git a/cli/tests/testdata/import_blob_url_imports.ts.out b/cli/tests/testdata/import_blob_url_imports.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/testdata/import_blob_url_imports.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/testdata/import_blob_url_jsx.ts b/cli/tests/testdata/import_blob_url_jsx.ts deleted file mode 100644 index 8d645796a..000000000 --- a/cli/tests/testdata/import_blob_url_jsx.ts +++ /dev/null @@ -1,16 +0,0 @@ -const blob = new Blob( - ["export default function() {\n return
Hello Deno!
\n}\n"], - { type: "text/jsx" }, -); -const url = URL.createObjectURL(blob); - -const { default: render } = await import(url); - -// deno-lint-ignore no-explicit-any -(globalThis as any).React = { - createElement(...args: unknown[]) { - console.log(...args); - }, -}; - -render(); diff --git a/cli/tests/testdata/import_blob_url_jsx.ts.out b/cli/tests/testdata/import_blob_url_jsx.ts.out deleted file mode 100644 index c1c85f250..000000000 --- a/cli/tests/testdata/import_blob_url_jsx.ts.out +++ /dev/null @@ -1 +0,0 @@ -div null Hello Deno! diff --git a/cli/tests/testdata/import_data_url.ts b/cli/tests/testdata/import_data_url.ts deleted file mode 100644 index 258514a5e..000000000 --- a/cli/tests/testdata/import_data_url.ts +++ /dev/null @@ -1,12 +0,0 @@ -// export const a = "a"; - -// export enum A { -// A, -// B, -// C, -// } -import * as a from "data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo="; - -console.log(a.a); -console.log(a.A); -console.log(a.A.A); diff --git a/cli/tests/testdata/import_data_url.ts.out b/cli/tests/testdata/import_data_url.ts.out deleted file mode 100644 index bfa0b9d94..000000000 --- a/cli/tests/testdata/import_data_url.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -a -{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } -0 diff --git a/cli/tests/testdata/import_data_url_error_stack.ts b/cli/tests/testdata/import_data_url_error_stack.ts deleted file mode 100644 index 022e49fe1..000000000 --- a/cli/tests/testdata/import_data_url_error_stack.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { a } from "data:application/typescript;base64,ZW51bSBBIHsKICBBLAogIEIsCiAgQywKIH0KIAogZXhwb3J0IGZ1bmN0aW9uIGEoKSB7CiAgIHRocm93IG5ldyBFcnJvcihgSGVsbG8gJHtBLkN9YCk7CiB9CiA="; - -a(); diff --git a/cli/tests/testdata/import_data_url_error_stack.ts.out b/cli/tests/testdata/import_data_url_error_stack.ts.out deleted file mode 100644 index ccd72e4ad..000000000 --- a/cli/tests/testdata/import_data_url_error_stack.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught Error: Hello 2 - throw new Error(`Hello ${A.C}`); - ^ - at a (data:application/typescript;base64,ZW51bSBBIHsKICBBLAog......JHtBLkN9YCk7CiB9CiA=:8:10) - at file:///[WILDCARD]/import_data_url_error_stack.ts:3:1 -[WILDCARD] diff --git a/cli/tests/testdata/import_data_url_import_relative.ts b/cli/tests/testdata/import_data_url_import_relative.ts deleted file mode 100644 index 23947fe60..000000000 --- a/cli/tests/testdata/import_data_url_import_relative.ts +++ /dev/null @@ -1,4 +0,0 @@ -// export { a } from "./a.ts"; -import * as a from "data:application/javascript;base64,ZXhwb3J0IHsgYSB9IGZyb20gIi4vYS50cyI7Cg=="; - -console.log(a); diff --git a/cli/tests/testdata/import_data_url_import_relative.ts.out b/cli/tests/testdata/import_data_url_import_relative.ts.out deleted file mode 100644 index 821c3e4df..000000000 --- a/cli/tests/testdata/import_data_url_import_relative.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -error: invalid URL: relative URL with a cannot-be-a-base base - at data:application/javascript;base64,ZXhwb3J0IHsgYSB9IGZyb20gIi4vYS50cyI7Cg==:1:19 diff --git a/cli/tests/testdata/import_data_url_imports.ts b/cli/tests/testdata/import_data_url_imports.ts deleted file mode 100644 index df7dae727..000000000 --- a/cli/tests/testdata/import_data_url_imports.ts +++ /dev/null @@ -1,4 +0,0 @@ -// export { printHello } from "http://localhost:4545/subdir/mod2.ts"; -import { printHello } from "data:application/typescript;base64,ZXhwb3J0IHsgcHJpbnRIZWxsbyB9IGZyb20gImh0dHA6Ly9sb2NhbGhvc3Q6NDU0NS9zdWJkaXIvbW9kMi50cyI7"; - -printHello(); diff --git a/cli/tests/testdata/import_data_url_imports.ts.out b/cli/tests/testdata/import_data_url_imports.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/testdata/import_data_url_imports.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/testdata/import_data_url_jsx.ts b/cli/tests/testdata/import_data_url_jsx.ts deleted file mode 100644 index 1881211f9..000000000 --- a/cli/tests/testdata/import_data_url_jsx.ts +++ /dev/null @@ -1,10 +0,0 @@ -import render from "data:text/jsx;base64,ZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24oKSB7CiAgcmV0dXJuIDxkaXY+SGVsbG8gRGVubyE8L2Rpdj4KfQo="; - -// deno-lint-ignore no-explicit-any -(globalThis as any).React = { - createElement(...args: unknown[]) { - console.log(...args); - }, -}; - -render(); diff --git a/cli/tests/testdata/import_data_url_jsx.ts.out b/cli/tests/testdata/import_data_url_jsx.ts.out deleted file mode 100644 index c1c85f250..000000000 --- a/cli/tests/testdata/import_data_url_jsx.ts.out +++ /dev/null @@ -1 +0,0 @@ -div null Hello Deno! diff --git a/cli/tests/testdata/import_dynamic_data_url.ts b/cli/tests/testdata/import_dynamic_data_url.ts deleted file mode 100644 index 53a0fbcd3..000000000 --- a/cli/tests/testdata/import_dynamic_data_url.ts +++ /dev/null @@ -1,14 +0,0 @@ -// export const a = "a"; - -// export enum A { -// A, -// B, -// C, -// } -const a = await import( - "data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=" -); - -console.log(a.a); -console.log(a.A); -console.log(a.A.A); diff --git a/cli/tests/testdata/import_dynamic_data_url.ts.out b/cli/tests/testdata/import_dynamic_data_url.ts.out deleted file mode 100644 index bfa0b9d94..000000000 --- a/cli/tests/testdata/import_dynamic_data_url.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -a -{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } -0 diff --git a/cli/tests/testdata/import_extensionless.ts b/cli/tests/testdata/import_extensionless.ts deleted file mode 100644 index 689d553ff..000000000 --- a/cli/tests/testdata/import_extensionless.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello3 } from "http://localhost:4545/v1/extensionless"; - -printHello3(); diff --git a/cli/tests/testdata/import_extensionless.ts.out b/cli/tests/testdata/import_extensionless.ts.out deleted file mode 100644 index 699b756ed..000000000 --- a/cli/tests/testdata/import_extensionless.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -Hello diff --git a/cli/tests/testdata/import_file_with_colon.ts b/cli/tests/testdata/import_file_with_colon.ts deleted file mode 100644 index 619bdd66d..000000000 --- a/cli/tests/testdata/import_file_with_colon.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/subdir/file_with_:_in_name.ts"; diff --git a/cli/tests/testdata/import_file_with_colon.ts.out b/cli/tests/testdata/import_file_with_colon.ts.out deleted file mode 100644 index f60bbf4b1..000000000 --- a/cli/tests/testdata/import_file_with_colon.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello from file_with_:_in_name.ts diff --git a/cli/tests/testdata/import_meta.importmap.json b/cli/tests/testdata/import_meta.importmap.json deleted file mode 100644 index f8c056afd..000000000 --- a/cli/tests/testdata/import_meta.importmap.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "imports": { - "bare": "https://example.com/", - "https://example.com/rewrite": "https://example.com/rewritten", - - "1": "https://example.com/PASS-1", - "null": "https://example.com/PASS-null", - "undefined": "https://example.com/PASS-undefined", - "[object Object]": "https://example.com/PASS-object" - } -} diff --git a/cli/tests/testdata/import_meta.ts b/cli/tests/testdata/import_meta.ts deleted file mode 100644 index 37af69020..000000000 --- a/cli/tests/testdata/import_meta.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { assertThrows } from "../../../test_util/std/testing/asserts.ts"; - -console.log("import_meta", import.meta.url, import.meta.main); - -import "./import_meta2.ts"; - -console.log("Resolving ./foo.js", import.meta.resolve("./foo.js")); -console.log("Resolving bare from import map", import.meta.resolve("bare")); -console.log( - "Resolving https://example.com/rewrite from import map", - import.meta.resolve("https://example.com/rewrite"), -); -console.log( - "Resolving without a value from import map", - import.meta.resolve(), -); -console.log( - "Resolving 1 from import map", - import.meta.resolve(1), -); -console.log( - "Resolving null from import map", - import.meta.resolve(null), -); -console.log( - "Resolving object from import map", - import.meta.resolve({}), -); -assertThrows(() => { - import.meta.resolve("too", "many", "arguments"); -}, TypeError); -assertThrows(() => { - import.meta.resolve("://malformed/url?asdf"); -}, TypeError); diff --git a/cli/tests/testdata/import_meta.ts.out b/cli/tests/testdata/import_meta.ts.out deleted file mode 100644 index a431f61df..000000000 --- a/cli/tests/testdata/import_meta.ts.out +++ /dev/null @@ -1,9 +0,0 @@ -import_meta2 [WILDCARD]import_meta2.ts false -import_meta [WILDCARD]import_meta.ts true -Resolving ./foo.js file:///[WILDCARD]/foo.js -Resolving bare from import map https://example.com/ -Resolving https://example.com/rewrite from import map https://example.com/rewritten -Resolving without a value from import map https://example.com/PASS-undefined -Resolving 1 from import map https://example.com/PASS-1 -Resolving null from import map https://example.com/PASS-null -Resolving object from import map https://example.com/PASS-object diff --git a/cli/tests/testdata/import_meta2.ts b/cli/tests/testdata/import_meta2.ts deleted file mode 100644 index 7f59a5a46..000000000 --- a/cli/tests/testdata/import_meta2.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("import_meta2", import.meta.url, import.meta.main); diff --git a/cli/tests/testdata/import_type.ts b/cli/tests/testdata/import_type.ts deleted file mode 100644 index 851ebad86..000000000 --- a/cli/tests/testdata/import_type.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { type B, create } from "./subdir/export_types.ts"; - -const b: B = create(); - -console.log(b); diff --git a/cli/tests/testdata/import_type.ts.out b/cli/tests/testdata/import_type.ts.out deleted file mode 100644 index 188c5e25d..000000000 --- a/cli/tests/testdata/import_type.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -B { a: "a" } diff --git a/cli/tests/testdata/info/031_info_ts_error.out b/cli/tests/testdata/info/031_info_ts_error.out new file mode 100644 index 000000000..2dc7bb4e8 --- /dev/null +++ b/cli/tests/testdata/info/031_info_ts_error.out @@ -0,0 +1,5 @@ +[WILDCARD] +local: [WILDCARD]031_info_ts_error.ts +type: TypeScript +dependencies: 0 unique (total [WILDCARD]) +[WILDCARD]031_info_ts_error.ts ([WILDCARD]) diff --git a/cli/tests/testdata/info/031_info_ts_error.ts b/cli/tests/testdata/info/031_info_ts_error.ts new file mode 100644 index 000000000..9b7492dbe --- /dev/null +++ b/cli/tests/testdata/info/031_info_ts_error.ts @@ -0,0 +1 @@ +const _foo: string = 1; diff --git a/cli/tests/testdata/info/041_info_flag.out b/cli/tests/testdata/info/041_info_flag.out new file mode 100644 index 000000000..3506a29e4 --- /dev/null +++ b/cli/tests/testdata/info/041_info_flag.out @@ -0,0 +1,6 @@ +DENO_DIR location: [WILDCARD] +Remote modules cache: [WILDCARD]deps +npm modules cache: [WILDCARD]npm +Emitted modules cache: [WILDCARD]gen +Language server registries cache: [WILDCARD]registries +Origin storage: [WILDCARD]location_data diff --git a/cli/tests/testdata/info/041_info_flag_location.out b/cli/tests/testdata/info/041_info_flag_location.out new file mode 100644 index 000000000..b9e72f659 --- /dev/null +++ b/cli/tests/testdata/info/041_info_flag_location.out @@ -0,0 +1,7 @@ +DENO_DIR location: [WILDCARD] +Remote modules cache: [WILDCARD]deps +npm modules cache: [WILDCARD]npm +Emitted modules cache: [WILDCARD]gen +Language server registries cache: [WILDCARD]registries +Origin storage: [WILDCARD]location_data[WILDCARD] +Local Storage: [WILDCARD]location_data[WILDCARD]local_storage diff --git a/cli/tests/testdata/info/049_info_flag_script_jsx.out b/cli/tests/testdata/info/049_info_flag_script_jsx.out new file mode 100644 index 000000000..16736c893 --- /dev/null +++ b/cli/tests/testdata/info/049_info_flag_script_jsx.out @@ -0,0 +1,14 @@ +[WILDCARD] +local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD] +type: TypeScript +dependencies: 8 unique (total [WILDCARD]) + +http://127.0.0.1:4545/run/048_media_types_jsx.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_ecmascript_jsx.j2.jsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_x_javascript_jsx.j4.jsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_x_typescript_tsx.t4.tsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_ecmascript_jsx.j3.jsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_javascript_jsx.j1.jsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_typescript_tsx.t1.tsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_video_mp2t_tsx.t3.tsx ([WILDCARD]) +└── http://localhost:4545/subdir/mt_video_vdn_tsx.t2.tsx ([WILDCARD]) diff --git a/cli/tests/testdata/info/054_info_local_imports.out b/cli/tests/testdata/info/054_info_local_imports.out new file mode 100644 index 000000000..cde5ff3ab --- /dev/null +++ b/cli/tests/testdata/info/054_info_local_imports.out @@ -0,0 +1,8 @@ +local: [WILDCARD]005_more_imports.ts +type: TypeScript +dependencies: 3 unique (total [WILDCARD]) + +file://[WILDCARD]/005_more_imports.ts ([WILDCARD]) +└─┬ file://[WILDCARD]/subdir/mod1.ts ([WILDCARD]) + └─┬ file://[WILDCARD]/subdir/subdir2/mod2.ts ([WILDCARD]) + └── file://[WILDCARD]/subdir/print_hello.ts ([WILDCARD]) diff --git a/cli/tests/testdata/info/065_import_map_info.out b/cli/tests/testdata/info/065_import_map_info.out new file mode 100644 index 000000000..8771d0594 --- /dev/null +++ b/cli/tests/testdata/info/065_import_map_info.out @@ -0,0 +1,5 @@ +[WILDCARD] +local: [WILDCARD]test.ts +type: TypeScript +dependencies: 7 unique (total [WILDCARD]) +[WILDCARD] diff --git a/cli/tests/testdata/info/076_info_json_deps_order.out b/cli/tests/testdata/info/076_info_json_deps_order.out new file mode 100644 index 000000000..db890ef02 --- /dev/null +++ b/cli/tests/testdata/info/076_info_json_deps_order.out @@ -0,0 +1,163 @@ +{ + "roots": [ + "file://[WILDCARD]/076_info_json_deps_order.ts" + ], + "modules": [ + { + "dependencies": [ + { + "specifier": "./recursive_imports/A.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/A.ts", + "span": { + "start": { + "line": 1, + "character": 18 + }, + "end": { + "line": 1, + "character": 44 + } + } + } + } + ], + "kind": "esm", + "local": "[WILDCARD]076_info_json_deps_order.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/076_info_json_deps_order.ts" + }, + { + "dependencies": [ + { + "specifier": "./B.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/B.ts", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 26 + } + } + } + }, + { + "specifier": "./common.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/common.ts", + "span": { + "start": { + "line": 1, + "character": 22 + }, + "end": { + "line": 1, + "character": 35 + } + } + } + } + ], + "kind": "esm", + "local": "[WILDCARD]A.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/recursive_imports/A.ts" + }, + { + "dependencies": [ + { + "specifier": "./C.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/C.ts", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 26 + } + } + } + }, + { + "specifier": "./common.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/common.ts", + "span": { + "start": { + "line": 1, + "character": 22 + }, + "end": { + "line": 1, + "character": 35 + } + } + } + } + ], + "kind": "esm", + "local": "[WILDCARD]B.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/recursive_imports/B.ts" + }, + { + "dependencies": [ + { + "specifier": "./A.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/A.ts", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 26 + } + } + } + }, + { + "specifier": "./common.ts", + "code": { + "specifier": "file://[WILDCARD]/recursive_imports/common.ts", + "span": { + "start": { + "line": 1, + "character": 22 + }, + "end": { + "line": 1, + "character": 35 + } + } + } + } + ], + "kind": "esm", + "local": "[WILDCARD]C.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/recursive_imports/C.ts" + }, + { + "kind": "esm", + "local": "[WILDCARD]common.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/recursive_imports/common.ts" + } + ], + "redirects": {} +} diff --git a/cli/tests/testdata/info/076_info_json_deps_order.ts b/cli/tests/testdata/info/076_info_json_deps_order.ts new file mode 100644 index 000000000..b1ae75e68 --- /dev/null +++ b/cli/tests/testdata/info/076_info_json_deps_order.ts @@ -0,0 +1,2 @@ +// deno-lint-ignore no-unused-vars +import { A } from "./recursive_imports/A.ts"; diff --git a/cli/tests/testdata/info/error_009_missing_js_module.js b/cli/tests/testdata/info/error_009_missing_js_module.js new file mode 100644 index 000000000..e6ca88934 --- /dev/null +++ b/cli/tests/testdata/info/error_009_missing_js_module.js @@ -0,0 +1 @@ +import "./bad-module.js"; diff --git a/cli/tests/testdata/info/error_009_missing_js_module.js.out b/cli/tests/testdata/info/error_009_missing_js_module.js.out new file mode 100644 index 000000000..edb08da1c --- /dev/null +++ b/cli/tests/testdata/info/error_009_missing_js_module.js.out @@ -0,0 +1 @@ +Cannot resolve module "./bad-module.js" from "[WILDCARD]error_009_missing_js_module.js" diff --git a/cli/tests/testdata/info/info_json.out b/cli/tests/testdata/info/info_json.out new file mode 100644 index 000000000..3215af742 --- /dev/null +++ b/cli/tests/testdata/info/info_json.out @@ -0,0 +1,8 @@ +{ + "denoDir": "[WILDCARD]", + "modulesCache": "[WILDCARD]deps", + "npmCache": "[WILDCARD]npm", + "typescriptCache": "[WILDCARD]gen", + "registryCache": "[WILDCARD]registries", + "originStorage": "[WILDCARD]location_data" +} diff --git a/cli/tests/testdata/info/info_json_location.out b/cli/tests/testdata/info/info_json_location.out new file mode 100644 index 000000000..510fa7749 --- /dev/null +++ b/cli/tests/testdata/info/info_json_location.out @@ -0,0 +1,9 @@ +{ + "denoDir": "[WILDCARD]", + "modulesCache": "[WILDCARD]deps", + "npmCache": "[WILDCARD]npm", + "typescriptCache": "[WILDCARD]gen", + "registryCache": "[WILDCARD]registries", + "originStorage": "[WILDCARD]location_data[WILDCARD]", + "localStorage": "[WILDCARD]location_data[WILDCARD]local_storage" +} diff --git a/cli/tests/testdata/info/info_missing_module.out b/cli/tests/testdata/info/info_missing_module.out new file mode 100644 index 000000000..07f893eec --- /dev/null +++ b/cli/tests/testdata/info/info_missing_module.out @@ -0,0 +1,6 @@ +local: [WILDCARD]error_009_missing_js_module.js +type: JavaScript +dependencies: 0 unique (total 26B) + +file://[WILDCARD]/error_009_missing_js_module.js (26B) +└── file://[WILDCARD]/bad-module.js (missing) diff --git a/cli/tests/testdata/info/info_recursive_imports_test.out b/cli/tests/testdata/info/info_recursive_imports_test.out new file mode 100644 index 000000000..10ee54534 --- /dev/null +++ b/cli/tests/testdata/info/info_recursive_imports_test.out @@ -0,0 +1,12 @@ +local: [WILDCARD]info_recursive_imports_test.ts +type: TypeScript +dependencies: 4 unique (total [WILDCARD]) + +file://[WILDCARD]/info_recursive_imports_test.ts ([WILDCARD]) +└─┬ file://[WILDCARD]/recursive_imports/A.ts ([WILDCARD]) + ├─┬ file://[WILDCARD]/recursive_imports/B.ts ([WILDCARD]) + │ ├─┬ file://[WILDCARD]/recursive_imports/C.ts ([WILDCARD]) + │ │ ├── file://[WILDCARD]/recursive_imports/A.ts * + │ │ └── file://[WILDCARD]/recursive_imports/common.ts ([WILDCARD]) + │ └── file://[WILDCARD]/recursive_imports/common.ts * + └── file://[WILDCARD]/recursive_imports/common.ts * diff --git a/cli/tests/testdata/info/info_recursive_imports_test.ts b/cli/tests/testdata/info/info_recursive_imports_test.ts new file mode 100644 index 000000000..c9ba44755 --- /dev/null +++ b/cli/tests/testdata/info/info_recursive_imports_test.ts @@ -0,0 +1,5 @@ +import { A } from "./recursive_imports/A.ts"; + +export function test() { + A(); +} diff --git a/cli/tests/testdata/info/info_type_import.out b/cli/tests/testdata/info/info_type_import.out new file mode 100644 index 000000000..6b9869f1f --- /dev/null +++ b/cli/tests/testdata/info/info_type_import.out @@ -0,0 +1,5 @@ +local: [WILDCARD]info_type_import.ts +type: TypeScript +dependencies: 1 unique (total [WILDCARD]) +[WILDCARD]info_type_import.ts ([WILDCARD]) +└── [WILDCARD]type_and_code.ts ([WILDCARD]) diff --git a/cli/tests/testdata/info/info_type_import.ts b/cli/tests/testdata/info/info_type_import.ts new file mode 100644 index 000000000..4db9f3387 --- /dev/null +++ b/cli/tests/testdata/info/info_type_import.ts @@ -0,0 +1,3 @@ +import { AnInterface as _, isAnInterface } from "../subdir/type_and_code.ts"; + +isAnInterface({}); diff --git a/cli/tests/testdata/info/json_output/main.out b/cli/tests/testdata/info/json_output/main.out new file mode 100644 index 000000000..124fc7351 --- /dev/null +++ b/cli/tests/testdata/info/json_output/main.out @@ -0,0 +1,90 @@ +{ + "roots": [ + "file://[WILDCARD]/info/json_output/main.ts" + ], + "modules": [ + { + "dependencies": [ + { + "specifier": "../../subdir/mod1.ts", + "code": { + "specifier": "file://[WILDCARD]/subdir/mod1.ts", + "span": { + "start": { + "line": 0, + "character": 52 + }, + "end": { + "line": 0, + "character": 74 + } + } + } + } + ], + "kind": "esm", + "local": "[WILDCARD]main.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/json_output/main.ts" + }, + { + "dependencies": [ + { + "specifier": "./subdir2/mod2.ts", + "code": { + "specifier": "file://[WILDCARD]/subdir/subdir2/mod2.ts", + "span": { + "start": { + "line": 0, + "character": 40 + }, + "end": { + "line": 0, + "character": 59 + } + } + } + } + ], + "kind": "esm", + "local": "[WILDCARD]mod1.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/subdir/mod1.ts" + }, + { + "kind": "esm", + "local": "[WILDCARD]print_hello.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/subdir/print_hello.ts" + }, + { + "dependencies": [ + { + "specifier": "../print_hello.ts", + "code": { + "specifier": "file://[WILDCARD]/subdir/print_hello.ts", + "span": { + "start": { + "line": 0, + "character": 27 + }, + "end": { + "line": 0, + "character": 46 + } + } + } + } + ], + "kind": "esm", + "local": "[WILDCARD]mod2.ts", + [WILDCARD] + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/subdir/subdir2/mod2.ts" + } + ], + "redirects": {} +} diff --git a/cli/tests/testdata/info/json_output/main.ts b/cli/tests/testdata/info/json_output/main.ts new file mode 100644 index 000000000..927bc55ed --- /dev/null +++ b/cli/tests/testdata/info/json_output/main.ts @@ -0,0 +1,11 @@ +import { printHello3, returnsFoo2, returnsHi } from "../../subdir/mod1.ts"; + +printHello3(); + +if (returnsHi() !== "Hi") { + throw Error("Unexpected"); +} + +if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); +} diff --git a/cli/tests/testdata/info/multiple_imports.out b/cli/tests/testdata/info/multiple_imports.out new file mode 100644 index 000000000..d4e315397 --- /dev/null +++ b/cli/tests/testdata/info/multiple_imports.out @@ -0,0 +1,14 @@ +[WILDCARD] +local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD] +type: TypeScript +dependencies: 8 unique (total [WILDCARD]) + +http://127.0.0.1:4545/run/019_media_types.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_ecmascript.j2.js ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_x_javascript.j4.js ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_x_typescript.t4.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_ecmascript.j3.js ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_javascript.j1.js ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_typescript.t1.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_video_mp2t.t3.ts ([WILDCARD]) +└── http://localhost:4545/subdir/mt_video_vdn.t2.ts ([WILDCARD]) diff --git a/cli/tests/testdata/info/recursive_imports/A.ts b/cli/tests/testdata/info/recursive_imports/A.ts new file mode 100644 index 000000000..43ecdbe5e --- /dev/null +++ b/cli/tests/testdata/info/recursive_imports/A.ts @@ -0,0 +1,7 @@ +import { B } from "./B.ts"; +import { thing } from "./common.ts"; + +export function A() { + thing(); + B(); +} diff --git a/cli/tests/testdata/info/recursive_imports/B.ts b/cli/tests/testdata/info/recursive_imports/B.ts new file mode 100644 index 000000000..9fff0fdc9 --- /dev/null +++ b/cli/tests/testdata/info/recursive_imports/B.ts @@ -0,0 +1,7 @@ +import { C } from "./C.ts"; +import { thing } from "./common.ts"; + +export function B() { + thing(); + C(); +} diff --git a/cli/tests/testdata/info/recursive_imports/C.ts b/cli/tests/testdata/info/recursive_imports/C.ts new file mode 100644 index 000000000..e47e77b41 --- /dev/null +++ b/cli/tests/testdata/info/recursive_imports/C.ts @@ -0,0 +1,8 @@ +import { A } from "./A.ts"; +import { thing } from "./common.ts"; + +export function C() { + if (A != null) { + thing(); + } +} diff --git a/cli/tests/testdata/info/recursive_imports/common.ts b/cli/tests/testdata/info/recursive_imports/common.ts new file mode 100644 index 000000000..2b16a7bf1 --- /dev/null +++ b/cli/tests/testdata/info/recursive_imports/common.ts @@ -0,0 +1,2 @@ +export function thing() { +} diff --git a/cli/tests/testdata/info_json.out b/cli/tests/testdata/info_json.out deleted file mode 100644 index 3215af742..000000000 --- a/cli/tests/testdata/info_json.out +++ /dev/null @@ -1,8 +0,0 @@ -{ - "denoDir": "[WILDCARD]", - "modulesCache": "[WILDCARD]deps", - "npmCache": "[WILDCARD]npm", - "typescriptCache": "[WILDCARD]gen", - "registryCache": "[WILDCARD]registries", - "originStorage": "[WILDCARD]location_data" -} diff --git a/cli/tests/testdata/info_json_location.out b/cli/tests/testdata/info_json_location.out deleted file mode 100644 index 510fa7749..000000000 --- a/cli/tests/testdata/info_json_location.out +++ /dev/null @@ -1,9 +0,0 @@ -{ - "denoDir": "[WILDCARD]", - "modulesCache": "[WILDCARD]deps", - "npmCache": "[WILDCARD]npm", - "typescriptCache": "[WILDCARD]gen", - "registryCache": "[WILDCARD]registries", - "originStorage": "[WILDCARD]location_data[WILDCARD]", - "localStorage": "[WILDCARD]location_data[WILDCARD]local_storage" -} diff --git a/cli/tests/testdata/info_missing_module.out b/cli/tests/testdata/info_missing_module.out deleted file mode 100644 index 07f893eec..000000000 --- a/cli/tests/testdata/info_missing_module.out +++ /dev/null @@ -1,6 +0,0 @@ -local: [WILDCARD]error_009_missing_js_module.js -type: JavaScript -dependencies: 0 unique (total 26B) - -file://[WILDCARD]/error_009_missing_js_module.js (26B) -└── file://[WILDCARD]/bad-module.js (missing) diff --git a/cli/tests/testdata/info_recursive_imports_test.out b/cli/tests/testdata/info_recursive_imports_test.out deleted file mode 100644 index 10ee54534..000000000 --- a/cli/tests/testdata/info_recursive_imports_test.out +++ /dev/null @@ -1,12 +0,0 @@ -local: [WILDCARD]info_recursive_imports_test.ts -type: TypeScript -dependencies: 4 unique (total [WILDCARD]) - -file://[WILDCARD]/info_recursive_imports_test.ts ([WILDCARD]) -└─┬ file://[WILDCARD]/recursive_imports/A.ts ([WILDCARD]) - ├─┬ file://[WILDCARD]/recursive_imports/B.ts ([WILDCARD]) - │ ├─┬ file://[WILDCARD]/recursive_imports/C.ts ([WILDCARD]) - │ │ ├── file://[WILDCARD]/recursive_imports/A.ts * - │ │ └── file://[WILDCARD]/recursive_imports/common.ts ([WILDCARD]) - │ └── file://[WILDCARD]/recursive_imports/common.ts * - └── file://[WILDCARD]/recursive_imports/common.ts * diff --git a/cli/tests/testdata/info_recursive_imports_test.ts b/cli/tests/testdata/info_recursive_imports_test.ts deleted file mode 100644 index c9ba44755..000000000 --- a/cli/tests/testdata/info_recursive_imports_test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { A } from "./recursive_imports/A.ts"; - -export function test() { - A(); -} diff --git a/cli/tests/testdata/info_type_import.out b/cli/tests/testdata/info_type_import.out deleted file mode 100644 index 6b9869f1f..000000000 --- a/cli/tests/testdata/info_type_import.out +++ /dev/null @@ -1,5 +0,0 @@ -local: [WILDCARD]info_type_import.ts -type: TypeScript -dependencies: 1 unique (total [WILDCARD]) -[WILDCARD]info_type_import.ts ([WILDCARD]) -└── [WILDCARD]type_and_code.ts ([WILDCARD]) diff --git a/cli/tests/testdata/info_type_import.ts b/cli/tests/testdata/info_type_import.ts deleted file mode 100644 index eeef46c89..000000000 --- a/cli/tests/testdata/info_type_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { AnInterface as _, isAnInterface } from "./subdir/type_and_code.ts"; - -isAnInterface({}); diff --git a/cli/tests/testdata/inline_js_source_map.ts b/cli/tests/testdata/inline_js_source_map.ts deleted file mode 100644 index 5ae7c226a..000000000 --- a/cli/tests/testdata/inline_js_source_map.ts +++ /dev/null @@ -1,6 +0,0 @@ -1 + 1; -interface Test { - hello: string; -} - -// throw new Error("Hello world!" as string); diff --git a/cli/tests/testdata/inline_js_source_map_2.js b/cli/tests/testdata/inline_js_source_map_2.js deleted file mode 100644 index 036f351b9..000000000 --- a/cli/tests/testdata/inline_js_source_map_2.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -1 + 1; -throw new Error("Hello world!"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2lubGluZV9qc19zb3VyY2VfbWFwXzIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLENBQUMsR0FBQyxDQUFDLENBQUM7QUFLSixNQUFNLElBQUksS0FBSyxDQUFDLGNBQStCLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/cli/tests/testdata/inline_js_source_map_2.js.out b/cli/tests/testdata/inline_js_source_map_2.js.out deleted file mode 100644 index 4f9127da6..000000000 --- a/cli/tests/testdata/inline_js_source_map_2.js.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Uncaught Error: Hello world! - at http://localhost:4545/inline_js_source_map_2.ts:6:7 diff --git a/cli/tests/testdata/inline_js_source_map_2.ts b/cli/tests/testdata/inline_js_source_map_2.ts deleted file mode 100644 index fa50586e6..000000000 --- a/cli/tests/testdata/inline_js_source_map_2.ts +++ /dev/null @@ -1,6 +0,0 @@ -1 + 1; -interface Test { - hello: string; -} - -throw new Error("Hello world!" as unknown as string); diff --git a/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js b/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js deleted file mode 100644 index 5bea615b8..000000000 --- a/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; - -throw new Error("Hello world!"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2lubGluZV9qc19zb3VyY2VfbWFwXzIudHMiXSwic291cmNlc0NvbnRlbnQiOlsiMSsxO1xuaW50ZXJmYWNlIFRlc3Qge1xuICBoZWxsbzogc3RyaW5nO1xufVxuXG50aHJvdyBuZXcgRXJyb3IoXCJIZWxsbyB3b3JsZCFcIiBhcyB1bmtub3duIGFzIHN0cmluZyk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLENBQUMsR0FBQyxDQUFDLENBQUM7QUFLSixNQUFNLElBQUksS0FBSyxDQUFDLGNBQStCLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out b/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out deleted file mode 100644 index 4f9127da6..000000000 --- a/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Uncaught Error: Hello world! - at http://localhost:4545/inline_js_source_map_2.ts:6:7 diff --git a/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js b/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js deleted file mode 100644 index decf47bdc..000000000 --- a/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -import "http://localhost:4545/inline_js_source_map.ts"; -throw new Error("Hello world!"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2lubGluZV9qc19zb3VyY2VfbWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js.out b/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js.out deleted file mode 100644 index 7304fc5f6..000000000 --- a/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught Error: Hello world! -// throw new Error("Hello world!" as string); - ^ - at http://localhost:4545/inline_js_source_map.ts:6:7 diff --git a/cli/tests/testdata/ip_address_unsafe_ssl.ts b/cli/tests/testdata/ip_address_unsafe_ssl.ts deleted file mode 100644 index a3268888f..000000000 --- a/cli/tests/testdata/ip_address_unsafe_ssl.ts +++ /dev/null @@ -1,2 +0,0 @@ -const r = await fetch("https://1.1.1.1"); -console.log(r.status); diff --git a/cli/tests/testdata/ip_address_unsafe_ssl.ts.out b/cli/tests/testdata/ip_address_unsafe_ssl.ts.out deleted file mode 100644 index d4ebb2617..000000000 --- a/cli/tests/testdata/ip_address_unsafe_ssl.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -DANGER: TLS certificate validation is disabled for: 1.1.1.1 -200 diff --git a/cli/tests/testdata/issue13562.ts b/cli/tests/testdata/issue13562.ts deleted file mode 100644 index 9f3134aef..000000000 --- a/cli/tests/testdata/issue13562.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello3 } from "./subdir/mod1.ts?q=.json"; - -printHello3(); diff --git a/cli/tests/testdata/issue13562.ts.out b/cli/tests/testdata/issue13562.ts.out deleted file mode 100644 index 699b756ed..000000000 --- a/cli/tests/testdata/issue13562.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -Hello diff --git a/cli/tests/testdata/issue9750.js b/cli/tests/testdata/issue9750.js deleted file mode 100644 index 89fd61629..000000000 --- a/cli/tests/testdata/issue9750.js +++ /dev/null @@ -1,6 +0,0 @@ -// Run without permissions. -const buf = new Uint8Array(1); -console.log("Enter 'yy':"); -await Deno.stdin.read(buf); -await Deno.permissions.request({ "name": "env" }); -console.log("\n\nOwned", Deno.env.get("SECRET")); diff --git a/cli/tests/testdata/js_import_detect.ts b/cli/tests/testdata/js_import_detect.ts deleted file mode 100644 index 751741996..000000000 --- a/cli/tests/testdata/js_import_detect.ts +++ /dev/null @@ -1,3 +0,0 @@ -function define(_foo: string[]) {} -define(["long"]); -console.log("ok"); diff --git a/cli/tests/testdata/js_import_detect.ts.out b/cli/tests/testdata/js_import_detect.ts.out deleted file mode 100644 index 9766475a4..000000000 --- a/cli/tests/testdata/js_import_detect.ts.out +++ /dev/null @@ -1 +0,0 @@ -ok diff --git a/cli/tests/testdata/js_root_with_ts_check.js b/cli/tests/testdata/js_root_with_ts_check.js deleted file mode 100644 index adca847ee..000000000 --- a/cli/tests/testdata/js_root_with_ts_check.js +++ /dev/null @@ -1,5 +0,0 @@ -// @ts-check - -/** @type {number} */ -const a = ""; -console.log(a); diff --git a/cli/tests/testdata/js_root_with_ts_check.js.out b/cli/tests/testdata/js_root_with_ts_check.js.out deleted file mode 100644 index 34e2fa61e..000000000 --- a/cli/tests/testdata/js_root_with_ts_check.js.out +++ /dev/null @@ -1,4 +0,0 @@ -error: TS2322 [ERROR]: Type 'string' is not assignable to type 'number'. -const a = ""; - ^ - at [WILDCARD] diff --git a/cli/tests/testdata/jsx_import_from_ts.App.jsx b/cli/tests/testdata/jsx_import_from_ts.App.jsx deleted file mode 100644 index 649230613..000000000 --- a/cli/tests/testdata/jsx_import_from_ts.App.jsx +++ /dev/null @@ -1,11 +0,0 @@ -const React = { - createElement() {}, -}; - -export default function app() { - return ( -
-

asdf

-
- ); -} diff --git a/cli/tests/testdata/jsx_import_from_ts.ts b/cli/tests/testdata/jsx_import_from_ts.ts deleted file mode 100644 index 3cc916698..000000000 --- a/cli/tests/testdata/jsx_import_from_ts.ts +++ /dev/null @@ -1,3 +0,0 @@ -import app from "./jsx_import_from_ts.App.jsx"; - -console.log(app); diff --git a/cli/tests/testdata/jsx_import_from_ts.ts.out b/cli/tests/testdata/jsx_import_from_ts.ts.out deleted file mode 100644 index d449b8c9a..000000000 --- a/cli/tests/testdata/jsx_import_from_ts.ts.out +++ /dev/null @@ -1 +0,0 @@ -[Function: app] diff --git a/cli/tests/testdata/jsx_import_source.out b/cli/tests/testdata/jsx_import_source.out deleted file mode 100644 index b9555987a..000000000 --- a/cli/tests/testdata/jsx_import_source.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime diff --git a/cli/tests/testdata/jsx_import_source_dev.out b/cli/tests/testdata/jsx_import_source_dev.out deleted file mode 100644 index 38d7a12f0..000000000 --- a/cli/tests/testdata/jsx_import_source_dev.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-dev-runtime diff --git a/cli/tests/testdata/jsx_import_source_error.out b/cli/tests/testdata/jsx_import_source_error.out deleted file mode 100644 index 634a5b09b..000000000 --- a/cli/tests/testdata/jsx_import_source_error.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Module not found "file:///[WILDCARD]/nonexistent/jsx-runtime". - at file:///[WILDCARD]/jsx_import_source_no_pragma.tsx:1:1 diff --git a/cli/tests/testdata/jsx_import_source_import_map.out b/cli/tests/testdata/jsx_import_source_import_map.out deleted file mode 100644 index 0d3238967..000000000 --- a/cli/tests/testdata/jsx_import_source_import_map.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime/index.ts diff --git a/cli/tests/testdata/jsx_import_source_import_map_dev.out b/cli/tests/testdata/jsx_import_source_import_map_dev.out deleted file mode 100644 index 56f514d90..000000000 --- a/cli/tests/testdata/jsx_import_source_import_map_dev.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-dev-runtime/index.ts diff --git a/cli/tests/testdata/jsx_import_source_no_pragma.tsx b/cli/tests/testdata/jsx_import_source_no_pragma.tsx deleted file mode 100644 index 2c756054f..000000000 --- a/cli/tests/testdata/jsx_import_source_no_pragma.tsx +++ /dev/null @@ -1,7 +0,0 @@ -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/cli/tests/testdata/jsx_import_source_pragma.tsx b/cli/tests/testdata/jsx_import_source_pragma.tsx deleted file mode 100644 index c19e53d4f..000000000 --- a/cli/tests/testdata/jsx_import_source_pragma.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/** @jsxImportSource http://localhost:4545/jsx */ - -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/cli/tests/testdata/jsx_import_source_pragma_import_map.tsx b/cli/tests/testdata/jsx_import_source_pragma_import_map.tsx deleted file mode 100644 index 548365f18..000000000 --- a/cli/tests/testdata/jsx_import_source_pragma_import_map.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/** @jsxImportSource jsx */ - -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/cli/tests/testdata/listen_tls_alpn.ts b/cli/tests/testdata/listen_tls_alpn.ts deleted file mode 100644 index b3ade686e..000000000 --- a/cli/tests/testdata/listen_tls_alpn.ts +++ /dev/null @@ -1,14 +0,0 @@ -const listener = Deno.listenTls({ - port: Number(Deno.args[0]), - certFile: "./tls/localhost.crt", - keyFile: "./tls/localhost.key", - alpnProtocols: ["h2", "http/1.1", "foobar"], -}); - -console.log("READY"); - -const conn = await listener.accept() as Deno.TlsConn; -await conn.handshake(); -conn.close(); - -listener.close(); diff --git a/cli/tests/testdata/listen_tls_alpn_fail.ts b/cli/tests/testdata/listen_tls_alpn_fail.ts deleted file mode 100644 index 04f9ec11f..000000000 --- a/cli/tests/testdata/listen_tls_alpn_fail.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { assertRejects } from "../../../test_util/std/testing/asserts.ts"; - -const listener = Deno.listenTls({ - port: Number(Deno.args[0]), - certFile: "./tls/localhost.crt", - keyFile: "./tls/localhost.key", - alpnProtocols: ["h2", "http/1.1", "foobar"], -}); - -console.log("READY"); - -const conn = await listener.accept() as Deno.TlsConn; -await assertRejects( - () => conn.handshake(), - Deno.errors.InvalidData, - "peer doesn't support any known protocol", -); -conn.close(); - -listener.close(); diff --git a/cli/tests/testdata/localhost_unsafe_ssl.ts.out b/cli/tests/testdata/localhost_unsafe_ssl.ts.out deleted file mode 100644 index 0bfaeb25d..000000000 --- a/cli/tests/testdata/localhost_unsafe_ssl.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -DANGER: TLS certificate validation is disabled for: deno.land -error: error sending request for url (https://localhost:5545/subdir/mod2.ts): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer - at file:///[WILDCARD]/cafile_url_imports.ts:[WILDCARD] diff --git a/cli/tests/testdata/lock_check_err.json b/cli/tests/testdata/lock_check_err.json deleted file mode 100644 index 9bf52adca..000000000 --- a/cli/tests/testdata/lock_check_err.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/003_relative_import.ts": "bad" -} diff --git a/cli/tests/testdata/lock_check_err.out b/cli/tests/testdata/lock_check_err.out deleted file mode 100644 index 3c5eceb8c..000000000 --- a/cli/tests/testdata/lock_check_err.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/003_relative_import.ts - Lock file: lock_check_err.json diff --git a/cli/tests/testdata/lock_check_err2.json b/cli/tests/testdata/lock_check_err2.json deleted file mode 100644 index a59cbc9e3..000000000 --- a/cli/tests/testdata/lock_check_err2.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "bad", - "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" -} diff --git a/cli/tests/testdata/lock_check_err2.out b/cli/tests/testdata/lock_check_err2.out deleted file mode 100644 index 958c01654..000000000 --- a/cli/tests/testdata/lock_check_err2.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://localhost:4545/subdir/mt_text_ecmascript.j3.js - Lock file: lock_check_err2.json diff --git a/cli/tests/testdata/lock_check_err_with_bundle.json b/cli/tests/testdata/lock_check_err_with_bundle.json deleted file mode 100644 index a218d7000..000000000 --- a/cli/tests/testdata/lock_check_err_with_bundle.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" -} diff --git a/cli/tests/testdata/lock_check_err_with_bundle.out b/cli/tests/testdata/lock_check_err_with_bundle.out deleted file mode 100644 index a20e9b3af..000000000 --- a/cli/tests/testdata/lock_check_err_with_bundle.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts - Lock file: lock_check_err_with_bundle.json diff --git a/cli/tests/testdata/lock_check_ok.json b/cli/tests/testdata/lock_check_ok.json deleted file mode 100644 index 9dd5b0548..000000000 --- a/cli/tests/testdata/lock_check_ok.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/003_relative_import.ts": "aa9e16de824f81871a1c7164d5bd6857df7db2e18621750bd66b0bde4df07f21" -} diff --git a/cli/tests/testdata/lock_check_ok2.json b/cli/tests/testdata/lock_check_ok2.json deleted file mode 100644 index 162c755e2..000000000 --- a/cli/tests/testdata/lock_check_ok2.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" -} diff --git a/cli/tests/testdata/lock_dynamic_imports.json b/cli/tests/testdata/lock_dynamic_imports.json deleted file mode 100644 index 57263bc85..000000000 --- a/cli/tests/testdata/lock_dynamic_imports.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "http://127.0.0.1:4545/013_dynamic_import.ts": "f0d2d108c100e769cda9f26b74326f21e44cab81611aa7f6cd2b731d4cbc1995", - "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" -} diff --git a/cli/tests/testdata/lock_dynamic_imports.out b/cli/tests/testdata/lock_dynamic_imports.out deleted file mode 100644 index 601d2282b..000000000 --- a/cli/tests/testdata/lock_dynamic_imports.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts - Lock file: lock_dynamic_imports.json diff --git a/cli/tests/testdata/lock_write_fetch.ts b/cli/tests/testdata/lock_write_fetch.ts deleted file mode 100644 index b403f5536..000000000 --- a/cli/tests/testdata/lock_write_fetch.ts +++ /dev/null @@ -1,52 +0,0 @@ -try { - Deno.removeSync("./lock_write_fetch.json"); -} catch { - // pass -} - -const fetchProc = await Deno.spawn(Deno.execPath(), { - stdout: "null", - stderr: "null", - args: [ - "cache", - "--reload", - "--lock=lock_write_fetch.json", - "--lock-write", - "--cert=tls/RootCA.pem", - "https_import.ts", - ], -}); - -console.log(`fetch code: ${fetchProc.code}`); - -const fetchCheckProc = await Deno.spawn(Deno.execPath(), { - stdout: "null", - stderr: "null", - args: [ - "cache", - "--lock=lock_write_fetch.json", - "--cert=tls/RootCA.pem", - "https_import.ts", - ], -}); - -console.log(`fetch check code: ${fetchCheckProc.code}`); - -Deno.removeSync("./lock_write_fetch.json"); - -const runProc = await Deno.spawn(Deno.execPath(), { - stdout: "null", - stderr: "null", - args: [ - "run", - "--lock=lock_write_fetch.json", - "--lock-write", - "--allow-read", - "file_exists.ts", - "lock_write_fetch.json", - ], -}); - -console.log(`run code: ${runProc.code}`); - -Deno.removeSync("./lock_write_fetch.json"); diff --git a/cli/tests/testdata/lock_write_fetch.ts.out b/cli/tests/testdata/lock_write_fetch.ts.out deleted file mode 100644 index bfdb952f9..000000000 --- a/cli/tests/testdata/lock_write_fetch.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -fetch code: 0 -fetch check code: 0 -run code: 0 diff --git a/cli/tests/testdata/lock_write_requires_lock.out b/cli/tests/testdata/lock_write_requires_lock.out deleted file mode 100644 index 7cc5906f6..000000000 --- a/cli/tests/testdata/lock_write_requires_lock.out +++ /dev/null @@ -1,3 +0,0 @@ -error: The following required arguments were not provided: - --lock -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/long_data_url_formatting.ts b/cli/tests/testdata/long_data_url_formatting.ts deleted file mode 100644 index 2ed2d5a03..000000000 --- a/cli/tests/testdata/long_data_url_formatting.ts +++ /dev/null @@ -1,3 +0,0 @@ -await import( - 'data:application/typescript,console.trace("foo"); const error = new Error("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log(error.stack); throw error;' -); diff --git a/cli/tests/testdata/long_data_url_formatting.ts.out b/cli/tests/testdata/long_data_url_formatting.ts.out deleted file mode 100644 index ea78c2591..000000000 --- a/cli/tests/testdata/long_data_url_formatting.ts.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD]Trace: foo - at data:application/typescript,console.trace("foo")......stack); throw error;:1:9 -Error: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - at data:application/typescript,console.trace("foo")......stack); throw error;:1:37 -error: Uncaught (in promise) Error: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -console.trace("foo"); const error = new Error("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log(error.stack); throw error; - ^ - at data:application/typescript,console.trace("foo")......stack); throw error;:1:37 diff --git a/cli/tests/testdata/lsp/code_action_redirect_response.json b/cli/tests/testdata/lsp/code_action_redirect_response.json index b2bb470bd..235127570 100644 --- a/cli/tests/testdata/lsp/code_action_redirect_response.json +++ b/cli/tests/testdata/lsp/code_action_redirect_response.json @@ -17,10 +17,10 @@ "severity": 3, "code": "redirect", "source": "deno", - "message": "The import of \"http://127.0.0.1:4545/x_deno_warning.js\" was redirected to \"http://127.0.0.1:4545/x_deno_warning_redirect.js\".", + "message": "The import of \"http://127.0.0.1:4545/x_deno_warning.js\" was redirected to \"http://127.0.0.1:4545/lsp/x_deno_warning_redirect.js\".", "data": { "specifier": "http://127.0.0.1:4545/x_deno_warning.js", - "redirect": "http://127.0.0.1:4545/x_deno_warning_redirect.js" + "redirect": "http://127.0.0.1:4545/lsp/x_deno_warning_redirect.js" } } ], @@ -38,7 +38,7 @@ "character": 60 } }, - "newText": "\"http://127.0.0.1:4545/x_deno_warning_redirect.js\"" + "newText": "\"http://127.0.0.1:4545/lsp/x_deno_warning_redirect.js\"" } ] } diff --git a/cli/tests/testdata/lsp/x_deno_warning_redirect.js b/cli/tests/testdata/lsp/x_deno_warning_redirect.js new file mode 100644 index 000000000..34b950566 --- /dev/null +++ b/cli/tests/testdata/lsp/x_deno_warning_redirect.js @@ -0,0 +1 @@ +console.log("testing x-deno-warning header"); diff --git a/cli/tests/testdata/main_module.ts b/cli/tests/testdata/main_module.ts deleted file mode 100644 index 19988f4bf..000000000 --- a/cli/tests/testdata/main_module.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log("main_module", Deno.mainModule); - -import "./main_module2.ts"; diff --git a/cli/tests/testdata/main_module.ts.out b/cli/tests/testdata/main_module.ts.out deleted file mode 100644 index 817bb6b8c..000000000 --- a/cli/tests/testdata/main_module.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -main_module2 [WILDCARD]/main_module.ts -main_module [WILDCARD]/main_module.ts diff --git a/cli/tests/testdata/main_module2.ts b/cli/tests/testdata/main_module2.ts deleted file mode 100644 index 585615c7f..000000000 --- a/cli/tests/testdata/main_module2.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("main_module2", Deno.mainModule); diff --git a/cli/tests/testdata/module_detection_force.ts b/cli/tests/testdata/module_detection_force.ts deleted file mode 100644 index 7729ae366..000000000 --- a/cli/tests/testdata/module_detection_force.ts +++ /dev/null @@ -1,3 +0,0 @@ -const a = 1; -await import("./module_detection_force_import.ts"); -console.log(a); diff --git a/cli/tests/testdata/module_detection_force_import.ts b/cli/tests/testdata/module_detection_force_import.ts deleted file mode 100644 index 66b229870..000000000 --- a/cli/tests/testdata/module_detection_force_import.ts +++ /dev/null @@ -1,2 +0,0 @@ -const a = 2; -console.log(a); diff --git a/cli/tests/testdata/mts_dmts_mjs.out b/cli/tests/testdata/mts_dmts_mjs.out deleted file mode 100644 index 5647bdfb9..000000000 --- a/cli/tests/testdata/mts_dmts_mjs.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -a diff --git a/cli/tests/testdata/nested_error.ts b/cli/tests/testdata/nested_error.ts deleted file mode 100644 index 69828e1ca..000000000 --- a/cli/tests/testdata/nested_error.ts +++ /dev/null @@ -1,3 +0,0 @@ -throw { - foo: new Error(), -}; diff --git a/cli/tests/testdata/nested_error.ts.out b/cli/tests/testdata/nested_error.ts.out deleted file mode 100644 index 042a179ff..000000000 --- a/cli/tests/testdata/nested_error.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught { - foo: Error - at file:///[WILDCARD]testdata/nested_error.ts:2:8 -} diff --git a/cli/tests/testdata/no_check_decorators.ts b/cli/tests/testdata/no_check_decorators.ts deleted file mode 100644 index 9f7ec550d..000000000 --- a/cli/tests/testdata/no_check_decorators.ts +++ /dev/null @@ -1,21 +0,0 @@ -// deno-lint-ignore-file -function a() { - console.log("a(): evaluated"); - return ( - _target: any, - _propertyKey: string, - _descriptor: PropertyDescriptor, - ) => { - console.log("a(): called"); - }; -} - -class B { - @a() - method() { - console.log("method"); - } -} - -const b = new B(); -b.method(); diff --git a/cli/tests/testdata/no_check_decorators.ts.out b/cli/tests/testdata/no_check_decorators.ts.out deleted file mode 100644 index 015f7076e..000000000 --- a/cli/tests/testdata/no_check_decorators.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -a(): evaluated -a(): called -method diff --git a/cli/tests/testdata/no_check_remote.ts b/cli/tests/testdata/no_check_remote.ts deleted file mode 100644 index 2ae8c2692..000000000 --- a/cli/tests/testdata/no_check_remote.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as a from "http://localhost:4545/subdir/type_error.ts"; - -console.log(a.a); diff --git a/cli/tests/testdata/no_check_remote.ts.disabled.out b/cli/tests/testdata/no_check_remote.ts.disabled.out deleted file mode 100644 index 344264634..000000000 --- a/cli/tests/testdata/no_check_remote.ts.disabled.out +++ /dev/null @@ -1,4 +0,0 @@ -error: TS2322 [ERROR]: Type '12' is not assignable to type '"a"'. -export const a: "a" = 12; - ^ - at http://localhost:4545/subdir/type_error.ts:1:14 diff --git a/cli/tests/testdata/no_check_remote.ts.enabled.out b/cli/tests/testdata/no_check_remote.ts.enabled.out deleted file mode 100644 index 48082f72f..000000000 --- a/cli/tests/testdata/no_check_remote.ts.enabled.out +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/cli/tests/testdata/no_color.js b/cli/tests/testdata/no_color.js deleted file mode 100644 index cea11a52f..000000000 --- a/cli/tests/testdata/no_color.js +++ /dev/null @@ -1 +0,0 @@ -console.log("noColor", Deno.noColor); diff --git a/cli/tests/testdata/no_mem_cache.js b/cli/tests/testdata/no_mem_cache.js deleted file mode 100644 index a486732b6..000000000 --- a/cli/tests/testdata/no_mem_cache.js +++ /dev/null @@ -1,33 +0,0 @@ -const fixtureFile = await Deno.makeTempFile(); -let prefix = "file://"; -if (Deno.build.os == "windows") { - prefix += "/"; -} -const fixtureUrl = new URL(`${prefix}${fixtureFile}`); -let resolve; - -let p = new Promise((res) => resolve = res); - -await Deno.writeTextFile(fixtureUrl, `self.postMessage("hello");\n`); - -const workerA = new Worker(fixtureUrl.href, { type: "module" }); -workerA.onmessage = (msg) => { - console.log(msg.data); - resolve(); -}; - -await p; -workerA.terminate(); - -p = new Promise((res) => resolve = res); - -await Deno.writeTextFile(fixtureUrl, `self.postMessage("goodbye");\n`); - -const workerB = new Worker(fixtureUrl.href, { type: "module" }); -workerB.onmessage = (msg) => { - console.log(msg.data); - resolve(); -}; - -await p; -workerB.terminate(); diff --git a/cli/tests/testdata/no_mem_cache.js.out b/cli/tests/testdata/no_mem_cache.js.out deleted file mode 100644 index a32119c8a..000000000 --- a/cli/tests/testdata/no_mem_cache.js.out +++ /dev/null @@ -1,2 +0,0 @@ -hello -goodbye diff --git a/cli/tests/testdata/no_prompt.ts b/cli/tests/testdata/no_prompt.ts deleted file mode 100644 index 7f9750995..000000000 --- a/cli/tests/testdata/no_prompt.ts +++ /dev/null @@ -1,10 +0,0 @@ -new Worker("data:,setTimeout(() => Deno.exit(2), 200)", { type: "module" }); - -try { - await Deno.spawn("ps", { - stdout: "inherit", - stderr: "inherit", - }); -} catch { - Deno.exit(0); -} diff --git a/cli/tests/testdata/no_validate_asm.js b/cli/tests/testdata/no_validate_asm.js deleted file mode 100644 index ef999e080..000000000 --- a/cli/tests/testdata/no_validate_asm.js +++ /dev/null @@ -1,20 +0,0 @@ -// V8 logs any asmjs validation errors to stdout, but it shows line numbers that -// are non-existent in the source. - -const _asmJsModule = function () { - "use asm"; - - function func( - x, - ) { - x = +x; // cast to float - - ~x; - // asmjs error: `~` is only valid on integers - // should not log to stdout with --no-validate-asm - } - - return { - f: func, - }; -}(); diff --git a/cli/tests/testdata/node_env_var_allowlist.ts b/cli/tests/testdata/node_env_var_allowlist.ts deleted file mode 100644 index 95da38c24..000000000 --- a/cli/tests/testdata/node_env_var_allowlist.ts +++ /dev/null @@ -1,2 +0,0 @@ -console.log(Deno.env.get("NODE_DEBUG") ?? "ok"); -Deno.env.get("NOT_NODE_DEBUG"); diff --git a/cli/tests/testdata/node_env_var_allowlist_with_unstable_flag.ts.out b/cli/tests/testdata/node_env_var_allowlist_with_unstable_flag.ts.out deleted file mode 100644 index 62f335c0f..000000000 --- a/cli/tests/testdata/node_env_var_allowlist_with_unstable_flag.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -ok -[WILDCARD]error: Uncaught PermissionDenied: Requires env access to "NOT_NODE_DEBUG", run again with the --allow-env flag -Deno.env.get("NOT_NODE_DEBUG"); - ^ - at [WILDCARD] diff --git a/cli/tests/testdata/node_env_var_allowlist_without_unstable_flag.ts.out b/cli/tests/testdata/node_env_var_allowlist_without_unstable_flag.ts.out deleted file mode 100644 index ac92cdb6b..000000000 --- a/cli/tests/testdata/node_env_var_allowlist_without_unstable_flag.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]error: Uncaught PermissionDenied: Requires env access to "NODE_DEBUG", run again with the --allow-env flag -console.log(Deno.env.get("NODE_DEBUG") ?? "ok"); - ^ - at [WILDCARD] diff --git a/cli/tests/testdata/op_exit_op_set_exit_code_in_worker.ts b/cli/tests/testdata/op_exit_op_set_exit_code_in_worker.ts deleted file mode 100644 index b2ed912de..000000000 --- a/cli/tests/testdata/op_exit_op_set_exit_code_in_worker.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Set exit code to some value, we'll ensure that `Deno.exit()` and -// setting exit code in worker context is a no-op and is an alias for -// `self.close()`. - -// @ts-ignore Deno.core doesn't have type-defs -Deno.core.ops.op_set_exit_code(21); - -const worker = new Worker( - import.meta.resolve("./op_exit_op_set_exit_code_worker.js"), - { type: "module" }, -); - -worker.postMessage("go"); diff --git a/cli/tests/testdata/op_exit_op_set_exit_code_worker.js b/cli/tests/testdata/op_exit_op_set_exit_code_worker.js deleted file mode 100644 index 3e6055747..000000000 --- a/cli/tests/testdata/op_exit_op_set_exit_code_worker.js +++ /dev/null @@ -1,4 +0,0 @@ -self.onmessage = () => { - Deno.core.ops.op_set_exit_code(42); - Deno.exit(); -}; diff --git a/cli/tests/testdata/performance_stats.out b/cli/tests/testdata/performance_stats.out deleted file mode 100644 index 141829ee6..000000000 --- a/cli/tests/testdata/performance_stats.out +++ /dev/null @@ -1,16 +0,0 @@ -[WILDCARD] -DEBUG RS - [WILDCARD] - Compilation statistics: - Files: [WILDCARD] - Nodes: [WILDCARD] - Identifiers: [WILDCARD] - Symbols: [WILDCARD] - Types: [WILDCARD] - Instantiations: [WILDCARD] - Parse time: [WILDCARD] - Bind time: [WILDCARD] - Check time: [WILDCARD] - Emit time: [WILDCARD] - Total TS time: [WILDCARD] - Compile time: [WILDCARD] - -[WILDCARD] diff --git a/cli/tests/testdata/permission_test.ts b/cli/tests/testdata/permission_test.ts deleted file mode 100644 index 4b186a0a2..000000000 --- a/cli/tests/testdata/permission_test.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -const name = Deno.args[0]; -// deno-lint-ignore no-explicit-any -const test: { [key: string]: (...args: any[]) => void | Promise } = { - readRequired() { - Deno.readFileSync("hello.txt"); - return Promise.resolve(); - }, - writeRequired() { - Deno.makeTempDirSync(); - }, - envRequired() { - Deno.env.get("home"); - }, - netRequired() { - Deno.listen({ transport: "tcp", port: 4541 }); - }, - async runRequired() { - await Deno.spawn(Deno.build.os === "windows" ? "cmd.exe" : "printf", { - args: Deno.build.os === "windows" ? ["/c", "echo hello"] : ["hello"], - }); - }, -}; - -if (!test[name]) { - console.log("Unknown test:", name); - Deno.exit(1); -} - -test[name](); diff --git a/cli/tests/testdata/preserve_imports.tsconfig.json b/cli/tests/testdata/preserve_imports.tsconfig.json deleted file mode 100644 index 9b19291aa..000000000 --- a/cli/tests/testdata/preserve_imports.tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "importsNotUsedAsValues": "preserve" - } -} diff --git a/cli/tests/testdata/private_field_presence.ts b/cli/tests/testdata/private_field_presence.ts deleted file mode 100644 index 7ce2840d8..000000000 --- a/cli/tests/testdata/private_field_presence.ts +++ /dev/null @@ -1,20 +0,0 @@ -export class Person { - #name: string; - constructor(name: string) { - this.#name = name; - } - - equals(other: unknown) { - return other && - typeof other === "object" && - #name in other && - this.#name === other.#name; - } -} - -const a = new Person("alice"); -const b = new Person("bob"); -const c = new Person("alice"); - -console.log(a.equals(b)); -console.log(a.equals(c)); diff --git a/cli/tests/testdata/private_field_presence.ts.out b/cli/tests/testdata/private_field_presence.ts.out deleted file mode 100644 index f582fb47a..000000000 --- a/cli/tests/testdata/private_field_presence.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -false -true diff --git a/cli/tests/testdata/proto_exploit.js b/cli/tests/testdata/proto_exploit.js deleted file mode 100644 index 8bd22cfe5..000000000 --- a/cli/tests/testdata/proto_exploit.js +++ /dev/null @@ -1,5 +0,0 @@ -const payload = `{ "__proto__": null }`; -const obj = {}; -console.log("Before: " + obj); -Object.assign(obj, JSON.parse(payload)); -console.log("After: " + obj); diff --git a/cli/tests/testdata/proto_exploit.js.out b/cli/tests/testdata/proto_exploit.js.out deleted file mode 100644 index fde881dc5..000000000 --- a/cli/tests/testdata/proto_exploit.js.out +++ /dev/null @@ -1,2 +0,0 @@ -Before: [object Object] -After: [object Object] diff --git a/cli/tests/testdata/queue_microtask_error.ts b/cli/tests/testdata/queue_microtask_error.ts deleted file mode 100644 index b2e9642c5..000000000 --- a/cli/tests/testdata/queue_microtask_error.ts +++ /dev/null @@ -1,5 +0,0 @@ -queueMicrotask(() => { - throw new Error("foo"); -}); -console.log(1); -Promise.resolve().then(() => console.log(2)); diff --git a/cli/tests/testdata/queue_microtask_error.ts.out b/cli/tests/testdata/queue_microtask_error.ts.out deleted file mode 100644 index 6c4d41936..000000000 --- a/cli/tests/testdata/queue_microtask_error.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -1 -error: Uncaught Error: foo - throw new Error("foo"); - ^ - at [WILDCARD]/queue_microtask_error.ts:2:9 - at deno:core/[WILDCARD] diff --git a/cli/tests/testdata/queue_microtask_error_handled.ts b/cli/tests/testdata/queue_microtask_error_handled.ts deleted file mode 100644 index 7d1440135..000000000 --- a/cli/tests/testdata/queue_microtask_error_handled.ts +++ /dev/null @@ -1,21 +0,0 @@ -addEventListener("error", (event) => { - console.log({ - cancelable: event.cancelable, - message: event.message, - filename: event.filename, - lineno: event.lineno, - colno: event.colno, - error: event.error, - }); - event.preventDefault(); -}); - -onerror = (event) => { - console.log("onerror() called", event.error); -}; - -queueMicrotask(() => { - throw new Error("foo"); -}); -console.log(1); -Promise.resolve().then(() => console.log(2)); diff --git a/cli/tests/testdata/queue_microtask_error_handled.ts.out b/cli/tests/testdata/queue_microtask_error_handled.ts.out deleted file mode 100644 index 7f3f7f84a..000000000 --- a/cli/tests/testdata/queue_microtask_error_handled.ts.out +++ /dev/null @@ -1,15 +0,0 @@ -1 -{ - cancelable: true, - message: "Uncaught Error: foo", - filename: "[WILDCARD]/queue_microtask_error_handled.ts", - lineno: 18, - colno: 9, - error: Error: foo - at [WILDCARD]/queue_microtask_error_handled.ts:18:9 - at deno:core/[WILDCARD] -} -onerror() called Error: foo - at [WILDCARD]/queue_microtask_error_handled.ts:18:9 - at deno:core/[WILDCARD] -2 diff --git a/cli/tests/testdata/raw_mode.ts b/cli/tests/testdata/raw_mode.ts deleted file mode 100644 index 87502e7d9..000000000 --- a/cli/tests/testdata/raw_mode.ts +++ /dev/null @@ -1,18 +0,0 @@ -Deno.setRaw(0, true); -Deno.setRaw(0, true); // Can be called multiple times - -Deno.stdout.writeSync(new TextEncoder().encode("S")); - -const buf = new Uint8Array(3); -for (let i = 0; i < 3; i++) { - const nread = await Deno.stdin.read(buf); - if (nread === null) { - break; - } else { - const data = new TextDecoder().decode(buf.subarray(0, nread)); - Deno.stdout.writeSync(new TextEncoder().encode(data.toUpperCase())); - } -} - -Deno.setRaw(0, false); // restores old mode. -Deno.setRaw(0, false); // Can be safely called multiple times diff --git a/cli/tests/testdata/recursive_imports/A.ts b/cli/tests/testdata/recursive_imports/A.ts deleted file mode 100644 index 43ecdbe5e..000000000 --- a/cli/tests/testdata/recursive_imports/A.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { B } from "./B.ts"; -import { thing } from "./common.ts"; - -export function A() { - thing(); - B(); -} diff --git a/cli/tests/testdata/recursive_imports/B.ts b/cli/tests/testdata/recursive_imports/B.ts deleted file mode 100644 index 9fff0fdc9..000000000 --- a/cli/tests/testdata/recursive_imports/B.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { C } from "./C.ts"; -import { thing } from "./common.ts"; - -export function B() { - thing(); - C(); -} diff --git a/cli/tests/testdata/recursive_imports/C.ts b/cli/tests/testdata/recursive_imports/C.ts deleted file mode 100644 index e47e77b41..000000000 --- a/cli/tests/testdata/recursive_imports/C.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { A } from "./A.ts"; -import { thing } from "./common.ts"; - -export function C() { - if (A != null) { - thing(); - } -} diff --git a/cli/tests/testdata/recursive_imports/common.ts b/cli/tests/testdata/recursive_imports/common.ts deleted file mode 100644 index 2b16a7bf1..000000000 --- a/cli/tests/testdata/recursive_imports/common.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function thing() { -} diff --git a/cli/tests/testdata/redirect_cache.out b/cli/tests/testdata/redirect_cache.out deleted file mode 100644 index 8905c4529..000000000 --- a/cli/tests/testdata/redirect_cache.out +++ /dev/null @@ -1,5 +0,0 @@ -Download http://localhost:4548/subdir/redirects/a.ts -Download http://localhost:4546/subdir/redirects/a.ts -Download http://localhost:4545/subdir/redirects/a.ts -Download http://localhost:4545/subdir/redirects/b.ts -Check http://localhost:4548/subdir/redirects/a.ts diff --git a/cli/tests/testdata/reference_types.ts b/cli/tests/testdata/reference_types.ts deleted file mode 100644 index 105e23b37..000000000 --- a/cli/tests/testdata/reference_types.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// - -console.log(globalThis.a); diff --git a/cli/tests/testdata/reference_types.ts.out b/cli/tests/testdata/reference_types.ts.out deleted file mode 100644 index 417b7b537..000000000 --- a/cli/tests/testdata/reference_types.ts.out +++ /dev/null @@ -1 +0,0 @@ -undefined diff --git a/cli/tests/testdata/reference_types_error.js b/cli/tests/testdata/reference_types_error.js deleted file mode 100644 index 68b6c2136..000000000 --- a/cli/tests/testdata/reference_types_error.js +++ /dev/null @@ -1,2 +0,0 @@ -/// -export const a = 1; diff --git a/cli/tests/testdata/reference_types_error.js.out b/cli/tests/testdata/reference_types_error.js.out deleted file mode 100644 index ebb9b3a26..000000000 --- a/cli/tests/testdata/reference_types_error.js.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Module not found "file:///[WILDCARD]/nonexistent.d.ts". - at file:///[WILDCARD]/reference_types_error.js:1:23 diff --git a/cli/tests/testdata/reference_types_remote.ts b/cli/tests/testdata/reference_types_remote.ts deleted file mode 100644 index e7fa81b2c..000000000 --- a/cli/tests/testdata/reference_types_remote.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// - -console.log(globalThis.a); diff --git a/cli/tests/testdata/reference_types_remote.ts.out b/cli/tests/testdata/reference_types_remote.ts.out deleted file mode 100644 index 417b7b537..000000000 --- a/cli/tests/testdata/reference_types_remote.ts.out +++ /dev/null @@ -1 +0,0 @@ -undefined diff --git a/cli/tests/testdata/repl/import_type.ts b/cli/tests/testdata/repl/import_type.ts new file mode 100644 index 000000000..851ebad86 --- /dev/null +++ b/cli/tests/testdata/repl/import_type.ts @@ -0,0 +1,5 @@ +import { type B, create } from "./subdir/export_types.ts"; + +const b: B = create(); + +console.log(b); diff --git a/cli/tests/testdata/replace_self.js b/cli/tests/testdata/replace_self.js deleted file mode 100644 index cfd473cd3..000000000 --- a/cli/tests/testdata/replace_self.js +++ /dev/null @@ -1,21 +0,0 @@ -// Test that setting `self` in the main thread to some other value doesn't break -// the world, in particular for events fired on the global scope. - -// deno-lint-ignore no-global-assign -self = null; - -addEventListener("load", () => { - console.log("load event (event listener)"); -}); - -addEventListener("unload", () => { - console.log("unload event (event listener)"); -}); - -globalThis.onload = () => { - console.log("load event (event handler)"); -}; - -globalThis.onunload = () => { - console.log("unload event (event handler)"); -}; diff --git a/cli/tests/testdata/replace_self.js.out b/cli/tests/testdata/replace_self.js.out deleted file mode 100644 index aaffb5a62..000000000 --- a/cli/tests/testdata/replace_self.js.out +++ /dev/null @@ -1,4 +0,0 @@ -load event (event listener) -load event (event handler) -unload event (event listener) -unload event (event handler) diff --git a/cli/tests/testdata/report_error.ts b/cli/tests/testdata/report_error.ts deleted file mode 100644 index a6d4af1fd..000000000 --- a/cli/tests/testdata/report_error.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -reportError(new Error("foo")); -console.log(2); diff --git a/cli/tests/testdata/report_error.ts.out b/cli/tests/testdata/report_error.ts.out deleted file mode 100644 index 185db62a5..000000000 --- a/cli/tests/testdata/report_error.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -error: Uncaught Error: foo -reportError(new Error("foo")); - ^ - at [WILDCARD]/report_error.ts:2:13 diff --git a/cli/tests/testdata/report_error_end_of_program.ts b/cli/tests/testdata/report_error_end_of_program.ts deleted file mode 100644 index cd7ce7f9c..000000000 --- a/cli/tests/testdata/report_error_end_of_program.ts +++ /dev/null @@ -1 +0,0 @@ -reportError(new Error("foo")); diff --git a/cli/tests/testdata/report_error_end_of_program.ts.out b/cli/tests/testdata/report_error_end_of_program.ts.out deleted file mode 100644 index ecca63389..000000000 --- a/cli/tests/testdata/report_error_end_of_program.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught Error: foo -reportError(new Error("foo")); - ^ - at [WILDCARD]/report_error_end_of_program.ts:1:13 diff --git a/cli/tests/testdata/report_error_handled.ts b/cli/tests/testdata/report_error_handled.ts deleted file mode 100644 index de58f0b8e..000000000 --- a/cli/tests/testdata/report_error_handled.ts +++ /dev/null @@ -1,19 +0,0 @@ -addEventListener("error", (event) => { - console.log({ - cancelable: event.cancelable, - message: event.message, - filename: event.filename, - lineno: event.lineno, - colno: event.colno, - error: event.error, - }); - event.preventDefault(); -}); - -onerror = (event) => { - console.log("onerror() called", event.error); -}; - -console.log(1); -reportError(new Error("foo")); -console.log(2); diff --git a/cli/tests/testdata/report_error_handled.ts.out b/cli/tests/testdata/report_error_handled.ts.out deleted file mode 100644 index 89fa30314..000000000 --- a/cli/tests/testdata/report_error_handled.ts.out +++ /dev/null @@ -1,13 +0,0 @@ -1 -{ - cancelable: true, - message: "Uncaught Error: foo", - filename: "[WILDCARD]/report_error_handled.ts", - lineno: 18, - colno: 13, - error: Error: foo - at [WILDCARD]/report_error_handled.ts:18:13 -} -onerror() called Error: foo - at [WILDCARD]/report_error_handled.ts:18:13 -2 diff --git a/cli/tests/testdata/resolve_dns.ts b/cli/tests/testdata/resolve_dns.ts deleted file mode 100644 index bde479c9a..000000000 --- a/cli/tests/testdata/resolve_dns.ts +++ /dev/null @@ -1,64 +0,0 @@ -const nameServer = { nameServer: { ipAddr: "127.0.0.1", port: 4553 } }; - -const [a, aaaa, aname, caa, cname, mx, naptr, ns, ptr, soa, srv, txt] = - await Promise - .all([ - Deno.resolveDns("www.example.com", "A", nameServer), - Deno.resolveDns("www.example.com", "AAAA", nameServer), - Deno.resolveDns("www.example.com", "ANAME", nameServer), - Deno.resolveDns("example.com", "CAA", nameServer), - Deno.resolveDns("alias.example.com", "CNAME", nameServer), - Deno.resolveDns("example.com", "MX", nameServer), - Deno.resolveDns("example.com", "NAPTR", nameServer), - Deno.resolveDns("example.com", "NS", nameServer), - Deno.resolveDns("1.2.3.4.IN-ADDR.ARPA.", "PTR", nameServer), - Deno.resolveDns("example.com", "SOA", nameServer), - Deno.resolveDns("_service._tcp.example.com", "SRV", nameServer), - Deno.resolveDns("example.com", "TXT", nameServer), - ]); - -console.log("A"); -console.log(JSON.stringify(a)); - -console.log("AAAA"); -console.log(JSON.stringify(aaaa)); - -console.log("ANAME"); -console.log(JSON.stringify(aname)); - -console.log("CAA"); -console.log(JSON.stringify(caa)); - -console.log("CNAME"); -console.log(JSON.stringify(cname)); - -console.log("MX"); -console.log(JSON.stringify(mx)); - -console.log("NAPTR"); -console.log(JSON.stringify(naptr)); - -console.log("NS"); -console.log(JSON.stringify(ns)); - -console.log("PTR"); -console.log(JSON.stringify(ptr)); - -console.log("SOA"); -console.log(JSON.stringify(soa)); - -console.log("SRV"); -console.log(JSON.stringify(srv)); - -console.log("TXT"); -console.log(JSON.stringify(txt)); - -try { - await Deno.resolveDns("not-found-example.com", "A", nameServer); -} catch (e) { - console.log( - `Error ${ - e instanceof Error ? e.name : "[non-error]" - } thrown for not-found-example.com`, - ); -} diff --git a/cli/tests/testdata/resolve_dns.ts.out b/cli/tests/testdata/resolve_dns.ts.out deleted file mode 100644 index 2fe10cb9a..000000000 --- a/cli/tests/testdata/resolve_dns.ts.out +++ /dev/null @@ -1,25 +0,0 @@ -A -["1.2.3.4","5.6.7.8"] -AAAA -["1:2:3:4:5:6:7:8"] -ANAME -["aname.example.com."] -CAA -[{"critical":false,"tag":"issue","value":"ca.example.net"},{"critical":false,"tag":"issue","value":"ca2.example.net; account=123456"},{"critical":false,"tag":"issuewild","value":";"},{"critical":false,"tag":"iodef","value":"mailto:security@example.com"},{"critical":true,"tag":"tbs","value":"Unknown"}] -CNAME -["cname.example.com."] -MX -[{"preference":10,"exchange":"mx1.com."},{"preference":20,"exchange":"mx2.com."}] -NAPTR -[{"order":10,"preference":0,"flags":"s","services":"SIPS+D2T","regexp":"","replacement":"_sips._tcp.example.com."},{"order":10,"preference":0,"flags":"s","services":"RELAY:turn.udp","regexp":"","replacement":"_turn._udp.example.com."}] -NS -["ns1.ns.com.","ns2.ns.com.","ns3.ns.com."] -PTR -["www.example.com.","alias.example.com."] -SOA -[{"mname":"net.example.com.","rname":"admin\\.domain.example.com.","serial":20,"refresh":7200,"retry":600,"expire":3600000,"minimum":60}] -SRV -[{"priority":0,"weight":100,"port":1234,"target":"srv.example.com."}] -TXT -[["I","am","a","txt","record"],["I","am","another","txt","record"],["I am a different","txt record"],["key=val"]] -Error NotFound thrown for not-found-example.com diff --git a/cli/tests/testdata/resolve_dns.zone.in b/cli/tests/testdata/resolve_dns.zone.in deleted file mode 100644 index c351a1de9..000000000 --- a/cli/tests/testdata/resolve_dns.zone.in +++ /dev/null @@ -1,31 +0,0 @@ -@ IN SOA net admin\.domain ( - 20 ; SERIAL - 7200 ; REFRESH - 600 ; RETRY - 3600000; EXPIRE - 60) ; MINIMUM -@ IN CAA 0 issue "ca.example.net" -@ IN CAA 0 issue "ca2.example.net; account=123456" -@ IN CAA 0 issuewild ";" -@ IN CAA 0 iodef "mailto:security@example.com" -@ IN CAA 128 tbs "Unknown" - NS ns1.ns.com. - NS ns2.ns.com. - NS ns3.ns.com. - MX 10 mx1.com. - MX 20 mx2.com. - TXT I am a txt record - TXT I am another txt record - TXT "I am a different" "txt record" - TXT key=val -www A 1.2.3.4 - A 5.6.7.8 - ANAME aname -www AAAA 1:2:3:4:5:6:7:8 -alias CNAME cname - -1.2.3.4.IN-ADDR.ARPA. PTR www - PTR alias -_service._tcp SRV 0 100 1234 srv -@ IN NAPTR 10 0 "s" "SIPS+D2T" "" _sips._tcp.example.com. -@ IN NAPTR 10 0 "s" RELAY:turn.udp "" _turn._udp.example.com. \ No newline at end of file diff --git a/cli/tests/testdata/response_string_perf.js b/cli/tests/testdata/response_string_perf.js deleted file mode 100644 index f55376c77..000000000 --- a/cli/tests/testdata/response_string_perf.js +++ /dev/null @@ -1,34 +0,0 @@ -const mixed = "@Ä€à¹ðŸ˜€"; - -function generateRandom(bytes) { - let result = ""; - let i = 0; - while (i < bytes) { - const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); - switch (toAdd) { - case 0: - result += mixed[0]; - i++; - break; - case 1: - result += mixed[1]; - i++; - break; - case 2: - result += mixed[2]; - i++; - break; - case 3: - result += mixed[3]; - result += mixed[4]; - i += 2; - break; - } - } - return result; -} - -const randomData = generateRandom(1024); -for (let i = 0; i < 10_000; i++) { - new Response(randomData); -} diff --git a/cli/tests/testdata/run/001_hello.js b/cli/tests/testdata/run/001_hello.js new file mode 100644 index 000000000..accefceba --- /dev/null +++ b/cli/tests/testdata/run/001_hello.js @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/cli/tests/testdata/run/001_hello.js.out b/cli/tests/testdata/run/001_hello.js.out new file mode 100644 index 000000000..557db03de --- /dev/null +++ b/cli/tests/testdata/run/001_hello.js.out @@ -0,0 +1 @@ +Hello World diff --git a/cli/tests/testdata/run/002_hello.ts b/cli/tests/testdata/run/002_hello.ts new file mode 100644 index 000000000..accefceba --- /dev/null +++ b/cli/tests/testdata/run/002_hello.ts @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/cli/tests/testdata/run/002_hello.ts.out b/cli/tests/testdata/run/002_hello.ts.out new file mode 100644 index 000000000..557db03de --- /dev/null +++ b/cli/tests/testdata/run/002_hello.ts.out @@ -0,0 +1 @@ +Hello World diff --git a/cli/tests/testdata/run/003_relative_import.ts b/cli/tests/testdata/run/003_relative_import.ts new file mode 100644 index 000000000..840121bfe --- /dev/null +++ b/cli/tests/testdata/run/003_relative_import.ts @@ -0,0 +1,3 @@ +import { printHello } from "../subdir/print_hello.ts"; + +printHello(); diff --git a/cli/tests/testdata/run/003_relative_import.ts.out b/cli/tests/testdata/run/003_relative_import.ts.out new file mode 100644 index 000000000..699b756ed --- /dev/null +++ b/cli/tests/testdata/run/003_relative_import.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +Hello diff --git a/cli/tests/testdata/run/004_set_timeout.ts b/cli/tests/testdata/run/004_set_timeout.ts new file mode 100644 index 000000000..214b25086 --- /dev/null +++ b/cli/tests/testdata/run/004_set_timeout.ts @@ -0,0 +1,11 @@ +setTimeout(() => { + console.log("World"); +}, 10); + +console.log("Hello"); + +const id = setTimeout(() => { + console.log("Not printed"); +}, 10000); + +clearTimeout(id); diff --git a/cli/tests/testdata/run/004_set_timeout.ts.out b/cli/tests/testdata/run/004_set_timeout.ts.out new file mode 100644 index 000000000..f9264f7fb --- /dev/null +++ b/cli/tests/testdata/run/004_set_timeout.ts.out @@ -0,0 +1,2 @@ +Hello +World diff --git a/cli/tests/testdata/run/005_more_imports.ts b/cli/tests/testdata/run/005_more_imports.ts new file mode 100644 index 000000000..6c96fac64 --- /dev/null +++ b/cli/tests/testdata/run/005_more_imports.ts @@ -0,0 +1,11 @@ +import { printHello3, returnsFoo2, returnsHi } from "../subdir/mod1.ts"; + +printHello3(); + +if (returnsHi() !== "Hi") { + throw Error("Unexpected"); +} + +if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); +} diff --git a/cli/tests/testdata/run/005_more_imports.ts.out b/cli/tests/testdata/run/005_more_imports.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/run/005_more_imports.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/run/006_url_imports.ts b/cli/tests/testdata/run/006_url_imports.ts new file mode 100644 index 000000000..4036f27ed --- /dev/null +++ b/cli/tests/testdata/run/006_url_imports.ts @@ -0,0 +1,3 @@ +import { printHello } from "http://localhost:4545/subdir/mod2.ts"; +printHello(); +console.log("success"); diff --git a/cli/tests/testdata/run/006_url_imports.ts.out b/cli/tests/testdata/run/006_url_imports.ts.out new file mode 100644 index 000000000..989ce33e9 --- /dev/null +++ b/cli/tests/testdata/run/006_url_imports.ts.out @@ -0,0 +1,2 @@ +Hello +success diff --git a/cli/tests/testdata/run/012_async.ts b/cli/tests/testdata/run/012_async.ts new file mode 100644 index 000000000..536197b68 --- /dev/null +++ b/cli/tests/testdata/run/012_async.ts @@ -0,0 +1,11 @@ +// Check that we can use the async keyword. +async function main() { + await new Promise((resolve) => { + console.log("2"); + setTimeout(resolve, 100); + }); + console.log("3"); +} + +console.log("1"); +main(); diff --git a/cli/tests/testdata/run/012_async.ts.out b/cli/tests/testdata/run/012_async.ts.out new file mode 100644 index 000000000..01e79c32a --- /dev/null +++ b/cli/tests/testdata/run/012_async.ts.out @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/cli/tests/testdata/run/013_dynamic_import.ts b/cli/tests/testdata/run/013_dynamic_import.ts new file mode 100644 index 000000000..fc231936c --- /dev/null +++ b/cli/tests/testdata/run/013_dynamic_import.ts @@ -0,0 +1,15 @@ +(async () => { + const { returnsHi, returnsFoo2, printHello3 } = await import( + "../subdir/mod1.ts" + ); + + printHello3(); + + if (returnsHi() !== "Hi") { + throw Error("Unexpected"); + } + + if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); + } +})(); diff --git a/cli/tests/testdata/run/013_dynamic_import.ts.out b/cli/tests/testdata/run/013_dynamic_import.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/run/013_dynamic_import.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/run/014_duplicate_import.ts b/cli/tests/testdata/run/014_duplicate_import.ts new file mode 100644 index 000000000..c7dd881cf --- /dev/null +++ b/cli/tests/testdata/run/014_duplicate_import.ts @@ -0,0 +1,9 @@ +// with all the imports of the same module, the module should only be +// instantiated once +import "../subdir/auto_print_hello.ts"; + +import "../subdir/auto_print_hello.ts"; + +(async () => { + await import("../subdir/auto_print_hello.ts"); +})(); diff --git a/cli/tests/testdata/run/014_duplicate_import.ts.out b/cli/tests/testdata/run/014_duplicate_import.ts.out new file mode 100644 index 000000000..4effa19f4 --- /dev/null +++ b/cli/tests/testdata/run/014_duplicate_import.ts.out @@ -0,0 +1 @@ +hello! diff --git a/cli/tests/testdata/run/015_duplicate_parallel_import.js b/cli/tests/testdata/run/015_duplicate_parallel_import.js new file mode 100644 index 000000000..2fbe2c732 --- /dev/null +++ b/cli/tests/testdata/run/015_duplicate_parallel_import.js @@ -0,0 +1,20 @@ +// Importing the same module in parallel, the module should only be +// instantiated once. + +const promises = new Array(100) + .fill(null) + .map(() => import("../subdir/mod1.ts")); + +Promise.all(promises).then((imports) => { + const mod = imports.reduce((first, cur) => { + if (typeof first !== "object") { + throw new Error("Expected an object."); + } + if (first !== cur) { + throw new Error("More than one instance of the same module."); + } + return first; + }); + + mod.printHello3(); +}); diff --git a/cli/tests/testdata/run/015_duplicate_parallel_import.js.out b/cli/tests/testdata/run/015_duplicate_parallel_import.js.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/run/015_duplicate_parallel_import.js.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/run/016_double_await.ts b/cli/tests/testdata/run/016_double_await.ts new file mode 100644 index 000000000..457a53ff3 --- /dev/null +++ b/cli/tests/testdata/run/016_double_await.ts @@ -0,0 +1,8 @@ +// This is to test if Deno would die at 2nd await +// See https://github.com/denoland/deno/issues/919 +(async () => { + const currDirInfo = await Deno.stat("."); + const parentDirInfo = await Deno.stat(".."); + console.log(currDirInfo.isDirectory); + console.log(parentDirInfo.isFile); +})(); diff --git a/cli/tests/testdata/run/016_double_await.ts.out b/cli/tests/testdata/run/016_double_await.ts.out new file mode 100644 index 000000000..da29283aa --- /dev/null +++ b/cli/tests/testdata/run/016_double_await.ts.out @@ -0,0 +1,2 @@ +true +false diff --git a/cli/tests/testdata/run/017_import_redirect.ts b/cli/tests/testdata/run/017_import_redirect.ts new file mode 100644 index 000000000..1265dd4ed --- /dev/null +++ b/cli/tests/testdata/run/017_import_redirect.ts @@ -0,0 +1,4 @@ +// http -> https redirect would happen: +import { printHello } from "http://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts"; + +printHello(); diff --git a/cli/tests/testdata/run/017_import_redirect.ts.out b/cli/tests/testdata/run/017_import_redirect.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/run/017_import_redirect.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/run/017_import_redirect_info.out b/cli/tests/testdata/run/017_import_redirect_info.out new file mode 100644 index 000000000..d3a2e86fc --- /dev/null +++ b/cli/tests/testdata/run/017_import_redirect_info.out @@ -0,0 +1,6 @@ +local: [WILDCARD]017_import_redirect.ts +type: TypeScript +dependencies: 1 unique (total 278B) + +file:///[WILDCARD]/017_import_redirect.ts ([WILDCARD]) +└── https://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts ([WILDCARD]) diff --git a/cli/tests/testdata/run/018_async_catch.ts b/cli/tests/testdata/run/018_async_catch.ts new file mode 100644 index 000000000..ac43a52e8 --- /dev/null +++ b/cli/tests/testdata/run/018_async_catch.ts @@ -0,0 +1,14 @@ +function fn(): Promise { + throw new Error("message"); +} +async function call() { + try { + console.log("before await fn()"); + await fn(); + console.log("after await fn()"); + } catch (_error) { + console.log("catch"); + } + console.log("after try-catch"); +} +call().catch(() => console.log("outer catch")); diff --git a/cli/tests/testdata/run/018_async_catch.ts.out b/cli/tests/testdata/run/018_async_catch.ts.out new file mode 100644 index 000000000..4fc219973 --- /dev/null +++ b/cli/tests/testdata/run/018_async_catch.ts.out @@ -0,0 +1,3 @@ +before await fn() +catch +after try-catch diff --git a/cli/tests/testdata/run/019_media_types.ts b/cli/tests/testdata/run/019_media_types.ts new file mode 100644 index 000000000..d985bd249 --- /dev/null +++ b/cli/tests/testdata/run/019_media_types.ts @@ -0,0 +1,24 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. + +import { loaded as loadedTs1 } from "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; +import { loaded as loadedTs2 } from "http://localhost:4545/subdir/mt_video_vdn.t2.ts"; +import { loaded as loadedTs3 } from "http://localhost:4545/subdir/mt_video_mp2t.t3.ts"; +import { loaded as loadedTs4 } from "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts"; +import { loaded as loadedJs1 } from "http://localhost:4545/subdir/mt_text_javascript.j1.js"; +import { loaded as loadedJs2 } from "http://localhost:4545/subdir/mt_application_ecmascript.j2.js"; +import { loaded as loadedJs3 } from "http://localhost:4545/subdir/mt_text_ecmascript.j3.js"; +import { loaded as loadedJs4 } from "http://localhost:4545/subdir/mt_application_x_javascript.j4.js"; + +console.log( + "success", + loadedTs1, + loadedTs2, + loadedTs3, + loadedTs4, + loadedJs1, + loadedJs2, + loadedJs3, + loadedJs4, +); diff --git a/cli/tests/testdata/run/019_media_types.ts.out b/cli/tests/testdata/run/019_media_types.ts.out new file mode 100644 index 000000000..b3e94678c --- /dev/null +++ b/cli/tests/testdata/run/019_media_types.ts.out @@ -0,0 +1 @@ +[WILDCARD]success true true true true true true true true diff --git a/cli/tests/testdata/run/020_json_modules.ts b/cli/tests/testdata/run/020_json_modules.ts new file mode 100644 index 000000000..b4ae60665 --- /dev/null +++ b/cli/tests/testdata/run/020_json_modules.ts @@ -0,0 +1,2 @@ +import config from "../subdir/config.json"; +console.log(JSON.stringify(config)); diff --git a/cli/tests/testdata/run/020_json_modules.ts.out b/cli/tests/testdata/run/020_json_modules.ts.out new file mode 100644 index 000000000..da33c40bf --- /dev/null +++ b/cli/tests/testdata/run/020_json_modules.ts.out @@ -0,0 +1,4 @@ +[WILDCARD] +error: Expected a JavaScript or TypeScript module, but identified a Json module. Consider importing Json modules with an import assertion with the type of "json". + Specifier: [WILDCARD]/subdir/config.json +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/run/021_mjs_modules.ts b/cli/tests/testdata/run/021_mjs_modules.ts new file mode 100644 index 000000000..838cd2c38 --- /dev/null +++ b/cli/tests/testdata/run/021_mjs_modules.ts @@ -0,0 +1,2 @@ +import { isMod5 } from "../subdir/mod5.mjs"; +console.log(isMod5); diff --git a/cli/tests/testdata/run/021_mjs_modules.ts.out b/cli/tests/testdata/run/021_mjs_modules.ts.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/testdata/run/021_mjs_modules.ts.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/testdata/run/023_no_ext b/cli/tests/testdata/run/023_no_ext new file mode 100644 index 000000000..d2cd6a037 --- /dev/null +++ b/cli/tests/testdata/run/023_no_ext @@ -0,0 +1,2 @@ +import * as mod4 from "../subdir/mod4.js"; +console.log(mod4.isMod4); diff --git a/cli/tests/testdata/run/023_no_ext.out b/cli/tests/testdata/run/023_no_ext.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/testdata/run/023_no_ext.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/testdata/run/025_hrtime.ts b/cli/tests/testdata/run/025_hrtime.ts new file mode 100644 index 000000000..b69d61488 --- /dev/null +++ b/cli/tests/testdata/run/025_hrtime.ts @@ -0,0 +1,5 @@ +window.onload = async () => { + console.log(performance.now() % 2 !== 0); + await Deno.permissions.revoke({ name: "hrtime" }); + console.log(performance.now() % 2 === 0); +}; diff --git a/cli/tests/testdata/run/025_hrtime.ts.out b/cli/tests/testdata/run/025_hrtime.ts.out new file mode 100644 index 000000000..bb101b641 --- /dev/null +++ b/cli/tests/testdata/run/025_hrtime.ts.out @@ -0,0 +1,2 @@ +true +true diff --git a/cli/tests/testdata/run/025_reload_js_type_error.js b/cli/tests/testdata/run/025_reload_js_type_error.js new file mode 100644 index 000000000..3b7c23cc9 --- /dev/null +++ b/cli/tests/testdata/run/025_reload_js_type_error.js @@ -0,0 +1,6 @@ +// deno-lint-ignore-file +// There was a bug where if this was executed with --reload it would throw a +// type error. +window.test = null; +test = console; +test.log("hello"); diff --git a/cli/tests/testdata/run/025_reload_js_type_error.js.out b/cli/tests/testdata/run/025_reload_js_type_error.js.out new file mode 100644 index 000000000..ce0136250 --- /dev/null +++ b/cli/tests/testdata/run/025_reload_js_type_error.js.out @@ -0,0 +1 @@ +hello diff --git a/cli/tests/testdata/run/026_redirect_javascript.js b/cli/tests/testdata/run/026_redirect_javascript.js new file mode 100644 index 000000000..226a6b622 --- /dev/null +++ b/cli/tests/testdata/run/026_redirect_javascript.js @@ -0,0 +1,2 @@ +import { value } from "http://localhost:4547/redirects/redirect3.js"; +console.log(value); diff --git a/cli/tests/testdata/run/026_redirect_javascript.js.out b/cli/tests/testdata/run/026_redirect_javascript.js.out new file mode 100644 index 000000000..290864299 --- /dev/null +++ b/cli/tests/testdata/run/026_redirect_javascript.js.out @@ -0,0 +1 @@ +3 imports 1 diff --git a/cli/tests/testdata/run/027_redirect_typescript.ts b/cli/tests/testdata/run/027_redirect_typescript.ts new file mode 100644 index 000000000..584341975 --- /dev/null +++ b/cli/tests/testdata/run/027_redirect_typescript.ts @@ -0,0 +1,2 @@ +import { value } from "http://localhost:4547/redirects/redirect4.ts"; +console.log(value); diff --git a/cli/tests/testdata/run/027_redirect_typescript.ts.out b/cli/tests/testdata/run/027_redirect_typescript.ts.out new file mode 100644 index 000000000..480d4e8ca --- /dev/null +++ b/cli/tests/testdata/run/027_redirect_typescript.ts.out @@ -0,0 +1 @@ +4 imports 1 diff --git a/cli/tests/testdata/run/028_args.ts b/cli/tests/testdata/run/028_args.ts new file mode 100644 index 000000000..ec41d52f9 --- /dev/null +++ b/cli/tests/testdata/run/028_args.ts @@ -0,0 +1,3 @@ +Deno.args.forEach((arg) => { + console.log(arg); +}); diff --git a/cli/tests/testdata/run/028_args.ts.out b/cli/tests/testdata/run/028_args.ts.out new file mode 100644 index 000000000..0f1b5c59e --- /dev/null +++ b/cli/tests/testdata/run/028_args.ts.out @@ -0,0 +1,6 @@ +--arg1 +val1 +--arg2=val2 +-- +arg3 +arg4 diff --git a/cli/tests/testdata/run/033_import_map.out b/cli/tests/testdata/run/033_import_map.out new file mode 100644 index 000000000..e9b9160e9 --- /dev/null +++ b/cli/tests/testdata/run/033_import_map.out @@ -0,0 +1,7 @@ +Hello from remapped moment! +Hello from remapped moment dir! +Hello from remapped lodash! +Hello from remapped lodash dir! +Hello from remapped Vue! +Hello from scoped moment! +Hello from scoped! diff --git a/cli/tests/testdata/run/033_import_map_remote.out b/cli/tests/testdata/run/033_import_map_remote.out new file mode 100644 index 000000000..804fa0d57 --- /dev/null +++ b/cli/tests/testdata/run/033_import_map_remote.out @@ -0,0 +1,5 @@ +Hello from remapped moment! +Hello from remapped moment dir! +Hello from remapped lodash! +Hello from remapped lodash dir! +Hello from remapped Vue! diff --git a/cli/tests/testdata/run/035_cached_only_flag.out b/cli/tests/testdata/run/035_cached_only_flag.out new file mode 100644 index 000000000..3bda398b6 --- /dev/null +++ b/cli/tests/testdata/run/035_cached_only_flag.out @@ -0,0 +1,4 @@ +error: Specifier not found in cache: "http://127.0.0.1:4545/run/019_media_types.ts", --cached-only is specified. + +Caused by: + Specifier not found in cache: "http://127.0.0.1:4545/run/019_media_types.ts", --cached-only is specified. diff --git a/cli/tests/testdata/run/038_checkjs.js b/cli/tests/testdata/run/038_checkjs.js new file mode 100644 index 000000000..f0856d94c --- /dev/null +++ b/cli/tests/testdata/run/038_checkjs.js @@ -0,0 +1,5 @@ +// console.log intentionally misspelled to trigger a type error +consol.log("hello world!"); + +// the following error should be ignored and not output to the console +const foo = new Foo(); diff --git a/cli/tests/testdata/run/038_checkjs.js.out b/cli/tests/testdata/run/038_checkjs.js.out new file mode 100644 index 000000000..4ea473e4f --- /dev/null +++ b/cli/tests/testdata/run/038_checkjs.js.out @@ -0,0 +1,22 @@ +[WILDCARD] +error: TS2552 [ERROR]: Cannot find name 'consol'. Did you mean 'console'? +consol.log("hello world!"); +~~~~~~ + at [WILDCARD]/038_checkjs.js:2:1 + + 'console' is declared here. + declare var console: Console; + ~~~~~~~ + at [WILDCARD] + +TS2552 [ERROR]: Cannot find name 'Foo'. Did you mean 'foo'? +const foo = new Foo(); + ~~~ + at [WILDCARD]/038_checkjs.js:5:17 + + 'foo' is declared here. + const foo = new Foo(); + ~~~ + at [WILDCARD]/038_checkjs.js:5:7 + +Found 2 errors. diff --git a/cli/tests/testdata/run/042_dyn_import_evalcontext.ts b/cli/tests/testdata/run/042_dyn_import_evalcontext.ts new file mode 100644 index 000000000..ccda3a972 --- /dev/null +++ b/cli/tests/testdata/run/042_dyn_import_evalcontext.ts @@ -0,0 +1,4 @@ +// @ts-expect-error "Deno.core" is not a public interface +Deno.core.evalContext( + "(async () => console.log(await import('./subdir/mod4.js')))()", +); diff --git a/cli/tests/testdata/run/042_dyn_import_evalcontext.ts.out b/cli/tests/testdata/run/042_dyn_import_evalcontext.ts.out new file mode 100644 index 000000000..12a45b8da --- /dev/null +++ b/cli/tests/testdata/run/042_dyn_import_evalcontext.ts.out @@ -0,0 +1 @@ +Module { isMod4: true } diff --git a/cli/tests/testdata/run/044_bad_resource.ts b/cli/tests/testdata/run/044_bad_resource.ts new file mode 100644 index 000000000..b956a3e3f --- /dev/null +++ b/cli/tests/testdata/run/044_bad_resource.ts @@ -0,0 +1,3 @@ +const file = await Deno.open("./run/044_bad_resource.ts", { read: true }); +file.close(); +await file.seek(10, 0); diff --git a/cli/tests/testdata/run/044_bad_resource.ts.out b/cli/tests/testdata/run/044_bad_resource.ts.out new file mode 100644 index 000000000..c9912711d --- /dev/null +++ b/cli/tests/testdata/run/044_bad_resource.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Uncaught[WILDCARD] BadResource: Bad resource ID +[WILDCARD] diff --git a/cli/tests/testdata/run/045_mod.ts b/cli/tests/testdata/run/045_mod.ts new file mode 100644 index 000000000..b5f2a0b5b --- /dev/null +++ b/cli/tests/testdata/run/045_mod.ts @@ -0,0 +1,5 @@ +import { output } from "./045_output.ts"; + +if (import.meta.main) { + output("Hello!"); +} diff --git a/cli/tests/testdata/run/045_output.ts b/cli/tests/testdata/run/045_output.ts new file mode 100644 index 000000000..398760ca0 --- /dev/null +++ b/cli/tests/testdata/run/045_output.ts @@ -0,0 +1,3 @@ +export function output(text: string) { + console.log(text); +} diff --git a/cli/tests/testdata/run/045_programmatic_proxy_client.ts b/cli/tests/testdata/run/045_programmatic_proxy_client.ts new file mode 100644 index 000000000..8bc45a4b6 --- /dev/null +++ b/cli/tests/testdata/run/045_programmatic_proxy_client.ts @@ -0,0 +1,16 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +const client = Deno.createHttpClient({ + proxy: { + url: "http://localhost:4555", + basicAuth: { username: "username", password: "password" }, + }, +}); + +const res = await fetch( + "http://localhost:4545/run/045_mod.ts", + { client }, +); +console.log(`Response http: ${await res.text()}`); + +client.close(); diff --git a/cli/tests/testdata/run/045_proxy_client.ts b/cli/tests/testdata/run/045_proxy_client.ts new file mode 100644 index 000000000..2a8728afa --- /dev/null +++ b/cli/tests/testdata/run/045_proxy_client.ts @@ -0,0 +1,5 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +const res = await fetch( + "http://localhost:4545/run/045_mod.ts", +); +console.log(`Response http: ${await res.text()}`); diff --git a/cli/tests/testdata/run/045_proxy_test.ts b/cli/tests/testdata/run/045_proxy_test.ts new file mode 100644 index 000000000..0ff7184b1 --- /dev/null +++ b/cli/tests/testdata/run/045_proxy_test.ts @@ -0,0 +1,121 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +import { Server } from "../../../../test_util/std/http/server.ts"; +import { assertEquals } from "../../../../test_util/std/testing/asserts.ts"; + +const addr = Deno.args[1] || "localhost:4555"; + +async function proxyServer() { + const [hostname, p] = addr.split(":"); + const port = parseInt(p ?? 4555); + const server = new Server({ hostname, port, handler }); + console.log(`Proxy server listening on http://${addr}/`); + await server.listenAndServe(); +} + +async function handler(req: Request): Promise { + console.log(`Proxy request to: ${req.url}`); + const headers = new Headers(req.headers); + const proxyAuthorization = headers.get("proxy-authorization"); + if (proxyAuthorization) { + console.log(`proxy-authorization: ${proxyAuthorization}`); + headers.delete("proxy-authorization"); + } + const resp = await fetch(req.url, { + method: req.method, + headers: headers, + }); + return new Response(new Uint8Array(await resp.arrayBuffer()), { + status: resp.status, + headers: resp.headers, + }); +} + +async function testFetch() { + const { code } = await Deno.spawn(Deno.execPath(), { + args: [ + "run", + "--quiet", + "--reload", + "--allow-net", + "run/045_proxy_client.ts", + ], + env: { + HTTP_PROXY: `http://${addr}`, + }, + }); + + assertEquals(code, 0); +} + +async function testModuleDownload() { + const { code } = await Deno.spawn(Deno.execPath(), { + args: [ + "cache", + "--reload", + "--quiet", + "http://localhost:4545/run/045_mod.ts", + ], + env: { + HTTP_PROXY: `http://${addr}`, + }, + }); + + assertEquals(code, 0); +} + +async function testFetchNoProxy() { + const { code } = await Deno.spawn(Deno.execPath(), { + args: [ + "run", + "--quiet", + "--reload", + "--allow-net", + "run/045_proxy_client.ts", + ], + env: { + HTTP_PROXY: "http://not.exising.proxy.server", + NO_PROXY: "localhost", + }, + }); + + assertEquals(code, 0); +} + +async function testModuleDownloadNoProxy() { + const { code } = await Deno.spawn(Deno.execPath(), { + args: [ + "cache", + "--reload", + "--quiet", + "http://localhost:4545/run/045_mod.ts", + ], + env: { + HTTP_PROXY: "http://not.exising.proxy.server", + NO_PROXY: "localhost", + }, + }); + + assertEquals(code, 0); +} + +async function testFetchProgrammaticProxy() { + const { code } = await Deno.spawn(Deno.execPath(), { + args: [ + "run", + "--quiet", + "--reload", + "--allow-net=localhost:4545,localhost:4555", + "--unstable", + "run/045_programmatic_proxy_client.ts", + ], + }); + assertEquals(code, 0); +} + +proxyServer(); +await testFetch(); +await testModuleDownload(); +await testFetchNoProxy(); +await testModuleDownloadNoProxy(); +await testFetchProgrammaticProxy(); +Deno.exit(0); diff --git a/cli/tests/testdata/run/045_proxy_test.ts.out b/cli/tests/testdata/run/045_proxy_test.ts.out new file mode 100644 index 000000000..a1e567a14 --- /dev/null +++ b/cli/tests/testdata/run/045_proxy_test.ts.out @@ -0,0 +1,6 @@ +Proxy server listening on [WILDCARD] +Proxy request to: http://localhost:4545/run/045_mod.ts +Proxy request to: http://localhost:4545/run/045_mod.ts +Proxy request to: http://localhost:4545/run/045_output.ts +Proxy request to: http://localhost:4545/run/045_mod.ts +proxy-authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= diff --git a/cli/tests/testdata/run/046_jsx_test.tsx b/cli/tests/testdata/run/046_jsx_test.tsx new file mode 100644 index 000000000..5ed3ff2fa --- /dev/null +++ b/cli/tests/testdata/run/046_jsx_test.tsx @@ -0,0 +1,14 @@ +declare global { + export namespace JSX { + interface IntrinsicElements { + [elemName: string]: any; + } + } +} +const React = { + createElement(factory: any, props: any, ...children: any[]) { + return { factory, props, children }; + }, +}; +const View = () =>
land
; +console.log(); diff --git a/cli/tests/testdata/run/046_jsx_test.tsx.out b/cli/tests/testdata/run/046_jsx_test.tsx.out new file mode 100644 index 000000000..85cfe824b --- /dev/null +++ b/cli/tests/testdata/run/046_jsx_test.tsx.out @@ -0,0 +1 @@ +{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/testdata/run/047_jsx_test.jsx b/cli/tests/testdata/run/047_jsx_test.jsx new file mode 100644 index 000000000..4c2314072 --- /dev/null +++ b/cli/tests/testdata/run/047_jsx_test.jsx @@ -0,0 +1,7 @@ +const React = { + createElement(factory, props, ...children) { + return { factory, props, children }; + }, +}; +const View = () =>
land
; +console.log(); diff --git a/cli/tests/testdata/run/047_jsx_test.jsx.out b/cli/tests/testdata/run/047_jsx_test.jsx.out new file mode 100644 index 000000000..85cfe824b --- /dev/null +++ b/cli/tests/testdata/run/047_jsx_test.jsx.out @@ -0,0 +1 @@ +{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/testdata/run/048_media_types_jsx.ts b/cli/tests/testdata/run/048_media_types_jsx.ts new file mode 100644 index 000000000..8dcd0ad68 --- /dev/null +++ b/cli/tests/testdata/run/048_media_types_jsx.ts @@ -0,0 +1,32 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. +import { loaded as loadedTsx1 } from "http://localhost:4545/subdir/mt_text_typescript_tsx.t1.tsx"; +import { loaded as loadedTsx2 } from "http://localhost:4545/subdir/mt_video_vdn_tsx.t2.tsx"; +import { loaded as loadedTsx3 } from "http://localhost:4545/subdir/mt_video_mp2t_tsx.t3.tsx"; +import { loaded as loadedTsx4 } from "http://localhost:4545/subdir/mt_application_x_typescript_tsx.t4.tsx"; +import { loaded as loadedJsx1 } from "http://localhost:4545/subdir/mt_text_javascript_jsx.j1.jsx"; +import { loaded as loadedJsx2 } from "http://localhost:4545/subdir/mt_application_ecmascript_jsx.j2.jsx"; +import { loaded as loadedJsx3 } from "http://localhost:4545/subdir/mt_text_ecmascript_jsx.j3.jsx"; +import { loaded as loadedJsx4 } from "http://localhost:4545/subdir/mt_application_x_javascript_jsx.j4.jsx"; + +declare global { + namespace JSX { + interface IntrinsicElements { + // deno-lint-ignore no-explicit-any + [elemName: string]: any; + } + } +} + +console.log( + "success", + loadedTsx1, + loadedTsx2, + loadedTsx3, + loadedTsx4, + loadedJsx1, + loadedJsx2, + loadedJsx3, + loadedJsx4, +); diff --git a/cli/tests/testdata/run/048_media_types_jsx.ts.out b/cli/tests/testdata/run/048_media_types_jsx.ts.out new file mode 100644 index 000000000..266cc5741 --- /dev/null +++ b/cli/tests/testdata/run/048_media_types_jsx.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +success true true true true true true true true diff --git a/cli/tests/testdata/run/052_no_remote_flag.out b/cli/tests/testdata/run/052_no_remote_flag.out new file mode 100644 index 000000000..f511f6d94 --- /dev/null +++ b/cli/tests/testdata/run/052_no_remote_flag.out @@ -0,0 +1,4 @@ +error: A remote specifier was requested: "http://127.0.0.1:4545/run/019_media_types.ts", but --no-remote is specified. + +Caused by: + A remote specifier was requested: "http://127.0.0.1:4545/run/019_media_types.ts", but --no-remote is specified. diff --git a/cli/tests/testdata/run/056_make_temp_file_write_perm.out b/cli/tests/testdata/run/056_make_temp_file_write_perm.out new file mode 100644 index 000000000..c56aae43f --- /dev/null +++ b/cli/tests/testdata/run/056_make_temp_file_write_perm.out @@ -0,0 +1 @@ +good [WILDCARD]subdir[WILDCARD] diff --git a/cli/tests/testdata/run/056_make_temp_file_write_perm.ts b/cli/tests/testdata/run/056_make_temp_file_write_perm.ts new file mode 100644 index 000000000..c0deda8a2 --- /dev/null +++ b/cli/tests/testdata/run/056_make_temp_file_write_perm.ts @@ -0,0 +1,9 @@ +const path = await Deno.makeTempFile({ dir: `subdir` }); +try { + if (!path.match(/^subdir[/\\][^/\\]+/)) { + throw Error("bad " + path); + } + console.log("good", path); +} finally { + await Deno.remove(path); +} diff --git a/cli/tests/testdata/run/058_tasks_microtasks_close.ts b/cli/tests/testdata/run/058_tasks_microtasks_close.ts new file mode 100644 index 000000000..38e156044 --- /dev/null +++ b/cli/tests/testdata/run/058_tasks_microtasks_close.ts @@ -0,0 +1,19 @@ +// deno-lint-ignore-file no-window-prefix +console.log("sync 1"); +setTimeout(() => { + console.log("setTimeout 1"); + Promise.resolve().then(() => { + console.log("Promise resolve in setTimeout 1"); + }); +}); +Promise.resolve().then(() => { + console.log("promise 1"); +}); +window.close(); +console.log("sync 2"); +setTimeout(() => { + console.log("setTimeout 2"); +}); +setTimeout(() => { + console.log("setTimeout 3"); +}, 100); diff --git a/cli/tests/testdata/run/058_tasks_microtasks_close.ts.out b/cli/tests/testdata/run/058_tasks_microtasks_close.ts.out new file mode 100644 index 000000000..218273cab --- /dev/null +++ b/cli/tests/testdata/run/058_tasks_microtasks_close.ts.out @@ -0,0 +1,6 @@ +sync 1 +sync 2 +promise 1 +setTimeout 1 +Promise resolve in setTimeout 1 +setTimeout 2 diff --git a/cli/tests/testdata/run/059_fs_relative_path_perm.ts b/cli/tests/testdata/run/059_fs_relative_path_perm.ts new file mode 100644 index 000000000..26630fe1c --- /dev/null +++ b/cli/tests/testdata/run/059_fs_relative_path_perm.ts @@ -0,0 +1,2 @@ +// The permission error message shouldn't include the CWD. +Deno.readFileSync("non-existent"); diff --git a/cli/tests/testdata/run/059_fs_relative_path_perm.ts.out b/cli/tests/testdata/run/059_fs_relative_path_perm.ts.out new file mode 100644 index 000000000..b55412137 --- /dev/null +++ b/cli/tests/testdata/run/059_fs_relative_path_perm.ts.out @@ -0,0 +1,4 @@ +[WILDCARD]error: Uncaught PermissionDenied: Requires read access to "non-existent", run again with the --allow-read flag +Deno.readFileSync("non-existent"); + ^ + at [WILDCARD] diff --git a/cli/tests/testdata/run/061_permissions_request.ts b/cli/tests/testdata/run/061_permissions_request.ts new file mode 100644 index 000000000..c31e7ac42 --- /dev/null +++ b/cli/tests/testdata/run/061_permissions_request.ts @@ -0,0 +1,9 @@ +const status1 = + (await Deno.permissions.request({ name: "read", path: "foo" })).state; +const status2 = + (await Deno.permissions.query({ name: "read", path: "bar" })).state; +const status3 = + (await Deno.permissions.request({ name: "read", path: "bar" })).state; +console.log(status1); +console.log(status2); +console.log(status3); diff --git a/cli/tests/testdata/run/062_permissions_request_global.ts b/cli/tests/testdata/run/062_permissions_request_global.ts new file mode 100644 index 000000000..e431bc31b --- /dev/null +++ b/cli/tests/testdata/run/062_permissions_request_global.ts @@ -0,0 +1,6 @@ +const status1 = await Deno.permissions.request({ name: "read" }); +console.log(status1); +const status2 = await Deno.permissions.query({ name: "read", path: "foo" }); +console.log(status2); +const status3 = await Deno.permissions.query({ name: "read", path: "bar" }); +console.log(status3); diff --git a/cli/tests/testdata/run/063_permissions_revoke.ts b/cli/tests/testdata/run/063_permissions_revoke.ts new file mode 100644 index 000000000..a81eee7cb --- /dev/null +++ b/cli/tests/testdata/run/063_permissions_revoke.ts @@ -0,0 +1,6 @@ +const status1 = await Deno.permissions.revoke({ name: "read", path: "foo" }); +console.log(status1); +const status2 = await Deno.permissions.query({ name: "read", path: "bar" }); +console.log(status2); +const status3 = await Deno.permissions.revoke({ name: "read", path: "bar" }); +console.log(status3); diff --git a/cli/tests/testdata/run/063_permissions_revoke.ts.out b/cli/tests/testdata/run/063_permissions_revoke.ts.out new file mode 100644 index 000000000..bbd64c557 --- /dev/null +++ b/cli/tests/testdata/run/063_permissions_revoke.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]PermissionStatus { state: "prompt", onchange: null } +PermissionStatus { state: "granted", onchange: null } +PermissionStatus { state: "prompt", onchange: null } diff --git a/cli/tests/testdata/run/064_permissions_revoke_global.ts b/cli/tests/testdata/run/064_permissions_revoke_global.ts new file mode 100644 index 000000000..a9b1fcd40 --- /dev/null +++ b/cli/tests/testdata/run/064_permissions_revoke_global.ts @@ -0,0 +1,6 @@ +const status1 = await Deno.permissions.revoke({ name: "read" }); +console.log(status1); +const status2 = await Deno.permissions.query({ name: "read", path: "foo" }); +console.log(status2); +const status3 = await Deno.permissions.query({ name: "read", path: "bar" }); +console.log(status3); diff --git a/cli/tests/testdata/run/064_permissions_revoke_global.ts.out b/cli/tests/testdata/run/064_permissions_revoke_global.ts.out new file mode 100644 index 000000000..f7e389a76 --- /dev/null +++ b/cli/tests/testdata/run/064_permissions_revoke_global.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]PermissionStatus { state: "prompt", onchange: null } +PermissionStatus { state: "prompt", onchange: null } +PermissionStatus { state: "prompt", onchange: null } diff --git a/cli/tests/testdata/run/066_prompt.ts b/cli/tests/testdata/run/066_prompt.ts new file mode 100644 index 000000000..e3daa7ac0 --- /dev/null +++ b/cli/tests/testdata/run/066_prompt.ts @@ -0,0 +1,21 @@ +const name0 = prompt("What is your name?", "Jane Doe"); // Answer John Doe +console.log(`Your name is ${name0}.`); +const name1 = prompt("What is your name?", "Jane Doe"); // Answer with default +console.log(`Your name is ${name1}.`); +const input = prompt(); // Answer foo +console.log(`Your input is ${input}.`); +const answer0 = confirm("Question 0"); // Answer y +console.log(`Your answer is ${answer0}`); +const answer1 = confirm("Question 1"); // Answer n +console.log(`Your answer is ${answer1}`); +const answer2 = confirm("Question 2"); // Answer with yes (returns false) +console.log(`Your answer is ${answer2}`); +const answer3 = confirm(); // Answer with default +console.log(`Your answer is ${answer3}`); +const windows = prompt("What is Windows EOL?"); +console.log(`Your answer is ${JSON.stringify(windows)}`); +alert("Hi"); +alert(); +console.log("The end of test"); +const eof = prompt("What is EOF?"); +console.log(`Your answer is ${JSON.stringify(eof)}`); diff --git a/cli/tests/testdata/run/070_location.ts b/cli/tests/testdata/run/070_location.ts new file mode 100644 index 000000000..05e5abdf1 --- /dev/null +++ b/cli/tests/testdata/run/070_location.ts @@ -0,0 +1,18 @@ +// deno-lint-ignore-file no-global-assign +console.log(Location); +console.log(Location.prototype); +console.log(location); +try { + location = {}; +} catch (error) { + if (error instanceof Error) { + console.log(error.toString()); + } +} +try { + location.hostname = "bar"; +} catch (error) { + if (error instanceof Error) { + console.log(error.toString()); + } +} diff --git a/cli/tests/testdata/run/070_location.ts.out b/cli/tests/testdata/run/070_location.ts.out new file mode 100644 index 000000000..692d7c976 --- /dev/null +++ b/cli/tests/testdata/run/070_location.ts.out @@ -0,0 +1,16 @@ +[WILDCARD][Function: Location] +Location {} +Location { + hash: "#bat", + host: "foo", + hostname: "foo", + href: "https://foo/bar?baz#bat", + origin: "https://foo", + pathname: "/bar", + port: "", + protocol: "https:", + search: "?baz" +} +NotSupportedError: Cannot set "location". +NotSupportedError: Cannot set "location.hostname". +[WILDCARD] diff --git a/cli/tests/testdata/run/071_location_unset.ts b/cli/tests/testdata/run/071_location_unset.ts new file mode 100644 index 000000000..f560d2716 --- /dev/null +++ b/cli/tests/testdata/run/071_location_unset.ts @@ -0,0 +1,16 @@ +console.log(Location); +console.log(Location.prototype); +console.log(location); + +globalThis.location = { + hash: "#bat", + host: "foo", + hostname: "foo", + href: "https://foo/bar?baz#bat", + origin: "https://foo", + pathname: "/bar", + port: "", + protocol: "https:", + search: "?baz", +}; +console.log(location.pathname); diff --git a/cli/tests/testdata/run/071_location_unset.ts.out b/cli/tests/testdata/run/071_location_unset.ts.out new file mode 100644 index 000000000..99f87a7fc --- /dev/null +++ b/cli/tests/testdata/run/071_location_unset.ts.out @@ -0,0 +1,5 @@ +[WILDCARD][Function: Location] +Location {} +undefined +/bar +[WILDCARD] diff --git a/cli/tests/testdata/run/072_location_relative_fetch.ts b/cli/tests/testdata/run/072_location_relative_fetch.ts new file mode 100644 index 000000000..b2a291693 --- /dev/null +++ b/cli/tests/testdata/run/072_location_relative_fetch.ts @@ -0,0 +1,2 @@ +const response = await fetch("run/fetch/hello.txt"); +console.log(await response.text()); diff --git a/cli/tests/testdata/run/072_location_relative_fetch.ts.out b/cli/tests/testdata/run/072_location_relative_fetch.ts.out new file mode 100644 index 000000000..8151f6f88 --- /dev/null +++ b/cli/tests/testdata/run/072_location_relative_fetch.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]Hello, world! + diff --git a/cli/tests/testdata/run/075_import_local_query_hash.ts b/cli/tests/testdata/run/075_import_local_query_hash.ts new file mode 100644 index 000000000..99c7ceab4 --- /dev/null +++ b/cli/tests/testdata/run/075_import_local_query_hash.ts @@ -0,0 +1,2 @@ +import "./001_hello.js?a=b#c"; +import "./002_hello.ts?a=b#c"; diff --git a/cli/tests/testdata/run/075_import_local_query_hash.ts.out b/cli/tests/testdata/run/075_import_local_query_hash.ts.out new file mode 100644 index 000000000..340777742 --- /dev/null +++ b/cli/tests/testdata/run/075_import_local_query_hash.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]Hello World +Hello World diff --git a/cli/tests/testdata/run/077_fetch_empty.ts b/cli/tests/testdata/run/077_fetch_empty.ts new file mode 100644 index 000000000..b10a9094e --- /dev/null +++ b/cli/tests/testdata/run/077_fetch_empty.ts @@ -0,0 +1 @@ +await fetch(""); diff --git a/cli/tests/testdata/run/077_fetch_empty.ts.out b/cli/tests/testdata/run/077_fetch_empty.ts.out new file mode 100644 index 000000000..e546cfcec --- /dev/null +++ b/cli/tests/testdata/run/077_fetch_empty.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Uncaught TypeError: Invalid URL +[WILDCARD] diff --git a/cli/tests/testdata/run/078_unload_on_exit.ts b/cli/tests/testdata/run/078_unload_on_exit.ts new file mode 100644 index 000000000..43d33eb25 --- /dev/null +++ b/cli/tests/testdata/run/078_unload_on_exit.ts @@ -0,0 +1,9 @@ +window.onunload = () => { + console.log("onunload is called"); + // This second exit call doesn't trigger unload event, + // and therefore actually stops the process. + Deno.exit(1); + console.log("This doesn't show up in console"); +}; +// This exit call triggers the above unload event handler. +Deno.exit(0); diff --git a/cli/tests/testdata/run/078_unload_on_exit.ts.out b/cli/tests/testdata/run/078_unload_on_exit.ts.out new file mode 100644 index 000000000..e213f9632 --- /dev/null +++ b/cli/tests/testdata/run/078_unload_on_exit.ts.out @@ -0,0 +1 @@ +[WILDCARD]onunload is called diff --git a/cli/tests/testdata/run/079_location_authentication.ts b/cli/tests/testdata/run/079_location_authentication.ts new file mode 100644 index 000000000..4989312ac --- /dev/null +++ b/cli/tests/testdata/run/079_location_authentication.ts @@ -0,0 +1 @@ +console.log(location.href); diff --git a/cli/tests/testdata/run/079_location_authentication.ts.out b/cli/tests/testdata/run/079_location_authentication.ts.out new file mode 100644 index 000000000..bb2458497 --- /dev/null +++ b/cli/tests/testdata/run/079_location_authentication.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +https://baz/qux +[WILDCARD] diff --git a/cli/tests/testdata/run/081_location_relative_fetch_redirect.ts b/cli/tests/testdata/run/081_location_relative_fetch_redirect.ts new file mode 100644 index 000000000..742ef0afb --- /dev/null +++ b/cli/tests/testdata/run/081_location_relative_fetch_redirect.ts @@ -0,0 +1,2 @@ +const response = await fetch("/"); +console.log(response.url); diff --git a/cli/tests/testdata/run/081_location_relative_fetch_redirect.ts.out b/cli/tests/testdata/run/081_location_relative_fetch_redirect.ts.out new file mode 100644 index 000000000..f62b93195 --- /dev/null +++ b/cli/tests/testdata/run/081_location_relative_fetch_redirect.ts.out @@ -0,0 +1 @@ +[WILDCARD]http://localhost:4545/ diff --git a/cli/tests/testdata/run/082_prepare_stack_trace_throw.js b/cli/tests/testdata/run/082_prepare_stack_trace_throw.js new file mode 100644 index 000000000..8137bfdc8 --- /dev/null +++ b/cli/tests/testdata/run/082_prepare_stack_trace_throw.js @@ -0,0 +1,6 @@ +Error.prepareStackTrace = () => { + console.trace(); + throw new Error("foo"); +}; + +new Error("bar").stack; diff --git a/cli/tests/testdata/run/082_prepare_stack_trace_throw.js.out b/cli/tests/testdata/run/082_prepare_stack_trace_throw.js.out new file mode 100644 index 000000000..751b7c971 --- /dev/null +++ b/cli/tests/testdata/run/082_prepare_stack_trace_throw.js.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Uncaught Error: foo +[WILDCARD] diff --git a/cli/tests/testdata/run/083_legacy_external_source_map.ts b/cli/tests/testdata/run/083_legacy_external_source_map.ts new file mode 100644 index 000000000..73d267b87 --- /dev/null +++ b/cli/tests/testdata/run/083_legacy_external_source_map.ts @@ -0,0 +1,2 @@ +// - +throw new Error("foo"); diff --git a/cli/tests/testdata/run/088_dynamic_import_already_evaluating.ts b/cli/tests/testdata/run/088_dynamic_import_already_evaluating.ts new file mode 100644 index 000000000..272163a5d --- /dev/null +++ b/cli/tests/testdata/run/088_dynamic_import_already_evaluating.ts @@ -0,0 +1,2 @@ +import("./088_dynamic_import_target.ts").then(() => console.log(3)); +import("./088_dynamic_import_target.ts").then(() => console.log(3)); diff --git a/cli/tests/testdata/run/088_dynamic_import_already_evaluating.ts.out b/cli/tests/testdata/run/088_dynamic_import_already_evaluating.ts.out new file mode 100644 index 000000000..a36dd11e7 --- /dev/null +++ b/cli/tests/testdata/run/088_dynamic_import_already_evaluating.ts.out @@ -0,0 +1,4 @@ +[WILDCARD]1 +2 +3 +3 diff --git a/cli/tests/testdata/run/088_dynamic_import_target.ts b/cli/tests/testdata/run/088_dynamic_import_target.ts new file mode 100644 index 000000000..226f1851a --- /dev/null +++ b/cli/tests/testdata/run/088_dynamic_import_target.ts @@ -0,0 +1,3 @@ +console.log(1); +await new Promise((r) => setTimeout(r, 100)); +console.log(2); diff --git a/cli/tests/testdata/run/089_run_allow_list.ts b/cli/tests/testdata/run/089_run_allow_list.ts new file mode 100644 index 000000000..d7bc8e195 --- /dev/null +++ b/cli/tests/testdata/run/089_run_allow_list.ts @@ -0,0 +1,12 @@ +try { + await Deno.spawn("ls"); +} catch (e) { + console.log(e); +} + +const { success } = await Deno.spawn("curl", { + args: ["--help"], + stdout: "null", + stderr: "inherit", +}); +console.log(success); diff --git a/cli/tests/testdata/run/089_run_allow_list.ts.out b/cli/tests/testdata/run/089_run_allow_list.ts.out new file mode 100644 index 000000000..68a4a2ac5 --- /dev/null +++ b/cli/tests/testdata/run/089_run_allow_list.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]PermissionDenied: Requires run access to "ls", run again with the --allow-run flag +[WILDCARD] +true diff --git a/cli/tests/testdata/run/090_run_permissions_request.ts b/cli/tests/testdata/run/090_run_permissions_request.ts new file mode 100644 index 000000000..8ecad2b3b --- /dev/null +++ b/cli/tests/testdata/run/090_run_permissions_request.ts @@ -0,0 +1,18 @@ +const status1 = + (await Deno.permissions.request({ name: "run", command: "ls" })).state; +if (status1 != "granted") { + throw Error(`unexpected status1 ${status1}`); +} +const status2 = + (await Deno.permissions.query({ name: "run", command: "cat" })).state; +if (status2 != "prompt") { + throw Error(`unexpected status2 ${status2}`); +} +const status3 = + (await Deno.permissions.request({ name: "run", command: "cat" })).state; +if (status3 != "denied") { + throw Error(`unexpected status3 ${status3}`); +} +console.log(status1); +console.log(status2); +console.log(status3); diff --git a/cli/tests/testdata/run/091_use_define_for_class_fields.ts b/cli/tests/testdata/run/091_use_define_for_class_fields.ts new file mode 100644 index 000000000..46be3ac0b --- /dev/null +++ b/cli/tests/testdata/run/091_use_define_for_class_fields.ts @@ -0,0 +1,4 @@ +class _A { + b = this.a; + constructor(public a: unknown) {} +} diff --git a/cli/tests/testdata/run/091_use_define_for_class_fields.ts.out b/cli/tests/testdata/run/091_use_define_for_class_fields.ts.out new file mode 100644 index 000000000..08f94a967 --- /dev/null +++ b/cli/tests/testdata/run/091_use_define_for_class_fields.ts.out @@ -0,0 +1,4 @@ +[WILDCARD]error: TS2729 [ERROR]: Property 'a' is used before its initialization. + b = this.a; + ^ +[WILDCARD] diff --git a/cli/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts b/cli/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts new file mode 100644 index 000000000..87684430d --- /dev/null +++ b/cli/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts @@ -0,0 +1 @@ +await import("unmapped"); diff --git a/cli/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts.out b/cli/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts.out new file mode 100644 index 000000000..6e82ad410 --- /dev/null +++ b/cli/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts.out @@ -0,0 +1,7 @@ +[WILDCARD] +error: Uncaught (in promise) TypeError: Relative import path "unmapped" not prefixed with / or ./ or ../ and not in import map from "file://[WILDCARD]/092_import_map_unmapped_bare_specifier.ts" + at file://[WILDCARD]/092_import_map_unmapped_bare_specifier.ts:1:14 + +await import("unmapped"); +^ + at async file://[WILDCARD]/092_import_map_unmapped_bare_specifier.ts:1:1 diff --git a/cli/tests/testdata/run/aggregate_error.out b/cli/tests/testdata/run/aggregate_error.out new file mode 100644 index 000000000..7d0c09c70 --- /dev/null +++ b/cli/tests/testdata/run/aggregate_error.out @@ -0,0 +1,18 @@ +AggregateError: Multiple errors. + at [WILDCARD]/aggregate_error.ts:1:24 + +AggregateError: Multiple errors. + Error: Error message 1. + at [WILDCARD]/aggregate_error.ts:2:3 + Error: Error message 2. + at [WILDCARD]/aggregate_error.ts:3:3 + at [WILDCARD]/aggregate_error.ts:1:24 + +error: Uncaught AggregateError: Multiple errors. + Error: Error message 1. + at [WILDCARD]/aggregate_error.ts:2:3 + Error: Error message 2. + at [WILDCARD]/aggregate_error.ts:3:3 +const aggregateError = new AggregateError([ + ^ + at [WILDCARD]/aggregate_error.ts:1:24 diff --git a/cli/tests/testdata/run/aggregate_error.ts b/cli/tests/testdata/run/aggregate_error.ts new file mode 100644 index 000000000..ce4b54376 --- /dev/null +++ b/cli/tests/testdata/run/aggregate_error.ts @@ -0,0 +1,9 @@ +const aggregateError = new AggregateError([ + new Error("Error message 1."), + new Error("Error message 2."), +], "Multiple errors."); +console.log(aggregateError.stack); +console.log(); +console.log(aggregateError); +console.log(); +throw aggregateError; diff --git a/cli/tests/testdata/run/async_error.ts b/cli/tests/testdata/run/async_error.ts new file mode 100644 index 000000000..b55c73aeb --- /dev/null +++ b/cli/tests/testdata/run/async_error.ts @@ -0,0 +1,9 @@ +console.log("hello"); +// deno-lint-ignore require-await +const foo = async (): Promise => { + console.log("before error"); + throw Error("error"); +}; + +foo(); +console.log("world"); diff --git a/cli/tests/testdata/run/async_error.ts.out b/cli/tests/testdata/run/async_error.ts.out new file mode 100644 index 000000000..b424f9072 --- /dev/null +++ b/cli/tests/testdata/run/async_error.ts.out @@ -0,0 +1,8 @@ +[WILDCARD]hello +before error +world +error: Uncaught (in promise) Error: error + throw Error("error"); + ^ + at foo ([WILDCARD]/async_error.ts:5:9) + at [WILDCARD]/async_error.ts:8:1 diff --git a/cli/tests/testdata/run/before_unload.js b/cli/tests/testdata/run/before_unload.js new file mode 100644 index 000000000..2572e512b --- /dev/null +++ b/cli/tests/testdata/run/before_unload.js @@ -0,0 +1,21 @@ +let count = 0; + +console.log("0"); + +globalThis.addEventListener("beforeunload", (e) => { + console.log("GOT EVENT"); + if (count === 0 || count === 1) { + e.preventDefault(); + setTimeout(() => { + console.log("3"); + }, 100); + } + + count++; +}); + +console.log("1"); + +setTimeout(() => { + console.log("2"); +}, 100); diff --git a/cli/tests/testdata/run/before_unload.js.out b/cli/tests/testdata/run/before_unload.js.out new file mode 100644 index 000000000..f1f2ab49a --- /dev/null +++ b/cli/tests/testdata/run/before_unload.js.out @@ -0,0 +1,8 @@ +0 +1 +2 +GOT EVENT +3 +GOT EVENT +3 +GOT EVENT diff --git a/cli/tests/testdata/run/blob_gc_finalization.js b/cli/tests/testdata/run/blob_gc_finalization.js new file mode 100644 index 000000000..c721e6b45 --- /dev/null +++ b/cli/tests/testdata/run/blob_gc_finalization.js @@ -0,0 +1,11 @@ +// This test creates 128 blobs of 128 MB each. This will only work if the blobs +// and their backing data is GCed as expected. +for (let i = 0; i < 128; i++) { + // Create a 128MB byte array, and then a blob from it. + const buf = new Uint8Array(128 * 1024 * 1024); + new Blob([buf]); + // It is very important that there is a yield here, otherwise the finalizer + // for the blob is not called and the memory is not freed. + await new Promise((resolve) => setTimeout(resolve, 0)); +} +console.log("GCed all blobs"); diff --git a/cli/tests/testdata/run/blob_gc_finalization.js.out b/cli/tests/testdata/run/blob_gc_finalization.js.out new file mode 100644 index 000000000..dcc4500f8 --- /dev/null +++ b/cli/tests/testdata/run/blob_gc_finalization.js.out @@ -0,0 +1 @@ +GCed all blobs diff --git a/cli/tests/testdata/run/byte_order_mark.out b/cli/tests/testdata/run/byte_order_mark.out new file mode 100644 index 000000000..557db03de --- /dev/null +++ b/cli/tests/testdata/run/byte_order_mark.out @@ -0,0 +1 @@ +Hello World diff --git a/cli/tests/testdata/run/byte_order_mark.ts b/cli/tests/testdata/run/byte_order_mark.ts new file mode 100644 index 000000000..40eb23c1d --- /dev/null +++ b/cli/tests/testdata/run/byte_order_mark.ts @@ -0,0 +1,4 @@ +import "./001_hello.js"; +// Note this file starts with special byte order mark +// it's important that this file is a .ts typescript file which is passed to +// deno through `--no-check` mode. diff --git a/cli/tests/testdata/run/checkjs.tsconfig.json b/cli/tests/testdata/run/checkjs.tsconfig.json new file mode 100644 index 000000000..46d96db9e --- /dev/null +++ b/cli/tests/testdata/run/checkjs.tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "allowJs": true, + "checkJs": true + } +} diff --git a/cli/tests/testdata/run/cjs_imports/commonjs.cjs b/cli/tests/testdata/run/cjs_imports/commonjs.cjs new file mode 100644 index 000000000..7df7d571e --- /dev/null +++ b/cli/tests/testdata/run/cjs_imports/commonjs.cjs @@ -0,0 +1 @@ +console.log("Hello World"); \ No newline at end of file diff --git a/cli/tests/testdata/run/cjs_imports/main.out b/cli/tests/testdata/run/cjs_imports/main.out new file mode 100644 index 000000000..557db03de --- /dev/null +++ b/cli/tests/testdata/run/cjs_imports/main.out @@ -0,0 +1 @@ +Hello World diff --git a/cli/tests/testdata/run/cjs_imports/main.ts b/cli/tests/testdata/run/cjs_imports/main.ts new file mode 100644 index 000000000..d8b77c22e --- /dev/null +++ b/cli/tests/testdata/run/cjs_imports/main.ts @@ -0,0 +1 @@ +import "./commonjs.cjs"; diff --git a/cli/tests/testdata/run/classic_workers_event_loop.js b/cli/tests/testdata/run/classic_workers_event_loop.js new file mode 100644 index 000000000..810a6df7f --- /dev/null +++ b/cli/tests/testdata/run/classic_workers_event_loop.js @@ -0,0 +1,4 @@ +new Worker( + "data:application/javascript,setTimeout(() => {console.log('done'); self.close()}, 1000)", + { type: "classic" }, +); diff --git a/cli/tests/testdata/run/classic_workers_event_loop.js.out b/cli/tests/testdata/run/classic_workers_event_loop.js.out new file mode 100644 index 000000000..19f86f493 --- /dev/null +++ b/cli/tests/testdata/run/classic_workers_event_loop.js.out @@ -0,0 +1 @@ +done diff --git a/cli/tests/testdata/run/colors_without_globalThis.js b/cli/tests/testdata/run/colors_without_globalThis.js new file mode 100644 index 000000000..f9d4b68fc --- /dev/null +++ b/cli/tests/testdata/run/colors_without_globalThis.js @@ -0,0 +1 @@ +console.log(delete globalThis.globalThis); diff --git a/cli/tests/testdata/run/complex_error.ts b/cli/tests/testdata/run/complex_error.ts new file mode 100644 index 000000000..b462992ac --- /dev/null +++ b/cli/tests/testdata/run/complex_error.ts @@ -0,0 +1,18 @@ +const error = new AggregateError( + [ + new AggregateError([new Error("qux1"), new Error("quux1")]), + new Error("bar1", { cause: new Error("baz1") }), + ], + "foo1", + { + cause: new AggregateError([ + new AggregateError([new Error("qux2"), new Error("quux2")]), + new Error("bar2", { cause: new Error("baz2") }), + ], "foo2"), + }, +); +console.log(error.stack); +console.log(); +console.log(error); +console.log(); +throw error; diff --git a/cli/tests/testdata/run/complex_error.ts.out b/cli/tests/testdata/run/complex_error.ts.out new file mode 100644 index 000000000..eef1b7699 --- /dev/null +++ b/cli/tests/testdata/run/complex_error.ts.out @@ -0,0 +1,44 @@ +AggregateError: foo1 + at [WILDCARD]/complex_error.ts:1:15 + +AggregateError: foo1 + AggregateError + Error: qux1 + at [WILDCARD]/complex_error.ts:3:25 + Error: quux1 + at [WILDCARD]/complex_error.ts:3:44 + at [WILDCARD]/complex_error.ts:3:5 + Error: bar1 + at [WILDCARD]/complex_error.ts:4:5 + Caused by Error: baz1 + at [WILDCARD]/complex_error.ts:4:32 + at [WILDCARD]/complex_error.ts:1:15 +Caused by AggregateError: foo2 + at [WILDCARD]/complex_error.ts:8:12 + +error: Uncaught AggregateError: foo1 + AggregateError + Error: qux1 + at [WILDCARD]/complex_error.ts:3:25 + Error: quux1 + at [WILDCARD]/complex_error.ts:3:44 + at [WILDCARD]/complex_error.ts:3:5 + Error: bar1 + at [WILDCARD]/complex_error.ts:4:5 + Caused by: Error: baz1 + at [WILDCARD]/complex_error.ts:4:32 +const error = new AggregateError( + ^ + at [WILDCARD]/complex_error.ts:1:15 +Caused by: AggregateError: foo2 + AggregateError + Error: qux2 + at [WILDCARD]/complex_error.ts:9:27 + Error: quux2 + at [WILDCARD]/complex_error.ts:9:46 + at [WILDCARD]/complex_error.ts:9:7 + Error: bar2 + at [WILDCARD]/complex_error.ts:10:7 + Caused by: Error: baz2 + at [WILDCARD]/complex_error.ts:10:34 + at [WILDCARD]/complex_error.ts:8:12 diff --git a/cli/tests/testdata/run/complex_permissions_test.ts b/cli/tests/testdata/run/complex_permissions_test.ts new file mode 100644 index 000000000..bae157246 --- /dev/null +++ b/cli/tests/testdata/run/complex_permissions_test.ts @@ -0,0 +1,53 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +const name = Deno.args[0]; +// deno-lint-ignore no-explicit-any +const test: { [key: string]: (...args: any[]) => void | Promise } = { + read(files: string[]) { + files.forEach((file) => Deno.readFileSync(file)); + }, + write(files: string[]) { + files.forEach((file) => + Deno.writeFileSync(file, new Uint8Array(0), { append: true }) + ); + }, + netFetch(urls: string[]) { + urls.forEach((url) => fetch(url)); + }, + netListen(endpoints: string[]) { + endpoints.forEach((endpoint) => { + const index = endpoint.lastIndexOf(":"); + const [hostname, port] = [ + endpoint.substr(0, index), + endpoint.substr(index + 1), + ]; + const listener = Deno.listen({ + transport: "tcp", + hostname, + port: parseInt(port, 10), + }); + listener.close(); + }); + }, + async netConnect(endpoints: string[]) { + for (const endpoint of endpoints) { + const index = endpoint.lastIndexOf(":"); + const [hostname, port] = [ + endpoint.substr(0, index), + endpoint.substr(index + 1), + ]; + const listener = await Deno.connect({ + transport: "tcp", + hostname, + port: parseInt(port, 10), + }); + listener.close(); + } + }, +}; + +if (!test[name]) { + console.log("Unknown test:", name); + Deno.exit(1); +} + +test[name](Deno.args.slice(1)); diff --git a/cli/tests/testdata/run/config/main.out b/cli/tests/testdata/run/config/main.out new file mode 100644 index 000000000..277314807 --- /dev/null +++ b/cli/tests/testdata/run/config/main.out @@ -0,0 +1,4 @@ +[WILDCARD]Unsupported compiler options in "[WILDCARD]tsconfig.json". + The following options were ignored: + module, target +Check [WILDCARD]/main.ts diff --git a/cli/tests/testdata/run/config/main.ts b/cli/tests/testdata/run/config/main.ts new file mode 100644 index 000000000..51a61e447 --- /dev/null +++ b/cli/tests/testdata/run/config/main.ts @@ -0,0 +1,5 @@ +function foo(bar) { + return bar; +} + +foo(1); diff --git a/cli/tests/testdata/run/config/tsconfig.json b/cli/tests/testdata/run/config/tsconfig.json new file mode 100644 index 000000000..0f0881920 --- /dev/null +++ b/cli/tests/testdata/run/config/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "module": "amd", + "strict": false, + "target": "es5" + } +} diff --git a/cli/tests/testdata/run/config_json_import.ts b/cli/tests/testdata/run/config_json_import.ts new file mode 100644 index 000000000..9cf1cceaa --- /dev/null +++ b/cli/tests/testdata/run/config_json_import.ts @@ -0,0 +1,2 @@ +import config from "../jsx/deno-jsx.json" assert { type: "json" }; +console.log(config); diff --git a/cli/tests/testdata/run/config_json_import.ts.out b/cli/tests/testdata/run/config_json_import.ts.out new file mode 100644 index 000000000..aa55be7d5 --- /dev/null +++ b/cli/tests/testdata/run/config_json_import.ts.out @@ -0,0 +1,3 @@ +{ + compilerOptions: { jsx: "react-jsx", jsxImportSource: "http://localhost:4545/jsx" } +} diff --git a/cli/tests/testdata/run/config_types/main.out b/cli/tests/testdata/run/config_types/main.out new file mode 100644 index 000000000..417b7b537 --- /dev/null +++ b/cli/tests/testdata/run/config_types/main.out @@ -0,0 +1 @@ +undefined diff --git a/cli/tests/testdata/run/config_types/main.ts b/cli/tests/testdata/run/config_types/main.ts new file mode 100644 index 000000000..f1a8d6583 --- /dev/null +++ b/cli/tests/testdata/run/config_types/main.ts @@ -0,0 +1 @@ +console.log(globalThis.a); diff --git a/cli/tests/testdata/run/config_types/remote.tsconfig.json b/cli/tests/testdata/run/config_types/remote.tsconfig.json new file mode 100644 index 000000000..255ff5def --- /dev/null +++ b/cli/tests/testdata/run/config_types/remote.tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "types": [ + "http://localhost:4545/run/config_types/types.d.ts" + ] + } +} diff --git a/cli/tests/testdata/run/config_types/tsconfig.json b/cli/tests/testdata/run/config_types/tsconfig.json new file mode 100644 index 000000000..85f1549e0 --- /dev/null +++ b/cli/tests/testdata/run/config_types/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "types": [ + "./types.d.ts" + ] + } +} diff --git a/cli/tests/testdata/run/config_types/types.d.ts b/cli/tests/testdata/run/config_types/types.d.ts new file mode 100644 index 000000000..536a6d0a6 --- /dev/null +++ b/cli/tests/testdata/run/config_types/types.d.ts @@ -0,0 +1,2 @@ +// deno-lint-ignore-file no-var +declare var a: string; diff --git a/cli/tests/testdata/run/custom_inspect_url.js b/cli/tests/testdata/run/custom_inspect_url.js new file mode 100644 index 000000000..69aa2dc49 --- /dev/null +++ b/cli/tests/testdata/run/custom_inspect_url.js @@ -0,0 +1,3 @@ +console.log([new URL("https://example.com/path")]); +console.log({ url: new URL("https://example.com/path") }); +console.log({ url: [new URL("https://example.com/path")] }); diff --git a/cli/tests/testdata/run/custom_inspect_url.js.out b/cli/tests/testdata/run/custom_inspect_url.js.out new file mode 100644 index 000000000..1c714e34e --- /dev/null +++ b/cli/tests/testdata/run/custom_inspect_url.js.out @@ -0,0 +1,47 @@ +[ + URL { + href: "https://example.com/path", + origin: "https://example.com", + protocol: "https:", + username: "", + password: "", + host: "example.com", + hostname: "example.com", + port: "", + pathname: "/path", + hash: "", + search: "" + } +] +{ + url: URL { + href: "https://example.com/path", + origin: "https://example.com", + protocol: "https:", + username: "", + password: "", + host: "example.com", + hostname: "example.com", + port: "", + pathname: "/path", + hash: "", + search: "" + } +} +{ + url: [ + URL { + href: "https://example.com/path", + origin: "https://example.com", + protocol: "https:", + username: "", + password: "", + host: "example.com", + hostname: "example.com", + port: "", + pathname: "/path", + hash: "", + search: "" + } + ] +} diff --git a/cli/tests/testdata/run/delete_window.js b/cli/tests/testdata/run/delete_window.js new file mode 100644 index 000000000..f2f16820d --- /dev/null +++ b/cli/tests/testdata/run/delete_window.js @@ -0,0 +1 @@ +console.log(delete globalThis.window); diff --git a/cli/tests/testdata/run/deno_exit_tampering.ts b/cli/tests/testdata/run/deno_exit_tampering.ts new file mode 100644 index 000000000..3b24261e2 --- /dev/null +++ b/cli/tests/testdata/run/deno_exit_tampering.ts @@ -0,0 +1,3 @@ +delete globalThis.dispatchEvent; +delete EventTarget.prototype.dispatchEvent; +Deno.exit(42); diff --git a/cli/tests/testdata/run/disallow_http_from_https.js b/cli/tests/testdata/run/disallow_http_from_https.js new file mode 100644 index 000000000..b8ddff170 --- /dev/null +++ b/cli/tests/testdata/run/disallow_http_from_https.js @@ -0,0 +1,2 @@ +// Trying to import "http://", while this file is accessed by "https://" +import "http://localhost:4545/run/001_hello.js"; diff --git a/cli/tests/testdata/run/disallow_http_from_https.ts b/cli/tests/testdata/run/disallow_http_from_https.ts new file mode 100644 index 000000000..b8ddff170 --- /dev/null +++ b/cli/tests/testdata/run/disallow_http_from_https.ts @@ -0,0 +1,2 @@ +// Trying to import "http://", while this file is accessed by "https://" +import "http://localhost:4545/run/001_hello.js"; diff --git a/cli/tests/testdata/run/disallow_http_from_https_js.out b/cli/tests/testdata/run/disallow_http_from_https_js.out new file mode 100644 index 000000000..5dc327975 --- /dev/null +++ b/cli/tests/testdata/run/disallow_http_from_https_js.out @@ -0,0 +1,3 @@ +error: Modules imported via https are not allowed to import http modules. + Importing: http://localhost:4545/run/001_hello.js + at https://localhost:5545/run/disallow_http_from_https.js:2:8 diff --git a/cli/tests/testdata/run/disallow_http_from_https_ts.out b/cli/tests/testdata/run/disallow_http_from_https_ts.out new file mode 100644 index 000000000..e3b8f4390 --- /dev/null +++ b/cli/tests/testdata/run/disallow_http_from_https_ts.out @@ -0,0 +1,3 @@ +error: Modules imported via https are not allowed to import http modules. + Importing: http://localhost:4545/run/001_hello.js + at https://localhost:5545/run/disallow_http_from_https.ts:2:8 diff --git a/cli/tests/testdata/run/dom_exception_formatting.ts b/cli/tests/testdata/run/dom_exception_formatting.ts new file mode 100644 index 000000000..0209ec81e --- /dev/null +++ b/cli/tests/testdata/run/dom_exception_formatting.ts @@ -0,0 +1 @@ +throw new DOMException("foo", "SyntaxError"); diff --git a/cli/tests/testdata/run/dom_exception_formatting.ts.out b/cli/tests/testdata/run/dom_exception_formatting.ts.out new file mode 100644 index 000000000..bcdd714ea --- /dev/null +++ b/cli/tests/testdata/run/dom_exception_formatting.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]error: Uncaught SyntaxError: foo +[WILDCARD] + at file:///[WILDCARD]/dom_exception_formatting.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/dynamic_import_already_rejected/error_001.ts b/cli/tests/testdata/run/dynamic_import_already_rejected/error_001.ts new file mode 100644 index 000000000..b01068bc0 --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_already_rejected/error_001.ts @@ -0,0 +1,9 @@ +function foo(): never { + throw Error("bad"); +} + +function bar() { + foo(); +} + +bar(); diff --git a/cli/tests/testdata/run/dynamic_import_already_rejected/main.out b/cli/tests/testdata/run/dynamic_import_already_rejected/main.out new file mode 100644 index 000000000..c3eb66f9e --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_already_rejected/main.out @@ -0,0 +1,4 @@ +[WILDCARD]Caught: Error: bad + at [WILDCARD]/error_001.ts:[WILDCARD] +Caught: Error: bad + at [WILDCARD]/error_001.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/dynamic_import_already_rejected/main.ts b/cli/tests/testdata/run/dynamic_import_already_rejected/main.ts new file mode 100644 index 000000000..249de8d8b --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_already_rejected/main.ts @@ -0,0 +1,15 @@ +try { + await import("./error_001.ts"); +} catch (error) { + if (error instanceof Error) { + console.log(`Caught: ${error.stack}`); + } +} + +try { + await import("./error_001.ts"); +} catch (error) { + if (error instanceof Error) { + console.log(`Caught: ${error.stack}`); + } +} diff --git a/cli/tests/testdata/run/dynamic_import_async_error/delayed_error.ts b/cli/tests/testdata/run/dynamic_import_async_error/delayed_error.ts new file mode 100644 index 000000000..76057e627 --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_async_error/delayed_error.ts @@ -0,0 +1,2 @@ +await new Promise((r) => setTimeout(r, 100)); +throw new Error("foo"); diff --git a/cli/tests/testdata/run/dynamic_import_async_error/main.out b/cli/tests/testdata/run/dynamic_import_async_error/main.out new file mode 100644 index 000000000..974c2e426 --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_async_error/main.out @@ -0,0 +1,2 @@ +[WILDCARD]Caught: Error: foo + at [WILDCARD]/delayed_error.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/dynamic_import_async_error/main.ts b/cli/tests/testdata/run/dynamic_import_async_error/main.ts new file mode 100644 index 000000000..998e7ed3e --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_async_error/main.ts @@ -0,0 +1,7 @@ +try { + await import("./delayed_error.ts"); +} catch (error) { + if (error instanceof Error) { + console.log(`Caught: ${error.stack}`); + } +} diff --git a/cli/tests/testdata/run/dynamic_import_conditional.js b/cli/tests/testdata/run/dynamic_import_conditional.js new file mode 100644 index 000000000..1b4193e3e --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_conditional.js @@ -0,0 +1,3 @@ +const Worker = globalThis.Worker ?? (await import("worker_threads")).Worker; + +console.log(!!Worker); diff --git a/cli/tests/testdata/run/dynamic_import_conditional.js.out b/cli/tests/testdata/run/dynamic_import_conditional.js.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_conditional.js.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/testdata/run/empty.ts b/cli/tests/testdata/run/empty.ts new file mode 100644 index 000000000..e69de29bb diff --git a/cli/tests/testdata/run/error_001.ts b/cli/tests/testdata/run/error_001.ts new file mode 100644 index 000000000..b01068bc0 --- /dev/null +++ b/cli/tests/testdata/run/error_001.ts @@ -0,0 +1,9 @@ +function foo(): never { + throw Error("bad"); +} + +function bar() { + foo(); +} + +bar(); diff --git a/cli/tests/testdata/run/error_001.ts.out b/cli/tests/testdata/run/error_001.ts.out new file mode 100644 index 000000000..25664a9a4 --- /dev/null +++ b/cli/tests/testdata/run/error_001.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught Error: bad + throw Error("bad"); + ^ + at foo ([WILDCARD]/error_001.ts:2:9) + at bar ([WILDCARD]/error_001.ts:6:3) + at [WILDCARD]/error_001.ts:9:1 diff --git a/cli/tests/testdata/run/error_002.ts b/cli/tests/testdata/run/error_002.ts new file mode 100644 index 000000000..5f8179bbe --- /dev/null +++ b/cli/tests/testdata/run/error_002.ts @@ -0,0 +1,7 @@ +import { throwsError } from "../subdir/mod1.ts"; + +function foo() { + throwsError(); +} + +foo(); diff --git a/cli/tests/testdata/run/error_002.ts.out b/cli/tests/testdata/run/error_002.ts.out new file mode 100644 index 000000000..96b9e602a --- /dev/null +++ b/cli/tests/testdata/run/error_002.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught Error: exception from mod1 + throw Error("exception from mod1"); + ^ + at throwsError ([WILDCARD]/subdir/mod1.ts:16:9) + at foo ([WILDCARD]/error_002.ts:4:3) + at [WILDCARD]/error_002.ts:7:1 diff --git a/cli/tests/testdata/run/error_003_typescript.ts b/cli/tests/testdata/run/error_003_typescript.ts new file mode 100644 index 000000000..e1f882123 --- /dev/null +++ b/cli/tests/testdata/run/error_003_typescript.ts @@ -0,0 +1,20 @@ +// deno-lint-ignore-file +let x = { + a: { + b: { + c() { + return { d: "hello" }; + }, + }, + }, +}; +let y = { + a: { + b: { + c() { + return { d: 1234 }; + }, + }, + }, +}; +x = y; diff --git a/cli/tests/testdata/run/error_003_typescript.ts.out b/cli/tests/testdata/run/error_003_typescript.ts.out new file mode 100644 index 000000000..bbb2ec470 --- /dev/null +++ b/cli/tests/testdata/run/error_003_typescript.ts.out @@ -0,0 +1,7 @@ +[WILDCARD] +error: TS2322 [ERROR]: Type '{ a: { b: { c(): { d: number; }; }; }; }' is not assignable to type '{ a: { b: { c(): { d: string; }; }; }; }'. + The types of 'a.b.c().d' are incompatible between these types. + Type 'number' is not assignable to type 'string'. +x = y; +^ + at [WILDCARD]/error_003_typescript.ts:20:1 diff --git a/cli/tests/testdata/run/error_004_missing_module.ts b/cli/tests/testdata/run/error_004_missing_module.ts new file mode 100644 index 000000000..82b281181 --- /dev/null +++ b/cli/tests/testdata/run/error_004_missing_module.ts @@ -0,0 +1,3 @@ +import * as badModule from "./bad-module.ts"; + +console.log(badModule); diff --git a/cli/tests/testdata/run/error_004_missing_module.ts.out b/cli/tests/testdata/run/error_004_missing_module.ts.out new file mode 100644 index 000000000..9a2cfb8a8 --- /dev/null +++ b/cli/tests/testdata/run/error_004_missing_module.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Module not found "file:///[WILDCARD]/bad-module.ts". + at file:///[WILDCARD]/error_004_missing_module.ts:1:28 diff --git a/cli/tests/testdata/run/error_005_missing_dynamic_import.ts b/cli/tests/testdata/run/error_005_missing_dynamic_import.ts new file mode 100644 index 000000000..8ea8ff94e --- /dev/null +++ b/cli/tests/testdata/run/error_005_missing_dynamic_import.ts @@ -0,0 +1,3 @@ +(async () => { + const _badModule = await import("./bad-module.ts"); +})(); diff --git a/cli/tests/testdata/run/error_005_missing_dynamic_import.ts.out b/cli/tests/testdata/run/error_005_missing_dynamic_import.ts.out new file mode 100644 index 000000000..55e4a8524 --- /dev/null +++ b/cli/tests/testdata/run/error_005_missing_dynamic_import.ts.out @@ -0,0 +1,4 @@ +error: Uncaught (in promise) TypeError: Module not found "[WILDCARD]/bad-module.ts". + const _badModule = await import("./bad-module.ts"); + ^ + at async file://[WILDCARD]/error_005_missing_dynamic_import.ts:2:22 diff --git a/cli/tests/testdata/run/error_006_import_ext_failure.ts b/cli/tests/testdata/run/error_006_import_ext_failure.ts new file mode 100644 index 000000000..3c32303a3 --- /dev/null +++ b/cli/tests/testdata/run/error_006_import_ext_failure.ts @@ -0,0 +1 @@ +import "./non-existent"; diff --git a/cli/tests/testdata/run/error_006_import_ext_failure.ts.out b/cli/tests/testdata/run/error_006_import_ext_failure.ts.out new file mode 100644 index 000000000..667579bd8 --- /dev/null +++ b/cli/tests/testdata/run/error_006_import_ext_failure.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Module not found "[WILDCARD]/non-existent". + at file:///[WILDCARD]/error_006_import_ext_failure.ts:1:8 diff --git a/cli/tests/testdata/run/error_007_any.ts b/cli/tests/testdata/run/error_007_any.ts new file mode 100644 index 000000000..bfef1289b --- /dev/null +++ b/cli/tests/testdata/run/error_007_any.ts @@ -0,0 +1 @@ +throw { foo: "bar" }; diff --git a/cli/tests/testdata/run/error_007_any.ts.out b/cli/tests/testdata/run/error_007_any.ts.out new file mode 100644 index 000000000..b93ceb1d0 --- /dev/null +++ b/cli/tests/testdata/run/error_007_any.ts.out @@ -0,0 +1 @@ +[WILDCARD]error: Uncaught { foo: "bar" } diff --git a/cli/tests/testdata/run/error_008_checkjs.js b/cli/tests/testdata/run/error_008_checkjs.js new file mode 100644 index 000000000..f0856d94c --- /dev/null +++ b/cli/tests/testdata/run/error_008_checkjs.js @@ -0,0 +1,5 @@ +// console.log intentionally misspelled to trigger a type error +consol.log("hello world!"); + +// the following error should be ignored and not output to the console +const foo = new Foo(); diff --git a/cli/tests/testdata/run/error_008_checkjs.js.out b/cli/tests/testdata/run/error_008_checkjs.js.out new file mode 100644 index 000000000..e43187382 --- /dev/null +++ b/cli/tests/testdata/run/error_008_checkjs.js.out @@ -0,0 +1,4 @@ +[WILDCARD]error: Uncaught ReferenceError: consol is not defined +consol.log("hello world!"); +^ + at [WILDCARD]/error_008_checkjs.js:2:1 diff --git a/cli/tests/testdata/run/error_009_extensions_error.js b/cli/tests/testdata/run/error_009_extensions_error.js new file mode 100644 index 000000000..01b97ea38 --- /dev/null +++ b/cli/tests/testdata/run/error_009_extensions_error.js @@ -0,0 +1,2 @@ +// Missing arg. +new Event(); diff --git a/cli/tests/testdata/run/error_009_extensions_error.js.out b/cli/tests/testdata/run/error_009_extensions_error.js.out new file mode 100644 index 000000000..8510980f6 --- /dev/null +++ b/cli/tests/testdata/run/error_009_extensions_error.js.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught TypeError: Failed to construct 'Event': 1 argument required, but only 0 present. +new Event(); +^ + at [WILDCARD] + at new Event (deno:ext/web/[WILDCARD]) + at [WILDCARD] diff --git a/cli/tests/testdata/run/error_009_missing_js_module.disabled b/cli/tests/testdata/run/error_009_missing_js_module.disabled new file mode 100644 index 000000000..3156fc94b --- /dev/null +++ b/cli/tests/testdata/run/error_009_missing_js_module.disabled @@ -0,0 +1,4 @@ +args: tests/error_009_missing_js_module.js +check_stderr: true +exit_code: 1 +output: tests/error_009_missing_js_module.js.out diff --git a/cli/tests/testdata/run/error_011_bad_module_specifier.ts b/cli/tests/testdata/run/error_011_bad_module_specifier.ts new file mode 100644 index 000000000..1c57e37a5 --- /dev/null +++ b/cli/tests/testdata/run/error_011_bad_module_specifier.ts @@ -0,0 +1,3 @@ +import * as badModule from "bad-module.ts"; + +console.log(badModule); diff --git a/cli/tests/testdata/run/error_011_bad_module_specifier.ts.out b/cli/tests/testdata/run/error_011_bad_module_specifier.ts.out new file mode 100644 index 000000000..81be915d1 --- /dev/null +++ b/cli/tests/testdata/run/error_011_bad_module_specifier.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Relative import path "bad-module.ts" not prefixed with / or ./ or ../ + at [WILDCARD]/error_011_bad_module_specifier.ts:1:28 diff --git a/cli/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts b/cli/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts new file mode 100644 index 000000000..5f39f407c --- /dev/null +++ b/cli/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts @@ -0,0 +1,3 @@ +(async () => { + const _badModule = await import("bad-module.ts"); +})(); diff --git a/cli/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts.out b/cli/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts.out new file mode 100644 index 000000000..7acd66713 --- /dev/null +++ b/cli/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts.out @@ -0,0 +1,7 @@ +Check [WILDCARD]error_012_bad_dynamic_import_specifier.ts +error: Uncaught (in promise) TypeError: Relative import path "bad-module.ts" not prefixed with / or ./ or ../ + at [WILDCARD]/error_012_bad_dynamic_import_specifier.ts:2:35 + + const _badModule = await import("bad-module.ts"); + ^ + at async [WILDCARD]/error_012_bad_dynamic_import_specifier.ts:2:22 diff --git a/cli/tests/testdata/run/error_013_missing_script.out b/cli/tests/testdata/run/error_013_missing_script.out new file mode 100644 index 000000000..7ee268de4 --- /dev/null +++ b/cli/tests/testdata/run/error_013_missing_script.out @@ -0,0 +1 @@ +error: Module not found "[WILDCARD]missing_file_name". diff --git a/cli/tests/testdata/run/error_014_catch_dynamic_import_error.js b/cli/tests/testdata/run/error_014_catch_dynamic_import_error.js new file mode 100644 index 000000000..c58e54dcb --- /dev/null +++ b/cli/tests/testdata/run/error_014_catch_dynamic_import_error.js @@ -0,0 +1,31 @@ +(async () => { + try { + await import("does not exist"); + } catch (err) { + console.log("Caught direct dynamic import error."); + console.log(err); + } + + try { + await import("../subdir/indirect_import_error.js"); + } catch (err) { + console.log("Caught indirect direct dynamic import error."); + console.log(err); + } + + try { + await import("../subdir/throws.js"); + } catch (err) { + console.log("Caught error thrown by dynamically imported module."); + console.log(err); + } + + try { + await import("../subdir/indirect_throws.js"); + } catch (err) { + console.log( + "Caught error thrown indirectly by dynamically imported module.", + ); + console.log(err); + } +})(); diff --git a/cli/tests/testdata/run/error_014_catch_dynamic_import_error.js.out b/cli/tests/testdata/run/error_014_catch_dynamic_import_error.js.out new file mode 100644 index 000000000..701ddc3b5 --- /dev/null +++ b/cli/tests/testdata/run/error_014_catch_dynamic_import_error.js.out @@ -0,0 +1,15 @@ +Caught direct dynamic import error. +TypeError: Relative import path "does not exist" not prefixed with / or ./ or ../ + at [WILDCARD]/error_014_catch_dynamic_import_error.js:3:18 + + at async [WILDCARD]/error_014_catch_dynamic_import_error.js:3:5 +Caught indirect direct dynamic import error. +TypeError: Relative import path "does not exist either" not prefixed with / or ./ or ../ + at [WILDCARD]/subdir/indirect_import_error.js:1:15 + at async [WILDCARD]/error_014_catch_dynamic_import_error.js:10:5 +Caught error thrown by dynamically imported module. +Error: An error + at [WILDCARD]/subdir/throws.js:6:7 +Caught error thrown indirectly by dynamically imported module. +Error: An error + at [WILDCARD]/subdir/throws.js:6:7 diff --git a/cli/tests/testdata/run/error_015_dynamic_import_permissions.js b/cli/tests/testdata/run/error_015_dynamic_import_permissions.js new file mode 100644 index 000000000..73da56fd8 --- /dev/null +++ b/cli/tests/testdata/run/error_015_dynamic_import_permissions.js @@ -0,0 +1,3 @@ +(async () => { + await import("http://localhost:4545/subdir/mod4.js"); +})(); diff --git a/cli/tests/testdata/run/error_015_dynamic_import_permissions.out b/cli/tests/testdata/run/error_015_dynamic_import_permissions.out new file mode 100644 index 000000000..ef54f331b --- /dev/null +++ b/cli/tests/testdata/run/error_015_dynamic_import_permissions.out @@ -0,0 +1,4 @@ +error: Uncaught (in promise) TypeError: Requires net access to "localhost:4545", run again with the --allow-net flag + await import("http://localhost:4545/subdir/mod4.js"); + ^ + at async file://[WILDCARD]/error_015_dynamic_import_permissions.js:2:3 diff --git a/cli/tests/testdata/run/error_016_dynamic_import_permissions2.js b/cli/tests/testdata/run/error_016_dynamic_import_permissions2.js new file mode 100644 index 000000000..f018d4a2e --- /dev/null +++ b/cli/tests/testdata/run/error_016_dynamic_import_permissions2.js @@ -0,0 +1,5 @@ +// If this is executed with --allow-net but not --allow-read the following +// import should cause a permission denied error. +(async () => { + await import("http://localhost:4545/subdir/evil_remote_import.js"); +})(); diff --git a/cli/tests/testdata/run/error_016_dynamic_import_permissions2.out b/cli/tests/testdata/run/error_016_dynamic_import_permissions2.out new file mode 100644 index 000000000..710871f41 --- /dev/null +++ b/cli/tests/testdata/run/error_016_dynamic_import_permissions2.out @@ -0,0 +1,7 @@ +[WILDCARD] +error: Uncaught (in promise) TypeError: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. + Importing: file:///c:/etc/passwd + at http://localhost:4545/subdir/evil_remote_import.js:3:15 + await import("http://localhost:4545/subdir/evil_remote_import.js"); + ^ + at async file://[WILDCARD]/error_016_dynamic_import_permissions2.js:4:3 diff --git a/cli/tests/testdata/run/error_017_hide_long_source_ts.ts b/cli/tests/testdata/run/error_017_hide_long_source_ts.ts new file mode 100644 index 000000000..d61cb1277 --- /dev/null +++ b/cli/tests/testdata/run/error_017_hide_long_source_ts.ts @@ -0,0 +1,3 @@ +// deno-fmt-ignore-file +const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; +LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; diff --git a/cli/tests/testdata/run/error_017_hide_long_source_ts.ts.out b/cli/tests/testdata/run/error_017_hide_long_source_ts.ts.out new file mode 100644 index 000000000..917061ab9 --- /dev/null +++ b/cli/tests/testdata/run/error_017_hide_long_source_ts.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +error: TS2532 [ERROR]: Object is possibly 'undefined'. + at [WILDCARD]/error_017_hide_long_source_ts.ts:3:1 diff --git a/cli/tests/testdata/run/error_018_hide_long_source_js.js b/cli/tests/testdata/run/error_018_hide_long_source_js.js new file mode 100644 index 000000000..d61cb1277 --- /dev/null +++ b/cli/tests/testdata/run/error_018_hide_long_source_js.js @@ -0,0 +1,3 @@ +// deno-fmt-ignore-file +const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; +LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; diff --git a/cli/tests/testdata/run/error_018_hide_long_source_js.js.out b/cli/tests/testdata/run/error_018_hide_long_source_js.js.out new file mode 100644 index 000000000..cc98669a7 --- /dev/null +++ b/cli/tests/testdata/run/error_018_hide_long_source_js.js.out @@ -0,0 +1,2 @@ +error: Uncaught TypeError: Cannot read properties of undefined (reading 'a') + at file:///[WILDCARD]/error_018_hide_long_source_js.js:3:206 diff --git a/cli/tests/testdata/run/error_019_stack_function.ts b/cli/tests/testdata/run/error_019_stack_function.ts new file mode 100644 index 000000000..a6a69d146 --- /dev/null +++ b/cli/tests/testdata/run/error_019_stack_function.ts @@ -0,0 +1,12 @@ +function foo(): never { + throw new Error("function"); +} + +try { + foo(); +} catch (error) { + if (error instanceof Error) { + console.log(error.stack); + } + throw error; +} diff --git a/cli/tests/testdata/run/error_019_stack_function.ts.out b/cli/tests/testdata/run/error_019_stack_function.ts.out new file mode 100644 index 000000000..03967d12b --- /dev/null +++ b/cli/tests/testdata/run/error_019_stack_function.ts.out @@ -0,0 +1,8 @@ +[WILDCARD]Error: function + at foo ([WILDCARD]/error_019_stack_function.ts:[WILDCARD]) + at [WILDCARD]/error_019_stack_function.ts:[WILDCARD] +error: Uncaught Error: function + throw new Error("function"); + ^ + at foo ([WILDCARD]/error_019_stack_function.ts:[WILDCARD]) + at [WILDCARD]/error_019_stack_function.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/error_020_stack_constructor.ts b/cli/tests/testdata/run/error_020_stack_constructor.ts new file mode 100644 index 000000000..526d1a661 --- /dev/null +++ b/cli/tests/testdata/run/error_020_stack_constructor.ts @@ -0,0 +1,14 @@ +class A { + constructor() { + throw new Error("constructor"); + } +} + +try { + new A(); +} catch (error) { + if (error instanceof Error) { + console.log(error.stack); + } + throw error; +} diff --git a/cli/tests/testdata/run/error_020_stack_constructor.ts.out b/cli/tests/testdata/run/error_020_stack_constructor.ts.out new file mode 100644 index 000000000..01fdfb3c4 --- /dev/null +++ b/cli/tests/testdata/run/error_020_stack_constructor.ts.out @@ -0,0 +1,8 @@ +[WILDCARD]Error: constructor + at new A ([WILDCARD]/error_020_stack_constructor.ts:[WILDCARD]) + at [WILDCARD]/error_020_stack_constructor.ts:[WILDCARD] +error: Uncaught Error: constructor + throw new Error("constructor"); + ^ + at new A ([WILDCARD]/error_020_stack_constructor.ts:[WILDCARD]) + at [WILDCARD]/error_020_stack_constructor.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/error_021_stack_method.ts b/cli/tests/testdata/run/error_021_stack_method.ts new file mode 100644 index 000000000..b6ebe1f5e --- /dev/null +++ b/cli/tests/testdata/run/error_021_stack_method.ts @@ -0,0 +1,14 @@ +class A { + m(): never { + throw new Error("method"); + } +} + +try { + new A().m(); +} catch (error) { + if (error instanceof Error) { + console.log(error.stack); + } + throw error; +} diff --git a/cli/tests/testdata/run/error_021_stack_method.ts.out b/cli/tests/testdata/run/error_021_stack_method.ts.out new file mode 100644 index 000000000..999f0aaa0 --- /dev/null +++ b/cli/tests/testdata/run/error_021_stack_method.ts.out @@ -0,0 +1,8 @@ +[WILDCARD]Error: method + at A.m ([WILDCARD]/error_021_stack_method.ts:[WILDCARD]) + at [WILDCARD]/error_021_stack_method.ts:[WILDCARD] +error: Uncaught Error: method + throw new Error("method"); + ^ + at A.m ([WILDCARD]/error_021_stack_method.ts:[WILDCARD]) + at [WILDCARD]/error_021_stack_method.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/error_022_stack_custom_error.ts b/cli/tests/testdata/run/error_022_stack_custom_error.ts new file mode 100644 index 000000000..b95743503 --- /dev/null +++ b/cli/tests/testdata/run/error_022_stack_custom_error.ts @@ -0,0 +1,14 @@ +class CustomError extends Error { + constructor() { + super(); + this.name = "CustomError"; + } + + get message(): string { + return "custom error"; + } +} + +const error = new CustomError(); +console.log(error.stack); +throw error; diff --git a/cli/tests/testdata/run/error_022_stack_custom_error.ts.out b/cli/tests/testdata/run/error_022_stack_custom_error.ts.out new file mode 100644 index 000000000..78b0dcaea --- /dev/null +++ b/cli/tests/testdata/run/error_022_stack_custom_error.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]CustomError: custom error + at [WILDCARD]/error_022_stack_custom_error.ts:[WILDCARD] +error: Uncaught CustomError: custom error +const error = new CustomError(); + ^ + at [WILDCARD]/error_022_stack_custom_error.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/error_023_stack_async.ts b/cli/tests/testdata/run/error_023_stack_async.ts new file mode 100644 index 000000000..fdabaa5df --- /dev/null +++ b/cli/tests/testdata/run/error_023_stack_async.ts @@ -0,0 +1,14 @@ +const p = (async () => { + await Promise.resolve().then((): never => { + throw new Error("async"); + }); +})(); + +try { + await p; +} catch (error) { + if (error instanceof Error) { + console.log(error.stack); + } + throw error; +} diff --git a/cli/tests/testdata/run/error_023_stack_async.ts.out b/cli/tests/testdata/run/error_023_stack_async.ts.out new file mode 100644 index 000000000..95f0eae64 --- /dev/null +++ b/cli/tests/testdata/run/error_023_stack_async.ts.out @@ -0,0 +1,10 @@ +[WILDCARD]Error: async + at [WILDCARD]/error_023_stack_async.ts:[WILDCARD] + at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] + at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] +error: Uncaught Error: async + throw new Error("async"); + ^ + at [WILDCARD]/error_023_stack_async.ts:[WILDCARD] + at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] + at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/error_024_stack_promise_all.ts b/cli/tests/testdata/run/error_024_stack_promise_all.ts new file mode 100644 index 000000000..8ca7b203c --- /dev/null +++ b/cli/tests/testdata/run/error_024_stack_promise_all.ts @@ -0,0 +1,16 @@ +const p = Promise.all([ + Promise.resolve(), + (async (): Promise => { + await Promise.resolve(); + throw new Error("Promise.all()"); + })(), +]); + +try { + await p; +} catch (error) { + if (error instanceof Error) { + console.log(error.stack); + } + throw error; +} diff --git a/cli/tests/testdata/run/error_024_stack_promise_all.ts.out b/cli/tests/testdata/run/error_024_stack_promise_all.ts.out new file mode 100644 index 000000000..6cd88715c --- /dev/null +++ b/cli/tests/testdata/run/error_024_stack_promise_all.ts.out @@ -0,0 +1,10 @@ +[WILDCARD]Error: Promise.all() + at [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] + at async Promise.all (index 1) + at async [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] +error: Uncaught Error: Promise.all() + throw new Error("Promise.all()"); + ^ + at [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] + at async Promise.all (index 1) + at async [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/error_025_tab_indent b/cli/tests/testdata/run/error_025_tab_indent new file mode 100644 index 000000000..35a25bcea --- /dev/null +++ b/cli/tests/testdata/run/error_025_tab_indent @@ -0,0 +1,9 @@ +function foo() { + throw Error("bad"); +} + +function bar() { + foo(); +} + +bar(); diff --git a/cli/tests/testdata/run/error_025_tab_indent.out b/cli/tests/testdata/run/error_025_tab_indent.out new file mode 100644 index 000000000..f1466ce3f --- /dev/null +++ b/cli/tests/testdata/run/error_025_tab_indent.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught Error: bad + throw Error("bad"); + ^ + at foo ([WILDCARD]/error_025_tab_indent:2:8) + at bar ([WILDCARD]/error_025_tab_indent:6:2) + at [WILDCARD]/error_025_tab_indent:9:1 diff --git a/cli/tests/testdata/run/error_026_remote_import_error.ts b/cli/tests/testdata/run/error_026_remote_import_error.ts new file mode 100644 index 000000000..1b230d06b --- /dev/null +++ b/cli/tests/testdata/run/error_026_remote_import_error.ts @@ -0,0 +1 @@ +import "http://localhost:4545/run/error_001.ts"; diff --git a/cli/tests/testdata/run/error_026_remote_import_error.ts.out b/cli/tests/testdata/run/error_026_remote_import_error.ts.out new file mode 100644 index 000000000..84f926f24 --- /dev/null +++ b/cli/tests/testdata/run/error_026_remote_import_error.ts.out @@ -0,0 +1,7 @@ +[WILDCARD]error: Uncaught Error: bad + throw Error("bad"); + ^ + at foo (http://localhost:4545/run/error_001.ts:2:9) + at bar (http://localhost:4545/run/error_001.ts:6:3) + at http://localhost:4545/run/error_001.ts:9:1 +[WILDCARD] diff --git a/cli/tests/testdata/run/error_cause.ts b/cli/tests/testdata/run/error_cause.ts new file mode 100644 index 000000000..385ce2a03 --- /dev/null +++ b/cli/tests/testdata/run/error_cause.ts @@ -0,0 +1,14 @@ +function a() { + // deno-lint-ignore no-explicit-any + throw new Error("foo", { cause: new Error("bar", { cause: "deno" as any }) }); +} + +function b() { + a(); +} + +function c() { + b(); +} + +c(); diff --git a/cli/tests/testdata/run/error_cause.ts.out b/cli/tests/testdata/run/error_cause.ts.out new file mode 100644 index 000000000..2aab020d9 --- /dev/null +++ b/cli/tests/testdata/run/error_cause.ts.out @@ -0,0 +1,15 @@ +[WILDCARD] +error: Uncaught Error: foo + throw new Error("foo", { cause: new Error("bar", { cause: "deno" as any }) }); + ^ + at a (file:///[WILDCARD]/error_cause.ts:3:9) + at b (file:///[WILDCARD]/error_cause.ts:7:3) + at c (file:///[WILDCARD]/error_cause.ts:11:3) + at file:///[WILDCARD]/error_cause.ts:14:1 +Caused by: Error: bar + at a (file:///[WILDCARD]/error_cause.ts:3:35) + at b (file:///[WILDCARD]/error_cause.ts:7:3) + at c (file:///[WILDCARD]/error_cause.ts:11:3) + at file:///[WILDCARD]/error_cause.ts:14:1 +Caused by: "deno" +[WILDCARD] diff --git a/cli/tests/testdata/run/error_cause_recursive.ts b/cli/tests/testdata/run/error_cause_recursive.ts new file mode 100644 index 000000000..a6999b1ff --- /dev/null +++ b/cli/tests/testdata/run/error_cause_recursive.ts @@ -0,0 +1,4 @@ +const x = new Error("foo"); +const y = new Error("bar", { cause: x }); +x.cause = y; +throw y; diff --git a/cli/tests/testdata/run/error_cause_recursive.ts.out b/cli/tests/testdata/run/error_cause_recursive.ts.out new file mode 100644 index 000000000..ac729574d --- /dev/null +++ b/cli/tests/testdata/run/error_cause_recursive.ts.out @@ -0,0 +1,10 @@ +[WILDCARD] +error: Uncaught Error: bar +const y = new Error("bar", { cause: x }); + ^ + at file:///[WILDCARD]/error_cause_recursive.ts:2:11 +Caused by: Error: foo + at file:///[WILDCARD]/error_cause_recursive.ts:1:11 +Caused by: Error: bar + at file:///[WILDCARD]/error_cause_recursive.ts:2:11 +[WILDCARD] diff --git a/cli/tests/testdata/run/error_for_await.ts b/cli/tests/testdata/run/error_for_await.ts new file mode 100644 index 000000000..64c81abe4 --- /dev/null +++ b/cli/tests/testdata/run/error_for_await.ts @@ -0,0 +1,12 @@ +const listener = Deno.listen({ port: 8080 }); + +for await (const conn of listener) { + handleConn(conn); +} + +function handleConn(conn: Deno.Conn) { + const httpConn = Deno.serveHttp(conn); + for await (const event of httpConn) { + event.respondWith(new Response("html", { status: 200 })); + } +} diff --git a/cli/tests/testdata/run/error_for_await.ts.out b/cli/tests/testdata/run/error_for_await.ts.out new file mode 100644 index 000000000..db3cdecb4 --- /dev/null +++ b/cli/tests/testdata/run/error_for_await.ts.out @@ -0,0 +1,10 @@ +[WILDCARD] +error: TS1103 [ERROR]: 'for await' loops are only allowed within async functions and at the top levels of modules. + for await (const event of httpConn) { + ~~~~~ + at [WILDCARD]error_for_await.ts:9:7 + +TS1356 [ERROR]: Did you mean to mark this function as 'async'? + function handleConn(conn: Deno.Conn) { + ~~~~~~~~~~ + at [WILDCARD]error_for_await.ts:7:10 diff --git a/cli/tests/testdata/run/error_import_map_unable_to_load.out b/cli/tests/testdata/run/error_import_map_unable_to_load.out new file mode 100644 index 000000000..50760e438 --- /dev/null +++ b/cli/tests/testdata/run/error_import_map_unable_to_load.out @@ -0,0 +1,4 @@ +error: Unable to load '[WILDCARD]' import map + +Caused by: + [WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/run/error_local_static_import_from_remote.js b/cli/tests/testdata/run/error_local_static_import_from_remote.js new file mode 100644 index 000000000..eb7fd23ba --- /dev/null +++ b/cli/tests/testdata/run/error_local_static_import_from_remote.js @@ -0,0 +1 @@ +import "file:///some/dir/file.js"; diff --git a/cli/tests/testdata/run/error_local_static_import_from_remote.js.out b/cli/tests/testdata/run/error_local_static_import_from_remote.js.out new file mode 100644 index 000000000..34f9e81e1 --- /dev/null +++ b/cli/tests/testdata/run/error_local_static_import_from_remote.js.out @@ -0,0 +1,4 @@ +[WILDCARD] +error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. + Importing: file:///some/dir/file.js + at http://localhost:4545/run/error_local_static_import_from_remote.js:1:8 diff --git a/cli/tests/testdata/run/error_local_static_import_from_remote.ts b/cli/tests/testdata/run/error_local_static_import_from_remote.ts new file mode 100644 index 000000000..a831db0c4 --- /dev/null +++ b/cli/tests/testdata/run/error_local_static_import_from_remote.ts @@ -0,0 +1 @@ +import "file:///some/dir/file.ts"; diff --git a/cli/tests/testdata/run/error_local_static_import_from_remote.ts.out b/cli/tests/testdata/run/error_local_static_import_from_remote.ts.out new file mode 100644 index 000000000..88990a049 --- /dev/null +++ b/cli/tests/testdata/run/error_local_static_import_from_remote.ts.out @@ -0,0 +1,4 @@ +[WILDCARD] +error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. + Importing: file:///some/dir/file.ts + at http://localhost:4545/run/error_local_static_import_from_remote.ts:1:8 diff --git a/cli/tests/testdata/run/error_missing_module_named_import.ts b/cli/tests/testdata/run/error_missing_module_named_import.ts new file mode 100644 index 000000000..9eb5239ff --- /dev/null +++ b/cli/tests/testdata/run/error_missing_module_named_import.ts @@ -0,0 +1,3 @@ +import { a } from "./does_not_exist.js"; + +console.log(a); diff --git a/cli/tests/testdata/run/error_missing_module_named_import.ts.out b/cli/tests/testdata/run/error_missing_module_named_import.ts.out new file mode 100644 index 000000000..3dccaffb1 --- /dev/null +++ b/cli/tests/testdata/run/error_missing_module_named_import.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +error: Module not found "file://[WILDCARD]/does_not_exist.js". + at file:///[WILDCARD]/error_missing_module_named_import.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/error_name_non_string.js b/cli/tests/testdata/run/error_name_non_string.js new file mode 100644 index 000000000..ae9609927 --- /dev/null +++ b/cli/tests/testdata/run/error_name_non_string.js @@ -0,0 +1,8 @@ +class ErrorNameNonString extends Error { + constructor() { + super(); + this.name = 42; + } +} + +throw new ErrorNameNonString(); diff --git a/cli/tests/testdata/run/error_name_non_string.js.out b/cli/tests/testdata/run/error_name_non_string.js.out new file mode 100644 index 000000000..a77f336e9 --- /dev/null +++ b/cli/tests/testdata/run/error_name_non_string.js.out @@ -0,0 +1,4 @@ +error: Uncaught Error +throw new ErrorNameNonString(); + ^ + at file:///[WILDCARD]/error_name_non_string.js:[WILDCARD] diff --git a/cli/tests/testdata/run/error_no_check.ts b/cli/tests/testdata/run/error_no_check.ts new file mode 100644 index 000000000..2da01e639 --- /dev/null +++ b/cli/tests/testdata/run/error_no_check.ts @@ -0,0 +1 @@ +export { AnInterface, isAnInterface } from "../subdir/type_and_code.ts"; diff --git a/cli/tests/testdata/run/error_no_check.ts.out b/cli/tests/testdata/run/error_no_check.ts.out new file mode 100644 index 000000000..78f478045 --- /dev/null +++ b/cli/tests/testdata/run/error_no_check.ts.out @@ -0,0 +1,2 @@ +error: Uncaught SyntaxError: The requested module '../subdir/type_and_code.ts' does not provide an export named 'AnInterface' +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/run/error_syntax.js b/cli/tests/testdata/run/error_syntax.js new file mode 100644 index 000000000..c0414c356 --- /dev/null +++ b/cli/tests/testdata/run/error_syntax.js @@ -0,0 +1,3 @@ + +// deno-fmt-ignore-file +(the following is a syntax error ^^ ! ) diff --git a/cli/tests/testdata/run/error_syntax.js.out b/cli/tests/testdata/run/error_syntax.js.out new file mode 100644 index 000000000..6d3f05b8e --- /dev/null +++ b/cli/tests/testdata/run/error_syntax.js.out @@ -0,0 +1 @@ +error: The module's source code could not be parsed: Expected ',', got 'following' at [WILDCARD]/error_syntax.js:3:6 diff --git a/cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs b/cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs new file mode 100644 index 000000000..864dfb0c7 --- /dev/null +++ b/cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs @@ -0,0 +1,2 @@ +// Deliberately using .mjs to avoid triggering dprint +setTimeout(() => {}), diff --git a/cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs.out b/cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs.out new file mode 100644 index 000000000..f4bbc6708 --- /dev/null +++ b/cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs.out @@ -0,0 +1 @@ +error: The module's source code could not be parsed: Unexpected eof at [WILDCARD]/error_syntax_empty_trailing_line.mjs:2:22 diff --git a/cli/tests/testdata/run/error_type_definitions.ts b/cli/tests/testdata/run/error_type_definitions.ts new file mode 100644 index 000000000..86675cbaa --- /dev/null +++ b/cli/tests/testdata/run/error_type_definitions.ts @@ -0,0 +1,5 @@ +// @deno-types="../type_definitions/bar.d.ts" +import { Bar } from "../type_definitions/bar.js"; + +const bar = new Bar(); +console.log(bar); diff --git a/cli/tests/testdata/run/error_type_definitions.ts.out b/cli/tests/testdata/run/error_type_definitions.ts.out new file mode 100644 index 000000000..5e1d73ca4 --- /dev/null +++ b/cli/tests/testdata/run/error_type_definitions.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Relative import path "baz" not prefixed with / or ./ or ../ + at [WILDCARD]/type_definitions/bar.d.ts:[WILDCARD] diff --git a/cli/tests/testdata/run/es_private_fields.js b/cli/tests/testdata/run/es_private_fields.js new file mode 100644 index 000000000..b5f83e39c --- /dev/null +++ b/cli/tests/testdata/run/es_private_fields.js @@ -0,0 +1,15 @@ +class Foo { + #field = "field"; + + setValue(val) { + this.#field = val; + } + + getValue() { + return this.#field; + } +} + +const bar = new Foo(); +bar.setValue("PRIVATE"); +console.log(bar.getValue()); diff --git a/cli/tests/testdata/run/es_private_fields.js.out b/cli/tests/testdata/run/es_private_fields.js.out new file mode 100644 index 000000000..be1970b05 --- /dev/null +++ b/cli/tests/testdata/run/es_private_fields.js.out @@ -0,0 +1 @@ +PRIVATE diff --git a/cli/tests/testdata/run/eval_context_throw_dom_exception.js b/cli/tests/testdata/run/eval_context_throw_dom_exception.js new file mode 100644 index 000000000..b8e99d498 --- /dev/null +++ b/cli/tests/testdata/run/eval_context_throw_dom_exception.js @@ -0,0 +1,2 @@ +const [, errorInfo] = Deno.core.evalContext('throw new DOMException("foo")'); +console.log(errorInfo); diff --git a/cli/tests/testdata/run/eval_context_throw_dom_exception.js.out b/cli/tests/testdata/run/eval_context_throw_dom_exception.js.out new file mode 100644 index 000000000..39e164083 --- /dev/null +++ b/cli/tests/testdata/run/eval_context_throw_dom_exception.js.out @@ -0,0 +1 @@ +{ thrown: DOMException: foo, isNativeError: true, isCompileError: false } diff --git a/cli/tests/testdata/run/event_listener_error.ts b/cli/tests/testdata/run/event_listener_error.ts new file mode 100644 index 000000000..1cbdf7bc2 --- /dev/null +++ b/cli/tests/testdata/run/event_listener_error.ts @@ -0,0 +1,6 @@ +addEventListener("foo", () => { + throw new Error("bar"); +}); +console.log(1); +dispatchEvent(new CustomEvent("foo")); +console.log(2); diff --git a/cli/tests/testdata/run/event_listener_error.ts.out b/cli/tests/testdata/run/event_listener_error.ts.out new file mode 100644 index 000000000..a20a91dfd --- /dev/null +++ b/cli/tests/testdata/run/event_listener_error.ts.out @@ -0,0 +1,7 @@ +1 +error: Uncaught Error: bar + throw new Error("bar"); + ^ + at [WILDCARD]/event_listener_error.ts:2:9 + at [WILDCARD] + at [WILDCARD]/event_listener_error.ts:5:1 diff --git a/cli/tests/testdata/run/event_listener_error_handled.ts b/cli/tests/testdata/run/event_listener_error_handled.ts new file mode 100644 index 000000000..c4c8fd1cd --- /dev/null +++ b/cli/tests/testdata/run/event_listener_error_handled.ts @@ -0,0 +1,23 @@ +addEventListener("error", (event) => { + console.log({ + cancelable: event.cancelable, + message: event.message, + filename: event.filename?.slice?.(-100), + lineno: event.lineno, + colno: event.colno, + error: event.error, + }); + event.preventDefault(); +}); + +onerror = (event) => { + console.log("onerror() called", event.error); +}; + +addEventListener("foo", () => { + throw new Error("bar"); +}); + +console.log(1); +dispatchEvent(new CustomEvent("foo")); +console.log(2); diff --git a/cli/tests/testdata/run/event_listener_error_handled.ts.out b/cli/tests/testdata/run/event_listener_error_handled.ts.out new file mode 100644 index 000000000..d3cf525c3 --- /dev/null +++ b/cli/tests/testdata/run/event_listener_error_handled.ts.out @@ -0,0 +1,17 @@ +1 +{ + cancelable: true, + message: "Uncaught Error: bar", + filename: "[WILDCARD]/event_listener_error_handled.ts", + lineno: 18, + colno: 9, + error: Error: bar + at [WILDCARD]/event_listener_error_handled.ts:18:9 + at [WILDCARD] + at [WILDCARD]/event_listener_error_handled.ts:22:1 +} +onerror() called Error: bar + at [WILDCARD]/event_listener_error_handled.ts:18:9 + at [WILDCARD] + at [WILDCARD]/event_listener_error_handled.ts:22:1 +2 diff --git a/cli/tests/testdata/run/event_listener_error_immediate_exit.ts b/cli/tests/testdata/run/event_listener_error_immediate_exit.ts new file mode 100644 index 000000000..c9e94c01b --- /dev/null +++ b/cli/tests/testdata/run/event_listener_error_immediate_exit.ts @@ -0,0 +1,12 @@ +addEventListener("foo", () => { + queueMicrotask(() => console.log("queueMicrotask")); + setTimeout(() => console.log("timer"), 0); + throw new Error("bar"); +}); +console.log(1); +// @ts-ignore Deno.core +Deno.core.setNextTickCallback(() => console.log("nextTick")); +// @ts-ignore Deno.core +Deno.core.setHasTickScheduled(true); +dispatchEvent(new CustomEvent("foo")); +console.log(2); diff --git a/cli/tests/testdata/run/event_listener_error_immediate_exit.ts.out b/cli/tests/testdata/run/event_listener_error_immediate_exit.ts.out new file mode 100644 index 000000000..1fb3ce76a --- /dev/null +++ b/cli/tests/testdata/run/event_listener_error_immediate_exit.ts.out @@ -0,0 +1,7 @@ +1 +queueMicrotask +error: Uncaught Error: bar + throw new Error("bar"); + ^ + at [WILDCARD]/event_listener_error_immediate_exit.ts:4:9[WILDCARD] + at [WILDCARD]/event_listener_error_immediate_exit.ts:11:1 diff --git a/cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts b/cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts new file mode 100644 index 000000000..58c45d1bb --- /dev/null +++ b/cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts @@ -0,0 +1,4 @@ +new Worker( + import.meta.resolve("./event_listener_error_immediate_exit.ts"), + { type: "module" }, +); diff --git a/cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out b/cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out new file mode 100644 index 000000000..8bd312298 --- /dev/null +++ b/cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out @@ -0,0 +1,8 @@ +1 +error: Uncaught (in worker "") Error: bar + throw new Error("bar"); + ^ + at [WILDCARD]/event_listener_error_immediate_exit.ts:4:9 + at [WILDCARD]/event_listener_error_immediate_exit.ts:11:1 +error: Uncaught (in promise) Error: Unhandled error in child worker. + at [WILDCARD] diff --git a/cli/tests/testdata/run/exec_path.ts b/cli/tests/testdata/run/exec_path.ts new file mode 100644 index 000000000..b70b23237 --- /dev/null +++ b/cli/tests/testdata/run/exec_path.ts @@ -0,0 +1 @@ +console.log(Deno.execPath()); diff --git a/cli/tests/testdata/run/exit_error42.ts b/cli/tests/testdata/run/exit_error42.ts new file mode 100644 index 000000000..e4db41f3a --- /dev/null +++ b/cli/tests/testdata/run/exit_error42.ts @@ -0,0 +1,3 @@ +console.log("before"); +Deno.exit(42); +console.log("after"); diff --git a/cli/tests/testdata/run/exit_error42.ts.out b/cli/tests/testdata/run/exit_error42.ts.out new file mode 100644 index 000000000..90be1f305 --- /dev/null +++ b/cli/tests/testdata/run/exit_error42.ts.out @@ -0,0 +1 @@ +before diff --git a/cli/tests/testdata/run/export_type_def.ts b/cli/tests/testdata/run/export_type_def.ts new file mode 100644 index 000000000..9a1e2b0fe --- /dev/null +++ b/cli/tests/testdata/run/export_type_def.ts @@ -0,0 +1,2 @@ +// @deno-types="../type_definitions/foo.d.ts" +export { foo } from "../type_definitions/foo.js"; diff --git a/cli/tests/testdata/run/fetch/hello.txt b/cli/tests/testdata/run/fetch/hello.txt new file mode 100644 index 000000000..af5626b4a --- /dev/null +++ b/cli/tests/testdata/run/fetch/hello.txt @@ -0,0 +1 @@ +Hello, world! diff --git a/cli/tests/testdata/run/fetch/other.ts b/cli/tests/testdata/run/fetch/other.ts new file mode 100644 index 000000000..91fe376b3 --- /dev/null +++ b/cli/tests/testdata/run/fetch/other.ts @@ -0,0 +1 @@ +import "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; diff --git a/cli/tests/testdata/run/fetch/test.ts b/cli/tests/testdata/run/fetch/test.ts new file mode 100644 index 000000000..baa52775d --- /dev/null +++ b/cli/tests/testdata/run/fetch/test.ts @@ -0,0 +1 @@ +import "http://localhost:4545/subdir/mod2.ts"; diff --git a/cli/tests/testdata/run/fetch_async_error_stack.ts b/cli/tests/testdata/run/fetch_async_error_stack.ts new file mode 100644 index 000000000..f583192c2 --- /dev/null +++ b/cli/tests/testdata/run/fetch_async_error_stack.ts @@ -0,0 +1 @@ +await fetch("https://nonexistent.deno.land/"); diff --git a/cli/tests/testdata/run/fetch_async_error_stack.ts.out b/cli/tests/testdata/run/fetch_async_error_stack.ts.out new file mode 100644 index 000000000..0a7b353e2 --- /dev/null +++ b/cli/tests/testdata/run/fetch_async_error_stack.ts.out @@ -0,0 +1,5 @@ +error: Uncaught (in promise) TypeError: error sending request for url[WILDCARD] +await fetch("https://nonexistent.deno.land/"); +^[WILDCARD] + at async fetch (deno:[WILDCARD]) + at async file:///[WILDCARD]/fetch_async_error_stack.ts:1:1 diff --git a/cli/tests/testdata/run/fetch_response_finalization.js b/cli/tests/testdata/run/fetch_response_finalization.js new file mode 100644 index 000000000..dd7c355eb --- /dev/null +++ b/cli/tests/testdata/run/fetch_response_finalization.js @@ -0,0 +1,16 @@ +async function doAFetch() { + const resp = await fetch("http://localhost:4545/README.md"); + console.log(Deno.resources()); // print the current resources + const _resp = resp; + // at this point resp can be GC'ed +} + +await doAFetch(); // create a resource + +globalThis.gc(); // force GC + +// It is very important that there is a yield here, otherwise the finalizer for +// the response body is not called and the resource is not closed. +await new Promise((resolve) => setTimeout(resolve, 0)); + +console.log(Deno.resources()); // print the current resources diff --git a/cli/tests/testdata/run/fetch_response_finalization.js.out b/cli/tests/testdata/run/fetch_response_finalization.js.out new file mode 100644 index 000000000..844a4e4b2 --- /dev/null +++ b/cli/tests/testdata/run/fetch_response_finalization.js.out @@ -0,0 +1,2 @@ +{ "0": "stdin", "1": "stdout", "2": "stderr", "5": "fetchResponseBody" } +{ "0": "stdin", "1": "stdout", "2": "stderr" } diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_1.js b/cli/tests/testdata/run/ffi/unstable_ffi_1.js new file mode 100644 index 000000000..8ca6c3a60 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_1.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_load({ path: "", symbols: {} }); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_1.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_1.js.out new file mode 100644 index 000000000..7c564be8c --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_1.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.dlopen'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_10.js b/cli/tests/testdata/run/ffi/unstable_ffi_10.js new file mode 100644 index 000000000..83687c584 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_10.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_read_i16(0n); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_10.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_10.js.out new file mode 100644 index 000000000..bf7e1bd4f --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_10.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#getInt16'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_11.js b/cli/tests/testdata/run/ffi/unstable_ffi_11.js new file mode 100644 index 000000000..5538753be --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_11.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_read_u32(0n); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_11.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_11.js.out new file mode 100644 index 000000000..2d2d72666 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_11.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#getUint32'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_12.js b/cli/tests/testdata/run/ffi/unstable_ffi_12.js new file mode 100644 index 000000000..089c9b5b1 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_12.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_read_i32(0n); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_12.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_12.js.out new file mode 100644 index 000000000..377d8e4a5 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_12.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#getInt32'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_13.js b/cli/tests/testdata/run/ffi/unstable_ffi_13.js new file mode 100644 index 000000000..630be2e6d --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_13.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_read_u64(0n); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_13.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_13.js.out new file mode 100644 index 000000000..6ca67a6f2 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_13.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#getBigUint64'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_14.js b/cli/tests/testdata/run/ffi/unstable_ffi_14.js new file mode 100644 index 000000000..b04c7865e --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_14.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_read_f32(0n); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_14.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_14.js.out new file mode 100644 index 000000000..11fcd5580 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_14.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#getFloat32'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_15.js b/cli/tests/testdata/run/ffi/unstable_ffi_15.js new file mode 100644 index 000000000..865f63c75 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_15.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_read_f64(0n); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_15.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_15.js.out new file mode 100644 index 000000000..3015e5c91 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_15.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#getFloat64'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_2.js b/cli/tests/testdata/run/ffi/unstable_ffi_2.js new file mode 100644 index 000000000..7f3f34f37 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_2.js @@ -0,0 +1,5 @@ +Deno.core.ops.op_ffi_call_ptr(0n, { + name: null, + parameters: [], + result: "void", +}, []); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_2.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_2.js.out new file mode 100644 index 000000000..cc4cc3dc6 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_2.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafeFnPointer#call'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_3.js b/cli/tests/testdata/run/ffi/unstable_ffi_3.js new file mode 100644 index 000000000..a8f7f4180 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_3.js @@ -0,0 +1,5 @@ +Deno.core.opAsync("op_ffi_call_ptr_nonblocking", 0n, { + name: null, + parameters: [], + result: "void", +}, []); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_3.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_3.js.out new file mode 100644 index 000000000..cc4cc3dc6 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_3.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafeFnPointer#call'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_4.js b/cli/tests/testdata/run/ffi/unstable_ffi_4.js new file mode 100644 index 000000000..8b4f3d75a --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_4.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_ptr_of(new Uint8Array(0)); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_4.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_4.js.out new file mode 100644 index 000000000..e0f40f2ee --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_4.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointer#of'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_5.js b/cli/tests/testdata/run/ffi/unstable_ffi_5.js new file mode 100644 index 000000000..d08d8eaa4 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_5.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_buf_copy_into(0n, new Uint8Array(0), 0); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_5.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_5.js.out new file mode 100644 index 000000000..e3db6af26 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_5.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#copyInto'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_6.js b/cli/tests/testdata/run/ffi/unstable_ffi_6.js new file mode 100644 index 000000000..9e4f1c761 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_6.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_cstr_read(0n); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_6.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_6.js.out new file mode 100644 index 000000000..c59f51d04 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_6.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#getCString'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_7.js b/cli/tests/testdata/run/ffi/unstable_ffi_7.js new file mode 100644 index 000000000..96e60f377 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_7.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_read_u8(0n); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_7.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_7.js.out new file mode 100644 index 000000000..6ab413537 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_7.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#getUint8'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_8.js b/cli/tests/testdata/run/ffi/unstable_ffi_8.js new file mode 100644 index 000000000..187b83891 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_8.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_read_i8(0n); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_8.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_8.js.out new file mode 100644 index 000000000..338db2631 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_8.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#getInt8'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_9.js b/cli/tests/testdata/run/ffi/unstable_ffi_9.js new file mode 100644 index 000000000..e968e534c --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_9.js @@ -0,0 +1 @@ +Deno.core.ops.op_ffi_read_u16(0n); diff --git a/cli/tests/testdata/run/ffi/unstable_ffi_9.js.out b/cli/tests/testdata/run/ffi/unstable_ffi_9.js.out new file mode 100644 index 000000000..fb6d75f14 --- /dev/null +++ b/cli/tests/testdata/run/ffi/unstable_ffi_9.js.out @@ -0,0 +1 @@ +Unstable API 'Deno.UnsafePointerView#getUint16'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/run/finalization_registry.js b/cli/tests/testdata/run/finalization_registry.js new file mode 100644 index 000000000..7d7d58149 --- /dev/null +++ b/cli/tests/testdata/run/finalization_registry.js @@ -0,0 +1,20 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +"use strict"; + +function assertEquals(a, b) { + if (a === b) return; + throw a + " does not equal " + b; +} + +const registry = new FinalizationRegistry((value) => { + assertEquals(value, "called!"); + Deno.core.print("FinalizationRegistry called!\n"); +}); + +(function () { + let x = {}; + registry.register(x, "called!"); + x = null; +})(); + +gc(); diff --git a/cli/tests/testdata/run/finalization_registry.js.out b/cli/tests/testdata/run/finalization_registry.js.out new file mode 100644 index 000000000..fee61413a --- /dev/null +++ b/cli/tests/testdata/run/finalization_registry.js.out @@ -0,0 +1 @@ +FinalizationRegistry called! diff --git a/cli/tests/testdata/run/fix_dynamic_import_errors.js b/cli/tests/testdata/run/fix_dynamic_import_errors.js new file mode 100644 index 000000000..1d7be37e0 --- /dev/null +++ b/cli/tests/testdata/run/fix_dynamic_import_errors.js @@ -0,0 +1,7 @@ +import("../dynamic_import/b.js").catch(() => { + console.log("caught import error from b.js"); +}); + +import("../dynamic_import/c.js").catch(() => { + console.log("caught import error from c.js"); +}); diff --git a/cli/tests/testdata/run/fix_dynamic_import_errors.js.out b/cli/tests/testdata/run/fix_dynamic_import_errors.js.out new file mode 100644 index 000000000..e7856fb9c --- /dev/null +++ b/cli/tests/testdata/run/fix_dynamic_import_errors.js.out @@ -0,0 +1,2 @@ +caught import error from [WILDCARD].js +caught import error from [WILDCARD].js diff --git a/cli/tests/testdata/run/fix_emittable_skipped.js b/cli/tests/testdata/run/fix_emittable_skipped.js new file mode 100644 index 000000000..a4ccc9efd --- /dev/null +++ b/cli/tests/testdata/run/fix_emittable_skipped.js @@ -0,0 +1,7 @@ +/// + +import "../subdir/polyfill.ts"; + +export const a = "a"; + +console.log(globalThis.polyfill); diff --git a/cli/tests/testdata/run/fix_emittable_skipped.ts.out b/cli/tests/testdata/run/fix_emittable_skipped.ts.out new file mode 100644 index 000000000..108c2d67f --- /dev/null +++ b/cli/tests/testdata/run/fix_emittable_skipped.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +[Function] diff --git a/cli/tests/testdata/run/fix_exotic_specifiers.ts b/cli/tests/testdata/run/fix_exotic_specifiers.ts new file mode 100644 index 000000000..101667b2a --- /dev/null +++ b/cli/tests/testdata/run/fix_exotic_specifiers.ts @@ -0,0 +1,3 @@ +import clone from "https://jspm.dev/lodash@4/clone"; + +console.log(clone); diff --git a/cli/tests/testdata/run/fix_exotic_specifiers.ts.out b/cli/tests/testdata/run/fix_exotic_specifiers.ts.out new file mode 100644 index 000000000..7afdb808d --- /dev/null +++ b/cli/tests/testdata/run/fix_exotic_specifiers.ts.out @@ -0,0 +1 @@ +[Function: clone] diff --git a/cli/tests/testdata/run/fix_js_import_js.ts b/cli/tests/testdata/run/fix_js_import_js.ts new file mode 100644 index 000000000..0f01877cd --- /dev/null +++ b/cli/tests/testdata/run/fix_js_import_js.ts @@ -0,0 +1,3 @@ +import { isMod4 } from "../subdir/mod6.js"; + +console.log(isMod4); diff --git a/cli/tests/testdata/run/fix_js_import_js.ts.out b/cli/tests/testdata/run/fix_js_import_js.ts.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/testdata/run/fix_js_import_js.ts.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/testdata/run/fix_js_imports.ts b/cli/tests/testdata/run/fix_js_imports.ts new file mode 100644 index 000000000..6ed13bae3 --- /dev/null +++ b/cli/tests/testdata/run/fix_js_imports.ts @@ -0,0 +1,3 @@ +import * as amdLike from "../subdir/amd_like.js"; + +console.log(amdLike); diff --git a/cli/tests/testdata/run/fix_js_imports.ts.out b/cli/tests/testdata/run/fix_js_imports.ts.out new file mode 100644 index 000000000..5e45122de --- /dev/null +++ b/cli/tests/testdata/run/fix_js_imports.ts.out @@ -0,0 +1 @@ +Module {} diff --git a/cli/tests/testdata/run/fix_tsc_file_exists.out b/cli/tests/testdata/run/fix_tsc_file_exists.out new file mode 100644 index 000000000..ce0136250 --- /dev/null +++ b/cli/tests/testdata/run/fix_tsc_file_exists.out @@ -0,0 +1 @@ +hello diff --git a/cli/tests/testdata/run/fix_worker_dispatchevent.ts b/cli/tests/testdata/run/fix_worker_dispatchevent.ts new file mode 100644 index 000000000..1b73b52dc --- /dev/null +++ b/cli/tests/testdata/run/fix_worker_dispatchevent.ts @@ -0,0 +1,43 @@ +const code = ` +addEventListener("message", () => { + postMessage("pong"); +}); + +const context = new EventTarget(); + +Object.defineProperty(globalThis, "dispatchEvent", { + value: context.dispatchEvent.bind(context), + writable: true, + enumerable: true, + configurable: true, +}); + +postMessage("start"); +`; + +const blob = new Blob([code], { type: "application/javascript" }); + +const url = URL.createObjectURL(blob); + +const worker = new Worker(url, { type: "module" }); + +let terminated = false; + +worker.addEventListener("message", (evt) => { + if (evt.data === "start") { + worker.postMessage("ping"); + } else if (evt.data === "pong") { + worker.terminate(); + terminated = true; + console.log("success"); + } else { + throw new Error("unexpected message from worker"); + } +}); + +setTimeout(() => { + if (!terminated) { + worker.terminate(); + throw new Error("did not receive message from worker in time"); + } +}, 2000); diff --git a/cli/tests/testdata/run/fix_worker_dispatchevent.ts.out b/cli/tests/testdata/run/fix_worker_dispatchevent.ts.out new file mode 100644 index 000000000..2e9ba477f --- /dev/null +++ b/cli/tests/testdata/run/fix_worker_dispatchevent.ts.out @@ -0,0 +1 @@ +success diff --git a/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts b/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts new file mode 100644 index 000000000..a8508f942 --- /dev/null +++ b/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts @@ -0,0 +1,14 @@ +// https://github.com/denoland/deno/issues/14726 + +// Any dynamic modules that are only pending on a TLA import should be resolved +// in the same event loop iteration as the imported module. + +// Long-running timer so the event loop doesn't have a next iteration for a +// while. +setTimeout(() => {}, 24 * 60 * 60 * 1000); + +await import("./sub1.ts"); + +// If we reach here, the test is passed. +console.log("Done."); +Deno.exit(); diff --git a/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts.out b/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts.out new file mode 100644 index 000000000..a19976d4a --- /dev/null +++ b/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts.out @@ -0,0 +1,3 @@ +sub2 +sub1 +Done. diff --git a/cli/tests/testdata/run/followup_dyn_import_resolves/sub1.ts b/cli/tests/testdata/run/followup_dyn_import_resolves/sub1.ts new file mode 100644 index 000000000..d06c30221 --- /dev/null +++ b/cli/tests/testdata/run/followup_dyn_import_resolves/sub1.ts @@ -0,0 +1,2 @@ +await import("./sub2.ts"); +console.log("sub1"); diff --git a/cli/tests/testdata/run/followup_dyn_import_resolves/sub2.ts b/cli/tests/testdata/run/followup_dyn_import_resolves/sub2.ts new file mode 100644 index 000000000..cce2b524c --- /dev/null +++ b/cli/tests/testdata/run/followup_dyn_import_resolves/sub2.ts @@ -0,0 +1 @@ +console.log("sub2"); diff --git a/cli/tests/testdata/run/future_check.ts b/cli/tests/testdata/run/future_check.ts new file mode 100644 index 000000000..4d41fe06a --- /dev/null +++ b/cli/tests/testdata/run/future_check.ts @@ -0,0 +1 @@ +Deno.metrics(); diff --git a/cli/tests/testdata/run/future_check2.out b/cli/tests/testdata/run/future_check2.out new file mode 100644 index 000000000..c626a5485 --- /dev/null +++ b/cli/tests/testdata/run/future_check2.out @@ -0,0 +1 @@ +Check [WILDCARD]/future_check.ts diff --git a/cli/tests/testdata/run/heapstats.js b/cli/tests/testdata/run/heapstats.js new file mode 100644 index 000000000..1f06e7f6e --- /dev/null +++ b/cli/tests/testdata/run/heapstats.js @@ -0,0 +1,37 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +"use strict"; + +function allocTest(alloc, allocAssert, deallocAssert) { + // Helper func that GCs then returns memory usage + const sample = () => { + // deno-lint-ignore no-undef + gc(); + return Deno.memoryUsage(); + }; + const delta = (t1, t2) => t2.heapUsed - t1.heapUsed; + + // Sample "clean" heap usage + const t1 = sample(); + + // Alloc + // deno-lint-ignore no-unused-vars + let x = alloc(); + const t2 = sample(); + allocAssert(delta(t1, t2)); + + // Free + x = null; + const t3 = sample(); + deallocAssert(delta(t2, t3)); +} + +function main() { + // Large-array test, 1M slot array consumes ~4MB (4B per slot) + allocTest( + () => new Array(1e6), + (delta) => console.log("Allocated:", Math.round(delta / 1e6) + "MB"), + (delta) => console.log("Freed:", Math.round(delta / 1e6) + "MB"), + ); +} + +main(); diff --git a/cli/tests/testdata/run/heapstats.js.out b/cli/tests/testdata/run/heapstats.js.out new file mode 100644 index 000000000..b75a755f8 --- /dev/null +++ b/cli/tests/testdata/run/heapstats.js.out @@ -0,0 +1,2 @@ +Allocated: 4MB +Freed: -4MB diff --git a/cli/tests/testdata/run/http2_request_url.ts b/cli/tests/testdata/run/http2_request_url.ts new file mode 100644 index 000000000..5acff8cc2 --- /dev/null +++ b/cli/tests/testdata/run/http2_request_url.ts @@ -0,0 +1,12 @@ +const listener = Deno.listen({ + port: Number(Deno.args[0]), +}); + +console.log("READY"); + +for await (const conn of listener) { + for await (const { request, respondWith } of Deno.serveHttp(conn)) { + const href = new URL(request.url).href; + respondWith(new Response(href)); + } +} diff --git a/cli/tests/testdata/run/https_import.ts b/cli/tests/testdata/run/https_import.ts new file mode 100644 index 000000000..3bcc90326 --- /dev/null +++ b/cli/tests/testdata/run/https_import.ts @@ -0,0 +1,3 @@ +import { printHello } from "https://localhost:5545/subdir/print_hello.ts"; + +printHello(); diff --git a/cli/tests/testdata/run/https_import.ts.out b/cli/tests/testdata/run/https_import.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/run/https_import.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/run/if_main.ts b/cli/tests/testdata/run/if_main.ts new file mode 100644 index 000000000..4dcfecea0 --- /dev/null +++ b/cli/tests/testdata/run/if_main.ts @@ -0,0 +1,6 @@ +if (import.meta.main) { + console.log("main"); +} else { + console.log("import.meta.url", import.meta.url); + throw Error("not main"); +} diff --git a/cli/tests/testdata/run/if_main.ts.out b/cli/tests/testdata/run/if_main.ts.out new file mode 100644 index 000000000..ba2906d06 --- /dev/null +++ b/cli/tests/testdata/run/if_main.ts.out @@ -0,0 +1 @@ +main diff --git a/cli/tests/testdata/run/import_blob_url.ts b/cli/tests/testdata/run/import_blob_url.ts new file mode 100644 index 000000000..86bb634e1 --- /dev/null +++ b/cli/tests/testdata/run/import_blob_url.ts @@ -0,0 +1,13 @@ +const blob = new Blob( + ['export const a = "a";\n\nexport enum A {\n A,\n B,\n C,\n}\n'], + { + type: "application/typescript", + }, +); +const url = URL.createObjectURL(blob); + +const a = await import(url); + +console.log(a.a); +console.log(a.A); +console.log(a.A.A); diff --git a/cli/tests/testdata/run/import_blob_url.ts.out b/cli/tests/testdata/run/import_blob_url.ts.out new file mode 100644 index 000000000..bfa0b9d94 --- /dev/null +++ b/cli/tests/testdata/run/import_blob_url.ts.out @@ -0,0 +1,3 @@ +a +{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } +0 diff --git a/cli/tests/testdata/run/import_blob_url_error_stack.ts b/cli/tests/testdata/run/import_blob_url_error_stack.ts new file mode 100644 index 000000000..f9c4f2e9d --- /dev/null +++ b/cli/tests/testdata/run/import_blob_url_error_stack.ts @@ -0,0 +1,13 @@ +const blob = new Blob( + [ + "enum A {\n A,\n B,\n C,\n }\n \n export function a() {\n throw new Error(`Hello ${A.C}`);\n }\n ", + ], + { + type: "application/typescript", + }, +); +const url = URL.createObjectURL(blob); + +const { a } = await import(url); + +a(); diff --git a/cli/tests/testdata/run/import_blob_url_error_stack.ts.out b/cli/tests/testdata/run/import_blob_url_error_stack.ts.out new file mode 100644 index 000000000..52b76fd5c --- /dev/null +++ b/cli/tests/testdata/run/import_blob_url_error_stack.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught (in promise) Error: Hello 2 + throw new Error(`Hello ${A.C}`); + ^ + at a (blob:null/[WILDCARD]:8:10) + at file:///[WILDCARD]/import_blob_url_error_stack.ts:13:1 +[WILDCARD] diff --git a/cli/tests/testdata/run/import_blob_url_import_relative.ts b/cli/tests/testdata/run/import_blob_url_import_relative.ts new file mode 100644 index 000000000..ad130bdac --- /dev/null +++ b/cli/tests/testdata/run/import_blob_url_import_relative.ts @@ -0,0 +1,8 @@ +const blob = new Blob(['export { a } from "./a.ts";'], { + type: "application/javascript", +}); +const url = URL.createObjectURL(blob); + +const a = await import(url); + +console.log(a); diff --git a/cli/tests/testdata/run/import_blob_url_import_relative.ts.out b/cli/tests/testdata/run/import_blob_url_import_relative.ts.out new file mode 100644 index 000000000..59a6f07fb --- /dev/null +++ b/cli/tests/testdata/run/import_blob_url_import_relative.ts.out @@ -0,0 +1,5 @@ +error: Uncaught (in promise) TypeError: invalid URL: relative URL with a cannot-be-a-base base + at blob:null/[WILDCARD]:1:19 +const a = await import(url); + ^ + at async file://[WILDCARD]/import_blob_url_import_relative.ts:6:11 diff --git a/cli/tests/testdata/run/import_blob_url_imports.ts b/cli/tests/testdata/run/import_blob_url_imports.ts new file mode 100644 index 000000000..a7c639152 --- /dev/null +++ b/cli/tests/testdata/run/import_blob_url_imports.ts @@ -0,0 +1,11 @@ +const blob = new Blob( + [ + 'export { printHello } from "http://localhost:4545/subdir/mod2.ts"', + ], + { type: "application/javascript" }, +); +const url = URL.createObjectURL(blob); + +const { printHello } = await import(url); + +printHello(); diff --git a/cli/tests/testdata/run/import_blob_url_imports.ts.out b/cli/tests/testdata/run/import_blob_url_imports.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/run/import_blob_url_imports.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/run/import_blob_url_jsx.ts b/cli/tests/testdata/run/import_blob_url_jsx.ts new file mode 100644 index 000000000..8d645796a --- /dev/null +++ b/cli/tests/testdata/run/import_blob_url_jsx.ts @@ -0,0 +1,16 @@ +const blob = new Blob( + ["export default function() {\n return
Hello Deno!
\n}\n"], + { type: "text/jsx" }, +); +const url = URL.createObjectURL(blob); + +const { default: render } = await import(url); + +// deno-lint-ignore no-explicit-any +(globalThis as any).React = { + createElement(...args: unknown[]) { + console.log(...args); + }, +}; + +render(); diff --git a/cli/tests/testdata/run/import_blob_url_jsx.ts.out b/cli/tests/testdata/run/import_blob_url_jsx.ts.out new file mode 100644 index 000000000..c1c85f250 --- /dev/null +++ b/cli/tests/testdata/run/import_blob_url_jsx.ts.out @@ -0,0 +1 @@ +div null Hello Deno! diff --git a/cli/tests/testdata/run/import_compression/brotli b/cli/tests/testdata/run/import_compression/brotli new file mode 100644 index 000000000..65f679d57 --- /dev/null +++ b/cli/tests/testdata/run/import_compression/brotli @@ -0,0 +1,2 @@ +‹ +€console.log('brotli'); \ No newline at end of file diff --git a/cli/tests/testdata/run/import_compression/gziped b/cli/tests/testdata/run/import_compression/gziped new file mode 100644 index 000000000..9f9a7bc69 Binary files /dev/null and b/cli/tests/testdata/run/import_compression/gziped differ diff --git a/cli/tests/testdata/run/import_compression/main.out b/cli/tests/testdata/run/import_compression/main.out new file mode 100644 index 000000000..371994979 --- /dev/null +++ b/cli/tests/testdata/run/import_compression/main.out @@ -0,0 +1,4 @@ +gzip +brotli +console.log('gzip') +console.log('brotli'); diff --git a/cli/tests/testdata/run/import_compression/main.ts b/cli/tests/testdata/run/import_compression/main.ts new file mode 100644 index 000000000..3dcd6fa24 --- /dev/null +++ b/cli/tests/testdata/run/import_compression/main.ts @@ -0,0 +1,13 @@ +import "http://127.0.0.1:4545/run/import_compression/gziped"; +import "http://127.0.0.1:4545/run/import_compression/brotli"; + +console.log( + await fetch( + "http://127.0.0.1:4545/run/import_compression/gziped", + ).then((res) => res.text()), +); +console.log( + await fetch( + "http://127.0.0.1:4545/run/import_compression/brotli", + ).then((res) => res.text()), +); diff --git a/cli/tests/testdata/run/import_data_url.ts b/cli/tests/testdata/run/import_data_url.ts new file mode 100644 index 000000000..258514a5e --- /dev/null +++ b/cli/tests/testdata/run/import_data_url.ts @@ -0,0 +1,12 @@ +// export const a = "a"; + +// export enum A { +// A, +// B, +// C, +// } +import * as a from "data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo="; + +console.log(a.a); +console.log(a.A); +console.log(a.A.A); diff --git a/cli/tests/testdata/run/import_data_url.ts.out b/cli/tests/testdata/run/import_data_url.ts.out new file mode 100644 index 000000000..bfa0b9d94 --- /dev/null +++ b/cli/tests/testdata/run/import_data_url.ts.out @@ -0,0 +1,3 @@ +a +{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } +0 diff --git a/cli/tests/testdata/run/import_data_url_error_stack.ts b/cli/tests/testdata/run/import_data_url_error_stack.ts new file mode 100644 index 000000000..022e49fe1 --- /dev/null +++ b/cli/tests/testdata/run/import_data_url_error_stack.ts @@ -0,0 +1,3 @@ +import { a } from "data:application/typescript;base64,ZW51bSBBIHsKICBBLAogIEIsCiAgQywKIH0KIAogZXhwb3J0IGZ1bmN0aW9uIGEoKSB7CiAgIHRocm93IG5ldyBFcnJvcihgSGVsbG8gJHtBLkN9YCk7CiB9CiA="; + +a(); diff --git a/cli/tests/testdata/run/import_data_url_error_stack.ts.out b/cli/tests/testdata/run/import_data_url_error_stack.ts.out new file mode 100644 index 000000000..ccd72e4ad --- /dev/null +++ b/cli/tests/testdata/run/import_data_url_error_stack.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught Error: Hello 2 + throw new Error(`Hello ${A.C}`); + ^ + at a (data:application/typescript;base64,ZW51bSBBIHsKICBBLAog......JHtBLkN9YCk7CiB9CiA=:8:10) + at file:///[WILDCARD]/import_data_url_error_stack.ts:3:1 +[WILDCARD] diff --git a/cli/tests/testdata/run/import_data_url_import_relative.ts b/cli/tests/testdata/run/import_data_url_import_relative.ts new file mode 100644 index 000000000..23947fe60 --- /dev/null +++ b/cli/tests/testdata/run/import_data_url_import_relative.ts @@ -0,0 +1,4 @@ +// export { a } from "./a.ts"; +import * as a from "data:application/javascript;base64,ZXhwb3J0IHsgYSB9IGZyb20gIi4vYS50cyI7Cg=="; + +console.log(a); diff --git a/cli/tests/testdata/run/import_data_url_import_relative.ts.out b/cli/tests/testdata/run/import_data_url_import_relative.ts.out new file mode 100644 index 000000000..821c3e4df --- /dev/null +++ b/cli/tests/testdata/run/import_data_url_import_relative.ts.out @@ -0,0 +1,2 @@ +error: invalid URL: relative URL with a cannot-be-a-base base + at data:application/javascript;base64,ZXhwb3J0IHsgYSB9IGZyb20gIi4vYS50cyI7Cg==:1:19 diff --git a/cli/tests/testdata/run/import_data_url_imports.ts b/cli/tests/testdata/run/import_data_url_imports.ts new file mode 100644 index 000000000..df7dae727 --- /dev/null +++ b/cli/tests/testdata/run/import_data_url_imports.ts @@ -0,0 +1,4 @@ +// export { printHello } from "http://localhost:4545/subdir/mod2.ts"; +import { printHello } from "data:application/typescript;base64,ZXhwb3J0IHsgcHJpbnRIZWxsbyB9IGZyb20gImh0dHA6Ly9sb2NhbGhvc3Q6NDU0NS9zdWJkaXIvbW9kMi50cyI7"; + +printHello(); diff --git a/cli/tests/testdata/run/import_data_url_imports.ts.out b/cli/tests/testdata/run/import_data_url_imports.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/run/import_data_url_imports.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/run/import_data_url_jsx.ts b/cli/tests/testdata/run/import_data_url_jsx.ts new file mode 100644 index 000000000..1881211f9 --- /dev/null +++ b/cli/tests/testdata/run/import_data_url_jsx.ts @@ -0,0 +1,10 @@ +import render from "data:text/jsx;base64,ZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24oKSB7CiAgcmV0dXJuIDxkaXY+SGVsbG8gRGVubyE8L2Rpdj4KfQo="; + +// deno-lint-ignore no-explicit-any +(globalThis as any).React = { + createElement(...args: unknown[]) { + console.log(...args); + }, +}; + +render(); diff --git a/cli/tests/testdata/run/import_data_url_jsx.ts.out b/cli/tests/testdata/run/import_data_url_jsx.ts.out new file mode 100644 index 000000000..c1c85f250 --- /dev/null +++ b/cli/tests/testdata/run/import_data_url_jsx.ts.out @@ -0,0 +1 @@ +div null Hello Deno! diff --git a/cli/tests/testdata/run/import_dynamic_data_url.ts b/cli/tests/testdata/run/import_dynamic_data_url.ts new file mode 100644 index 000000000..53a0fbcd3 --- /dev/null +++ b/cli/tests/testdata/run/import_dynamic_data_url.ts @@ -0,0 +1,14 @@ +// export const a = "a"; + +// export enum A { +// A, +// B, +// C, +// } +const a = await import( + "data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=" +); + +console.log(a.a); +console.log(a.A); +console.log(a.A.A); diff --git a/cli/tests/testdata/run/import_dynamic_data_url.ts.out b/cli/tests/testdata/run/import_dynamic_data_url.ts.out new file mode 100644 index 000000000..bfa0b9d94 --- /dev/null +++ b/cli/tests/testdata/run/import_dynamic_data_url.ts.out @@ -0,0 +1,3 @@ +a +{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } +0 diff --git a/cli/tests/testdata/run/import_extensionless.ts b/cli/tests/testdata/run/import_extensionless.ts new file mode 100644 index 000000000..689d553ff --- /dev/null +++ b/cli/tests/testdata/run/import_extensionless.ts @@ -0,0 +1,3 @@ +import { printHello3 } from "http://localhost:4545/v1/extensionless"; + +printHello3(); diff --git a/cli/tests/testdata/run/import_extensionless.ts.out b/cli/tests/testdata/run/import_extensionless.ts.out new file mode 100644 index 000000000..699b756ed --- /dev/null +++ b/cli/tests/testdata/run/import_extensionless.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +Hello diff --git a/cli/tests/testdata/run/import_file_with_colon.ts b/cli/tests/testdata/run/import_file_with_colon.ts new file mode 100644 index 000000000..619bdd66d --- /dev/null +++ b/cli/tests/testdata/run/import_file_with_colon.ts @@ -0,0 +1 @@ +import "http://localhost:4545/subdir/file_with_:_in_name.ts"; diff --git a/cli/tests/testdata/run/import_file_with_colon.ts.out b/cli/tests/testdata/run/import_file_with_colon.ts.out new file mode 100644 index 000000000..f60bbf4b1 --- /dev/null +++ b/cli/tests/testdata/run/import_file_with_colon.ts.out @@ -0,0 +1 @@ +Hello from file_with_:_in_name.ts diff --git a/cli/tests/testdata/run/import_meta/importmap.json b/cli/tests/testdata/run/import_meta/importmap.json new file mode 100644 index 000000000..f8c056afd --- /dev/null +++ b/cli/tests/testdata/run/import_meta/importmap.json @@ -0,0 +1,11 @@ +{ + "imports": { + "bare": "https://example.com/", + "https://example.com/rewrite": "https://example.com/rewritten", + + "1": "https://example.com/PASS-1", + "null": "https://example.com/PASS-null", + "undefined": "https://example.com/PASS-undefined", + "[object Object]": "https://example.com/PASS-object" + } +} diff --git a/cli/tests/testdata/run/import_meta/main.out b/cli/tests/testdata/run/import_meta/main.out new file mode 100644 index 000000000..89aeddaf3 --- /dev/null +++ b/cli/tests/testdata/run/import_meta/main.out @@ -0,0 +1,9 @@ +other [WILDCARD]other.ts false +main [WILDCARD]main.ts true +Resolving ./foo.js file:///[WILDCARD]/foo.js +Resolving bare from import map https://example.com/ +Resolving https://example.com/rewrite from import map https://example.com/rewritten +Resolving without a value from import map https://example.com/PASS-undefined +Resolving 1 from import map https://example.com/PASS-1 +Resolving null from import map https://example.com/PASS-null +Resolving object from import map https://example.com/PASS-object diff --git a/cli/tests/testdata/run/import_meta/main.ts b/cli/tests/testdata/run/import_meta/main.ts new file mode 100644 index 000000000..02f0a1c58 --- /dev/null +++ b/cli/tests/testdata/run/import_meta/main.ts @@ -0,0 +1,34 @@ +import { assertThrows } from "../../../../../test_util/std/testing/asserts.ts"; + +console.log("main", import.meta.url, import.meta.main); + +import "./other.ts"; + +console.log("Resolving ./foo.js", import.meta.resolve("./foo.js")); +console.log("Resolving bare from import map", import.meta.resolve("bare")); +console.log( + "Resolving https://example.com/rewrite from import map", + import.meta.resolve("https://example.com/rewrite"), +); +console.log( + "Resolving without a value from import map", + import.meta.resolve(), +); +console.log( + "Resolving 1 from import map", + import.meta.resolve(1), +); +console.log( + "Resolving null from import map", + import.meta.resolve(null), +); +console.log( + "Resolving object from import map", + import.meta.resolve({}), +); +assertThrows(() => { + import.meta.resolve("too", "many", "arguments"); +}, TypeError); +assertThrows(() => { + import.meta.resolve("://malformed/url?asdf"); +}, TypeError); diff --git a/cli/tests/testdata/run/import_meta/other.ts b/cli/tests/testdata/run/import_meta/other.ts new file mode 100644 index 000000000..47d7527cd --- /dev/null +++ b/cli/tests/testdata/run/import_meta/other.ts @@ -0,0 +1 @@ +console.log("other", import.meta.url, import.meta.main); diff --git a/cli/tests/testdata/run/import_type.ts b/cli/tests/testdata/run/import_type.ts new file mode 100644 index 000000000..22c639cbc --- /dev/null +++ b/cli/tests/testdata/run/import_type.ts @@ -0,0 +1,5 @@ +import { type B, create } from "../subdir/export_types.ts"; + +const b: B = create(); + +console.log(b); diff --git a/cli/tests/testdata/run/import_type.ts.out b/cli/tests/testdata/run/import_type.ts.out new file mode 100644 index 000000000..188c5e25d --- /dev/null +++ b/cli/tests/testdata/run/import_type.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +B { a: "a" } diff --git a/cli/tests/testdata/run/inline_js_source_map.ts b/cli/tests/testdata/run/inline_js_source_map.ts new file mode 100644 index 000000000..5ae7c226a --- /dev/null +++ b/cli/tests/testdata/run/inline_js_source_map.ts @@ -0,0 +1,6 @@ +1 + 1; +interface Test { + hello: string; +} + +// throw new Error("Hello world!" as string); diff --git a/cli/tests/testdata/run/inline_js_source_map_2.js b/cli/tests/testdata/run/inline_js_source_map_2.js new file mode 100644 index 000000000..d14d906b8 --- /dev/null +++ b/cli/tests/testdata/run/inline_js_source_map_2.js @@ -0,0 +1,4 @@ +"use strict"; +1 + 1; +throw new Error("Hello world!"); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L3J1bi9pbmxpbmVfanNfc291cmNlX21hcF8yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/cli/tests/testdata/run/inline_js_source_map_2.js.out b/cli/tests/testdata/run/inline_js_source_map_2.js.out new file mode 100644 index 000000000..72a531b0b --- /dev/null +++ b/cli/tests/testdata/run/inline_js_source_map_2.js.out @@ -0,0 +1,2 @@ +error: Uncaught Error: Hello world! + at http://localhost:4545/run/inline_js_source_map_2.ts:6:7 diff --git a/cli/tests/testdata/run/inline_js_source_map_2.ts b/cli/tests/testdata/run/inline_js_source_map_2.ts new file mode 100644 index 000000000..fa50586e6 --- /dev/null +++ b/cli/tests/testdata/run/inline_js_source_map_2.ts @@ -0,0 +1,6 @@ +1 + 1; +interface Test { + hello: string; +} + +throw new Error("Hello world!" as unknown as string); diff --git a/cli/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js b/cli/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js new file mode 100644 index 000000000..7660cc229 --- /dev/null +++ b/cli/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js @@ -0,0 +1,4 @@ +"use strict"; + +throw new Error("Hello world!"); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L3J1bi9pbmxpbmVfanNfc291cmNlX21hcF8yLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIjErMTtcbmludGVyZmFjZSBUZXN0IHtcbiAgaGVsbG86IHN0cmluZztcbn1cblxudGhyb3cgbmV3IEVycm9yKFwiSGVsbG8gd29ybGQhXCIgYXMgdW5rbm93biBhcyBzdHJpbmcpO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/cli/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js.out b/cli/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js.out new file mode 100644 index 000000000..72a531b0b --- /dev/null +++ b/cli/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js.out @@ -0,0 +1,2 @@ +error: Uncaught Error: Hello world! + at http://localhost:4545/run/inline_js_source_map_2.ts:6:7 diff --git a/cli/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js b/cli/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js new file mode 100644 index 000000000..887f02320 --- /dev/null +++ b/cli/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js @@ -0,0 +1,4 @@ +"use strict"; +import "http://localhost:4545/run/inline_js_source_map.ts"; +throw new Error("Hello world!"); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L3J1bi9pbmxpbmVfanNfc291cmNlX21hcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsQ0FBQyxHQUFDLENBQUMsQ0FBQztBQUtKLE1BQU0sSUFBSSxLQUFLLENBQUMsY0FBK0IsQ0FBQyxDQUFDIn0= \ No newline at end of file diff --git a/cli/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js.out b/cli/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js.out new file mode 100644 index 000000000..9a5a26a68 --- /dev/null +++ b/cli/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js.out @@ -0,0 +1,4 @@ +error: Uncaught Error: Hello world! +// throw new Error("Hello world!" as string); + ^ + at http://localhost:4545/run/inline_js_source_map.ts:6:7 diff --git a/cli/tests/testdata/run/issue13562.ts b/cli/tests/testdata/run/issue13562.ts new file mode 100644 index 000000000..afbf69f99 --- /dev/null +++ b/cli/tests/testdata/run/issue13562.ts @@ -0,0 +1,3 @@ +import { printHello3 } from "../subdir/mod1.ts?q=.json"; + +printHello3(); diff --git a/cli/tests/testdata/run/issue13562.ts.out b/cli/tests/testdata/run/issue13562.ts.out new file mode 100644 index 000000000..699b756ed --- /dev/null +++ b/cli/tests/testdata/run/issue13562.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +Hello diff --git a/cli/tests/testdata/run/issue9750.js b/cli/tests/testdata/run/issue9750.js new file mode 100644 index 000000000..89fd61629 --- /dev/null +++ b/cli/tests/testdata/run/issue9750.js @@ -0,0 +1,6 @@ +// Run without permissions. +const buf = new Uint8Array(1); +console.log("Enter 'yy':"); +await Deno.stdin.read(buf); +await Deno.permissions.request({ "name": "env" }); +console.log("\n\nOwned", Deno.env.get("SECRET")); diff --git a/cli/tests/testdata/run/js_import_detect.ts b/cli/tests/testdata/run/js_import_detect.ts new file mode 100644 index 000000000..751741996 --- /dev/null +++ b/cli/tests/testdata/run/js_import_detect.ts @@ -0,0 +1,3 @@ +function define(_foo: string[]) {} +define(["long"]); +console.log("ok"); diff --git a/cli/tests/testdata/run/js_import_detect.ts.out b/cli/tests/testdata/run/js_import_detect.ts.out new file mode 100644 index 000000000..9766475a4 --- /dev/null +++ b/cli/tests/testdata/run/js_import_detect.ts.out @@ -0,0 +1 @@ +ok diff --git a/cli/tests/testdata/run/js_root_with_ts_check.js b/cli/tests/testdata/run/js_root_with_ts_check.js new file mode 100644 index 000000000..adca847ee --- /dev/null +++ b/cli/tests/testdata/run/js_root_with_ts_check.js @@ -0,0 +1,5 @@ +// @ts-check + +/** @type {number} */ +const a = ""; +console.log(a); diff --git a/cli/tests/testdata/run/js_root_with_ts_check.js.out b/cli/tests/testdata/run/js_root_with_ts_check.js.out new file mode 100644 index 000000000..34e2fa61e --- /dev/null +++ b/cli/tests/testdata/run/js_root_with_ts_check.js.out @@ -0,0 +1,4 @@ +error: TS2322 [ERROR]: Type 'string' is not assignable to type 'number'. +const a = ""; + ^ + at [WILDCARD] diff --git a/cli/tests/testdata/run/jsx_import_from_ts.App.jsx b/cli/tests/testdata/run/jsx_import_from_ts.App.jsx new file mode 100644 index 000000000..649230613 --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_from_ts.App.jsx @@ -0,0 +1,11 @@ +const React = { + createElement() {}, +}; + +export default function app() { + return ( +
+

asdf

+
+ ); +} diff --git a/cli/tests/testdata/run/jsx_import_from_ts.ts b/cli/tests/testdata/run/jsx_import_from_ts.ts new file mode 100644 index 000000000..3cc916698 --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_from_ts.ts @@ -0,0 +1,3 @@ +import app from "./jsx_import_from_ts.App.jsx"; + +console.log(app); diff --git a/cli/tests/testdata/run/jsx_import_from_ts.ts.out b/cli/tests/testdata/run/jsx_import_from_ts.ts.out new file mode 100644 index 000000000..d449b8c9a --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_from_ts.ts.out @@ -0,0 +1 @@ +[Function: app] diff --git a/cli/tests/testdata/run/jsx_import_source.out b/cli/tests/testdata/run/jsx_import_source.out new file mode 100644 index 000000000..b9555987a --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_source.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime diff --git a/cli/tests/testdata/run/jsx_import_source_dev.out b/cli/tests/testdata/run/jsx_import_source_dev.out new file mode 100644 index 000000000..38d7a12f0 --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_source_dev.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-dev-runtime diff --git a/cli/tests/testdata/run/jsx_import_source_error.out b/cli/tests/testdata/run/jsx_import_source_error.out new file mode 100644 index 000000000..634a5b09b --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_source_error.out @@ -0,0 +1,2 @@ +error: Module not found "file:///[WILDCARD]/nonexistent/jsx-runtime". + at file:///[WILDCARD]/jsx_import_source_no_pragma.tsx:1:1 diff --git a/cli/tests/testdata/run/jsx_import_source_import_map.out b/cli/tests/testdata/run/jsx_import_source_import_map.out new file mode 100644 index 000000000..0d3238967 --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_source_import_map.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime/index.ts diff --git a/cli/tests/testdata/run/jsx_import_source_import_map_dev.out b/cli/tests/testdata/run/jsx_import_source_import_map_dev.out new file mode 100644 index 000000000..56f514d90 --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_source_import_map_dev.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-dev-runtime/index.ts diff --git a/cli/tests/testdata/run/jsx_import_source_no_pragma.tsx b/cli/tests/testdata/run/jsx_import_source_no_pragma.tsx new file mode 100644 index 000000000..2c756054f --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_source_no_pragma.tsx @@ -0,0 +1,7 @@ +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/cli/tests/testdata/run/jsx_import_source_pragma.tsx b/cli/tests/testdata/run/jsx_import_source_pragma.tsx new file mode 100644 index 000000000..c19e53d4f --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_source_pragma.tsx @@ -0,0 +1,9 @@ +/** @jsxImportSource http://localhost:4545/jsx */ + +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/cli/tests/testdata/run/jsx_import_source_pragma_import_map.tsx b/cli/tests/testdata/run/jsx_import_source_pragma_import_map.tsx new file mode 100644 index 000000000..548365f18 --- /dev/null +++ b/cli/tests/testdata/run/jsx_import_source_pragma_import_map.tsx @@ -0,0 +1,9 @@ +/** @jsxImportSource jsx */ + +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/cli/tests/testdata/run/lock_check_err.json b/cli/tests/testdata/run/lock_check_err.json new file mode 100644 index 000000000..fc6c2d45c --- /dev/null +++ b/cli/tests/testdata/run/lock_check_err.json @@ -0,0 +1,4 @@ +{ + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/run/003_relative_import.ts": "bad" +} diff --git a/cli/tests/testdata/run/lock_check_err.out b/cli/tests/testdata/run/lock_check_err.out new file mode 100644 index 000000000..e4cc7b81a --- /dev/null +++ b/cli/tests/testdata/run/lock_check_err.out @@ -0,0 +1,3 @@ +[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. + Specifier: http://127.0.0.1:4545/run/003_relative_import.ts + Lock file: run/lock_check_err.json diff --git a/cli/tests/testdata/run/lock_check_err2.json b/cli/tests/testdata/run/lock_check_err2.json new file mode 100644 index 000000000..a59cbc9e3 --- /dev/null +++ b/cli/tests/testdata/run/lock_check_err2.json @@ -0,0 +1,10 @@ +{ + "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "bad", + "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" +} diff --git a/cli/tests/testdata/run/lock_check_err2.out b/cli/tests/testdata/run/lock_check_err2.out new file mode 100644 index 000000000..065c7434b --- /dev/null +++ b/cli/tests/testdata/run/lock_check_err2.out @@ -0,0 +1,3 @@ +[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. + Specifier: http://localhost:4545/subdir/mt_text_ecmascript.j3.js + Lock file: run/lock_check_err2.json diff --git a/cli/tests/testdata/run/lock_check_ok.json b/cli/tests/testdata/run/lock_check_ok.json new file mode 100644 index 000000000..94de0f630 --- /dev/null +++ b/cli/tests/testdata/run/lock_check_ok.json @@ -0,0 +1,4 @@ +{ + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/run/003_relative_import.ts": "a1572e8fd2c2712b33f04aed2561505b5feb2c8696f1f2cded3de7127931b97e" +} diff --git a/cli/tests/testdata/run/lock_check_ok2.json b/cli/tests/testdata/run/lock_check_ok2.json new file mode 100644 index 000000000..162c755e2 --- /dev/null +++ b/cli/tests/testdata/run/lock_check_ok2.json @@ -0,0 +1,10 @@ +{ + "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" +} diff --git a/cli/tests/testdata/run/lock_dynamic_imports.json b/cli/tests/testdata/run/lock_dynamic_imports.json new file mode 100644 index 000000000..0269b9409 --- /dev/null +++ b/cli/tests/testdata/run/lock_dynamic_imports.json @@ -0,0 +1,6 @@ +{ + "http://127.0.0.1:4545/run/013_dynamic_import.ts": "3f83e653329dc1f963761a986997d710b9763f667fc243eef89b3a5decacda30", + "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" +} diff --git a/cli/tests/testdata/run/lock_dynamic_imports.out b/cli/tests/testdata/run/lock_dynamic_imports.out new file mode 100644 index 000000000..acc65c8e6 --- /dev/null +++ b/cli/tests/testdata/run/lock_dynamic_imports.out @@ -0,0 +1,4 @@ +[WILDCARD] +error: The source code is invalid, as it does not match the expected hash in the lock file. + Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts + Lock file: run/lock_dynamic_imports.json diff --git a/cli/tests/testdata/run/lock_write_fetch/file_exists.ts b/cli/tests/testdata/run/lock_write_fetch/file_exists.ts new file mode 100644 index 000000000..20de4d4f2 --- /dev/null +++ b/cli/tests/testdata/run/lock_write_fetch/file_exists.ts @@ -0,0 +1,6 @@ +try { + await Deno.open(Deno.args[0]); + Deno.exit(0); +} catch (_e) { + Deno.exit(1); +} diff --git a/cli/tests/testdata/run/lock_write_fetch/main.out b/cli/tests/testdata/run/lock_write_fetch/main.out new file mode 100644 index 000000000..bfdb952f9 --- /dev/null +++ b/cli/tests/testdata/run/lock_write_fetch/main.out @@ -0,0 +1,3 @@ +fetch code: 0 +fetch check code: 0 +run code: 0 diff --git a/cli/tests/testdata/run/lock_write_fetch/main.ts b/cli/tests/testdata/run/lock_write_fetch/main.ts new file mode 100644 index 000000000..3e6892cf0 --- /dev/null +++ b/cli/tests/testdata/run/lock_write_fetch/main.ts @@ -0,0 +1,52 @@ +try { + Deno.removeSync("./lock_write_fetch.json"); +} catch { + // pass +} + +const fetchProc = await Deno.spawn(Deno.execPath(), { + stdout: "null", + stderr: "null", + args: [ + "cache", + "--reload", + "--lock=lock_write_fetch.json", + "--lock-write", + "--cert=tls/RootCA.pem", + "run/https_import.ts", + ], +}); + +console.log(`fetch code: ${fetchProc.code}`); + +const fetchCheckProc = await Deno.spawn(Deno.execPath(), { + stdout: "null", + stderr: "null", + args: [ + "cache", + "--lock=lock_write_fetch.json", + "--cert=tls/RootCA.pem", + "run/https_import.ts", + ], +}); + +console.log(`fetch check code: ${fetchCheckProc.code}`); + +Deno.removeSync("./lock_write_fetch.json"); + +const runProc = await Deno.spawn(Deno.execPath(), { + stdout: "null", + stderr: "null", + args: [ + "run", + "--lock=lock_write_fetch.json", + "--lock-write", + "--allow-read", + "run/lock_write_fetch/file_exists.ts", + "lock_write_fetch.json", + ], +}); + +console.log(`run code: ${runProc.code}`); + +Deno.removeSync("./lock_write_fetch.json"); diff --git a/cli/tests/testdata/run/lock_write_requires_lock.out b/cli/tests/testdata/run/lock_write_requires_lock.out new file mode 100644 index 000000000..7cc5906f6 --- /dev/null +++ b/cli/tests/testdata/run/lock_write_requires_lock.out @@ -0,0 +1,3 @@ +error: The following required arguments were not provided: + --lock +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/run/long_data_url_formatting.ts b/cli/tests/testdata/run/long_data_url_formatting.ts new file mode 100644 index 000000000..2ed2d5a03 --- /dev/null +++ b/cli/tests/testdata/run/long_data_url_formatting.ts @@ -0,0 +1,3 @@ +await import( + 'data:application/typescript,console.trace("foo"); const error = new Error("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log(error.stack); throw error;' +); diff --git a/cli/tests/testdata/run/long_data_url_formatting.ts.out b/cli/tests/testdata/run/long_data_url_formatting.ts.out new file mode 100644 index 000000000..ea78c2591 --- /dev/null +++ b/cli/tests/testdata/run/long_data_url_formatting.ts.out @@ -0,0 +1,8 @@ +[WILDCARD]Trace: foo + at data:application/typescript,console.trace("foo")......stack); throw error;:1:9 +Error: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + at data:application/typescript,console.trace("foo")......stack); throw error;:1:37 +error: Uncaught (in promise) Error: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +console.trace("foo"); const error = new Error("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); console.log(error.stack); throw error; + ^ + at data:application/typescript,console.trace("foo")......stack); throw error;:1:37 diff --git a/cli/tests/testdata/run/main_module/main.out b/cli/tests/testdata/run/main_module/main.out new file mode 100644 index 000000000..29f592c2a --- /dev/null +++ b/cli/tests/testdata/run/main_module/main.out @@ -0,0 +1,2 @@ +other [WILDCARD]/main.ts +main [WILDCARD]/main.ts diff --git a/cli/tests/testdata/run/main_module/main.ts b/cli/tests/testdata/run/main_module/main.ts new file mode 100644 index 000000000..d2f2c66ee --- /dev/null +++ b/cli/tests/testdata/run/main_module/main.ts @@ -0,0 +1,3 @@ +console.log("main", Deno.mainModule); + +import "./other.ts"; diff --git a/cli/tests/testdata/run/main_module/other.ts b/cli/tests/testdata/run/main_module/other.ts new file mode 100644 index 000000000..b3e524b0a --- /dev/null +++ b/cli/tests/testdata/run/main_module/other.ts @@ -0,0 +1 @@ +console.log("other", Deno.mainModule); diff --git a/cli/tests/testdata/run/mts_dmts_mjs.out b/cli/tests/testdata/run/mts_dmts_mjs.out new file mode 100644 index 000000000..5647bdfb9 --- /dev/null +++ b/cli/tests/testdata/run/mts_dmts_mjs.out @@ -0,0 +1,2 @@ +[WILDCARD] +a diff --git a/cli/tests/testdata/run/nested_error.ts b/cli/tests/testdata/run/nested_error.ts new file mode 100644 index 000000000..69828e1ca --- /dev/null +++ b/cli/tests/testdata/run/nested_error.ts @@ -0,0 +1,3 @@ +throw { + foo: new Error(), +}; diff --git a/cli/tests/testdata/run/nested_error.ts.out b/cli/tests/testdata/run/nested_error.ts.out new file mode 100644 index 000000000..f5ebeec4d --- /dev/null +++ b/cli/tests/testdata/run/nested_error.ts.out @@ -0,0 +1,4 @@ +error: Uncaught { + foo: Error + at file:///[WILDCARD]testdata/run/nested_error.ts:2:8 +} diff --git a/cli/tests/testdata/run/no_check_decorators.ts b/cli/tests/testdata/run/no_check_decorators.ts new file mode 100644 index 000000000..9f7ec550d --- /dev/null +++ b/cli/tests/testdata/run/no_check_decorators.ts @@ -0,0 +1,21 @@ +// deno-lint-ignore-file +function a() { + console.log("a(): evaluated"); + return ( + _target: any, + _propertyKey: string, + _descriptor: PropertyDescriptor, + ) => { + console.log("a(): called"); + }; +} + +class B { + @a() + method() { + console.log("method"); + } +} + +const b = new B(); +b.method(); diff --git a/cli/tests/testdata/run/no_check_decorators.ts.out b/cli/tests/testdata/run/no_check_decorators.ts.out new file mode 100644 index 000000000..015f7076e --- /dev/null +++ b/cli/tests/testdata/run/no_check_decorators.ts.out @@ -0,0 +1,3 @@ +a(): evaluated +a(): called +method diff --git a/cli/tests/testdata/run/no_check_imports_not_used_as_values/hello.ts b/cli/tests/testdata/run/no_check_imports_not_used_as_values/hello.ts new file mode 100644 index 000000000..1a9d8f114 --- /dev/null +++ b/cli/tests/testdata/run/no_check_imports_not_used_as_values/hello.ts @@ -0,0 +1,2 @@ +export type SomeType = unknown; +console.log("Hello, world!"); diff --git a/cli/tests/testdata/run/no_check_imports_not_used_as_values/main.out b/cli/tests/testdata/run/no_check_imports_not_used_as_values/main.out new file mode 100644 index 000000000..f744c4183 --- /dev/null +++ b/cli/tests/testdata/run/no_check_imports_not_used_as_values/main.out @@ -0,0 +1,2 @@ +[WILDCARD]Hello, world! +Hi! diff --git a/cli/tests/testdata/run/no_check_imports_not_used_as_values/main.ts b/cli/tests/testdata/run/no_check_imports_not_used_as_values/main.ts new file mode 100644 index 000000000..80e17aa35 --- /dev/null +++ b/cli/tests/testdata/run/no_check_imports_not_used_as_values/main.ts @@ -0,0 +1,4 @@ +import { SomeType } from "./hello.ts"; + +const string: SomeType = "Hi!"; +console.log(string); diff --git a/cli/tests/testdata/run/no_check_imports_not_used_as_values/preserve_imports.tsconfig.json b/cli/tests/testdata/run/no_check_imports_not_used_as_values/preserve_imports.tsconfig.json new file mode 100644 index 000000000..9b19291aa --- /dev/null +++ b/cli/tests/testdata/run/no_check_imports_not_used_as_values/preserve_imports.tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "importsNotUsedAsValues": "preserve" + } +} diff --git a/cli/tests/testdata/run/no_check_remote.ts b/cli/tests/testdata/run/no_check_remote.ts new file mode 100644 index 000000000..2ae8c2692 --- /dev/null +++ b/cli/tests/testdata/run/no_check_remote.ts @@ -0,0 +1,3 @@ +import * as a from "http://localhost:4545/subdir/type_error.ts"; + +console.log(a.a); diff --git a/cli/tests/testdata/run/no_check_remote.ts.disabled.out b/cli/tests/testdata/run/no_check_remote.ts.disabled.out new file mode 100644 index 000000000..344264634 --- /dev/null +++ b/cli/tests/testdata/run/no_check_remote.ts.disabled.out @@ -0,0 +1,4 @@ +error: TS2322 [ERROR]: Type '12' is not assignable to type '"a"'. +export const a: "a" = 12; + ^ + at http://localhost:4545/subdir/type_error.ts:1:14 diff --git a/cli/tests/testdata/run/no_check_remote.ts.enabled.out b/cli/tests/testdata/run/no_check_remote.ts.enabled.out new file mode 100644 index 000000000..48082f72f --- /dev/null +++ b/cli/tests/testdata/run/no_check_remote.ts.enabled.out @@ -0,0 +1 @@ +12 diff --git a/cli/tests/testdata/run/no_mem_cache.js b/cli/tests/testdata/run/no_mem_cache.js new file mode 100644 index 000000000..a486732b6 --- /dev/null +++ b/cli/tests/testdata/run/no_mem_cache.js @@ -0,0 +1,33 @@ +const fixtureFile = await Deno.makeTempFile(); +let prefix = "file://"; +if (Deno.build.os == "windows") { + prefix += "/"; +} +const fixtureUrl = new URL(`${prefix}${fixtureFile}`); +let resolve; + +let p = new Promise((res) => resolve = res); + +await Deno.writeTextFile(fixtureUrl, `self.postMessage("hello");\n`); + +const workerA = new Worker(fixtureUrl.href, { type: "module" }); +workerA.onmessage = (msg) => { + console.log(msg.data); + resolve(); +}; + +await p; +workerA.terminate(); + +p = new Promise((res) => resolve = res); + +await Deno.writeTextFile(fixtureUrl, `self.postMessage("goodbye");\n`); + +const workerB = new Worker(fixtureUrl.href, { type: "module" }); +workerB.onmessage = (msg) => { + console.log(msg.data); + resolve(); +}; + +await p; +workerB.terminate(); diff --git a/cli/tests/testdata/run/no_mem_cache.js.out b/cli/tests/testdata/run/no_mem_cache.js.out new file mode 100644 index 000000000..a32119c8a --- /dev/null +++ b/cli/tests/testdata/run/no_mem_cache.js.out @@ -0,0 +1,2 @@ +hello +goodbye diff --git a/cli/tests/testdata/run/no_prompt.ts b/cli/tests/testdata/run/no_prompt.ts new file mode 100644 index 000000000..7f9750995 --- /dev/null +++ b/cli/tests/testdata/run/no_prompt.ts @@ -0,0 +1,10 @@ +new Worker("data:,setTimeout(() => Deno.exit(2), 200)", { type: "module" }); + +try { + await Deno.spawn("ps", { + stdout: "inherit", + stderr: "inherit", + }); +} catch { + Deno.exit(0); +} diff --git a/cli/tests/testdata/run/no_validate_asm.js b/cli/tests/testdata/run/no_validate_asm.js new file mode 100644 index 000000000..ef999e080 --- /dev/null +++ b/cli/tests/testdata/run/no_validate_asm.js @@ -0,0 +1,20 @@ +// V8 logs any asmjs validation errors to stdout, but it shows line numbers that +// are non-existent in the source. + +const _asmJsModule = function () { + "use asm"; + + function func( + x, + ) { + x = +x; // cast to float + + ~x; + // asmjs error: `~` is only valid on integers + // should not log to stdout with --no-validate-asm + } + + return { + f: func, + }; +}(); diff --git a/cli/tests/testdata/run/node_env_var_allowlist.ts b/cli/tests/testdata/run/node_env_var_allowlist.ts new file mode 100644 index 000000000..95da38c24 --- /dev/null +++ b/cli/tests/testdata/run/node_env_var_allowlist.ts @@ -0,0 +1,2 @@ +console.log(Deno.env.get("NODE_DEBUG") ?? "ok"); +Deno.env.get("NOT_NODE_DEBUG"); diff --git a/cli/tests/testdata/run/node_env_var_allowlist_with_unstable_flag.ts.out b/cli/tests/testdata/run/node_env_var_allowlist_with_unstable_flag.ts.out new file mode 100644 index 000000000..62f335c0f --- /dev/null +++ b/cli/tests/testdata/run/node_env_var_allowlist_with_unstable_flag.ts.out @@ -0,0 +1,5 @@ +ok +[WILDCARD]error: Uncaught PermissionDenied: Requires env access to "NOT_NODE_DEBUG", run again with the --allow-env flag +Deno.env.get("NOT_NODE_DEBUG"); + ^ + at [WILDCARD] diff --git a/cli/tests/testdata/run/node_env_var_allowlist_without_unstable_flag.ts.out b/cli/tests/testdata/run/node_env_var_allowlist_without_unstable_flag.ts.out new file mode 100644 index 000000000..ac92cdb6b --- /dev/null +++ b/cli/tests/testdata/run/node_env_var_allowlist_without_unstable_flag.ts.out @@ -0,0 +1,4 @@ +[WILDCARD]error: Uncaught PermissionDenied: Requires env access to "NODE_DEBUG", run again with the --allow-env flag +console.log(Deno.env.get("NODE_DEBUG") ?? "ok"); + ^ + at [WILDCARD] diff --git a/cli/tests/testdata/run/onload/imported.ts b/cli/tests/testdata/run/onload/imported.ts new file mode 100644 index 000000000..969f97e56 --- /dev/null +++ b/cli/tests/testdata/run/onload/imported.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-window-prefix +import { assert } from "../../../../../test_util/std/testing/asserts.ts"; +import "./nest_imported.ts"; + +const handler = (e: Event) => { + assert(!e.cancelable); + console.log(`got ${e.type} event in event handler (imported)`); +}; + +window.addEventListener("load", handler); +window.addEventListener("unload", handler); +console.log("log from imported script"); diff --git a/cli/tests/testdata/run/onload/main.out b/cli/tests/testdata/run/onload/main.out new file mode 100644 index 000000000..9b1f454c9 --- /dev/null +++ b/cli/tests/testdata/run/onload/main.out @@ -0,0 +1,11 @@ +log from nest_imported script +log from imported script +log from main +got load event in event handler (nest_imported) +got load event in event handler (imported) +got load event in event handler (main) +got load event in onload function +got unload event in event handler (nest_imported) +got unload event in event handler (imported) +got unload event in event handler (main) +got unload event in onunload function diff --git a/cli/tests/testdata/run/onload/main.ts b/cli/tests/testdata/run/onload/main.ts new file mode 100644 index 000000000..798b8aa7b --- /dev/null +++ b/cli/tests/testdata/run/onload/main.ts @@ -0,0 +1,27 @@ +// deno-lint-ignore-file no-window-prefix no-prototype-builtins +import { assert } from "../../../../../test_util/std/testing/asserts.ts"; +import "./imported.ts"; + +assert(window.hasOwnProperty("onload")); +assert(window.onload === null); + +const eventHandler = (e: Event) => { + assert(!e.cancelable); + console.log(`got ${e.type} event in event handler (main)`); +}; + +window.addEventListener("load", eventHandler); + +window.addEventListener("unload", eventHandler); + +window.onload = (e: Event) => { + assert(!e.cancelable); + console.log(`got ${e.type} event in onload function`); +}; + +window.onunload = (e: Event) => { + assert(!e.cancelable); + console.log(`got ${e.type} event in onunload function`); +}; + +console.log("log from main"); diff --git a/cli/tests/testdata/run/onload/nest_imported.ts b/cli/tests/testdata/run/onload/nest_imported.ts new file mode 100644 index 000000000..351a3cb22 --- /dev/null +++ b/cli/tests/testdata/run/onload/nest_imported.ts @@ -0,0 +1,11 @@ +// deno-lint-ignore-file no-window-prefix +import { assert } from "../../../../../test_util/std/testing/asserts.ts"; + +const handler = (e: Event) => { + assert(!e.cancelable); + console.log(`got ${e.type} event in event handler (nest_imported)`); +}; + +window.addEventListener("load", handler); +window.addEventListener("unload", handler); +console.log("log from nest_imported script"); diff --git a/cli/tests/testdata/run/op_exit_op_set_exit_code_in_worker.ts b/cli/tests/testdata/run/op_exit_op_set_exit_code_in_worker.ts new file mode 100644 index 000000000..b2ed912de --- /dev/null +++ b/cli/tests/testdata/run/op_exit_op_set_exit_code_in_worker.ts @@ -0,0 +1,13 @@ +// Set exit code to some value, we'll ensure that `Deno.exit()` and +// setting exit code in worker context is a no-op and is an alias for +// `self.close()`. + +// @ts-ignore Deno.core doesn't have type-defs +Deno.core.ops.op_set_exit_code(21); + +const worker = new Worker( + import.meta.resolve("./op_exit_op_set_exit_code_worker.js"), + { type: "module" }, +); + +worker.postMessage("go"); diff --git a/cli/tests/testdata/run/op_exit_op_set_exit_code_worker.js b/cli/tests/testdata/run/op_exit_op_set_exit_code_worker.js new file mode 100644 index 000000000..3e6055747 --- /dev/null +++ b/cli/tests/testdata/run/op_exit_op_set_exit_code_worker.js @@ -0,0 +1,4 @@ +self.onmessage = () => { + Deno.core.ops.op_set_exit_code(42); + Deno.exit(); +}; diff --git a/cli/tests/testdata/run/permission_test.ts b/cli/tests/testdata/run/permission_test.ts new file mode 100644 index 000000000..9b5409b4f --- /dev/null +++ b/cli/tests/testdata/run/permission_test.ts @@ -0,0 +1,30 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +const name = Deno.args[0]; +// deno-lint-ignore no-explicit-any +const test: { [key: string]: (...args: any[]) => void | Promise } = { + readRequired() { + Deno.readFileSync("assets/hello.txt"); + return Promise.resolve(); + }, + writeRequired() { + Deno.makeTempDirSync(); + }, + envRequired() { + Deno.env.get("home"); + }, + netRequired() { + Deno.listen({ transport: "tcp", port: 4541 }); + }, + async runRequired() { + await Deno.spawn(Deno.build.os === "windows" ? "cmd.exe" : "printf", { + args: Deno.build.os === "windows" ? ["/c", "echo hello"] : ["hello"], + }); + }, +}; + +if (!test[name]) { + console.log("Unknown test:", name); + Deno.exit(1); +} + +test[name](); diff --git a/cli/tests/testdata/run/private_field_presence.ts b/cli/tests/testdata/run/private_field_presence.ts new file mode 100644 index 000000000..7ce2840d8 --- /dev/null +++ b/cli/tests/testdata/run/private_field_presence.ts @@ -0,0 +1,20 @@ +export class Person { + #name: string; + constructor(name: string) { + this.#name = name; + } + + equals(other: unknown) { + return other && + typeof other === "object" && + #name in other && + this.#name === other.#name; + } +} + +const a = new Person("alice"); +const b = new Person("bob"); +const c = new Person("alice"); + +console.log(a.equals(b)); +console.log(a.equals(c)); diff --git a/cli/tests/testdata/run/private_field_presence.ts.out b/cli/tests/testdata/run/private_field_presence.ts.out new file mode 100644 index 000000000..f582fb47a --- /dev/null +++ b/cli/tests/testdata/run/private_field_presence.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +false +true diff --git a/cli/tests/testdata/run/proto_exploit.js b/cli/tests/testdata/run/proto_exploit.js new file mode 100644 index 000000000..8bd22cfe5 --- /dev/null +++ b/cli/tests/testdata/run/proto_exploit.js @@ -0,0 +1,5 @@ +const payload = `{ "__proto__": null }`; +const obj = {}; +console.log("Before: " + obj); +Object.assign(obj, JSON.parse(payload)); +console.log("After: " + obj); diff --git a/cli/tests/testdata/run/proto_exploit.js.out b/cli/tests/testdata/run/proto_exploit.js.out new file mode 100644 index 000000000..fde881dc5 --- /dev/null +++ b/cli/tests/testdata/run/proto_exploit.js.out @@ -0,0 +1,2 @@ +Before: [object Object] +After: [object Object] diff --git a/cli/tests/testdata/run/queue_microtask_error.ts b/cli/tests/testdata/run/queue_microtask_error.ts new file mode 100644 index 000000000..b2e9642c5 --- /dev/null +++ b/cli/tests/testdata/run/queue_microtask_error.ts @@ -0,0 +1,5 @@ +queueMicrotask(() => { + throw new Error("foo"); +}); +console.log(1); +Promise.resolve().then(() => console.log(2)); diff --git a/cli/tests/testdata/run/queue_microtask_error.ts.out b/cli/tests/testdata/run/queue_microtask_error.ts.out new file mode 100644 index 000000000..6c4d41936 --- /dev/null +++ b/cli/tests/testdata/run/queue_microtask_error.ts.out @@ -0,0 +1,6 @@ +1 +error: Uncaught Error: foo + throw new Error("foo"); + ^ + at [WILDCARD]/queue_microtask_error.ts:2:9 + at deno:core/[WILDCARD] diff --git a/cli/tests/testdata/run/queue_microtask_error_handled.ts b/cli/tests/testdata/run/queue_microtask_error_handled.ts new file mode 100644 index 000000000..7d1440135 --- /dev/null +++ b/cli/tests/testdata/run/queue_microtask_error_handled.ts @@ -0,0 +1,21 @@ +addEventListener("error", (event) => { + console.log({ + cancelable: event.cancelable, + message: event.message, + filename: event.filename, + lineno: event.lineno, + colno: event.colno, + error: event.error, + }); + event.preventDefault(); +}); + +onerror = (event) => { + console.log("onerror() called", event.error); +}; + +queueMicrotask(() => { + throw new Error("foo"); +}); +console.log(1); +Promise.resolve().then(() => console.log(2)); diff --git a/cli/tests/testdata/run/queue_microtask_error_handled.ts.out b/cli/tests/testdata/run/queue_microtask_error_handled.ts.out new file mode 100644 index 000000000..7f3f7f84a --- /dev/null +++ b/cli/tests/testdata/run/queue_microtask_error_handled.ts.out @@ -0,0 +1,15 @@ +1 +{ + cancelable: true, + message: "Uncaught Error: foo", + filename: "[WILDCARD]/queue_microtask_error_handled.ts", + lineno: 18, + colno: 9, + error: Error: foo + at [WILDCARD]/queue_microtask_error_handled.ts:18:9 + at deno:core/[WILDCARD] +} +onerror() called Error: foo + at [WILDCARD]/queue_microtask_error_handled.ts:18:9 + at deno:core/[WILDCARD] +2 diff --git a/cli/tests/testdata/run/reference_types.ts b/cli/tests/testdata/run/reference_types.ts new file mode 100644 index 000000000..105e23b37 --- /dev/null +++ b/cli/tests/testdata/run/reference_types.ts @@ -0,0 +1,3 @@ +/// + +console.log(globalThis.a); diff --git a/cli/tests/testdata/run/reference_types.ts.out b/cli/tests/testdata/run/reference_types.ts.out new file mode 100644 index 000000000..417b7b537 --- /dev/null +++ b/cli/tests/testdata/run/reference_types.ts.out @@ -0,0 +1 @@ +undefined diff --git a/cli/tests/testdata/run/reference_types_error.js b/cli/tests/testdata/run/reference_types_error.js new file mode 100644 index 000000000..68b6c2136 --- /dev/null +++ b/cli/tests/testdata/run/reference_types_error.js @@ -0,0 +1,2 @@ +/// +export const a = 1; diff --git a/cli/tests/testdata/run/reference_types_error.js.out b/cli/tests/testdata/run/reference_types_error.js.out new file mode 100644 index 000000000..ebb9b3a26 --- /dev/null +++ b/cli/tests/testdata/run/reference_types_error.js.out @@ -0,0 +1,2 @@ +error: Module not found "file:///[WILDCARD]/nonexistent.d.ts". + at file:///[WILDCARD]/reference_types_error.js:1:23 diff --git a/cli/tests/testdata/run/reference_types_remote.ts b/cli/tests/testdata/run/reference_types_remote.ts new file mode 100644 index 000000000..e7fa81b2c --- /dev/null +++ b/cli/tests/testdata/run/reference_types_remote.ts @@ -0,0 +1,3 @@ +/// + +console.log(globalThis.a); diff --git a/cli/tests/testdata/run/reference_types_remote.ts.out b/cli/tests/testdata/run/reference_types_remote.ts.out new file mode 100644 index 000000000..417b7b537 --- /dev/null +++ b/cli/tests/testdata/run/reference_types_remote.ts.out @@ -0,0 +1 @@ +undefined diff --git a/cli/tests/testdata/run/replace_self.js b/cli/tests/testdata/run/replace_self.js new file mode 100644 index 000000000..cfd473cd3 --- /dev/null +++ b/cli/tests/testdata/run/replace_self.js @@ -0,0 +1,21 @@ +// Test that setting `self` in the main thread to some other value doesn't break +// the world, in particular for events fired on the global scope. + +// deno-lint-ignore no-global-assign +self = null; + +addEventListener("load", () => { + console.log("load event (event listener)"); +}); + +addEventListener("unload", () => { + console.log("unload event (event listener)"); +}); + +globalThis.onload = () => { + console.log("load event (event handler)"); +}; + +globalThis.onunload = () => { + console.log("unload event (event handler)"); +}; diff --git a/cli/tests/testdata/run/replace_self.js.out b/cli/tests/testdata/run/replace_self.js.out new file mode 100644 index 000000000..aaffb5a62 --- /dev/null +++ b/cli/tests/testdata/run/replace_self.js.out @@ -0,0 +1,4 @@ +load event (event listener) +load event (event handler) +unload event (event listener) +unload event (event handler) diff --git a/cli/tests/testdata/run/report_error.ts b/cli/tests/testdata/run/report_error.ts new file mode 100644 index 000000000..a6d4af1fd --- /dev/null +++ b/cli/tests/testdata/run/report_error.ts @@ -0,0 +1,3 @@ +console.log(1); +reportError(new Error("foo")); +console.log(2); diff --git a/cli/tests/testdata/run/report_error.ts.out b/cli/tests/testdata/run/report_error.ts.out new file mode 100644 index 000000000..185db62a5 --- /dev/null +++ b/cli/tests/testdata/run/report_error.ts.out @@ -0,0 +1,5 @@ +1 +error: Uncaught Error: foo +reportError(new Error("foo")); + ^ + at [WILDCARD]/report_error.ts:2:13 diff --git a/cli/tests/testdata/run/report_error_end_of_program.ts b/cli/tests/testdata/run/report_error_end_of_program.ts new file mode 100644 index 000000000..cd7ce7f9c --- /dev/null +++ b/cli/tests/testdata/run/report_error_end_of_program.ts @@ -0,0 +1 @@ +reportError(new Error("foo")); diff --git a/cli/tests/testdata/run/report_error_end_of_program.ts.out b/cli/tests/testdata/run/report_error_end_of_program.ts.out new file mode 100644 index 000000000..ecca63389 --- /dev/null +++ b/cli/tests/testdata/run/report_error_end_of_program.ts.out @@ -0,0 +1,4 @@ +error: Uncaught Error: foo +reportError(new Error("foo")); + ^ + at [WILDCARD]/report_error_end_of_program.ts:1:13 diff --git a/cli/tests/testdata/run/report_error_handled.ts b/cli/tests/testdata/run/report_error_handled.ts new file mode 100644 index 000000000..de58f0b8e --- /dev/null +++ b/cli/tests/testdata/run/report_error_handled.ts @@ -0,0 +1,19 @@ +addEventListener("error", (event) => { + console.log({ + cancelable: event.cancelable, + message: event.message, + filename: event.filename, + lineno: event.lineno, + colno: event.colno, + error: event.error, + }); + event.preventDefault(); +}); + +onerror = (event) => { + console.log("onerror() called", event.error); +}; + +console.log(1); +reportError(new Error("foo")); +console.log(2); diff --git a/cli/tests/testdata/run/report_error_handled.ts.out b/cli/tests/testdata/run/report_error_handled.ts.out new file mode 100644 index 000000000..89fa30314 --- /dev/null +++ b/cli/tests/testdata/run/report_error_handled.ts.out @@ -0,0 +1,13 @@ +1 +{ + cancelable: true, + message: "Uncaught Error: foo", + filename: "[WILDCARD]/report_error_handled.ts", + lineno: 18, + colno: 13, + error: Error: foo + at [WILDCARD]/report_error_handled.ts:18:13 +} +onerror() called Error: foo + at [WILDCARD]/report_error_handled.ts:18:13 +2 diff --git a/cli/tests/testdata/run/resolve_dns.ts b/cli/tests/testdata/run/resolve_dns.ts new file mode 100644 index 000000000..bde479c9a --- /dev/null +++ b/cli/tests/testdata/run/resolve_dns.ts @@ -0,0 +1,64 @@ +const nameServer = { nameServer: { ipAddr: "127.0.0.1", port: 4553 } }; + +const [a, aaaa, aname, caa, cname, mx, naptr, ns, ptr, soa, srv, txt] = + await Promise + .all([ + Deno.resolveDns("www.example.com", "A", nameServer), + Deno.resolveDns("www.example.com", "AAAA", nameServer), + Deno.resolveDns("www.example.com", "ANAME", nameServer), + Deno.resolveDns("example.com", "CAA", nameServer), + Deno.resolveDns("alias.example.com", "CNAME", nameServer), + Deno.resolveDns("example.com", "MX", nameServer), + Deno.resolveDns("example.com", "NAPTR", nameServer), + Deno.resolveDns("example.com", "NS", nameServer), + Deno.resolveDns("1.2.3.4.IN-ADDR.ARPA.", "PTR", nameServer), + Deno.resolveDns("example.com", "SOA", nameServer), + Deno.resolveDns("_service._tcp.example.com", "SRV", nameServer), + Deno.resolveDns("example.com", "TXT", nameServer), + ]); + +console.log("A"); +console.log(JSON.stringify(a)); + +console.log("AAAA"); +console.log(JSON.stringify(aaaa)); + +console.log("ANAME"); +console.log(JSON.stringify(aname)); + +console.log("CAA"); +console.log(JSON.stringify(caa)); + +console.log("CNAME"); +console.log(JSON.stringify(cname)); + +console.log("MX"); +console.log(JSON.stringify(mx)); + +console.log("NAPTR"); +console.log(JSON.stringify(naptr)); + +console.log("NS"); +console.log(JSON.stringify(ns)); + +console.log("PTR"); +console.log(JSON.stringify(ptr)); + +console.log("SOA"); +console.log(JSON.stringify(soa)); + +console.log("SRV"); +console.log(JSON.stringify(srv)); + +console.log("TXT"); +console.log(JSON.stringify(txt)); + +try { + await Deno.resolveDns("not-found-example.com", "A", nameServer); +} catch (e) { + console.log( + `Error ${ + e instanceof Error ? e.name : "[non-error]" + } thrown for not-found-example.com`, + ); +} diff --git a/cli/tests/testdata/run/resolve_dns.ts.out b/cli/tests/testdata/run/resolve_dns.ts.out new file mode 100644 index 000000000..2fe10cb9a --- /dev/null +++ b/cli/tests/testdata/run/resolve_dns.ts.out @@ -0,0 +1,25 @@ +A +["1.2.3.4","5.6.7.8"] +AAAA +["1:2:3:4:5:6:7:8"] +ANAME +["aname.example.com."] +CAA +[{"critical":false,"tag":"issue","value":"ca.example.net"},{"critical":false,"tag":"issue","value":"ca2.example.net; account=123456"},{"critical":false,"tag":"issuewild","value":";"},{"critical":false,"tag":"iodef","value":"mailto:security@example.com"},{"critical":true,"tag":"tbs","value":"Unknown"}] +CNAME +["cname.example.com."] +MX +[{"preference":10,"exchange":"mx1.com."},{"preference":20,"exchange":"mx2.com."}] +NAPTR +[{"order":10,"preference":0,"flags":"s","services":"SIPS+D2T","regexp":"","replacement":"_sips._tcp.example.com."},{"order":10,"preference":0,"flags":"s","services":"RELAY:turn.udp","regexp":"","replacement":"_turn._udp.example.com."}] +NS +["ns1.ns.com.","ns2.ns.com.","ns3.ns.com."] +PTR +["www.example.com.","alias.example.com."] +SOA +[{"mname":"net.example.com.","rname":"admin\\.domain.example.com.","serial":20,"refresh":7200,"retry":600,"expire":3600000,"minimum":60}] +SRV +[{"priority":0,"weight":100,"port":1234,"target":"srv.example.com."}] +TXT +[["I","am","a","txt","record"],["I","am","another","txt","record"],["I am a different","txt record"],["key=val"]] +Error NotFound thrown for not-found-example.com diff --git a/cli/tests/testdata/run/resolve_dns.zone.in b/cli/tests/testdata/run/resolve_dns.zone.in new file mode 100644 index 000000000..c351a1de9 --- /dev/null +++ b/cli/tests/testdata/run/resolve_dns.zone.in @@ -0,0 +1,31 @@ +@ IN SOA net admin\.domain ( + 20 ; SERIAL + 7200 ; REFRESH + 600 ; RETRY + 3600000; EXPIRE + 60) ; MINIMUM +@ IN CAA 0 issue "ca.example.net" +@ IN CAA 0 issue "ca2.example.net; account=123456" +@ IN CAA 0 issuewild ";" +@ IN CAA 0 iodef "mailto:security@example.com" +@ IN CAA 128 tbs "Unknown" + NS ns1.ns.com. + NS ns2.ns.com. + NS ns3.ns.com. + MX 10 mx1.com. + MX 20 mx2.com. + TXT I am a txt record + TXT I am another txt record + TXT "I am a different" "txt record" + TXT key=val +www A 1.2.3.4 + A 5.6.7.8 + ANAME aname +www AAAA 1:2:3:4:5:6:7:8 +alias CNAME cname + +1.2.3.4.IN-ADDR.ARPA. PTR www + PTR alias +_service._tcp SRV 0 100 1234 srv +@ IN NAPTR 10 0 "s" "SIPS+D2T" "" _sips._tcp.example.com. +@ IN NAPTR 10 0 "s" RELAY:turn.udp "" _turn._udp.example.com. \ No newline at end of file diff --git a/cli/tests/testdata/run/runtime_decorators.ts b/cli/tests/testdata/run/runtime_decorators.ts new file mode 100644 index 000000000..5da109110 --- /dev/null +++ b/cli/tests/testdata/run/runtime_decorators.ts @@ -0,0 +1,42 @@ +// deno-lint-ignore-file +function A() { + console.log("@A evaluated"); + return function ( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor, + ) { + console.log("@A called"); + const fn = descriptor.value; + descriptor.value = function () { + console.log("fn() called from @A"); + fn(); + }; + }; +} + +function B() { + console.log("@B evaluated"); + return function ( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor, + ) { + console.log("@B called"); + const fn = descriptor.value; + descriptor.value = function () { + console.log("fn() called from @B"); + fn(); + }; + }; +} + +class C { + @A() + @B() + static test() { + console.log("C.test() called"); + } +} + +C.test(); diff --git a/cli/tests/testdata/run/runtime_decorators.ts.out b/cli/tests/testdata/run/runtime_decorators.ts.out new file mode 100644 index 000000000..0fc1d4590 --- /dev/null +++ b/cli/tests/testdata/run/runtime_decorators.ts.out @@ -0,0 +1,7 @@ +@A evaluated +@B evaluated +@B called +@A called +fn() called from @A +fn() called from @B +C.test() called diff --git a/cli/tests/testdata/run/seed_random.js b/cli/tests/testdata/run/seed_random.js new file mode 100644 index 000000000..7f6e336df --- /dev/null +++ b/cli/tests/testdata/run/seed_random.js @@ -0,0 +1,11 @@ +for (let i = 0; i < 10; ++i) { + console.log(Math.random()); +} + +const arr = new Uint8Array(32); + +crypto.getRandomValues(arr); +console.log(arr); + +crypto.getRandomValues(arr); +console.log(arr); diff --git a/cli/tests/testdata/run/seed_random.js.out b/cli/tests/testdata/run/seed_random.js.out new file mode 100644 index 000000000..4d1ebd081 --- /dev/null +++ b/cli/tests/testdata/run/seed_random.js.out @@ -0,0 +1,22 @@ +0.858562739044346 +0.8973397944553141 +0.15335012655691727 +0.36867387434349963 +0.3591039342838782 +0.7044499748617652 +0.7461423057751548 +0.3824611207183364 +0.5950178237266042 +0.22440633214343908 +Uint8Array(32) [ + 153, 221, 127, 193, 173, 88, 77, 155, + 23, 66, 117, 239, 157, 231, 189, 160, + 79, 198, 30, 56, 137, 159, 220, 226, + 47, 211, 26, 73, 243, 252, 71, 214 +] +Uint8Array(32) [ + 18, 98, 66, 131, 76, 87, 93, 76, + 205, 81, 250, 112, 129, 119, 92, 9, + 116, 99, 5, 171, 8, 137, 132, 79, + 255, 9, 194, 1, 138, 85, 72, 189 +] diff --git a/cli/tests/testdata/run/set_exit_code_0.ts b/cli/tests/testdata/run/set_exit_code_0.ts new file mode 100644 index 000000000..362a9f28a --- /dev/null +++ b/cli/tests/testdata/run/set_exit_code_0.ts @@ -0,0 +1,2 @@ +Deno.core.ops.op_set_exit_code(42); +Deno.exit(0); // Takes precedence. diff --git a/cli/tests/testdata/run/set_exit_code_1.ts b/cli/tests/testdata/run/set_exit_code_1.ts new file mode 100644 index 000000000..b10863568 --- /dev/null +++ b/cli/tests/testdata/run/set_exit_code_1.ts @@ -0,0 +1,2 @@ +Deno.core.ops.op_set_exit_code(42); +Deno.exit(); diff --git a/cli/tests/testdata/run/set_exit_code_2.ts b/cli/tests/testdata/run/set_exit_code_2.ts new file mode 100644 index 000000000..d68812cae --- /dev/null +++ b/cli/tests/testdata/run/set_exit_code_2.ts @@ -0,0 +1,2 @@ +Deno.core.ops.op_set_exit_code(42); +// Exits naturally. diff --git a/cli/tests/testdata/run/set_timeout_error.ts b/cli/tests/testdata/run/set_timeout_error.ts new file mode 100644 index 000000000..2864574e7 --- /dev/null +++ b/cli/tests/testdata/run/set_timeout_error.ts @@ -0,0 +1,3 @@ +setTimeout(() => { + throw new Error("foo"); +}, 0); diff --git a/cli/tests/testdata/run/set_timeout_error.ts.out b/cli/tests/testdata/run/set_timeout_error.ts.out new file mode 100644 index 000000000..9db053f6c --- /dev/null +++ b/cli/tests/testdata/run/set_timeout_error.ts.out @@ -0,0 +1,5 @@ +error: Uncaught Error: foo + throw new Error("foo"); + ^ + at [WILDCARD]/set_timeout_error.ts:2:9 + at [WILDCARD] diff --git a/cli/tests/testdata/run/set_timeout_error_handled.ts b/cli/tests/testdata/run/set_timeout_error_handled.ts new file mode 100644 index 000000000..aee2d97d2 --- /dev/null +++ b/cli/tests/testdata/run/set_timeout_error_handled.ts @@ -0,0 +1,19 @@ +addEventListener("error", (event) => { + console.log({ + cancelable: event.cancelable, + message: event.message, + filename: event.filename?.slice?.(-100), + lineno: event.lineno, + colno: event.colno, + error: event.error, + }); + event.preventDefault(); +}); + +onerror = (event) => { + console.log("onerror() called", event.error); +}; + +setTimeout(() => { + throw new Error("foo"); +}, 0); diff --git a/cli/tests/testdata/run/set_timeout_error_handled.ts.out b/cli/tests/testdata/run/set_timeout_error_handled.ts.out new file mode 100644 index 000000000..054dd9b6b --- /dev/null +++ b/cli/tests/testdata/run/set_timeout_error_handled.ts.out @@ -0,0 +1,13 @@ +{ + cancelable: true, + message: "Uncaught Error: foo", + filename: "[WILDCARD]/set_timeout_error_handled.ts", + lineno: 18, + colno: 9, + error: Error: foo + at [WILDCARD]/set_timeout_error_handled.ts:18:9 + at [WILDCARD] +} +onerror() called Error: foo + at [WILDCARD]/set_timeout_error_handled.ts:18:9 + at [WILDCARD] diff --git a/cli/tests/testdata/run/shebang.ts b/cli/tests/testdata/run/shebang.ts new file mode 100644 index 000000000..00feb2da0 --- /dev/null +++ b/cli/tests/testdata/run/shebang.ts @@ -0,0 +1,5 @@ +#!/usr/bin/env -S deno run + +import test from "./shebang2.ts"; + +console.log(test as number); diff --git a/cli/tests/testdata/run/shebang.ts.out b/cli/tests/testdata/run/shebang.ts.out new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/cli/tests/testdata/run/shebang.ts.out @@ -0,0 +1 @@ +42 diff --git a/cli/tests/testdata/run/shebang2.ts b/cli/tests/testdata/run/shebang2.ts new file mode 100644 index 000000000..da0d7bf0c --- /dev/null +++ b/cli/tests/testdata/run/shebang2.ts @@ -0,0 +1,3 @@ +#!/usr/bin/env -S deno run + +export default 42; diff --git a/cli/tests/testdata/run/single_compile_with_reload.ts b/cli/tests/testdata/run/single_compile_with_reload.ts new file mode 100644 index 000000000..ea6a73474 --- /dev/null +++ b/cli/tests/testdata/run/single_compile_with_reload.ts @@ -0,0 +1,18 @@ +await import("./single_compile_with_reload_dyn.ts"); +console.log("1"); +await import("./single_compile_with_reload_dyn.ts"); +console.log("2"); +await new Promise((r) => + new Worker( + import.meta.resolve("single_compile_with_reload_worker.ts"), + { type: "module" }, + ).onmessage = r +); +console.log("3"); +await new Promise((r) => + new Worker( + import.meta.resolve("single_compile_with_reload_worker.ts"), + { type: "module" }, + ).onmessage = r +); +console.log("4"); diff --git a/cli/tests/testdata/run/single_compile_with_reload.ts.out b/cli/tests/testdata/run/single_compile_with_reload.ts.out new file mode 100644 index 000000000..b0b2fcaf1 --- /dev/null +++ b/cli/tests/testdata/run/single_compile_with_reload.ts.out @@ -0,0 +1,9 @@ +Check [WILDCARD]single_compile_with_reload.ts +Hello +1 +2 +Check [WILDCARD]single_compile_with_reload_worker.ts +Hello from worker +3 +Hello from worker +4 diff --git a/cli/tests/testdata/run/single_compile_with_reload_dyn.ts b/cli/tests/testdata/run/single_compile_with_reload_dyn.ts new file mode 100644 index 000000000..6c96fac64 --- /dev/null +++ b/cli/tests/testdata/run/single_compile_with_reload_dyn.ts @@ -0,0 +1,11 @@ +import { printHello3, returnsFoo2, returnsHi } from "../subdir/mod1.ts"; + +printHello3(); + +if (returnsHi() !== "Hi") { + throw Error("Unexpected"); +} + +if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); +} diff --git a/cli/tests/testdata/run/single_compile_with_reload_worker.ts b/cli/tests/testdata/run/single_compile_with_reload_worker.ts new file mode 100644 index 000000000..103cafe20 --- /dev/null +++ b/cli/tests/testdata/run/single_compile_with_reload_worker.ts @@ -0,0 +1,3 @@ +console.log("Hello from worker"); +postMessage(null); +close(); diff --git a/cli/tests/testdata/run/spawn_stdout_inherit.ts b/cli/tests/testdata/run/spawn_stdout_inherit.ts new file mode 100644 index 000000000..be5f9b7ef --- /dev/null +++ b/cli/tests/testdata/run/spawn_stdout_inherit.ts @@ -0,0 +1,8 @@ +await Deno.spawn(Deno.execPath(), { + args: ["eval", "--quiet", "console.log('Hello, world! 1')"], + stdout: "inherit", +}); +Deno.spawnSync(Deno.execPath(), { + args: ["eval", "--quiet", "console.log('Hello, world! 2')"], + stdout: "inherit", +}); diff --git a/cli/tests/testdata/run/spawn_stdout_inherit.ts.out b/cli/tests/testdata/run/spawn_stdout_inherit.ts.out new file mode 100644 index 000000000..474891cf2 --- /dev/null +++ b/cli/tests/testdata/run/spawn_stdout_inherit.ts.out @@ -0,0 +1,2 @@ +Hello, world! 1 +Hello, world! 2 diff --git a/cli/tests/testdata/run/swc_syntax_error.ts b/cli/tests/testdata/run/swc_syntax_error.ts new file mode 100644 index 000000000..991ca9214 --- /dev/null +++ b/cli/tests/testdata/run/swc_syntax_error.ts @@ -0,0 +1,4 @@ +// deno-fmt-ignore-file +for await (const req of s) { + let something: +} diff --git a/cli/tests/testdata/run/swc_syntax_error.ts.out b/cli/tests/testdata/run/swc_syntax_error.ts.out new file mode 100644 index 000000000..c968db5e9 --- /dev/null +++ b/cli/tests/testdata/run/swc_syntax_error.ts.out @@ -0,0 +1 @@ +error: The module's source code could not be parsed: Unexpected token `}`. Expected an identifier, void, yield, null, await, break, a string literal, a numeric literal, true, false, `, -, import, this, typeof, {, [, ( at [WILDCARD]syntax_error.ts:4:1 diff --git a/cli/tests/testdata/run/test_and_bench_in_run.js b/cli/tests/testdata/run/test_and_bench_in_run.js new file mode 100644 index 000000000..108ae937a --- /dev/null +++ b/cli/tests/testdata/run/test_and_bench_in_run.js @@ -0,0 +1,5 @@ +Deno.test(function foo() { +}); + +Deno.bench(function bar() { +}); diff --git a/cli/tests/testdata/run/tls.out b/cli/tests/testdata/run/tls.out new file mode 100644 index 000000000..c8e8a135c --- /dev/null +++ b/cli/tests/testdata/run/tls.out @@ -0,0 +1 @@ +DONE diff --git a/cli/tests/testdata/run/tls_connecttls.js b/cli/tests/testdata/run/tls_connecttls.js new file mode 100644 index 000000000..fb3839968 --- /dev/null +++ b/cli/tests/testdata/run/tls_connecttls.js @@ -0,0 +1,70 @@ +import { deferred } from "../../../../test_util/std/async/deferred.ts"; +import { + assert, + assertEquals, +} from "../../../../test_util/std/testing/asserts.ts"; +import { BufReader, BufWriter } from "../../../../test_util/std/io/bufio.ts"; +import { TextProtoReader } from "../../../../test_util/std/textproto/mod.ts"; + +const encoder = new TextEncoder(); +const decoder = new TextDecoder(); + +const resolvable = deferred(); +const hostname = "localhost"; +const port = 3505; + +const listener = Deno.listenTls({ + hostname, + port, + certFile: "./tls/localhost.crt", + keyFile: "./tls/localhost.key", +}); + +const response = encoder.encode( + "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", +); + +listener.accept().then( + async (conn) => { + assert(conn.remoteAddr != null); + assert(conn.localAddr != null); + await conn.write(response); + // TODO(bartlomieju): this might be a bug + setTimeout(() => { + conn.close(); + resolvable.resolve(); + }, 0); + }, +); + +const conn = await Deno.connectTls({ + hostname, + port, +}); +assert(conn.rid > 0); +const w = new BufWriter(conn); +const r = new BufReader(conn); +const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`; +const writeResult = await w.write(encoder.encode(body)); +assertEquals(body.length, writeResult); +await w.flush(); +const tpr = new TextProtoReader(r); +const statusLine = await tpr.readLine(); +assert(statusLine !== null, `line must be read: ${String(statusLine)}`); +const m = statusLine.match(/^(.+?) (.+?) (.+?)$/); +assert(m !== null, "must be matched"); +const [_, proto, status, ok] = m; +assertEquals(proto, "HTTP/1.1"); +assertEquals(status, "200"); +assertEquals(ok, "OK"); +const headers = await tpr.readMIMEHeader(); +assert(headers !== null); +const contentLength = parseInt(headers.get("content-length")); +const bodyBuf = new Uint8Array(contentLength); +await r.readFull(bodyBuf); +assertEquals(decoder.decode(bodyBuf), "Hello World\n"); +conn.close(); +listener.close(); +await resolvable; + +console.log("DONE"); diff --git a/cli/tests/testdata/run/tls_starttls.js b/cli/tests/testdata/run/tls_starttls.js new file mode 100644 index 000000000..7aa436512 --- /dev/null +++ b/cli/tests/testdata/run/tls_starttls.js @@ -0,0 +1,68 @@ +import { deferred } from "../../../../test_util/std/async/deferred.ts"; +import { + assert, + assertEquals, +} from "../../../../test_util/std/testing/asserts.ts"; +import { BufReader, BufWriter } from "../../../../test_util/std/io/bufio.ts"; +import { TextProtoReader } from "../../../../test_util/std/textproto/mod.ts"; + +const encoder = new TextEncoder(); +const decoder = new TextDecoder(); + +const resolvable = deferred(); +const hostname = "localhost"; +const port = 3504; + +const listener = Deno.listenTls({ + hostname, + port, + certFile: "./tls/localhost.crt", + keyFile: "./tls/localhost.key", +}); + +const response = encoder.encode( + "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", +); + +listener.accept().then( + async (conn) => { + assert(conn.remoteAddr != null); + assert(conn.localAddr != null); + await conn.write(response); + // TODO(bartlomieju): this might be a bug + setTimeout(() => { + conn.close(); + resolvable.resolve(); + }, 0); + }, +); + +let conn = await Deno.connect({ hostname, port }); +conn = await Deno.startTls(conn, { hostname }); +assert(conn.rid > 0); +const w = new BufWriter(conn); +const r = new BufReader(conn); +const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`; +const writeResult = await w.write(encoder.encode(body)); +assertEquals(body.length, writeResult); +await w.flush(); +const tpr = new TextProtoReader(r); +const statusLine = await tpr.readLine(); +assert(statusLine !== null, `line must be read: ${String(statusLine)}`); +const m = statusLine.match(/^(.+?) (.+?) (.+?)$/); +assert(m !== null, "must be matched"); +const [_, proto, status, ok] = m; +assertEquals(proto, "HTTP/1.1"); +assertEquals(status, "200"); +assertEquals(ok, "OK"); +const headers = await tpr.readMIMEHeader(); +assert(headers !== null); +const contentLength = parseInt(headers.get("content-length")); +const bodyBuf = new Uint8Array(contentLength); +await r.readFull(bodyBuf); +assertEquals(decoder.decode(bodyBuf), "Hello World\n"); +conn.close(); +listener.close(); +await resolvable; + +console.log("DONE"); diff --git a/cli/tests/testdata/run/top_level_await/circular.js b/cli/tests/testdata/run/top_level_await/circular.js new file mode 100644 index 000000000..ff2964b6a --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/circular.js @@ -0,0 +1,8 @@ +import { foo } from "./tla3/timeout_loop.js"; + +export const collection = []; + +const mod = await import("./tla3/b.js"); + +console.log("foo in main", foo); +console.log("mod", mod); diff --git a/cli/tests/testdata/run/top_level_await/circular.out b/cli/tests/testdata/run/top_level_await/circular.out new file mode 100644 index 000000000..72072071e --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/circular.out @@ -0,0 +1,9 @@ +timeout loop 0 +timeout loop 1 +timeout loop 2 +timeout loop 3 +timeout loop 4 +timeout loop 5 +error: Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promises. +Pending dynamic modules: +- [WILDCARD]/tla3/b.js diff --git a/cli/tests/testdata/run/top_level_await/loop.js b/cli/tests/testdata/run/top_level_await/loop.js new file mode 100644 index 000000000..415db5ec7 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/loop.js @@ -0,0 +1,20 @@ +const importsDir = Deno.readDirSync( + Deno.realPathSync("./run/top_level_await/tla2"), +); + +const resolvedPaths = []; + +for (const { name } of importsDir) { + const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); + resolvedPaths.push(filePath); +} + +resolvedPaths.sort(); + +for (const filePath of resolvedPaths) { + console.log("loading", filePath); + const mod = await import(`file://${filePath}`); + console.log("loaded", mod); +} + +console.log("all loaded"); diff --git a/cli/tests/testdata/run/top_level_await/loop.out b/cli/tests/testdata/run/top_level_await/loop.out new file mode 100644 index 000000000..70e621e45 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/loop.out @@ -0,0 +1,5 @@ +loading [WILDCARD]a.js +loaded Module { default: [Function: Foo] } +loading [WILDCARD]b.js +loaded Module { default: [Function: Bar] } +all loaded diff --git a/cli/tests/testdata/run/top_level_await/nested.out b/cli/tests/testdata/run/top_level_await/nested.out new file mode 100644 index 000000000..8a1218a10 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/nested.out @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/cli/tests/testdata/run/top_level_await/nested/a.js b/cli/tests/testdata/run/top_level_await/nested/a.js new file mode 100644 index 000000000..74837d4ba --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/nested/a.js @@ -0,0 +1,3 @@ +console.log(2); +await import("./b.js"); +console.log(4); diff --git a/cli/tests/testdata/run/top_level_await/nested/b.js b/cli/tests/testdata/run/top_level_await/nested/b.js new file mode 100644 index 000000000..3bd241b50 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/nested/b.js @@ -0,0 +1 @@ +console.log(3); diff --git a/cli/tests/testdata/run/top_level_await/nested/main.js b/cli/tests/testdata/run/top_level_await/nested/main.js new file mode 100644 index 000000000..ed46a4717 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/nested/main.js @@ -0,0 +1,3 @@ +console.log(1); +await import("./a.js"); +console.log(5); diff --git a/cli/tests/testdata/run/top_level_await/order.js b/cli/tests/testdata/run/top_level_await/order.js new file mode 100644 index 000000000..30659cdfb --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/order.js @@ -0,0 +1,21 @@ +// Ported from Node +// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs + +const { default: order } = await import("./tla/parent.js"); + +console.log("order", JSON.stringify(order)); + +if ( + !( + order[0] === "order" && + order[1] === "b" && + order[2] === "c" && + order[3] === "d" && + order[4] === "a" && + order[5] === "parent" + ) +) { + throw new Error("TLA wrong order"); +} + +console.log("TLA order correct"); diff --git a/cli/tests/testdata/run/top_level_await/order.out b/cli/tests/testdata/run/top_level_await/order.out new file mode 100644 index 000000000..4cc27858c --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/order.out @@ -0,0 +1,2 @@ +order ["order","b","c","d","a","parent"] +TLA order correct diff --git a/cli/tests/testdata/run/top_level_await/tla/a.js b/cli/tests/testdata/run/top_level_await/tla/a.js new file mode 100644 index 000000000..c3ef3f7db --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/cli/tests/testdata/run/top_level_await/tla/b.js b/cli/tests/testdata/run/top_level_await/tla/b.js new file mode 100644 index 000000000..3271c92d8 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/cli/tests/testdata/run/top_level_await/tla/c.js b/cli/tests/testdata/run/top_level_await/tla/c.js new file mode 100644 index 000000000..806eb0a8b --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/cli/tests/testdata/run/top_level_await/tla/d.js b/cli/tests/testdata/run/top_level_await/tla/d.js new file mode 100644 index 000000000..283ebf817 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/cli/tests/testdata/run/top_level_await/tla/order.js b/cli/tests/testdata/run/top_level_await/tla/order.js new file mode 100644 index 000000000..f213a562c --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/cli/tests/testdata/run/top_level_await/tla/parent.js b/cli/tests/testdata/run/top_level_await/tla/parent.js new file mode 100644 index 000000000..1ecc15463 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/cli/tests/testdata/run/top_level_await/tla2/a.js b/cli/tests/testdata/run/top_level_await/tla2/a.js new file mode 100644 index 000000000..d07bcb94d --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/cli/tests/testdata/run/top_level_await/tla2/b.js b/cli/tests/testdata/run/top_level_await/tla2/b.js new file mode 100644 index 000000000..68e357c1e --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/cli/tests/testdata/run/top_level_await/tla3/b.js b/cli/tests/testdata/run/top_level_await/tla3/b.js new file mode 100644 index 000000000..d0349545e --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/cli/tests/testdata/run/top_level_await/tla3/timeout_loop.js b/cli/tests/testdata/run/top_level_await/tla3/timeout_loop.js new file mode 100644 index 000000000..860e6cd2a --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/cli/tests/testdata/run/top_level_await/top_level_await.js b/cli/tests/testdata/run/top_level_await/top_level_await.js new file mode 100644 index 000000000..ea319ea12 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/top_level_await.js @@ -0,0 +1,3 @@ +const buf = await Deno.readFile("./assets/hello.txt"); +const n = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/cli/tests/testdata/run/top_level_await/top_level_await.out b/cli/tests/testdata/run/top_level_await/top_level_await.out new file mode 100644 index 000000000..4b65d15fe --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/top_level_await.out @@ -0,0 +1,3 @@ +Hello world! + +write 12 diff --git a/cli/tests/testdata/run/top_level_await/top_level_await.ts b/cli/tests/testdata/run/top_level_await/top_level_await.ts new file mode 100644 index 000000000..8d47ceb21 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/top_level_await.ts @@ -0,0 +1,3 @@ +const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); +const n: number = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/cli/tests/testdata/run/top_level_await/top_level_for_await.js b/cli/tests/testdata/run/top_level_await/top_level_for_await.js new file mode 100644 index 000000000..a330f6c71 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/top_level_for_await.js @@ -0,0 +1,10 @@ +function* asyncGenerator() { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/cli/tests/testdata/run/top_level_await/top_level_for_await.out b/cli/tests/testdata/run/top_level_await/top_level_for_await.out new file mode 100644 index 000000000..4539bbf2d --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/top_level_for_await.out @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/cli/tests/testdata/run/top_level_await/top_level_for_await.ts b/cli/tests/testdata/run/top_level_await/top_level_for_await.ts new file mode 100644 index 000000000..9179322d7 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/top_level_for_await.ts @@ -0,0 +1,10 @@ +async function* asyncGenerator(): AsyncIterableIterator { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/cli/tests/testdata/run/top_level_await/unresolved.js b/cli/tests/testdata/run/top_level_await/unresolved.js new file mode 100644 index 000000000..231a8cd63 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/unresolved.js @@ -0,0 +1 @@ +await new Promise(() => {}); diff --git a/cli/tests/testdata/run/top_level_await/unresolved.out b/cli/tests/testdata/run/top_level_await/unresolved.out new file mode 100644 index 000000000..d5291f833 --- /dev/null +++ b/cli/tests/testdata/run/top_level_await/unresolved.out @@ -0,0 +1 @@ +error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promises. diff --git a/cli/tests/testdata/run/ts_decorators.ts b/cli/tests/testdata/run/ts_decorators.ts new file mode 100644 index 000000000..95fba6cd4 --- /dev/null +++ b/cli/tests/testdata/run/ts_decorators.ts @@ -0,0 +1,14 @@ +// deno-lint-ignore-file + +function Decorate() { + return function (constructor: any): any { + return class extends constructor { + protected someField: string = "asdf"; + }; + }; +} + +@Decorate() +class SomeClass {} + +console.log(new SomeClass()); diff --git a/cli/tests/testdata/run/ts_decorators.ts.out b/cli/tests/testdata/run/ts_decorators.ts.out new file mode 100644 index 000000000..381c7a809 --- /dev/null +++ b/cli/tests/testdata/run/ts_decorators.ts.out @@ -0,0 +1,2 @@ +Check [WILDCARD] +{ someField: "asdf" } diff --git a/cli/tests/testdata/run/ts_import_from_js/deps.js b/cli/tests/testdata/run/ts_import_from_js/deps.js new file mode 100644 index 000000000..746b5cf6b --- /dev/null +++ b/cli/tests/testdata/run/ts_import_from_js/deps.js @@ -0,0 +1,2 @@ +import "../005_more_imports.ts"; +export { printHello } from "http://localhost:4545/subdir/mod2.ts"; diff --git a/cli/tests/testdata/run/ts_import_from_js/main.js b/cli/tests/testdata/run/ts_import_from_js/main.js new file mode 100644 index 000000000..32d6c29a1 --- /dev/null +++ b/cli/tests/testdata/run/ts_import_from_js/main.js @@ -0,0 +1,3 @@ +import { printHello } from "./deps.js"; +printHello(); +console.log("success"); diff --git a/cli/tests/testdata/run/ts_import_from_js/main.out b/cli/tests/testdata/run/ts_import_from_js/main.out new file mode 100644 index 000000000..e1d7a869f --- /dev/null +++ b/cli/tests/testdata/run/ts_import_from_js/main.out @@ -0,0 +1,3 @@ +Hello +Hello +success diff --git a/cli/tests/testdata/run/ts_type_imports.ts b/cli/tests/testdata/run/ts_type_imports.ts new file mode 100644 index 000000000..73c779156 --- /dev/null +++ b/cli/tests/testdata/run/ts_type_imports.ts @@ -0,0 +1,5 @@ +// deno-lint-ignore-file + +type Foo = import("./ts_type_imports_foo.ts").Foo; + +const foo: Foo = new Map(); diff --git a/cli/tests/testdata/run/ts_type_imports.ts.out b/cli/tests/testdata/run/ts_type_imports.ts.out new file mode 100644 index 000000000..3972d6a97 --- /dev/null +++ b/cli/tests/testdata/run/ts_type_imports.ts.out @@ -0,0 +1,6 @@ +Check [WILDCARD]ts_type_imports.ts +error: TS2322 [ERROR]: Type 'Map' is not assignable to type 'Foo'. + Type 'string' is not assignable to type 'number'. +const foo: Foo = new Map(); + ~~~ + at [WILDCARD]ts_type_imports.ts:5:7 diff --git a/cli/tests/testdata/run/ts_type_imports_foo.ts b/cli/tests/testdata/run/ts_type_imports_foo.ts new file mode 100644 index 000000000..db20773f6 --- /dev/null +++ b/cli/tests/testdata/run/ts_type_imports_foo.ts @@ -0,0 +1 @@ +export type Foo = Map; diff --git a/cli/tests/testdata/run/ts_type_only_import.d.ts b/cli/tests/testdata/run/ts_type_only_import.d.ts new file mode 100644 index 000000000..d48e4b48a --- /dev/null +++ b/cli/tests/testdata/run/ts_type_only_import.d.ts @@ -0,0 +1,3 @@ +export interface HelloWorld { + a: string; +} diff --git a/cli/tests/testdata/run/ts_type_only_import.ts b/cli/tests/testdata/run/ts_type_only_import.ts new file mode 100644 index 000000000..53e114373 --- /dev/null +++ b/cli/tests/testdata/run/ts_type_only_import.ts @@ -0,0 +1 @@ +export * from "./ts_type_only_import.d.ts"; diff --git a/cli/tests/testdata/run/ts_type_only_import.ts.out b/cli/tests/testdata/run/ts_type_only_import.ts.out new file mode 100644 index 000000000..42852cd26 --- /dev/null +++ b/cli/tests/testdata/run/ts_type_only_import.ts.out @@ -0,0 +1 @@ +Check file://[WILDCARD]/ts_type_only_import.ts diff --git a/cli/tests/testdata/run/tsx_imports/Component.tsx b/cli/tests/testdata/run/tsx_imports/Component.tsx new file mode 100644 index 000000000..c466a28ca --- /dev/null +++ b/cli/tests/testdata/run/tsx_imports/Component.tsx @@ -0,0 +1 @@ +import "../046_jsx_test.tsx"; diff --git a/cli/tests/testdata/run/tsx_imports/tsx_imports.ts b/cli/tests/testdata/run/tsx_imports/tsx_imports.ts new file mode 100644 index 000000000..44ba10b7a --- /dev/null +++ b/cli/tests/testdata/run/tsx_imports/tsx_imports.ts @@ -0,0 +1 @@ +import "./Component.tsx"; diff --git a/cli/tests/testdata/run/tsx_imports/tsx_imports.ts.out b/cli/tests/testdata/run/tsx_imports/tsx_imports.ts.out new file mode 100644 index 000000000..1f8b10d32 --- /dev/null +++ b/cli/tests/testdata/run/tsx_imports/tsx_imports.ts.out @@ -0,0 +1,2 @@ +Check [WILDCARD]tsx_imports.ts +{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/testdata/run/type_definitions.ts b/cli/tests/testdata/run/type_definitions.ts new file mode 100644 index 000000000..594842721 --- /dev/null +++ b/cli/tests/testdata/run/type_definitions.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file + +// @deno-types="../type_definitions/foo.d.ts" +import { foo } from "../type_definitions/foo.js"; +// @deno-types="../type_definitions/fizz.d.ts" +import "../type_definitions/fizz.js"; + +import * as qat from "../type_definitions/qat.ts"; + +console.log(foo); +console.log(fizz); +console.log(qat.qat); diff --git a/cli/tests/testdata/run/type_definitions.ts.out b/cli/tests/testdata/run/type_definitions.ts.out new file mode 100644 index 000000000..b4fa88c50 --- /dev/null +++ b/cli/tests/testdata/run/type_definitions.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]foo +fizz +qat diff --git a/cli/tests/testdata/run/type_definitions_for_export.ts b/cli/tests/testdata/run/type_definitions_for_export.ts new file mode 100644 index 000000000..1f17b4962 --- /dev/null +++ b/cli/tests/testdata/run/type_definitions_for_export.ts @@ -0,0 +1,7 @@ +import { foo } from "./export_type_def.ts"; + +function bar(a: number) { + console.log(a); +} + +bar(foo); diff --git a/cli/tests/testdata/run/type_definitions_for_export.ts.out b/cli/tests/testdata/run/type_definitions_for_export.ts.out new file mode 100644 index 000000000..8f1240bc7 --- /dev/null +++ b/cli/tests/testdata/run/type_definitions_for_export.ts.out @@ -0,0 +1,5 @@ +Check [WILDCARD]type_definitions_for_export.ts +error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'number'. +bar(foo); + ~~~ + at [WILDCARD]type_definitions_for_export.ts:7:5 diff --git a/cli/tests/testdata/run/type_directives_01.ts b/cli/tests/testdata/run/type_directives_01.ts new file mode 100644 index 000000000..71305824c --- /dev/null +++ b/cli/tests/testdata/run/type_directives_01.ts @@ -0,0 +1,3 @@ +import * as foo from "http://127.0.0.1:4545/xTypeScriptTypes.js"; + +console.log(foo.foo); diff --git a/cli/tests/testdata/run/type_directives_01.ts.out b/cli/tests/testdata/run/type_directives_01.ts.out new file mode 100644 index 000000000..77ed3ae26 --- /dev/null +++ b/cli/tests/testdata/run/type_directives_01.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +DEBUG TS - host.getSourceFile("http://127.0.0.1:4545/xTypeScriptTypes.d.ts", Latest) +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/run/type_directives_02.ts b/cli/tests/testdata/run/type_directives_02.ts new file mode 100644 index 000000000..0c59346e2 --- /dev/null +++ b/cli/tests/testdata/run/type_directives_02.ts @@ -0,0 +1,3 @@ +import * as foo from "../subdir/type_reference.js"; + +console.log(foo.foo); diff --git a/cli/tests/testdata/run/type_directives_02.ts.out b/cli/tests/testdata/run/type_directives_02.ts.out new file mode 100644 index 000000000..b064483b4 --- /dev/null +++ b/cli/tests/testdata/run/type_directives_02.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +DEBUG TS - host.getSourceFile("file:///[WILDCARD]/subdir/type_reference.d.ts", Latest) +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/run/type_directives_js_main.js b/cli/tests/testdata/run/type_directives_js_main.js new file mode 100644 index 000000000..0c59346e2 --- /dev/null +++ b/cli/tests/testdata/run/type_directives_js_main.js @@ -0,0 +1,3 @@ +import * as foo from "../subdir/type_reference.js"; + +console.log(foo.foo); diff --git a/cli/tests/testdata/run/type_directives_js_main.js.out b/cli/tests/testdata/run/type_directives_js_main.js.out new file mode 100644 index 000000000..7bca837f0 --- /dev/null +++ b/cli/tests/testdata/run/type_directives_js_main.js.out @@ -0,0 +1,3 @@ +[WILDCARD] +DEBUG RS - [WILDCARD] - FileFetcher::fetch() - specifier: file:///[WILDCARD]/subdir/type_reference.d.ts +[WILDCARD] diff --git a/cli/tests/testdata/run/type_directives_redirect.ts b/cli/tests/testdata/run/type_directives_redirect.ts new file mode 100644 index 000000000..8b98831fd --- /dev/null +++ b/cli/tests/testdata/run/type_directives_redirect.ts @@ -0,0 +1 @@ +import "http://localhost:4545/run/type_directives_redirect.js"; diff --git a/cli/tests/testdata/run/type_directives_redirect.ts.out b/cli/tests/testdata/run/type_directives_redirect.ts.out new file mode 100644 index 000000000..471d9c0b4 --- /dev/null +++ b/cli/tests/testdata/run/type_directives_redirect.ts.out @@ -0,0 +1,5 @@ +Download [WILDCARD]type_directives_redirect.js +Download [WILDCARD]xTypeScriptTypesRedirect.d.ts +Download [WILDCARD]xTypeScriptTypesRedirect.d.ts +Download [WILDCARD]xTypeScriptTypesRedirected.d.ts +Check [WILDCARD]type_directives_redirect.ts diff --git a/cli/tests/testdata/run/type_headers_deno_types.ts b/cli/tests/testdata/run/type_headers_deno_types.ts new file mode 100644 index 000000000..9670f68cd --- /dev/null +++ b/cli/tests/testdata/run/type_headers_deno_types.ts @@ -0,0 +1,18 @@ +/** + * Following import uses two distinct ways to provide types: + * - X-TypeScript-Types headers + * - @deno-types directive + * + * Because "@deno-types" directive must be placed by user explicitly it + * should have higher precedence than type header. + * + * This is verified by providing conflicting type declaration + * depending on a way. There should be no TS error, otherwise + * it means that wrong type declarations are used (from X-TypeScript-Types) + * header. + */ + +// @deno-types="http://127.0.0.1:4545/run/type_headers_deno_types.foo.d.ts" +import { foo } from "http://127.0.0.1:4545/run/type_headers_deno_types.foo.js"; + +foo("hello"); diff --git a/cli/tests/testdata/run/type_headers_deno_types.ts.out b/cli/tests/testdata/run/type_headers_deno_types.ts.out new file mode 100644 index 000000000..798f98311 --- /dev/null +++ b/cli/tests/testdata/run/type_headers_deno_types.ts.out @@ -0,0 +1,5 @@ +Download http://[WILDCARD]:4545/run/type_headers_deno_types.foo.js +Download http://[WILDCARD]:4545/run/type_headers_deno_types.foo.d.ts +Download http://[WILDCARD]:4545/run/type_headers_deno_types.d.ts +Check [WILDCARD]/type_headers_deno_types.ts +hello diff --git a/cli/tests/testdata/run/unbuffered_stderr.ts b/cli/tests/testdata/run/unbuffered_stderr.ts new file mode 100644 index 000000000..0f1d2a999 --- /dev/null +++ b/cli/tests/testdata/run/unbuffered_stderr.ts @@ -0,0 +1 @@ +Deno.stderr.write(new TextEncoder().encode("x")); diff --git a/cli/tests/testdata/run/unbuffered_stderr.ts.out b/cli/tests/testdata/run/unbuffered_stderr.ts.out new file mode 100644 index 000000000..500019738 --- /dev/null +++ b/cli/tests/testdata/run/unbuffered_stderr.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +x \ No newline at end of file diff --git a/cli/tests/testdata/run/unbuffered_stdout.ts b/cli/tests/testdata/run/unbuffered_stdout.ts new file mode 100644 index 000000000..9f1e07a97 --- /dev/null +++ b/cli/tests/testdata/run/unbuffered_stdout.ts @@ -0,0 +1 @@ +Deno.stdout.write(new TextEncoder().encode("a")); diff --git a/cli/tests/testdata/run/unbuffered_stdout.ts.out b/cli/tests/testdata/run/unbuffered_stdout.ts.out new file mode 100644 index 000000000..2e65efe2a --- /dev/null +++ b/cli/tests/testdata/run/unbuffered_stdout.ts.out @@ -0,0 +1 @@ +a \ No newline at end of file diff --git a/cli/tests/testdata/run/unhandled_rejection.ts b/cli/tests/testdata/run/unhandled_rejection.ts new file mode 100644 index 000000000..388583434 --- /dev/null +++ b/cli/tests/testdata/run/unhandled_rejection.ts @@ -0,0 +1,13 @@ +globalThis.addEventListener("unhandledrejection", (e) => { + console.log("unhandled rejection at:", e.promise, "reason:", e.reason); + e.preventDefault(); +}); + +class Foo { + constructor() { + Promise.reject(new Error("bar not available")); + } +} + +new Foo(); +Promise.reject(); diff --git a/cli/tests/testdata/run/unhandled_rejection.ts.out b/cli/tests/testdata/run/unhandled_rejection.ts.out new file mode 100644 index 000000000..6ab1667dc --- /dev/null +++ b/cli/tests/testdata/run/unhandled_rejection.ts.out @@ -0,0 +1,9 @@ +[WILDCARD] +unhandled rejection at: Promise { + Error: bar not available + at new Foo (file:///[WILDCARD]/testdata/run/unhandled_rejection.ts:8:20) + at file:///[WILDCARD]/testdata/run/unhandled_rejection.ts:12:1 +} reason: Error: bar not available + at new Foo (file:///[WILDCARD]/testdata/run/unhandled_rejection.ts:8:20) + at file:///[WILDCARD]/testdata/run/unhandled_rejection.ts:12:1 +unhandled rejection at: Promise { undefined } reason: undefined diff --git a/cli/tests/testdata/run/unhandled_rejection_sync_error.ts b/cli/tests/testdata/run/unhandled_rejection_sync_error.ts new file mode 100644 index 000000000..0dabb1cb7 --- /dev/null +++ b/cli/tests/testdata/run/unhandled_rejection_sync_error.ts @@ -0,0 +1,6 @@ +globalThis.addEventListener("unhandledrejection", (e) => { + console.log("unhandled rejection at:", e.promise, "reason:", e.reason); + e.preventDefault(); +}); + +throw new Error("boom!"); diff --git a/cli/tests/testdata/run/unhandled_rejection_sync_error.ts.out b/cli/tests/testdata/run/unhandled_rejection_sync_error.ts.out new file mode 100644 index 000000000..e178373f0 --- /dev/null +++ b/cli/tests/testdata/run/unhandled_rejection_sync_error.ts.out @@ -0,0 +1,6 @@ +[WILDCARD] +unhandled rejection at: Promise { + Error: boom! + at file:///[WILDCARD]testdata/run/unhandled_rejection_sync_error.ts:6:7 +} reason: Error: boom! + at file:///[WILDCARD]testdata/run/unhandled_rejection_sync_error.ts:6:7 diff --git a/cli/tests/testdata/run/unstable.js b/cli/tests/testdata/run/unstable.js new file mode 100644 index 000000000..a9894be3e --- /dev/null +++ b/cli/tests/testdata/run/unstable.js @@ -0,0 +1 @@ +console.log(Deno.loadavg); diff --git a/cli/tests/testdata/run/unstable.ts b/cli/tests/testdata/run/unstable.ts new file mode 100644 index 000000000..a9894be3e --- /dev/null +++ b/cli/tests/testdata/run/unstable.ts @@ -0,0 +1 @@ +console.log(Deno.loadavg); diff --git a/cli/tests/testdata/run/unstable_disabled.out b/cli/tests/testdata/run/unstable_disabled.out new file mode 100644 index 000000000..28659645d --- /dev/null +++ b/cli/tests/testdata/run/unstable_disabled.out @@ -0,0 +1,5 @@ +[WILDCARD] +error: TS2339 [ERROR]: Property 'loadavg' does not exist on type 'typeof Deno'. 'Deno.loadavg' is an unstable API. Did you forget to run with the '--unstable' flag? +console.log(Deno.loadavg); + ~~~~~~~ + at [WILDCARD]/unstable.ts:1:18 diff --git a/cli/tests/testdata/run/unstable_disabled_js.out b/cli/tests/testdata/run/unstable_disabled_js.out new file mode 100644 index 000000000..417b7b537 --- /dev/null +++ b/cli/tests/testdata/run/unstable_disabled_js.out @@ -0,0 +1 @@ +undefined diff --git a/cli/tests/testdata/run/unstable_enabled.out b/cli/tests/testdata/run/unstable_enabled.out new file mode 100644 index 000000000..b4cedce14 --- /dev/null +++ b/cli/tests/testdata/run/unstable_enabled.out @@ -0,0 +1 @@ +[Function: loadavg] diff --git a/cli/tests/testdata/run/unstable_enabled_js.out b/cli/tests/testdata/run/unstable_enabled_js.out new file mode 100644 index 000000000..b4cedce14 --- /dev/null +++ b/cli/tests/testdata/run/unstable_enabled_js.out @@ -0,0 +1 @@ +[Function: loadavg] diff --git a/cli/tests/testdata/run/unstable_worker.ts b/cli/tests/testdata/run/unstable_worker.ts new file mode 100644 index 000000000..d111d2c7e --- /dev/null +++ b/cli/tests/testdata/run/unstable_worker.ts @@ -0,0 +1,6 @@ +const w = new Worker( + import.meta.resolve("../workers/worker_unstable.ts"), + { type: "module", name: "Unstable Worker" }, +); + +w.postMessage({}); diff --git a/cli/tests/testdata/run/unstable_worker.ts.out b/cli/tests/testdata/run/unstable_worker.ts.out new file mode 100644 index 000000000..b40bdfeb8 --- /dev/null +++ b/cli/tests/testdata/run/unstable_worker.ts.out @@ -0,0 +1,2 @@ +[Function: query] +[Function: setRaw] diff --git a/cli/tests/testdata/run/unsupported_dynamic_import_scheme.out b/cli/tests/testdata/run/unsupported_dynamic_import_scheme.out new file mode 100644 index 000000000..c708fced4 --- /dev/null +++ b/cli/tests/testdata/run/unsupported_dynamic_import_scheme.out @@ -0,0 +1,7 @@ +error: Uncaught (in promise) TypeError: Unsupported scheme "xxx" for module "xxx:". Supported schemes: [ + "data", + "blob", + "file", + "http", + "https", +] diff --git a/cli/tests/testdata/run/v8_flags.js b/cli/tests/testdata/run/v8_flags.js new file mode 100644 index 000000000..f7999c4af --- /dev/null +++ b/cli/tests/testdata/run/v8_flags.js @@ -0,0 +1 @@ +console.log(typeof gc); diff --git a/cli/tests/testdata/run/v8_flags.js.out b/cli/tests/testdata/run/v8_flags.js.out new file mode 100644 index 000000000..e2dbde096 --- /dev/null +++ b/cli/tests/testdata/run/v8_flags.js.out @@ -0,0 +1 @@ +function diff --git a/cli/tests/testdata/run/v8_flags_unrecognized.out b/cli/tests/testdata/run/v8_flags_unrecognized.out new file mode 100644 index 000000000..56e70f830 --- /dev/null +++ b/cli/tests/testdata/run/v8_flags_unrecognized.out @@ -0,0 +1,5 @@ +error: V8 did not recognize flag '--foo' +error: V8 did not recognize flag 'bar' +error: V8 did not recognize flag '-baz' + +For a list of V8 flags, use '--v8-flags=--help' diff --git a/cli/tests/testdata/run/v8_help.out b/cli/tests/testdata/run/v8_help.out new file mode 100644 index 000000000..006d73557 --- /dev/null +++ b/cli/tests/testdata/run/v8_help.out @@ -0,0 +1,4 @@ +[WILDCARD] +Options: +[WILDCARD] + --trace-gc [WILDCARD] diff --git a/cli/tests/testdata/run/wasm.ts b/cli/tests/testdata/run/wasm.ts new file mode 100644 index 000000000..96b5fdffc --- /dev/null +++ b/cli/tests/testdata/run/wasm.ts @@ -0,0 +1,16 @@ +// deno-fmt-ignore +const wasmCode = new Uint8Array([ + 0, 97, 115, 109, 1, 0, 0, 0, 1, 133, 128, 128, 128, 0, 1, 96, 0, 1, 127, + 3, 130, 128, 128, 128, 0, 1, 0, 4, 132, 128, 128, 128, 0, 1, 112, 0, 0, + 5, 131, 128, 128, 128, 0, 1, 0, 1, 6, 129, 128, 128, 128, 0, 0, 7, 145, + 128, 128, 128, 0, 2, 6, 109, 101, 109, 111, 114, 121, 2, 0, 4, 109, 97, + 105, 110, 0, 0, 10, 138, 128, 128, 128, 0, 1, 132, 128, 128, 128, 0, 0, + 65, 42, 11 + ]); + +const wasmModule = new WebAssembly.Module(wasmCode); + +const wasmInstance = new WebAssembly.Instance(wasmModule); + +const main = wasmInstance.exports.main as CallableFunction; +console.log(main().toString()); diff --git a/cli/tests/testdata/run/wasm.ts.out b/cli/tests/testdata/run/wasm.ts.out new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/cli/tests/testdata/run/wasm.ts.out @@ -0,0 +1 @@ +42 diff --git a/cli/tests/testdata/run/wasm_async.js b/cli/tests/testdata/run/wasm_async.js new file mode 100644 index 000000000..837460ae9 --- /dev/null +++ b/cli/tests/testdata/run/wasm_async.js @@ -0,0 +1,27 @@ +// The following blob can be created by taking the following s-expr and pass +// it through wat2wasm. +// (module +// (func $add (param $a i32) (param $b i32) (result i32) +// local.get $a +// local.get $b +// i32.add) +// (export "add" (func $add)) +// ) +// deno-fmt-ignore +const bytes = new Uint8Array([ + 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, 0x60, + 0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x07, 0x01, + 0x03, 0x61, 0x64, 0x64, 0x00, 0x00, 0x0a, 0x09, 0x01, 0x07, 0x00, 0x20, + 0x00, 0x20, 0x01, 0x6a, 0x0b +]); + +async function main() { + const wasm = await WebAssembly.instantiate(bytes); + const result = wasm.instance.exports.add(1, 3); + console.log("1 + 3 =", result); + if (result != 4) { + throw Error("bad"); + } +} + +main(); diff --git a/cli/tests/testdata/run/wasm_async.out b/cli/tests/testdata/run/wasm_async.out new file mode 100644 index 000000000..5cdf17de7 --- /dev/null +++ b/cli/tests/testdata/run/wasm_async.out @@ -0,0 +1 @@ +1 + 3 = 4 diff --git a/cli/tests/testdata/run/wasm_shared.out b/cli/tests/testdata/run/wasm_shared.out new file mode 100644 index 000000000..e69de29bb diff --git a/cli/tests/testdata/run/wasm_shared.ts b/cli/tests/testdata/run/wasm_shared.ts new file mode 100644 index 000000000..b713385d5 --- /dev/null +++ b/cli/tests/testdata/run/wasm_shared.ts @@ -0,0 +1,6 @@ +const memory = new WebAssembly.Memory({ + initial: 1, + maximum: 10, + shared: true, +}); +console.assert(memory.buffer instanceof SharedArrayBuffer); diff --git a/cli/tests/testdata/run/wasm_streaming_panic_test.js b/cli/tests/testdata/run/wasm_streaming_panic_test.js new file mode 100644 index 000000000..ec017592f --- /dev/null +++ b/cli/tests/testdata/run/wasm_streaming_panic_test.js @@ -0,0 +1,3 @@ +// https://github.com/denoland/deno/issues/13917 + +WebAssembly.instantiateStreaming(Response.error()); diff --git a/cli/tests/testdata/run/wasm_streaming_panic_test.js.out b/cli/tests/testdata/run/wasm_streaming_panic_test.js.out new file mode 100644 index 000000000..3e93f643a --- /dev/null +++ b/cli/tests/testdata/run/wasm_streaming_panic_test.js.out @@ -0,0 +1,2 @@ +error: Uncaught (in promise) TypeError: Invalid WebAssembly content type. + at handleWasmStreaming (deno:ext/fetch/26_fetch.js:[WILDCARD]) diff --git a/cli/tests/testdata/run/wasm_unreachable.js b/cli/tests/testdata/run/wasm_unreachable.js new file mode 100644 index 000000000..d6a4f59db --- /dev/null +++ b/cli/tests/testdata/run/wasm_unreachable.js @@ -0,0 +1,9 @@ +// WebAssembly module containing a single function with an unreachable instruction +const binary = await Deno.readFile("./assets/unreachable.wasm"); + +const module = new WebAssembly.Module(binary); +const instance = new WebAssembly.Instance(module); + +// Compare the stack trace with wasm_url.js, which compiles the WASM module with +// streaming APIs. +instance.exports.unreachable(); diff --git a/cli/tests/testdata/run/wasm_unreachable.out b/cli/tests/testdata/run/wasm_unreachable.out new file mode 100644 index 000000000..c213097ab --- /dev/null +++ b/cli/tests/testdata/run/wasm_unreachable.out @@ -0,0 +1,3 @@ +error: Uncaught[WILDCARD] RuntimeError: unreachable + at (wasm://wasm/d1c677ea:1:41) + at [WILDCARD]/wasm_unreachable.js:[WILDCARD] diff --git a/cli/tests/testdata/run/wasm_url.js b/cli/tests/testdata/run/wasm_url.js new file mode 100644 index 000000000..71686ef7e --- /dev/null +++ b/cli/tests/testdata/run/wasm_url.js @@ -0,0 +1,8 @@ +const module = await WebAssembly.compileStreaming( + fetch("http://localhost:4545/assets/unreachable.wasm"), +); +const instance = new WebAssembly.Instance(module); + +// Compare the stack trace with wasm_unreachable.js, which compiles the WASM +// module with synchronous APIs. +instance.exports.unreachable(); diff --git a/cli/tests/testdata/run/wasm_url.out b/cli/tests/testdata/run/wasm_url.out new file mode 100644 index 000000000..ae3bf491a --- /dev/null +++ b/cli/tests/testdata/run/wasm_url.out @@ -0,0 +1,3 @@ +error: Uncaught (in promise) RuntimeError: unreachable + at (http://localhost:4545/assets/unreachable.wasm:1:41) + at [WILDCARD]/wasm_url.js:[WILDCARD] diff --git a/cli/tests/testdata/run/weakref.ts b/cli/tests/testdata/run/weakref.ts new file mode 100644 index 000000000..47c3985fe --- /dev/null +++ b/cli/tests/testdata/run/weakref.ts @@ -0,0 +1 @@ +console.log(WeakRef, FinalizationRegistry); diff --git a/cli/tests/testdata/run/weakref.ts.out b/cli/tests/testdata/run/weakref.ts.out new file mode 100644 index 000000000..32bafcf2d --- /dev/null +++ b/cli/tests/testdata/run/weakref.ts.out @@ -0,0 +1 @@ +[Function: WeakRef] [Function: FinalizationRegistry] diff --git a/cli/tests/testdata/run/websocket_server_idletimeout.ts b/cli/tests/testdata/run/websocket_server_idletimeout.ts new file mode 100644 index 000000000..9ae6698cb --- /dev/null +++ b/cli/tests/testdata/run/websocket_server_idletimeout.ts @@ -0,0 +1,26 @@ +import { assertEquals } from "../../../test_util/std/testing/asserts.ts"; +import { deferred } from "../../../test_util/std/async/deferred.ts"; + +const errorDeferred = deferred(); +const closeDeferred = deferred(); + +const listener = Deno.listen({ port: 4509 }); +console.log("READY"); +const httpConn = Deno.serveHttp(await listener.accept()); +const { request, respondWith } = (await httpConn.nextRequest())!; +const { response, socket } = Deno.upgradeWebSocket(request, { + idleTimeout: 1, +}); +socket.onerror = (e) => { + assertEquals((e as ErrorEvent).message, "No response from ping frame."); + errorDeferred.resolve(); +}; +socket.onclose = (e) => { + assertEquals(e.reason, "No response from ping frame."); + closeDeferred.resolve(); +}; +await respondWith(response); + +await errorDeferred; +await closeDeferred; +listener.close(); diff --git a/cli/tests/testdata/run/websocket_server_multi_field_connection_header_test.ts b/cli/tests/testdata/run/websocket_server_multi_field_connection_header_test.ts new file mode 100644 index 000000000..709419a6a --- /dev/null +++ b/cli/tests/testdata/run/websocket_server_multi_field_connection_header_test.ts @@ -0,0 +1,17 @@ +import { deferred } from "../../unit/test_util.ts"; + +const promise = deferred(); +const listener = Deno.listen({ port: 4319 }); +console.log("READY"); +const conn = await listener.accept(); +const httpConn = Deno.serveHttp(conn); +const { request, respondWith } = (await httpConn.nextRequest())!; +const { + response, + socket, +} = Deno.upgradeWebSocket(request); +socket.onerror = () => Deno.exit(1); +socket.onopen = () => socket.close(); +socket.onclose = () => promise.resolve(); +await respondWith(response); +await promise; diff --git a/cli/tests/testdata/run/websocket_test.ts b/cli/tests/testdata/run/websocket_test.ts new file mode 100644 index 000000000..e557a3cb2 --- /dev/null +++ b/cli/tests/testdata/run/websocket_test.ts @@ -0,0 +1,308 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +import { + assert, + assertEquals, + assertThrows, + fail, +} from "../../../../test_util/std/testing/asserts.ts"; +import { deferred } from "../../../../test_util/std/async/deferred.ts"; + +Deno.test("invalid scheme", () => { + assertThrows(() => new WebSocket("foo://localhost:4242")); +}); + +Deno.test("fragment", () => { + assertThrows(() => new WebSocket("ws://localhost:4242/#")); + assertThrows(() => new WebSocket("ws://localhost:4242/#foo")); +}); + +Deno.test("duplicate protocols", () => { + assertThrows(() => new WebSocket("ws://localhost:4242", ["foo", "foo"])); +}); + +Deno.test("invalid server", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:2121"); + let err = false; + ws.onerror = () => { + err = true; + }; + ws.onclose = () => { + if (err) { + promise.resolve(); + } else { + fail(); + } + }; + ws.onopen = () => fail(); + await promise; +}); + +Deno.test("connect & close", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => { + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("connect & abort", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.close(); + let err = false; + ws.onerror = () => { + err = true; + }; + ws.onclose = () => { + if (err) { + promise.resolve(); + } else { + fail(); + } + }; + ws.onopen = () => fail(); + await promise; +}); + +Deno.test("connect & close custom valid code", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => ws.close(1000); + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("connect & close custom invalid code", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => { + assertThrows(() => ws.close(1001)); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("connect & close custom valid reason", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => ws.close(1000, "foo"); + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("connect & close custom invalid reason", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => { + assertThrows(() => ws.close(1000, "".padEnd(124, "o"))); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo string", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => ws.send("foo"); + ws.onmessage = (e) => { + assertEquals(e.data, "foo"); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo string tls", async () => { + const promise1 = deferred(); + const promise2 = deferred(); + const ws = new WebSocket("wss://localhost:4243"); + ws.onerror = () => fail(); + ws.onopen = () => ws.send("foo"); + ws.onmessage = (e) => { + assertEquals(e.data, "foo"); + ws.close(); + promise1.resolve(); + }; + ws.onclose = () => { + promise2.resolve(); + }; + await promise1; + await promise2; +}); + +Deno.test("websocket error", async () => { + const promise1 = deferred(); + const ws = new WebSocket("wss://localhost:4242"); + ws.onopen = () => fail(); + ws.onerror = (err) => { + assert(err instanceof ErrorEvent); + + // Error message got changed because we don't use warp in test_util + assertEquals(err.message, "UnexpectedEof: tls handshake eof"); + promise1.resolve(); + }; + await promise1; +}); + +Deno.test("echo blob with binaryType blob", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + const blob = new Blob(["foo"]); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(blob); + ws.onmessage = (e) => { + e.data.text().then((actual: string) => { + blob.text().then((expected) => { + assertEquals(actual, expected); + }); + }); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo blob with binaryType arraybuffer", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.binaryType = "arraybuffer"; + const blob = new Blob(["foo"]); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(blob); + ws.onmessage = (e) => { + blob.arrayBuffer().then((expected) => { + assertEquals(e.data, expected); + }); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo uint8array with binaryType blob", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + const uint = new Uint8Array([102, 111, 111]); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(uint); + ws.onmessage = (e) => { + e.data.arrayBuffer().then((actual: ArrayBuffer) => { + assertEquals(actual, uint.buffer); + }); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo uint8array with binaryType arraybuffer", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.binaryType = "arraybuffer"; + const uint = new Uint8Array([102, 111, 111]); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(uint); + ws.onmessage = (e) => { + assertEquals(e.data, uint.buffer); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo arraybuffer with binaryType blob", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + const buffer = new ArrayBuffer(3); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(buffer); + ws.onmessage = (e) => { + e.data.arrayBuffer().then((actual: ArrayBuffer) => { + assertEquals(actual, buffer); + }); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo arraybuffer with binaryType arraybuffer", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.binaryType = "arraybuffer"; + const buffer = new ArrayBuffer(3); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(buffer); + ws.onmessage = (e) => { + assertEquals(e.data, buffer); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("Event Handlers order", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + const arr: number[] = []; + ws.onerror = () => fail(); + ws.addEventListener("message", () => arr.push(1)); + ws.onmessage = () => fail(); + ws.addEventListener("message", () => { + arr.push(3); + ws.close(); + assertEquals(arr, [1, 2, 3]); + }); + ws.onmessage = () => arr.push(2); + ws.onopen = () => ws.send("Echo"); + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("Close without frame", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4244"); + ws.onerror = () => fail(); + ws.onclose = (e) => { + assertEquals(e.code, 1005); + promise.resolve(); + }; + await promise; +}); diff --git a/cli/tests/testdata/run/websocketstream_ping_test.ts b/cli/tests/testdata/run/websocketstream_ping_test.ts new file mode 100644 index 000000000..12f847cd8 --- /dev/null +++ b/cli/tests/testdata/run/websocketstream_ping_test.ts @@ -0,0 +1,5 @@ +const wss = new WebSocketStream("ws://127.0.0.1:4513"); +const { readable } = await wss.connection; +for await (const _ of readable) { + // +} diff --git a/cli/tests/testdata/run/websocketstream_test.ts b/cli/tests/testdata/run/websocketstream_test.ts new file mode 100644 index 000000000..74d8e5d9a --- /dev/null +++ b/cli/tests/testdata/run/websocketstream_test.ts @@ -0,0 +1,335 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +import { + assert, + assertEquals, + assertNotEquals, + assertRejects, + assertThrows, + unreachable, +} from "../../../../test_util/std/testing/asserts.ts"; + +Deno.test("fragment", () => { + assertThrows(() => new WebSocketStream("ws://localhost:4242/#")); + assertThrows(() => new WebSocketStream("ws://localhost:4242/#foo")); +}); + +Deno.test("duplicate protocols", () => { + assertThrows(() => + new WebSocketStream("ws://localhost:4242", { + protocols: ["foo", "foo"], + }) + ); +}); + +Deno.test("connect & close custom valid code", async () => { + const ws = new WebSocketStream("ws://localhost:4242"); + await ws.connection; + ws.close({ code: 1000 }); + await ws.closed; +}); + +Deno.test("connect & close custom invalid reason", async () => { + const ws = new WebSocketStream("ws://localhost:4242"); + await ws.connection; + assertThrows(() => ws.close({ code: 1000, reason: "".padEnd(124, "o") })); + ws.close(); + await ws.closed; +}); + +Deno.test("echo string", async () => { + const ws = new WebSocketStream("ws://localhost:4242"); + const { readable, writable } = await ws.connection; + await writable.getWriter().write("foo"); + const res = await readable.getReader().read(); + assertEquals(res.value, "foo"); + ws.close(); + await ws.closed; +}); + +Deno.test("echo string tls", async () => { + const ws = new WebSocketStream("wss://localhost:4243"); + const { readable, writable } = await ws.connection; + await writable.getWriter().write("foo"); + const res = await readable.getReader().read(); + assertEquals(res.value, "foo"); + ws.close(); + await ws.closed; +}); + +Deno.test("websocket error", async () => { + const ws = new WebSocketStream("wss://localhost:4242"); + await Promise.all([ + assertRejects( + () => ws.connection, + Deno.errors.UnexpectedEof, + "tls handshake eof", + ), + assertRejects( + () => ws.closed, + Deno.errors.UnexpectedEof, + "tls handshake eof", + ), + ]); +}); + +Deno.test("echo uint8array", async () => { + const ws = new WebSocketStream("ws://localhost:4242"); + const { readable, writable } = await ws.connection; + const uint = new Uint8Array([102, 111, 111]); + await writable.getWriter().write(uint); + const res = await readable.getReader().read(); + assertEquals(res.value, uint); + ws.close(); + await ws.closed; +}); + +Deno.test("aborting immediately throws an AbortError", async () => { + const controller = new AbortController(); + const wss = new WebSocketStream("ws://localhost:4242", { + signal: controller.signal, + }); + controller.abort(); + await assertRejects( + () => wss.connection, + (error: Error) => { + assert(error instanceof DOMException); + assertEquals(error.name, "AbortError"); + }, + ); + await assertRejects( + () => wss.closed, + (error: Error) => { + assert(error instanceof DOMException); + assertEquals(error.name, "AbortError"); + }, + ); +}); + +Deno.test("aborting immediately with a reason throws that reason", async () => { + const controller = new AbortController(); + const wss = new WebSocketStream("ws://localhost:4242", { + signal: controller.signal, + }); + const abortReason = new Error(); + controller.abort(abortReason); + await assertRejects( + () => wss.connection, + (error: Error) => assertEquals(error, abortReason), + ); + await assertRejects( + () => wss.closed, + (error: Error) => assertEquals(error, abortReason), + ); +}); + +Deno.test("aborting immediately with a primitive as reason throws that primitive", async () => { + const controller = new AbortController(); + const wss = new WebSocketStream("ws://localhost:4242", { + signal: controller.signal, + }); + controller.abort("Some string"); + await wss.connection.then( + () => unreachable(), + (e) => assertEquals(e, "Some string"), + ); + await wss.closed.then( + () => unreachable(), + (e) => assertEquals(e, "Some string"), + ); +}); + +Deno.test("headers", async () => { + const listener = Deno.listen({ port: 4512 }); + const promise = (async () => { + const conn = await listener.accept(); + const httpConn = Deno.serveHttp(conn); + const { request, respondWith } = (await httpConn.nextRequest())!; + assertEquals(request.headers.get("x-some-header"), "foo"); + const { response, socket } = Deno.upgradeWebSocket(request); + socket.onopen = () => socket.close(); + const p = new Promise((resolve) => { + socket.onopen = () => socket.close(); + socket.onclose = () => resolve(); + }); + await respondWith(response); + await p; + })(); + + const ws = new WebSocketStream("ws://localhost:4512", { + headers: [["x-some-header", "foo"]], + }); + await ws.connection; + await promise; + await ws.closed; + listener.close(); +}); + +Deno.test("forbidden headers", async () => { + const forbiddenHeaders = [ + "sec-websocket-accept", + "sec-websocket-extensions", + "sec-websocket-key", + "sec-websocket-protocol", + "sec-websocket-version", + "upgrade", + "connection", + ]; + + const listener = Deno.listen({ port: 4512 }); + const promise = (async () => { + const conn = await listener.accept(); + const httpConn = Deno.serveHttp(conn); + const { request, respondWith } = (await httpConn.nextRequest())!; + for (const [key] of request.headers) { + assertNotEquals(key, "foo"); + } + const { response, socket } = Deno.upgradeWebSocket(request); + const p = new Promise((resolve) => { + socket.onopen = () => socket.close(); + socket.onclose = () => resolve(); + }); + await respondWith(response); + await p; + })(); + + const ws = new WebSocketStream("ws://localhost:4512", { + headers: forbiddenHeaders.map((header) => [header, "foo"]), + }); + await ws.connection; + await promise; + await ws.closed; + listener.close(); +}); + +Deno.test("sync close with empty stream", async () => { + const listener = Deno.listen({ port: 4512 }); + const promise = (async () => { + const conn = await listener.accept(); + const httpConn = Deno.serveHttp(conn); + const { request, respondWith } = (await httpConn.nextRequest())!; + const { response, socket } = Deno.upgradeWebSocket(request); + const p = new Promise((resolve) => { + socket.onopen = () => { + socket.send("first message"); + socket.send("second message"); + }; + socket.onclose = () => resolve(); + }); + await respondWith(response); + await p; + })(); + + const ws = new WebSocketStream("ws://localhost:4512"); + const { readable } = await ws.connection; + const reader = readable.getReader(); + const firstMessage = await reader.read(); + assertEquals(firstMessage.value, "first message"); + const secondMessage = await reader.read(); + assertEquals(secondMessage.value, "second message"); + ws.close({ code: 1000 }); + await ws.closed; + await promise; + listener.close(); +}); + +Deno.test("sync close with unread messages in stream", async () => { + const listener = Deno.listen({ port: 4512 }); + const promise = (async () => { + const conn = await listener.accept(); + const httpConn = Deno.serveHttp(conn); + const { request, respondWith } = (await httpConn.nextRequest())!; + const { response, socket } = Deno.upgradeWebSocket(request); + const p = new Promise((resolve) => { + socket.onopen = () => { + socket.send("first message"); + socket.send("second message"); + socket.send("third message"); + socket.send("fourth message"); + }; + socket.onclose = () => resolve(); + }); + await respondWith(response); + await p; + })(); + + const ws = new WebSocketStream("ws://localhost:4512"); + const { readable } = await ws.connection; + const reader = readable.getReader(); + const firstMessage = await reader.read(); + assertEquals(firstMessage.value, "first message"); + const secondMessage = await reader.read(); + assertEquals(secondMessage.value, "second message"); + ws.close({ code: 1000 }); + await ws.closed; + await promise; + listener.close(); +}); + +Deno.test("async close with empty stream", async () => { + const listener = Deno.listen({ port: 4512 }); + const promise = (async () => { + const conn = await listener.accept(); + const httpConn = Deno.serveHttp(conn); + const { request, respondWith } = (await httpConn.nextRequest())!; + const { response, socket } = Deno.upgradeWebSocket(request); + const p = new Promise((resolve) => { + socket.onopen = () => { + socket.send("first message"); + socket.send("second message"); + }; + socket.onclose = () => resolve(); + }); + await respondWith(response); + await p; + })(); + + const ws = new WebSocketStream("ws://localhost:4512"); + const { readable } = await ws.connection; + const reader = readable.getReader(); + const firstMessage = await reader.read(); + assertEquals(firstMessage.value, "first message"); + const secondMessage = await reader.read(); + assertEquals(secondMessage.value, "second message"); + setTimeout(() => { + ws.close({ code: 1000 }); + }, 0); + await ws.closed; + await promise; + listener.close(); +}); + +Deno.test("async close with unread messages in stream", async () => { + const listener = Deno.listen({ port: 4512 }); + const promise = (async () => { + const conn = await listener.accept(); + const httpConn = Deno.serveHttp(conn); + const { request, respondWith } = (await httpConn.nextRequest())!; + const { response, socket } = Deno.upgradeWebSocket(request); + const p = new Promise((resolve) => { + socket.onopen = () => { + socket.send("first message"); + socket.send("second message"); + socket.send("third message"); + socket.send("fourth message"); + }; + socket.onclose = () => resolve(); + }); + await respondWith(response); + await p; + })(); + + const ws = new WebSocketStream("ws://localhost:4512"); + const { readable } = await ws.connection; + const reader = readable.getReader(); + const firstMessage = await reader.read(); + assertEquals(firstMessage.value, "first message"); + const secondMessage = await reader.read(); + assertEquals(secondMessage.value, "second message"); + setTimeout(() => { + ws.close({ code: 1000 }); + }, 0); + await ws.closed; + await promise; + listener.close(); +}); diff --git a/cli/tests/testdata/run/webstorage/config_a.jsonc b/cli/tests/testdata/run/webstorage/config_a.jsonc new file mode 100644 index 000000000..875cb6001 --- /dev/null +++ b/cli/tests/testdata/run/webstorage/config_a.jsonc @@ -0,0 +1,3 @@ +{ + "compilerOptions": {} +} diff --git a/cli/tests/testdata/run/webstorage/config_b.jsonc b/cli/tests/testdata/run/webstorage/config_b.jsonc new file mode 100644 index 000000000..875cb6001 --- /dev/null +++ b/cli/tests/testdata/run/webstorage/config_b.jsonc @@ -0,0 +1,3 @@ +{ + "compilerOptions": {} +} diff --git a/cli/tests/testdata/run/webstorage/fixture.ts b/cli/tests/testdata/run/webstorage/fixture.ts new file mode 100644 index 000000000..cf4bd9f1f --- /dev/null +++ b/cli/tests/testdata/run/webstorage/fixture.ts @@ -0,0 +1,2 @@ +import "./logger.ts"; +import "./setter.ts"; diff --git a/cli/tests/testdata/run/webstorage/logger.ts b/cli/tests/testdata/run/webstorage/logger.ts new file mode 100644 index 000000000..3898c4445 --- /dev/null +++ b/cli/tests/testdata/run/webstorage/logger.ts @@ -0,0 +1 @@ +console.log(window.localStorage); diff --git a/cli/tests/testdata/run/webstorage/serialization.ts b/cli/tests/testdata/run/webstorage/serialization.ts new file mode 100644 index 000000000..f3791d355 --- /dev/null +++ b/cli/tests/testdata/run/webstorage/serialization.ts @@ -0,0 +1,4 @@ +window.sessionStorage.setItem("hello", "deno"); + +console.log(window.localStorage); +console.log(window.sessionStorage); diff --git a/cli/tests/testdata/run/webstorage/serialization.ts.out b/cli/tests/testdata/run/webstorage/serialization.ts.out new file mode 100644 index 000000000..fea76aa43 --- /dev/null +++ b/cli/tests/testdata/run/webstorage/serialization.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +Storage {[WILDCARD] +Storage { length: 1, hello: "deno" } diff --git a/cli/tests/testdata/run/webstorage/setter.ts b/cli/tests/testdata/run/webstorage/setter.ts new file mode 100644 index 000000000..ec6d474f5 --- /dev/null +++ b/cli/tests/testdata/run/webstorage/setter.ts @@ -0,0 +1 @@ +window.localStorage.setItem("hello", "deno"); diff --git a/cli/tests/testdata/run/worker_close_in_wasm_reactions.js b/cli/tests/testdata/run/worker_close_in_wasm_reactions.js new file mode 100644 index 000000000..8238aaa14 --- /dev/null +++ b/cli/tests/testdata/run/worker_close_in_wasm_reactions.js @@ -0,0 +1,10 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +// https://github.com/denoland/deno/issues/12263 +// Test for a panic that happens when a worker is closed in the reactions of a +// WASM async operation. + +new Worker( + import.meta.resolve("../workers/close_in_wasm_reactions.js"), + { type: "module" }, +); diff --git a/cli/tests/testdata/run/worker_close_in_wasm_reactions.js.out b/cli/tests/testdata/run/worker_close_in_wasm_reactions.js.out new file mode 100644 index 000000000..6485c620e --- /dev/null +++ b/cli/tests/testdata/run/worker_close_in_wasm_reactions.js.out @@ -0,0 +1 @@ +Error: CompileError: WebAssembly.compile(): expected length: @+10 diff --git a/cli/tests/testdata/run/worker_close_nested.js b/cli/tests/testdata/run/worker_close_nested.js new file mode 100644 index 000000000..b39dfd4c0 --- /dev/null +++ b/cli/tests/testdata/run/worker_close_nested.js @@ -0,0 +1,20 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +// Test that closing a worker which has living child workers will automatically +// close the children. + +console.log("Starting the main thread"); + +const worker = new Worker( + import.meta.resolve("../workers/close_nested_parent.js"), + { type: "module" }, +); + +setTimeout(() => { + console.log("About to close"); + worker.postMessage({}); + + // Keep the process running for another two seconds, to make sure there's no + // output from the child worker. + setTimeout(() => {}, 2000); +}, 1000); diff --git a/cli/tests/testdata/run/worker_close_nested.js.out b/cli/tests/testdata/run/worker_close_nested.js.out new file mode 100644 index 000000000..496bc6251 --- /dev/null +++ b/cli/tests/testdata/run/worker_close_nested.js.out @@ -0,0 +1,5 @@ +Starting the main thread +Starting the parent worker +Starting the child worker +About to close +Closing diff --git a/cli/tests/testdata/run/worker_close_race.js b/cli/tests/testdata/run/worker_close_race.js new file mode 100644 index 000000000..1b369c5d3 --- /dev/null +++ b/cli/tests/testdata/run/worker_close_race.js @@ -0,0 +1,14 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +// https://github.com/denoland/deno/issues/11416 +// Test for a race condition between a worker's `close()` and the main thread's +// `Worker.prototype.terminate()`. + +const worker = new Worker( + import.meta.resolve("../workers/close_race_worker.js"), + { type: "module" }, +); + +worker.onmessage = () => { + worker.terminate(); +}; diff --git a/cli/tests/testdata/run/worker_close_race.js.out b/cli/tests/testdata/run/worker_close_race.js.out new file mode 100644 index 000000000..e69de29bb diff --git a/cli/tests/testdata/run/worker_drop_handle_race.js b/cli/tests/testdata/run/worker_drop_handle_race.js new file mode 100644 index 000000000..5ad918314 --- /dev/null +++ b/cli/tests/testdata/run/worker_drop_handle_race.js @@ -0,0 +1,12 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +// https://github.com/denoland/deno/issues/11342 +// Test for a panic that happens when the main thread's event loop finishes +// running while the worker's event loop is still spinning. + +// The exception thrown in the worker will not terminate the worker, but it will +// propagate to the main thread and cause it to exit. +new Worker( + import.meta.resolve("../workers/drop_handle_race.js"), + { type: "module" }, +); diff --git a/cli/tests/testdata/run/worker_drop_handle_race.js.out b/cli/tests/testdata/run/worker_drop_handle_race.js.out new file mode 100644 index 000000000..a81684bfa --- /dev/null +++ b/cli/tests/testdata/run/worker_drop_handle_race.js.out @@ -0,0 +1,8 @@ +error: Uncaught (in worker "") Error + throw new Error(); + ^ + at [WILDCARD]/workers/drop_handle_race.js:2:9 + at Object.action (deno:ext/web/02_timers.js:[WILDCARD]) + at handleTimerMacrotask (deno:ext/web/02_timers.js:[WILDCARD]) +error: Uncaught (in promise) Error: Unhandled error in child worker. + at Worker.#pollControl (deno:runtime/js/11_workers.js:[WILDCARD]) diff --git a/cli/tests/testdata/run/worker_drop_handle_race_terminate.js b/cli/tests/testdata/run/worker_drop_handle_race_terminate.js new file mode 100644 index 000000000..93c324fdf --- /dev/null +++ b/cli/tests/testdata/run/worker_drop_handle_race_terminate.js @@ -0,0 +1,37 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +// Test that the panic in https://github.com/denoland/deno/issues/11342 does not +// happen when calling worker.terminate() after fixing +// https://github.com/denoland/deno/issues/13705 + +function getCodeBlobUrl(code) { + const blob = new Blob([code], { type: "text/javascript" }); + return URL.createObjectURL(blob); +} + +const WORKER2 = getCodeBlobUrl(` + console.log("Worker 2"); + self.postMessage(undefined); + + // We sleep synchronously for slightly under 2 seconds in order to make sure + // that worker 1 has closed, and that this worker's thread finishes normally + // rather than being killed (which happens 2 seconds after calling terminate). + Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 1800); + console.log("Finished sleeping in worker 2"); +`); + +const WORKER1 = getCodeBlobUrl(` + console.log("Worker 1"); + const worker = new Worker(${JSON.stringify(WORKER2)}, { type: "module" }); + + worker.addEventListener("message", () => { + console.log("Terminating"); + worker.terminate(); + self.close(); + }); +`); + +new Worker(WORKER1, { type: "module" }); + +// Don't kill the process before worker 2 is finished. +setTimeout(() => {}, 3000); diff --git a/cli/tests/testdata/run/worker_drop_handle_race_terminate.js.out b/cli/tests/testdata/run/worker_drop_handle_race_terminate.js.out new file mode 100644 index 000000000..5ec1e7ff8 --- /dev/null +++ b/cli/tests/testdata/run/worker_drop_handle_race_terminate.js.out @@ -0,0 +1,4 @@ +Worker 1 +Worker 2 +Terminating +Finished sleeping in worker 2 diff --git a/cli/tests/testdata/run/worker_event_handler_test.js b/cli/tests/testdata/run/worker_event_handler_test.js new file mode 100644 index 000000000..a91b0ec0b --- /dev/null +++ b/cli/tests/testdata/run/worker_event_handler_test.js @@ -0,0 +1,5 @@ +const w = new Worker( + import.meta.resolve("../workers/worker_event_handlers.js"), + { type: "module" }, +); +w.postMessage({}); diff --git a/cli/tests/testdata/run/worker_event_handler_test.js.out b/cli/tests/testdata/run/worker_event_handler_test.js.out new file mode 100644 index 000000000..b3eed7f6c --- /dev/null +++ b/cli/tests/testdata/run/worker_event_handler_test.js.out @@ -0,0 +1,11 @@ +Target from self.onmessage: [object DedicatedWorkerGlobalScope] +Target from message event listener: [object DedicatedWorkerGlobalScope] +Arguments from self.onerror: [ + "Uncaught Error: Some error message", + "[WILDCARD]/worker_event_handlers.js", + 9, + 9, + Error: Some error message + at [WILDCARD] +] +Is event canceled?: true diff --git a/cli/tests/testdata/run/worker_message_before_close.js b/cli/tests/testdata/run/worker_message_before_close.js new file mode 100644 index 000000000..569388b9b --- /dev/null +++ b/cli/tests/testdata/run/worker_message_before_close.js @@ -0,0 +1,26 @@ +const messagesReceived = new Set(); + +for (let i = 0; i < 4; i++) { + const worker = new Worker( + import.meta.resolve("../workers/message_before_close.js"), + { type: "module", name: String(i) }, + ); + + worker.addEventListener("message", () => { + messagesReceived.add(i); + if (messagesReceived.size == 4) { + console.log("received all 4 responses from the workers"); + } + }); + + worker.postMessage({}); +} + +globalThis.addEventListener("unload", () => { + if (messagesReceived.size !== 4) { + console.log( + "received only %d responses from the workers", + messagesReceived.size, + ); + } +}); diff --git a/cli/tests/testdata/run/worker_message_before_close.js.out b/cli/tests/testdata/run/worker_message_before_close.js.out new file mode 100644 index 000000000..f91b7b4cb --- /dev/null +++ b/cli/tests/testdata/run/worker_message_before_close.js.out @@ -0,0 +1 @@ +received all 4 responses from the workers diff --git a/cli/tests/testdata/runtime/esm_imports_a.js b/cli/tests/testdata/runtime/esm_imports_a.js new file mode 100644 index 000000000..673cd9aa3 --- /dev/null +++ b/cli/tests/testdata/runtime/esm_imports_a.js @@ -0,0 +1,3 @@ +import { retb } from "./esm_imports_b.js"; + +if (retb() != "b") throw Error(); diff --git a/cli/tests/testdata/runtime/esm_imports_b.js b/cli/tests/testdata/runtime/esm_imports_b.js new file mode 100644 index 000000000..840121368 --- /dev/null +++ b/cli/tests/testdata/runtime/esm_imports_b.js @@ -0,0 +1,4 @@ +// deno-lint-ignore-file +export function retb() { + return "b"; +} diff --git a/cli/tests/testdata/runtime_decorators.ts b/cli/tests/testdata/runtime_decorators.ts deleted file mode 100644 index 5da109110..000000000 --- a/cli/tests/testdata/runtime_decorators.ts +++ /dev/null @@ -1,42 +0,0 @@ -// deno-lint-ignore-file -function A() { - console.log("@A evaluated"); - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ) { - console.log("@A called"); - const fn = descriptor.value; - descriptor.value = function () { - console.log("fn() called from @A"); - fn(); - }; - }; -} - -function B() { - console.log("@B evaluated"); - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ) { - console.log("@B called"); - const fn = descriptor.value; - descriptor.value = function () { - console.log("fn() called from @B"); - fn(); - }; - }; -} - -class C { - @A() - @B() - static test() { - console.log("C.test() called"); - } -} - -C.test(); diff --git a/cli/tests/testdata/runtime_decorators.ts.out b/cli/tests/testdata/runtime_decorators.ts.out deleted file mode 100644 index 0fc1d4590..000000000 --- a/cli/tests/testdata/runtime_decorators.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -@A evaluated -@B evaluated -@B called -@A called -fn() called from @A -fn() called from @B -C.test() called diff --git a/cli/tests/testdata/seed_random.js b/cli/tests/testdata/seed_random.js deleted file mode 100644 index 7f6e336df..000000000 --- a/cli/tests/testdata/seed_random.js +++ /dev/null @@ -1,11 +0,0 @@ -for (let i = 0; i < 10; ++i) { - console.log(Math.random()); -} - -const arr = new Uint8Array(32); - -crypto.getRandomValues(arr); -console.log(arr); - -crypto.getRandomValues(arr); -console.log(arr); diff --git a/cli/tests/testdata/seed_random.js.out b/cli/tests/testdata/seed_random.js.out deleted file mode 100644 index 4d1ebd081..000000000 --- a/cli/tests/testdata/seed_random.js.out +++ /dev/null @@ -1,22 +0,0 @@ -0.858562739044346 -0.8973397944553141 -0.15335012655691727 -0.36867387434349963 -0.3591039342838782 -0.7044499748617652 -0.7461423057751548 -0.3824611207183364 -0.5950178237266042 -0.22440633214343908 -Uint8Array(32) [ - 153, 221, 127, 193, 173, 88, 77, 155, - 23, 66, 117, 239, 157, 231, 189, 160, - 79, 198, 30, 56, 137, 159, 220, 226, - 47, 211, 26, 73, 243, 252, 71, 214 -] -Uint8Array(32) [ - 18, 98, 66, 131, 76, 87, 93, 76, - 205, 81, 250, 112, 129, 119, 92, 9, - 116, 99, 5, 171, 8, 137, 132, 79, - 255, 9, 194, 1, 138, 85, 72, 189 -] diff --git a/cli/tests/testdata/set_exit_code_0.ts b/cli/tests/testdata/set_exit_code_0.ts deleted file mode 100644 index 362a9f28a..000000000 --- a/cli/tests/testdata/set_exit_code_0.ts +++ /dev/null @@ -1,2 +0,0 @@ -Deno.core.ops.op_set_exit_code(42); -Deno.exit(0); // Takes precedence. diff --git a/cli/tests/testdata/set_exit_code_1.ts b/cli/tests/testdata/set_exit_code_1.ts deleted file mode 100644 index b10863568..000000000 --- a/cli/tests/testdata/set_exit_code_1.ts +++ /dev/null @@ -1,2 +0,0 @@ -Deno.core.ops.op_set_exit_code(42); -Deno.exit(); diff --git a/cli/tests/testdata/set_exit_code_2.ts b/cli/tests/testdata/set_exit_code_2.ts deleted file mode 100644 index d68812cae..000000000 --- a/cli/tests/testdata/set_exit_code_2.ts +++ /dev/null @@ -1,2 +0,0 @@ -Deno.core.ops.op_set_exit_code(42); -// Exits naturally. diff --git a/cli/tests/testdata/set_timeout_error.ts b/cli/tests/testdata/set_timeout_error.ts deleted file mode 100644 index 2864574e7..000000000 --- a/cli/tests/testdata/set_timeout_error.ts +++ /dev/null @@ -1,3 +0,0 @@ -setTimeout(() => { - throw new Error("foo"); -}, 0); diff --git a/cli/tests/testdata/set_timeout_error.ts.out b/cli/tests/testdata/set_timeout_error.ts.out deleted file mode 100644 index 9db053f6c..000000000 --- a/cli/tests/testdata/set_timeout_error.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught Error: foo - throw new Error("foo"); - ^ - at [WILDCARD]/set_timeout_error.ts:2:9 - at [WILDCARD] diff --git a/cli/tests/testdata/set_timeout_error_handled.ts b/cli/tests/testdata/set_timeout_error_handled.ts deleted file mode 100644 index aee2d97d2..000000000 --- a/cli/tests/testdata/set_timeout_error_handled.ts +++ /dev/null @@ -1,19 +0,0 @@ -addEventListener("error", (event) => { - console.log({ - cancelable: event.cancelable, - message: event.message, - filename: event.filename?.slice?.(-100), - lineno: event.lineno, - colno: event.colno, - error: event.error, - }); - event.preventDefault(); -}); - -onerror = (event) => { - console.log("onerror() called", event.error); -}; - -setTimeout(() => { - throw new Error("foo"); -}, 0); diff --git a/cli/tests/testdata/set_timeout_error_handled.ts.out b/cli/tests/testdata/set_timeout_error_handled.ts.out deleted file mode 100644 index 054dd9b6b..000000000 --- a/cli/tests/testdata/set_timeout_error_handled.ts.out +++ /dev/null @@ -1,13 +0,0 @@ -{ - cancelable: true, - message: "Uncaught Error: foo", - filename: "[WILDCARD]/set_timeout_error_handled.ts", - lineno: 18, - colno: 9, - error: Error: foo - at [WILDCARD]/set_timeout_error_handled.ts:18:9 - at [WILDCARD] -} -onerror() called Error: foo - at [WILDCARD]/set_timeout_error_handled.ts:18:9 - at [WILDCARD] diff --git a/cli/tests/testdata/shebang.ts b/cli/tests/testdata/shebang.ts deleted file mode 100644 index 00feb2da0..000000000 --- a/cli/tests/testdata/shebang.ts +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env -S deno run - -import test from "./shebang2.ts"; - -console.log(test as number); diff --git a/cli/tests/testdata/shebang.ts.out b/cli/tests/testdata/shebang.ts.out deleted file mode 100644 index d81cc0710..000000000 --- a/cli/tests/testdata/shebang.ts.out +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/cli/tests/testdata/shebang2.ts b/cli/tests/testdata/shebang2.ts deleted file mode 100644 index da0d7bf0c..000000000 --- a/cli/tests/testdata/shebang2.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env -S deno run - -export default 42; diff --git a/cli/tests/testdata/single_compile_with_reload.ts b/cli/tests/testdata/single_compile_with_reload.ts deleted file mode 100644 index ea6a73474..000000000 --- a/cli/tests/testdata/single_compile_with_reload.ts +++ /dev/null @@ -1,18 +0,0 @@ -await import("./single_compile_with_reload_dyn.ts"); -console.log("1"); -await import("./single_compile_with_reload_dyn.ts"); -console.log("2"); -await new Promise((r) => - new Worker( - import.meta.resolve("single_compile_with_reload_worker.ts"), - { type: "module" }, - ).onmessage = r -); -console.log("3"); -await new Promise((r) => - new Worker( - import.meta.resolve("single_compile_with_reload_worker.ts"), - { type: "module" }, - ).onmessage = r -); -console.log("4"); diff --git a/cli/tests/testdata/single_compile_with_reload.ts.out b/cli/tests/testdata/single_compile_with_reload.ts.out deleted file mode 100644 index b0b2fcaf1..000000000 --- a/cli/tests/testdata/single_compile_with_reload.ts.out +++ /dev/null @@ -1,9 +0,0 @@ -Check [WILDCARD]single_compile_with_reload.ts -Hello -1 -2 -Check [WILDCARD]single_compile_with_reload_worker.ts -Hello from worker -3 -Hello from worker -4 diff --git a/cli/tests/testdata/single_compile_with_reload_dyn.ts b/cli/tests/testdata/single_compile_with_reload_dyn.ts deleted file mode 100644 index 0266bf46c..000000000 --- a/cli/tests/testdata/single_compile_with_reload_dyn.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { printHello3, returnsFoo2, returnsHi } from "./subdir/mod1.ts"; - -printHello3(); - -if (returnsHi() !== "Hi") { - throw Error("Unexpected"); -} - -if (returnsFoo2() !== "Foo") { - throw Error("Unexpected"); -} diff --git a/cli/tests/testdata/single_compile_with_reload_worker.ts b/cli/tests/testdata/single_compile_with_reload_worker.ts deleted file mode 100644 index 103cafe20..000000000 --- a/cli/tests/testdata/single_compile_with_reload_worker.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log("Hello from worker"); -postMessage(null); -close(); diff --git a/cli/tests/testdata/spawn_stdout_inherit.ts b/cli/tests/testdata/spawn_stdout_inherit.ts deleted file mode 100644 index be5f9b7ef..000000000 --- a/cli/tests/testdata/spawn_stdout_inherit.ts +++ /dev/null @@ -1,8 +0,0 @@ -await Deno.spawn(Deno.execPath(), { - args: ["eval", "--quiet", "console.log('Hello, world! 1')"], - stdout: "inherit", -}); -Deno.spawnSync(Deno.execPath(), { - args: ["eval", "--quiet", "console.log('Hello, world! 2')"], - stdout: "inherit", -}); diff --git a/cli/tests/testdata/spawn_stdout_inherit.ts.out b/cli/tests/testdata/spawn_stdout_inherit.ts.out deleted file mode 100644 index 474891cf2..000000000 --- a/cli/tests/testdata/spawn_stdout_inherit.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Hello, world! 1 -Hello, world! 2 diff --git a/cli/tests/testdata/standalone_dynamic_imports.ts b/cli/tests/testdata/standalone_dynamic_imports.ts deleted file mode 100644 index d4dc55152..000000000 --- a/cli/tests/testdata/standalone_dynamic_imports.ts +++ /dev/null @@ -1,15 +0,0 @@ -(async () => { - const { returnsHi, returnsFoo2, printHello3 } = await import( - "./subdir/mod1.ts" - ); - - printHello3(); - - if (returnsHi() !== "Hi") { - throw Error("Unexpected"); - } - - if (returnsFoo2() !== "Foo") { - throw Error("Unexpected"); - } -})(); diff --git a/cli/tests/testdata/standalone_error.ts b/cli/tests/testdata/standalone_error.ts deleted file mode 100644 index 279398113..000000000 --- a/cli/tests/testdata/standalone_error.ts +++ /dev/null @@ -1,9 +0,0 @@ -function boom() { - throw new Error("boom!"); -} - -function foo() { - boom(); -} - -foo(); diff --git a/cli/tests/testdata/standalone_error_module_with_imports_1.ts b/cli/tests/testdata/standalone_error_module_with_imports_1.ts deleted file mode 100644 index bf38f7263..000000000 --- a/cli/tests/testdata/standalone_error_module_with_imports_1.ts +++ /dev/null @@ -1 +0,0 @@ -import "./standalone_error_module_with_imports_2.ts"; diff --git a/cli/tests/testdata/standalone_error_module_with_imports_2.ts b/cli/tests/testdata/standalone_error_module_with_imports_2.ts deleted file mode 100644 index ef052b512..000000000 --- a/cli/tests/testdata/standalone_error_module_with_imports_2.ts +++ /dev/null @@ -1,2 +0,0 @@ -console.log("hello"); -throw new Error("boom!"); diff --git a/cli/tests/testdata/standalone_follow_redirects.ts b/cli/tests/testdata/standalone_follow_redirects.ts deleted file mode 100644 index f0957bc3d..000000000 --- a/cli/tests/testdata/standalone_follow_redirects.ts +++ /dev/null @@ -1,2 +0,0 @@ -import "./standalone_follow_redirects_2.js"; -console.log("Hello"); diff --git a/cli/tests/testdata/standalone_follow_redirects_2.js b/cli/tests/testdata/standalone_follow_redirects_2.js deleted file mode 100644 index c0130ef5a..000000000 --- a/cli/tests/testdata/standalone_follow_redirects_2.js +++ /dev/null @@ -1,5 +0,0 @@ -// unversioned import redirects with dependencies. -import { - assertNotEquals as _a, - assertStrictEquals as _b, -} from "https://deno.land/std/testing/asserts.ts"; diff --git a/cli/tests/testdata/standalone_import.ts b/cli/tests/testdata/standalone_import.ts deleted file mode 100644 index 804102a53..000000000 --- a/cli/tests/testdata/standalone_import.ts +++ /dev/null @@ -1,2 +0,0 @@ -console.log("start"); -await import("./001_hello.js"); diff --git a/cli/tests/testdata/standalone_import_datauri.ts b/cli/tests/testdata/standalone_import_datauri.ts deleted file mode 100644 index 68f348828..000000000 --- a/cli/tests/testdata/standalone_import_datauri.ts +++ /dev/null @@ -1,4 +0,0 @@ -const c = await import( - "data:text/javascript;base64,ZXhwb3J0IGRlZmF1bHQgJ0hlbGxvIERlbm8hJw==" -); -console.log(c.default); // Output: "Hello Deno!" diff --git a/cli/tests/testdata/standalone_import_map.json b/cli/tests/testdata/standalone_import_map.json deleted file mode 100644 index 6f978d6be..000000000 --- a/cli/tests/testdata/standalone_import_map.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "imports": { - "hello": "./001_hello.js" - } -} diff --git a/cli/tests/testdata/standalone_import_map.ts b/cli/tests/testdata/standalone_import_map.ts deleted file mode 100644 index 097b96356..000000000 --- a/cli/tests/testdata/standalone_import_map.ts +++ /dev/null @@ -1 +0,0 @@ -import "hello"; diff --git a/cli/tests/testdata/standalone_runtime_flags.ts b/cli/tests/testdata/standalone_runtime_flags.ts deleted file mode 100644 index 0154c7f4e..000000000 --- a/cli/tests/testdata/standalone_runtime_flags.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log(Math.random()); -await Deno.stat("."); -await Deno.create("foo.txt"); diff --git a/cli/tests/testdata/std_lint.out b/cli/tests/testdata/std_lint.out deleted file mode 100644 index 9d62fcc67..000000000 --- a/cli/tests/testdata/std_lint.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] - -Found [WILDCARD] problems \ No newline at end of file diff --git a/cli/tests/testdata/subdir/empty.ts b/cli/tests/testdata/subdir/empty.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/testdata/subdir/types.d.ts b/cli/tests/testdata/subdir/types.d.ts deleted file mode 100644 index 536a6d0a6..000000000 --- a/cli/tests/testdata/subdir/types.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// deno-lint-ignore-file no-var -declare var a: string; diff --git a/cli/tests/testdata/swc_syntax_error.ts b/cli/tests/testdata/swc_syntax_error.ts deleted file mode 100644 index 991ca9214..000000000 --- a/cli/tests/testdata/swc_syntax_error.ts +++ /dev/null @@ -1,4 +0,0 @@ -// deno-fmt-ignore-file -for await (const req of s) { - let something: -} diff --git a/cli/tests/testdata/swc_syntax_error.ts.out b/cli/tests/testdata/swc_syntax_error.ts.out deleted file mode 100644 index c968db5e9..000000000 --- a/cli/tests/testdata/swc_syntax_error.ts.out +++ /dev/null @@ -1 +0,0 @@ -error: The module's source code could not be parsed: Unexpected token `}`. Expected an identifier, void, yield, null, await, break, a string literal, a numeric literal, true, false, `, -, import, this, typeof, {, [, ( at [WILDCARD]syntax_error.ts:4:1 diff --git a/cli/tests/testdata/test/resource_sanitizer.ts b/cli/tests/testdata/test/resource_sanitizer.ts index c1291b89a..93c9222c5 100644 --- a/cli/tests/testdata/test/resource_sanitizer.ts +++ b/cli/tests/testdata/test/resource_sanitizer.ts @@ -1,4 +1,4 @@ Deno.test("leak", function () { - Deno.openSync("001_hello.js"); + Deno.openSync("run/001_hello.js"); Deno.stdin.close(); }); diff --git a/cli/tests/testdata/test_and_bench_in_run.js b/cli/tests/testdata/test_and_bench_in_run.js deleted file mode 100644 index 108ae937a..000000000 --- a/cli/tests/testdata/test_and_bench_in_run.js +++ /dev/null @@ -1,5 +0,0 @@ -Deno.test(function foo() { -}); - -Deno.bench(function bar() { -}); diff --git a/cli/tests/testdata/text_decoder_perf.js b/cli/tests/testdata/text_decoder_perf.js deleted file mode 100644 index 2e52b1f8b..000000000 --- a/cli/tests/testdata/text_decoder_perf.js +++ /dev/null @@ -1,38 +0,0 @@ -const mixed = new TextEncoder().encode("@Ä€à¹ðŸ˜€"); - -function generateRandom(bytes) { - const result = new Uint8Array(bytes); - let i = 0; - while (i < bytes) { - const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); - switch (toAdd) { - case 0: - result[i] = mixed[0]; - i++; - break; - case 1: - result[i] = mixed[1]; - result[i + 1] = mixed[2]; - i += 2; - break; - case 2: - result[i] = mixed[3]; - result[i + 1] = mixed[4]; - result[i + 2] = mixed[5]; - i += 3; - break; - case 3: - result[i] = mixed[6]; - result[i + 1] = mixed[7]; - result[i + 2] = mixed[8]; - result[i + 3] = mixed[9]; - i += 4; - break; - } - } - return result; -} - -const randomData = generateRandom(1024); -const decoder = new TextDecoder(); -for (let i = 0; i < 10_000; i++) decoder.decode(randomData); diff --git a/cli/tests/testdata/text_encoder_into_perf.js b/cli/tests/testdata/text_encoder_into_perf.js deleted file mode 100644 index 8d60e9f00..000000000 --- a/cli/tests/testdata/text_encoder_into_perf.js +++ /dev/null @@ -1,34 +0,0 @@ -const mixed = "@Ä€à¹ðŸ˜€"; - -function generateRandom(bytes) { - let result = ""; - let i = 0; - while (i < bytes) { - const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); - switch (toAdd) { - case 0: - result += mixed[0]; - i++; - break; - case 1: - result += mixed[1]; - i++; - break; - case 2: - result += mixed[2]; - i++; - break; - case 3: - result += mixed[3]; - result += mixed[4]; - i += 2; - break; - } - } - return result; -} - -const randomData = generateRandom(1024); -const encoder = new TextEncoder(); -const targetBuffer = new Uint8Array(randomData.length * 4); -for (let i = 0; i < 10_000; i++) encoder.encodeInto(randomData, targetBuffer); diff --git a/cli/tests/testdata/text_encoder_perf.js b/cli/tests/testdata/text_encoder_perf.js deleted file mode 100644 index 6f61f019e..000000000 --- a/cli/tests/testdata/text_encoder_perf.js +++ /dev/null @@ -1,33 +0,0 @@ -const mixed = "@Ä€à¹ðŸ˜€"; - -function generateRandom(bytes) { - let result = ""; - let i = 0; - while (i < bytes) { - const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); - switch (toAdd) { - case 0: - result += mixed[0]; - i++; - break; - case 1: - result += mixed[1]; - i++; - break; - case 2: - result += mixed[2]; - i++; - break; - case 3: - result += mixed[3]; - result += mixed[4]; - i += 2; - break; - } - } - return result; -} - -const randomData = generateRandom(1024); -const encoder = new TextEncoder(); -for (let i = 0; i < 10_000; i++) encoder.encode(randomData); diff --git a/cli/tests/testdata/tla/a.js b/cli/tests/testdata/tla/a.js deleted file mode 100644 index c3ef3f7db..000000000 --- a/cli/tests/testdata/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/cli/tests/testdata/tla/b.js b/cli/tests/testdata/tla/b.js deleted file mode 100644 index 3271c92d8..000000000 --- a/cli/tests/testdata/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/cli/tests/testdata/tla/c.js b/cli/tests/testdata/tla/c.js deleted file mode 100644 index 806eb0a8b..000000000 --- a/cli/tests/testdata/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/cli/tests/testdata/tla/d.js b/cli/tests/testdata/tla/d.js deleted file mode 100644 index 283ebf817..000000000 --- a/cli/tests/testdata/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/cli/tests/testdata/tla/order.js b/cli/tests/testdata/tla/order.js deleted file mode 100644 index f213a562c..000000000 --- a/cli/tests/testdata/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/cli/tests/testdata/tla/parent.js b/cli/tests/testdata/tla/parent.js deleted file mode 100644 index 1ecc15463..000000000 --- a/cli/tests/testdata/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/cli/tests/testdata/tla2/a.js b/cli/tests/testdata/tla2/a.js deleted file mode 100644 index d07bcb94d..000000000 --- a/cli/tests/testdata/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/cli/tests/testdata/tla2/b.js b/cli/tests/testdata/tla2/b.js deleted file mode 100644 index 68e357c1e..000000000 --- a/cli/tests/testdata/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/cli/tests/testdata/tla3/b.js b/cli/tests/testdata/tla3/b.js deleted file mode 100644 index b74c659e4..000000000 --- a/cli/tests/testdata/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../top_level_await_circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/cli/tests/testdata/tla3/timeout_loop.js b/cli/tests/testdata/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2a..000000000 --- a/cli/tests/testdata/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/cli/tests/testdata/tls.out b/cli/tests/testdata/tls.out deleted file mode 100644 index c8e8a135c..000000000 --- a/cli/tests/testdata/tls.out +++ /dev/null @@ -1 +0,0 @@ -DONE diff --git a/cli/tests/testdata/tls_connecttls.js b/cli/tests/testdata/tls_connecttls.js deleted file mode 100644 index 1e8cf320c..000000000 --- a/cli/tests/testdata/tls_connecttls.js +++ /dev/null @@ -1,70 +0,0 @@ -import { deferred } from "../../../test_util/std/async/deferred.ts"; -import { - assert, - assertEquals, -} from "../../../test_util/std/testing/asserts.ts"; -import { BufReader, BufWriter } from "../../../test_util/std/io/bufio.ts"; -import { TextProtoReader } from "../../../test_util/std/textproto/mod.ts"; - -const encoder = new TextEncoder(); -const decoder = new TextDecoder(); - -const resolvable = deferred(); -const hostname = "localhost"; -const port = 3505; - -const listener = Deno.listenTls({ - hostname, - port, - certFile: "./tls/localhost.crt", - keyFile: "./tls/localhost.key", -}); - -const response = encoder.encode( - "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", -); - -listener.accept().then( - async (conn) => { - assert(conn.remoteAddr != null); - assert(conn.localAddr != null); - await conn.write(response); - // TODO(bartlomieju): this might be a bug - setTimeout(() => { - conn.close(); - resolvable.resolve(); - }, 0); - }, -); - -const conn = await Deno.connectTls({ - hostname, - port, -}); -assert(conn.rid > 0); -const w = new BufWriter(conn); -const r = new BufReader(conn); -const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`; -const writeResult = await w.write(encoder.encode(body)); -assertEquals(body.length, writeResult); -await w.flush(); -const tpr = new TextProtoReader(r); -const statusLine = await tpr.readLine(); -assert(statusLine !== null, `line must be read: ${String(statusLine)}`); -const m = statusLine.match(/^(.+?) (.+?) (.+?)$/); -assert(m !== null, "must be matched"); -const [_, proto, status, ok] = m; -assertEquals(proto, "HTTP/1.1"); -assertEquals(status, "200"); -assertEquals(ok, "OK"); -const headers = await tpr.readMIMEHeader(); -assert(headers !== null); -const contentLength = parseInt(headers.get("content-length")); -const bodyBuf = new Uint8Array(contentLength); -await r.readFull(bodyBuf); -assertEquals(decoder.decode(bodyBuf), "Hello World\n"); -conn.close(); -listener.close(); -await resolvable; - -console.log("DONE"); diff --git a/cli/tests/testdata/tls_starttls.js b/cli/tests/testdata/tls_starttls.js deleted file mode 100644 index 9b8767eaa..000000000 --- a/cli/tests/testdata/tls_starttls.js +++ /dev/null @@ -1,68 +0,0 @@ -import { deferred } from "../../../test_util/std/async/deferred.ts"; -import { - assert, - assertEquals, -} from "../../../test_util/std/testing/asserts.ts"; -import { BufReader, BufWriter } from "../../../test_util/std/io/bufio.ts"; -import { TextProtoReader } from "../../../test_util/std/textproto/mod.ts"; - -const encoder = new TextEncoder(); -const decoder = new TextDecoder(); - -const resolvable = deferred(); -const hostname = "localhost"; -const port = 3504; - -const listener = Deno.listenTls({ - hostname, - port, - certFile: "./tls/localhost.crt", - keyFile: "./tls/localhost.key", -}); - -const response = encoder.encode( - "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", -); - -listener.accept().then( - async (conn) => { - assert(conn.remoteAddr != null); - assert(conn.localAddr != null); - await conn.write(response); - // TODO(bartlomieju): this might be a bug - setTimeout(() => { - conn.close(); - resolvable.resolve(); - }, 0); - }, -); - -let conn = await Deno.connect({ hostname, port }); -conn = await Deno.startTls(conn, { hostname }); -assert(conn.rid > 0); -const w = new BufWriter(conn); -const r = new BufReader(conn); -const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`; -const writeResult = await w.write(encoder.encode(body)); -assertEquals(body.length, writeResult); -await w.flush(); -const tpr = new TextProtoReader(r); -const statusLine = await tpr.readLine(); -assert(statusLine !== null, `line must be read: ${String(statusLine)}`); -const m = statusLine.match(/^(.+?) (.+?) (.+?)$/); -assert(m !== null, "must be matched"); -const [_, proto, status, ok] = m; -assertEquals(proto, "HTTP/1.1"); -assertEquals(status, "200"); -assertEquals(ok, "OK"); -const headers = await tpr.readMIMEHeader(); -assert(headers !== null); -const contentLength = parseInt(headers.get("content-length")); -const bodyBuf = new Uint8Array(contentLength); -await r.readFull(bodyBuf); -assertEquals(decoder.decode(bodyBuf), "Hello World\n"); -conn.close(); -listener.close(); -await resolvable; - -console.log("DONE"); diff --git a/cli/tests/testdata/top_level_await.js b/cli/tests/testdata/top_level_await.js deleted file mode 100644 index af6fbd662..000000000 --- a/cli/tests/testdata/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/cli/tests/testdata/top_level_await.out b/cli/tests/testdata/top_level_await.out deleted file mode 100644 index 4b65d15fe..000000000 --- a/cli/tests/testdata/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/cli/tests/testdata/top_level_await.ts b/cli/tests/testdata/top_level_await.ts deleted file mode 100644 index 65de253ea..000000000 --- a/cli/tests/testdata/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/cli/tests/testdata/top_level_await_circular.js b/cli/tests/testdata/top_level_await_circular.js deleted file mode 100644 index ff2964b6a..000000000 --- a/cli/tests/testdata/top_level_await_circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/cli/tests/testdata/top_level_await_circular.out b/cli/tests/testdata/top_level_await_circular.out deleted file mode 100644 index 72072071e..000000000 --- a/cli/tests/testdata/top_level_await_circular.out +++ /dev/null @@ -1,9 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promises. -Pending dynamic modules: -- [WILDCARD]/tla3/b.js diff --git a/cli/tests/testdata/top_level_await_loop.js b/cli/tests/testdata/top_level_await_loop.js deleted file mode 100644 index 384f8d0ed..000000000 --- a/cli/tests/testdata/top_level_await_loop.js +++ /dev/null @@ -1,18 +0,0 @@ -const importsDir = Deno.readDirSync(Deno.realPathSync("./tla2")); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/cli/tests/testdata/top_level_await_loop.out b/cli/tests/testdata/top_level_await_loop.out deleted file mode 100644 index 70e621e45..000000000 --- a/cli/tests/testdata/top_level_await_loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded Module { default: [Function: Foo] } -loading [WILDCARD]b.js -loaded Module { default: [Function: Bar] } -all loaded diff --git a/cli/tests/testdata/top_level_await_nested.out b/cli/tests/testdata/top_level_await_nested.out deleted file mode 100644 index 8a1218a10..000000000 --- a/cli/tests/testdata/top_level_await_nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/cli/tests/testdata/top_level_await_nested/a.js b/cli/tests/testdata/top_level_await_nested/a.js deleted file mode 100644 index 74837d4ba..000000000 --- a/cli/tests/testdata/top_level_await_nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/cli/tests/testdata/top_level_await_nested/b.js b/cli/tests/testdata/top_level_await_nested/b.js deleted file mode 100644 index 3bd241b50..000000000 --- a/cli/tests/testdata/top_level_await_nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/cli/tests/testdata/top_level_await_nested/main.js b/cli/tests/testdata/top_level_await_nested/main.js deleted file mode 100644 index ed46a4717..000000000 --- a/cli/tests/testdata/top_level_await_nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/cli/tests/testdata/top_level_await_order.js b/cli/tests/testdata/top_level_await_order.js deleted file mode 100644 index 30659cdfb..000000000 --- a/cli/tests/testdata/top_level_await_order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/cli/tests/testdata/top_level_await_order.out b/cli/tests/testdata/top_level_await_order.out deleted file mode 100644 index 4cc27858c..000000000 --- a/cli/tests/testdata/top_level_await_order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/cli/tests/testdata/top_level_await_unresolved.js b/cli/tests/testdata/top_level_await_unresolved.js deleted file mode 100644 index 231a8cd63..000000000 --- a/cli/tests/testdata/top_level_await_unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/cli/tests/testdata/top_level_await_unresolved.out b/cli/tests/testdata/top_level_await_unresolved.out deleted file mode 100644 index d5291f833..000000000 --- a/cli/tests/testdata/top_level_await_unresolved.out +++ /dev/null @@ -1 +0,0 @@ -error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promises. diff --git a/cli/tests/testdata/top_level_for_await.js b/cli/tests/testdata/top_level_for_await.js deleted file mode 100644 index a330f6c71..000000000 --- a/cli/tests/testdata/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/cli/tests/testdata/top_level_for_await.out b/cli/tests/testdata/top_level_for_await.out deleted file mode 100644 index 4539bbf2d..000000000 --- a/cli/tests/testdata/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/cli/tests/testdata/top_level_for_await.ts b/cli/tests/testdata/top_level_for_await.ts deleted file mode 100644 index 9179322d7..000000000 --- a/cli/tests/testdata/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/cli/tests/testdata/ts_decorators.ts b/cli/tests/testdata/ts_decorators.ts deleted file mode 100644 index 95fba6cd4..000000000 --- a/cli/tests/testdata/ts_decorators.ts +++ /dev/null @@ -1,14 +0,0 @@ -// deno-lint-ignore-file - -function Decorate() { - return function (constructor: any): any { - return class extends constructor { - protected someField: string = "asdf"; - }; - }; -} - -@Decorate() -class SomeClass {} - -console.log(new SomeClass()); diff --git a/cli/tests/testdata/ts_decorators.ts.out b/cli/tests/testdata/ts_decorators.ts.out deleted file mode 100644 index 381c7a809..000000000 --- a/cli/tests/testdata/ts_decorators.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Check [WILDCARD] -{ someField: "asdf" } diff --git a/cli/tests/testdata/ts_decorators_bundle.out b/cli/tests/testdata/ts_decorators_bundle.out deleted file mode 100644 index 2f503fdd0..000000000 --- a/cli/tests/testdata/ts_decorators_bundle.out +++ /dev/null @@ -1,49 +0,0 @@ -[WILDCARD] -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -var __decorate = this && this.__decorate || function(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -function a() { - console.log("a(): evaluated"); - return (_target, _propertyKey, _descriptor)=>{ - console.log("a(): called"); - }; -} -class B { - method() { - console.log("method"); - } -} -__decorate([ - a() -], B.prototype, "method", null); -var __decorate1 = this && this.__decorate || function(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -function Decorator() { - return function(target, propertyKey, descriptor) { - const originalFn = descriptor.value; - descriptor.value = async function(...args) { - return await originalFn.apply(this, args); - }; - return descriptor; - }; -} -class SomeClass { - async test() {} -} -__decorate1([ - Decorator() -], SomeClass.prototype, "test", null); -new SomeClass().test(); -new B().method(); -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/ts_decorators_bundle.ts b/cli/tests/testdata/ts_decorators_bundle.ts deleted file mode 100644 index 72120b2ec..000000000 --- a/cli/tests/testdata/ts_decorators_bundle.ts +++ /dev/null @@ -1,25 +0,0 @@ -// deno-lint-ignore-file - -import { B } from "./subdir/more_decorators.ts"; - -function Decorator() { - return function ( - target: Record, - propertyKey: string, - descriptor: TypedPropertyDescriptor, - ) { - const originalFn: Function = descriptor.value as Function; - descriptor.value = async function (...args: any[]) { - return await originalFn.apply(this, args); - }; - return descriptor; - }; -} - -class SomeClass { - @Decorator() - async test() {} -} - -new SomeClass().test(); -new B().method(); diff --git a/cli/tests/testdata/ts_import_from_js.deps.js b/cli/tests/testdata/ts_import_from_js.deps.js deleted file mode 100644 index ef326c444..000000000 --- a/cli/tests/testdata/ts_import_from_js.deps.js +++ /dev/null @@ -1,2 +0,0 @@ -import "./005_more_imports.ts"; -export { printHello } from "http://localhost:4545/subdir/mod2.ts"; diff --git a/cli/tests/testdata/ts_import_from_js.js b/cli/tests/testdata/ts_import_from_js.js deleted file mode 100644 index f912c2723..000000000 --- a/cli/tests/testdata/ts_import_from_js.js +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello } from "./ts_import_from_js.deps.js"; -printHello(); -console.log("success"); diff --git a/cli/tests/testdata/ts_import_from_js.js.out b/cli/tests/testdata/ts_import_from_js.js.out deleted file mode 100644 index e1d7a869f..000000000 --- a/cli/tests/testdata/ts_import_from_js.js.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello -Hello -success diff --git a/cli/tests/testdata/ts_type_imports.ts b/cli/tests/testdata/ts_type_imports.ts deleted file mode 100644 index 73c779156..000000000 --- a/cli/tests/testdata/ts_type_imports.ts +++ /dev/null @@ -1,5 +0,0 @@ -// deno-lint-ignore-file - -type Foo = import("./ts_type_imports_foo.ts").Foo; - -const foo: Foo = new Map(); diff --git a/cli/tests/testdata/ts_type_imports.ts.out b/cli/tests/testdata/ts_type_imports.ts.out deleted file mode 100644 index 3972d6a97..000000000 --- a/cli/tests/testdata/ts_type_imports.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -Check [WILDCARD]ts_type_imports.ts -error: TS2322 [ERROR]: Type 'Map' is not assignable to type 'Foo'. - Type 'string' is not assignable to type 'number'. -const foo: Foo = new Map(); - ~~~ - at [WILDCARD]ts_type_imports.ts:5:7 diff --git a/cli/tests/testdata/ts_type_imports_foo.ts b/cli/tests/testdata/ts_type_imports_foo.ts deleted file mode 100644 index db20773f6..000000000 --- a/cli/tests/testdata/ts_type_imports_foo.ts +++ /dev/null @@ -1 +0,0 @@ -export type Foo = Map; diff --git a/cli/tests/testdata/ts_type_only_import.d.ts b/cli/tests/testdata/ts_type_only_import.d.ts deleted file mode 100644 index d48e4b48a..000000000 --- a/cli/tests/testdata/ts_type_only_import.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface HelloWorld { - a: string; -} diff --git a/cli/tests/testdata/ts_type_only_import.ts b/cli/tests/testdata/ts_type_only_import.ts deleted file mode 100644 index 53e114373..000000000 --- a/cli/tests/testdata/ts_type_only_import.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./ts_type_only_import.d.ts"; diff --git a/cli/tests/testdata/ts_type_only_import.ts.out b/cli/tests/testdata/ts_type_only_import.ts.out deleted file mode 100644 index 42852cd26..000000000 --- a/cli/tests/testdata/ts_type_only_import.ts.out +++ /dev/null @@ -1 +0,0 @@ -Check file://[WILDCARD]/ts_type_only_import.ts diff --git a/cli/tests/testdata/ts_with_generic.ts b/cli/tests/testdata/ts_with_generic.ts deleted file mode 100644 index 1e3591f40..000000000 --- a/cli/tests/testdata/ts_with_generic.ts +++ /dev/null @@ -1,3 +0,0 @@ -// deno-lint-ignore-file - -const foo = { delete() {} }; diff --git a/cli/tests/testdata/tsx_imports.ts b/cli/tests/testdata/tsx_imports.ts deleted file mode 100644 index 44ba10b7a..000000000 --- a/cli/tests/testdata/tsx_imports.ts +++ /dev/null @@ -1 +0,0 @@ -import "./Component.tsx"; diff --git a/cli/tests/testdata/tsx_imports.ts.out b/cli/tests/testdata/tsx_imports.ts.out deleted file mode 100644 index 1f8b10d32..000000000 --- a/cli/tests/testdata/tsx_imports.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Check [WILDCARD]tsx_imports.ts -{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/testdata/type_definitions.ts b/cli/tests/testdata/type_definitions.ts deleted file mode 100644 index a1bb37a65..000000000 --- a/cli/tests/testdata/type_definitions.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file - -// @deno-types="./type_definitions/foo.d.ts" -import { foo } from "./type_definitions/foo.js"; -// @deno-types="./type_definitions/fizz.d.ts" -import "./type_definitions/fizz.js"; - -import * as qat from "./type_definitions/qat.ts"; - -console.log(foo); -console.log(fizz); -console.log(qat.qat); diff --git a/cli/tests/testdata/type_definitions.ts.out b/cli/tests/testdata/type_definitions.ts.out deleted file mode 100644 index b4fa88c50..000000000 --- a/cli/tests/testdata/type_definitions.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]foo -fizz -qat diff --git a/cli/tests/testdata/type_definitions_for_export.ts b/cli/tests/testdata/type_definitions_for_export.ts deleted file mode 100644 index 1f17b4962..000000000 --- a/cli/tests/testdata/type_definitions_for_export.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./export_type_def.ts"; - -function bar(a: number) { - console.log(a); -} - -bar(foo); diff --git a/cli/tests/testdata/type_definitions_for_export.ts.out b/cli/tests/testdata/type_definitions_for_export.ts.out deleted file mode 100644 index 8f1240bc7..000000000 --- a/cli/tests/testdata/type_definitions_for_export.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -Check [WILDCARD]type_definitions_for_export.ts -error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'number'. -bar(foo); - ~~~ - at [WILDCARD]type_definitions_for_export.ts:7:5 diff --git a/cli/tests/testdata/type_directives_01.ts b/cli/tests/testdata/type_directives_01.ts deleted file mode 100644 index 71305824c..000000000 --- a/cli/tests/testdata/type_directives_01.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as foo from "http://127.0.0.1:4545/xTypeScriptTypes.js"; - -console.log(foo.foo); diff --git a/cli/tests/testdata/type_directives_01.ts.out b/cli/tests/testdata/type_directives_01.ts.out deleted file mode 100644 index 77ed3ae26..000000000 --- a/cli/tests/testdata/type_directives_01.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -DEBUG TS - host.getSourceFile("http://127.0.0.1:4545/xTypeScriptTypes.d.ts", Latest) -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/type_directives_02.ts b/cli/tests/testdata/type_directives_02.ts deleted file mode 100644 index f7274bf26..000000000 --- a/cli/tests/testdata/type_directives_02.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as foo from "./subdir/type_reference.js"; - -console.log(foo.foo); diff --git a/cli/tests/testdata/type_directives_02.ts.out b/cli/tests/testdata/type_directives_02.ts.out deleted file mode 100644 index b064483b4..000000000 --- a/cli/tests/testdata/type_directives_02.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -DEBUG TS - host.getSourceFile("file:///[WILDCARD]/subdir/type_reference.d.ts", Latest) -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/type_directives_js_main.js b/cli/tests/testdata/type_directives_js_main.js deleted file mode 100644 index f7274bf26..000000000 --- a/cli/tests/testdata/type_directives_js_main.js +++ /dev/null @@ -1,3 +0,0 @@ -import * as foo from "./subdir/type_reference.js"; - -console.log(foo.foo); diff --git a/cli/tests/testdata/type_directives_js_main.js.out b/cli/tests/testdata/type_directives_js_main.js.out deleted file mode 100644 index 7bca837f0..000000000 --- a/cli/tests/testdata/type_directives_js_main.js.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -DEBUG RS - [WILDCARD] - FileFetcher::fetch() - specifier: file:///[WILDCARD]/subdir/type_reference.d.ts -[WILDCARD] diff --git a/cli/tests/testdata/type_directives_redirect.ts b/cli/tests/testdata/type_directives_redirect.ts deleted file mode 100644 index 1756d5af9..000000000 --- a/cli/tests/testdata/type_directives_redirect.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/type_directives_redirect.js"; diff --git a/cli/tests/testdata/type_directives_redirect.ts.out b/cli/tests/testdata/type_directives_redirect.ts.out deleted file mode 100644 index 471d9c0b4..000000000 --- a/cli/tests/testdata/type_directives_redirect.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -Download [WILDCARD]type_directives_redirect.js -Download [WILDCARD]xTypeScriptTypesRedirect.d.ts -Download [WILDCARD]xTypeScriptTypesRedirect.d.ts -Download [WILDCARD]xTypeScriptTypesRedirected.d.ts -Check [WILDCARD]type_directives_redirect.ts diff --git a/cli/tests/testdata/type_headers_deno_types.ts b/cli/tests/testdata/type_headers_deno_types.ts deleted file mode 100644 index 92391c666..000000000 --- a/cli/tests/testdata/type_headers_deno_types.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Following import uses two distinct ways to provide types: - * - X-TypeScript-Types headers - * - @deno-types directive - * - * Because "@deno-types" directive must be placed by user explicitly it - * should have higher precedence than type header. - * - * This is verified by providing conflicting type declaration - * depending on a way. There should be no TS error, otherwise - * it means that wrong type declarations are used (from X-TypeScript-Types) - * header. - */ - -// @deno-types="http://127.0.0.1:4545/type_headers_deno_types.foo.d.ts" -import { foo } from "http://127.0.0.1:4545/type_headers_deno_types.foo.js"; - -foo("hello"); diff --git a/cli/tests/testdata/type_headers_deno_types.ts.out b/cli/tests/testdata/type_headers_deno_types.ts.out deleted file mode 100644 index f1e4ca1f8..000000000 --- a/cli/tests/testdata/type_headers_deno_types.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -Download http://[WILDCARD]:4545/type_headers_deno_types.foo.js -Download http://[WILDCARD]:4545/type_headers_deno_types.foo.d.ts -Download http://[WILDCARD]:4545/type_headers_deno_types.d.ts -Check [WILDCARD]/type_headers_deno_types.ts -hello diff --git a/cli/tests/testdata/types.out b/cli/tests/testdata/types.out deleted file mode 100644 index 089a9381f..000000000 --- a/cli/tests/testdata/types.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -declare namespace Deno [WILDCARD] -declare var window: Window [WILDCARD] diff --git a/cli/tests/testdata/types/types.out b/cli/tests/testdata/types/types.out new file mode 100644 index 000000000..089a9381f --- /dev/null +++ b/cli/tests/testdata/types/types.out @@ -0,0 +1,3 @@ +[WILDCARD] +declare namespace Deno [WILDCARD] +declare var window: Window [WILDCARD] diff --git a/cli/tests/testdata/unbuffered_stderr.ts b/cli/tests/testdata/unbuffered_stderr.ts deleted file mode 100644 index 0f1d2a999..000000000 --- a/cli/tests/testdata/unbuffered_stderr.ts +++ /dev/null @@ -1 +0,0 @@ -Deno.stderr.write(new TextEncoder().encode("x")); diff --git a/cli/tests/testdata/unbuffered_stderr.ts.out b/cli/tests/testdata/unbuffered_stderr.ts.out deleted file mode 100644 index 500019738..000000000 --- a/cli/tests/testdata/unbuffered_stderr.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -x \ No newline at end of file diff --git a/cli/tests/testdata/unbuffered_stdout.ts b/cli/tests/testdata/unbuffered_stdout.ts deleted file mode 100644 index 9f1e07a97..000000000 --- a/cli/tests/testdata/unbuffered_stdout.ts +++ /dev/null @@ -1 +0,0 @@ -Deno.stdout.write(new TextEncoder().encode("a")); diff --git a/cli/tests/testdata/unbuffered_stdout.ts.out b/cli/tests/testdata/unbuffered_stdout.ts.out deleted file mode 100644 index 2e65efe2a..000000000 --- a/cli/tests/testdata/unbuffered_stdout.ts.out +++ /dev/null @@ -1 +0,0 @@ -a \ No newline at end of file diff --git a/cli/tests/testdata/unhandled_rejection.ts b/cli/tests/testdata/unhandled_rejection.ts deleted file mode 100644 index 388583434..000000000 --- a/cli/tests/testdata/unhandled_rejection.ts +++ /dev/null @@ -1,13 +0,0 @@ -globalThis.addEventListener("unhandledrejection", (e) => { - console.log("unhandled rejection at:", e.promise, "reason:", e.reason); - e.preventDefault(); -}); - -class Foo { - constructor() { - Promise.reject(new Error("bar not available")); - } -} - -new Foo(); -Promise.reject(); diff --git a/cli/tests/testdata/unhandled_rejection.ts.out b/cli/tests/testdata/unhandled_rejection.ts.out deleted file mode 100644 index 6addab20a..000000000 --- a/cli/tests/testdata/unhandled_rejection.ts.out +++ /dev/null @@ -1,9 +0,0 @@ -[WILDCARD] -unhandled rejection at: Promise { - Error: bar not available - at new Foo (file:///[WILDCARD]/testdata/unhandled_rejection.ts:8:20) - at file:///[WILDCARD]/testdata/unhandled_rejection.ts:12:1 -} reason: Error: bar not available - at new Foo (file:///[WILDCARD]/testdata/unhandled_rejection.ts:8:20) - at file:///[WILDCARD]/testdata/unhandled_rejection.ts:12:1 -unhandled rejection at: Promise { undefined } reason: undefined diff --git a/cli/tests/testdata/unhandled_rejection_sync_error.ts b/cli/tests/testdata/unhandled_rejection_sync_error.ts deleted file mode 100644 index 0dabb1cb7..000000000 --- a/cli/tests/testdata/unhandled_rejection_sync_error.ts +++ /dev/null @@ -1,6 +0,0 @@ -globalThis.addEventListener("unhandledrejection", (e) => { - console.log("unhandled rejection at:", e.promise, "reason:", e.reason); - e.preventDefault(); -}); - -throw new Error("boom!"); diff --git a/cli/tests/testdata/unhandled_rejection_sync_error.ts.out b/cli/tests/testdata/unhandled_rejection_sync_error.ts.out deleted file mode 100644 index 270319824..000000000 --- a/cli/tests/testdata/unhandled_rejection_sync_error.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD] -unhandled rejection at: Promise { - Error: boom! - at file:///[WILDCARD]testdata/unhandled_rejection_sync_error.ts:6:7 -} reason: Error: boom! - at file:///[WILDCARD]testdata/unhandled_rejection_sync_error.ts:6:7 diff --git a/cli/tests/testdata/unreachable.wasm b/cli/tests/testdata/unreachable.wasm deleted file mode 100644 index a4110ee39..000000000 Binary files a/cli/tests/testdata/unreachable.wasm and /dev/null differ diff --git a/cli/tests/testdata/unstable.js b/cli/tests/testdata/unstable.js deleted file mode 100644 index a9894be3e..000000000 --- a/cli/tests/testdata/unstable.js +++ /dev/null @@ -1 +0,0 @@ -console.log(Deno.loadavg); diff --git a/cli/tests/testdata/unstable.ts b/cli/tests/testdata/unstable.ts deleted file mode 100644 index a9894be3e..000000000 --- a/cli/tests/testdata/unstable.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(Deno.loadavg); diff --git a/cli/tests/testdata/unstable_disabled.out b/cli/tests/testdata/unstable_disabled.out deleted file mode 100644 index 28659645d..000000000 --- a/cli/tests/testdata/unstable_disabled.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD] -error: TS2339 [ERROR]: Property 'loadavg' does not exist on type 'typeof Deno'. 'Deno.loadavg' is an unstable API. Did you forget to run with the '--unstable' flag? -console.log(Deno.loadavg); - ~~~~~~~ - at [WILDCARD]/unstable.ts:1:18 diff --git a/cli/tests/testdata/unstable_disabled_js.out b/cli/tests/testdata/unstable_disabled_js.out deleted file mode 100644 index 417b7b537..000000000 --- a/cli/tests/testdata/unstable_disabled_js.out +++ /dev/null @@ -1 +0,0 @@ -undefined diff --git a/cli/tests/testdata/unstable_enabled.out b/cli/tests/testdata/unstable_enabled.out deleted file mode 100644 index b4cedce14..000000000 --- a/cli/tests/testdata/unstable_enabled.out +++ /dev/null @@ -1 +0,0 @@ -[Function: loadavg] diff --git a/cli/tests/testdata/unstable_enabled_js.out b/cli/tests/testdata/unstable_enabled_js.out deleted file mode 100644 index b4cedce14..000000000 --- a/cli/tests/testdata/unstable_enabled_js.out +++ /dev/null @@ -1 +0,0 @@ -[Function: loadavg] diff --git a/cli/tests/testdata/unstable_ffi_1.js b/cli/tests/testdata/unstable_ffi_1.js deleted file mode 100644 index 8ca6c3a60..000000000 --- a/cli/tests/testdata/unstable_ffi_1.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_load({ path: "", symbols: {} }); diff --git a/cli/tests/testdata/unstable_ffi_1.js.out b/cli/tests/testdata/unstable_ffi_1.js.out deleted file mode 100644 index 7c564be8c..000000000 --- a/cli/tests/testdata/unstable_ffi_1.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.dlopen'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_10.js b/cli/tests/testdata/unstable_ffi_10.js deleted file mode 100644 index 83687c584..000000000 --- a/cli/tests/testdata/unstable_ffi_10.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_read_i16(0n); diff --git a/cli/tests/testdata/unstable_ffi_10.js.out b/cli/tests/testdata/unstable_ffi_10.js.out deleted file mode 100644 index bf7e1bd4f..000000000 --- a/cli/tests/testdata/unstable_ffi_10.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#getInt16'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_11.js b/cli/tests/testdata/unstable_ffi_11.js deleted file mode 100644 index 5538753be..000000000 --- a/cli/tests/testdata/unstable_ffi_11.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_read_u32(0n); diff --git a/cli/tests/testdata/unstable_ffi_11.js.out b/cli/tests/testdata/unstable_ffi_11.js.out deleted file mode 100644 index 2d2d72666..000000000 --- a/cli/tests/testdata/unstable_ffi_11.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#getUint32'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_12.js b/cli/tests/testdata/unstable_ffi_12.js deleted file mode 100644 index 089c9b5b1..000000000 --- a/cli/tests/testdata/unstable_ffi_12.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_read_i32(0n); diff --git a/cli/tests/testdata/unstable_ffi_12.js.out b/cli/tests/testdata/unstable_ffi_12.js.out deleted file mode 100644 index 377d8e4a5..000000000 --- a/cli/tests/testdata/unstable_ffi_12.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#getInt32'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_13.js b/cli/tests/testdata/unstable_ffi_13.js deleted file mode 100644 index 630be2e6d..000000000 --- a/cli/tests/testdata/unstable_ffi_13.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_read_u64(0n); diff --git a/cli/tests/testdata/unstable_ffi_13.js.out b/cli/tests/testdata/unstable_ffi_13.js.out deleted file mode 100644 index 6ca67a6f2..000000000 --- a/cli/tests/testdata/unstable_ffi_13.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#getBigUint64'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_14.js b/cli/tests/testdata/unstable_ffi_14.js deleted file mode 100644 index b04c7865e..000000000 --- a/cli/tests/testdata/unstable_ffi_14.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_read_f32(0n); diff --git a/cli/tests/testdata/unstable_ffi_14.js.out b/cli/tests/testdata/unstable_ffi_14.js.out deleted file mode 100644 index 11fcd5580..000000000 --- a/cli/tests/testdata/unstable_ffi_14.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#getFloat32'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_15.js b/cli/tests/testdata/unstable_ffi_15.js deleted file mode 100644 index 865f63c75..000000000 --- a/cli/tests/testdata/unstable_ffi_15.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_read_f64(0n); diff --git a/cli/tests/testdata/unstable_ffi_15.js.out b/cli/tests/testdata/unstable_ffi_15.js.out deleted file mode 100644 index 3015e5c91..000000000 --- a/cli/tests/testdata/unstable_ffi_15.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#getFloat64'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_2.js b/cli/tests/testdata/unstable_ffi_2.js deleted file mode 100644 index 7f3f34f37..000000000 --- a/cli/tests/testdata/unstable_ffi_2.js +++ /dev/null @@ -1,5 +0,0 @@ -Deno.core.ops.op_ffi_call_ptr(0n, { - name: null, - parameters: [], - result: "void", -}, []); diff --git a/cli/tests/testdata/unstable_ffi_2.js.out b/cli/tests/testdata/unstable_ffi_2.js.out deleted file mode 100644 index cc4cc3dc6..000000000 --- a/cli/tests/testdata/unstable_ffi_2.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafeFnPointer#call'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_3.js b/cli/tests/testdata/unstable_ffi_3.js deleted file mode 100644 index a8f7f4180..000000000 --- a/cli/tests/testdata/unstable_ffi_3.js +++ /dev/null @@ -1,5 +0,0 @@ -Deno.core.opAsync("op_ffi_call_ptr_nonblocking", 0n, { - name: null, - parameters: [], - result: "void", -}, []); diff --git a/cli/tests/testdata/unstable_ffi_3.js.out b/cli/tests/testdata/unstable_ffi_3.js.out deleted file mode 100644 index cc4cc3dc6..000000000 --- a/cli/tests/testdata/unstable_ffi_3.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafeFnPointer#call'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_4.js b/cli/tests/testdata/unstable_ffi_4.js deleted file mode 100644 index 8b4f3d75a..000000000 --- a/cli/tests/testdata/unstable_ffi_4.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_ptr_of(new Uint8Array(0)); diff --git a/cli/tests/testdata/unstable_ffi_4.js.out b/cli/tests/testdata/unstable_ffi_4.js.out deleted file mode 100644 index e0f40f2ee..000000000 --- a/cli/tests/testdata/unstable_ffi_4.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointer#of'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_5.js b/cli/tests/testdata/unstable_ffi_5.js deleted file mode 100644 index d08d8eaa4..000000000 --- a/cli/tests/testdata/unstable_ffi_5.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_buf_copy_into(0n, new Uint8Array(0), 0); diff --git a/cli/tests/testdata/unstable_ffi_5.js.out b/cli/tests/testdata/unstable_ffi_5.js.out deleted file mode 100644 index e3db6af26..000000000 --- a/cli/tests/testdata/unstable_ffi_5.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#copyInto'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_6.js b/cli/tests/testdata/unstable_ffi_6.js deleted file mode 100644 index 9e4f1c761..000000000 --- a/cli/tests/testdata/unstable_ffi_6.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_cstr_read(0n); diff --git a/cli/tests/testdata/unstable_ffi_6.js.out b/cli/tests/testdata/unstable_ffi_6.js.out deleted file mode 100644 index c59f51d04..000000000 --- a/cli/tests/testdata/unstable_ffi_6.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#getCString'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_7.js b/cli/tests/testdata/unstable_ffi_7.js deleted file mode 100644 index 96e60f377..000000000 --- a/cli/tests/testdata/unstable_ffi_7.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_read_u8(0n); diff --git a/cli/tests/testdata/unstable_ffi_7.js.out b/cli/tests/testdata/unstable_ffi_7.js.out deleted file mode 100644 index 6ab413537..000000000 --- a/cli/tests/testdata/unstable_ffi_7.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#getUint8'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_8.js b/cli/tests/testdata/unstable_ffi_8.js deleted file mode 100644 index 187b83891..000000000 --- a/cli/tests/testdata/unstable_ffi_8.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_read_i8(0n); diff --git a/cli/tests/testdata/unstable_ffi_8.js.out b/cli/tests/testdata/unstable_ffi_8.js.out deleted file mode 100644 index 338db2631..000000000 --- a/cli/tests/testdata/unstable_ffi_8.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#getInt8'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_ffi_9.js b/cli/tests/testdata/unstable_ffi_9.js deleted file mode 100644 index e968e534c..000000000 --- a/cli/tests/testdata/unstable_ffi_9.js +++ /dev/null @@ -1 +0,0 @@ -Deno.core.ops.op_ffi_read_u16(0n); diff --git a/cli/tests/testdata/unstable_ffi_9.js.out b/cli/tests/testdata/unstable_ffi_9.js.out deleted file mode 100644 index fb6d75f14..000000000 --- a/cli/tests/testdata/unstable_ffi_9.js.out +++ /dev/null @@ -1 +0,0 @@ -Unstable API 'Deno.UnsafePointerView#getUint16'. The --unstable flag must be provided. diff --git a/cli/tests/testdata/unstable_worker.ts b/cli/tests/testdata/unstable_worker.ts deleted file mode 100644 index f96de6c4a..000000000 --- a/cli/tests/testdata/unstable_worker.ts +++ /dev/null @@ -1,6 +0,0 @@ -const w = new Worker( - import.meta.resolve("./workers/worker_unstable.ts"), - { type: "module", name: "Unstable Worker" }, -); - -w.postMessage({}); diff --git a/cli/tests/testdata/unstable_worker.ts.out b/cli/tests/testdata/unstable_worker.ts.out deleted file mode 100644 index b40bdfeb8..000000000 --- a/cli/tests/testdata/unstable_worker.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[Function: query] -[Function: setRaw] diff --git a/cli/tests/testdata/unsupported_dynamic_import_scheme.out b/cli/tests/testdata/unsupported_dynamic_import_scheme.out deleted file mode 100644 index c708fced4..000000000 --- a/cli/tests/testdata/unsupported_dynamic_import_scheme.out +++ /dev/null @@ -1,7 +0,0 @@ -error: Uncaught (in promise) TypeError: Unsupported scheme "xxx" for module "xxx:". Supported schemes: [ - "data", - "blob", - "file", - "http", - "https", -] diff --git a/cli/tests/testdata/v8_flags.js b/cli/tests/testdata/v8_flags.js deleted file mode 100644 index f7999c4af..000000000 --- a/cli/tests/testdata/v8_flags.js +++ /dev/null @@ -1 +0,0 @@ -console.log(typeof gc); diff --git a/cli/tests/testdata/v8_flags.js.out b/cli/tests/testdata/v8_flags.js.out deleted file mode 100644 index e2dbde096..000000000 --- a/cli/tests/testdata/v8_flags.js.out +++ /dev/null @@ -1 +0,0 @@ -function diff --git a/cli/tests/testdata/v8_flags_unrecognized.out b/cli/tests/testdata/v8_flags_unrecognized.out deleted file mode 100644 index 56e70f830..000000000 --- a/cli/tests/testdata/v8_flags_unrecognized.out +++ /dev/null @@ -1,5 +0,0 @@ -error: V8 did not recognize flag '--foo' -error: V8 did not recognize flag 'bar' -error: V8 did not recognize flag '-baz' - -For a list of V8 flags, use '--v8-flags=--help' diff --git a/cli/tests/testdata/v8_help.out b/cli/tests/testdata/v8_help.out deleted file mode 100644 index 006d73557..000000000 --- a/cli/tests/testdata/v8_help.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -Options: -[WILDCARD] - --trace-gc [WILDCARD] diff --git a/cli/tests/testdata/wasm.ts b/cli/tests/testdata/wasm.ts deleted file mode 100644 index 96b5fdffc..000000000 --- a/cli/tests/testdata/wasm.ts +++ /dev/null @@ -1,16 +0,0 @@ -// deno-fmt-ignore -const wasmCode = new Uint8Array([ - 0, 97, 115, 109, 1, 0, 0, 0, 1, 133, 128, 128, 128, 0, 1, 96, 0, 1, 127, - 3, 130, 128, 128, 128, 0, 1, 0, 4, 132, 128, 128, 128, 0, 1, 112, 0, 0, - 5, 131, 128, 128, 128, 0, 1, 0, 1, 6, 129, 128, 128, 128, 0, 0, 7, 145, - 128, 128, 128, 0, 2, 6, 109, 101, 109, 111, 114, 121, 2, 0, 4, 109, 97, - 105, 110, 0, 0, 10, 138, 128, 128, 128, 0, 1, 132, 128, 128, 128, 0, 0, - 65, 42, 11 - ]); - -const wasmModule = new WebAssembly.Module(wasmCode); - -const wasmInstance = new WebAssembly.Instance(wasmModule); - -const main = wasmInstance.exports.main as CallableFunction; -console.log(main().toString()); diff --git a/cli/tests/testdata/wasm.ts.out b/cli/tests/testdata/wasm.ts.out deleted file mode 100644 index d81cc0710..000000000 --- a/cli/tests/testdata/wasm.ts.out +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/cli/tests/testdata/wasm_async.js b/cli/tests/testdata/wasm_async.js deleted file mode 100644 index 837460ae9..000000000 --- a/cli/tests/testdata/wasm_async.js +++ /dev/null @@ -1,27 +0,0 @@ -// The following blob can be created by taking the following s-expr and pass -// it through wat2wasm. -// (module -// (func $add (param $a i32) (param $b i32) (result i32) -// local.get $a -// local.get $b -// i32.add) -// (export "add" (func $add)) -// ) -// deno-fmt-ignore -const bytes = new Uint8Array([ - 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, 0x60, - 0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x07, 0x01, - 0x03, 0x61, 0x64, 0x64, 0x00, 0x00, 0x0a, 0x09, 0x01, 0x07, 0x00, 0x20, - 0x00, 0x20, 0x01, 0x6a, 0x0b -]); - -async function main() { - const wasm = await WebAssembly.instantiate(bytes); - const result = wasm.instance.exports.add(1, 3); - console.log("1 + 3 =", result); - if (result != 4) { - throw Error("bad"); - } -} - -main(); diff --git a/cli/tests/testdata/wasm_async.out b/cli/tests/testdata/wasm_async.out deleted file mode 100644 index 5cdf17de7..000000000 --- a/cli/tests/testdata/wasm_async.out +++ /dev/null @@ -1 +0,0 @@ -1 + 3 = 4 diff --git a/cli/tests/testdata/wasm_shared.out b/cli/tests/testdata/wasm_shared.out deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/testdata/wasm_shared.ts b/cli/tests/testdata/wasm_shared.ts deleted file mode 100644 index b713385d5..000000000 --- a/cli/tests/testdata/wasm_shared.ts +++ /dev/null @@ -1,6 +0,0 @@ -const memory = new WebAssembly.Memory({ - initial: 1, - maximum: 10, - shared: true, -}); -console.assert(memory.buffer instanceof SharedArrayBuffer); diff --git a/cli/tests/testdata/wasm_streaming_panic_test.js b/cli/tests/testdata/wasm_streaming_panic_test.js deleted file mode 100644 index ec017592f..000000000 --- a/cli/tests/testdata/wasm_streaming_panic_test.js +++ /dev/null @@ -1,3 +0,0 @@ -// https://github.com/denoland/deno/issues/13917 - -WebAssembly.instantiateStreaming(Response.error()); diff --git a/cli/tests/testdata/wasm_streaming_panic_test.js.out b/cli/tests/testdata/wasm_streaming_panic_test.js.out deleted file mode 100644 index 3e93f643a..000000000 --- a/cli/tests/testdata/wasm_streaming_panic_test.js.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Uncaught (in promise) TypeError: Invalid WebAssembly content type. - at handleWasmStreaming (deno:ext/fetch/26_fetch.js:[WILDCARD]) diff --git a/cli/tests/testdata/wasm_unreachable.js b/cli/tests/testdata/wasm_unreachable.js deleted file mode 100644 index 36aab0d84..000000000 --- a/cli/tests/testdata/wasm_unreachable.js +++ /dev/null @@ -1,9 +0,0 @@ -// WebAssembly module containing a single function with an unreachable instruction -const binary = await Deno.readFile("./unreachable.wasm"); - -const module = new WebAssembly.Module(binary); -const instance = new WebAssembly.Instance(module); - -// Compare the stack trace with wasm_url.js, which compiles the WASM module with -// streaming APIs. -instance.exports.unreachable(); diff --git a/cli/tests/testdata/wasm_unreachable.out b/cli/tests/testdata/wasm_unreachable.out deleted file mode 100644 index c213097ab..000000000 --- a/cli/tests/testdata/wasm_unreachable.out +++ /dev/null @@ -1,3 +0,0 @@ -error: Uncaught[WILDCARD] RuntimeError: unreachable - at (wasm://wasm/d1c677ea:1:41) - at [WILDCARD]/wasm_unreachable.js:[WILDCARD] diff --git a/cli/tests/testdata/wasm_url.js b/cli/tests/testdata/wasm_url.js deleted file mode 100644 index bb7ccd73d..000000000 --- a/cli/tests/testdata/wasm_url.js +++ /dev/null @@ -1,8 +0,0 @@ -const module = await WebAssembly.compileStreaming( - fetch("http://localhost:4545/unreachable.wasm"), -); -const instance = new WebAssembly.Instance(module); - -// Compare the stack trace with wasm_unreachable.js, which compiles the WASM -// module with synchronous APIs. -instance.exports.unreachable(); diff --git a/cli/tests/testdata/wasm_url.out b/cli/tests/testdata/wasm_url.out deleted file mode 100644 index c88b51020..000000000 --- a/cli/tests/testdata/wasm_url.out +++ /dev/null @@ -1,3 +0,0 @@ -error: Uncaught (in promise) RuntimeError: unreachable - at (http://localhost:4545/unreachable.wasm:1:41) - at [WILDCARD]/wasm_url.js:[WILDCARD] diff --git a/cli/tests/testdata/weakref.ts b/cli/tests/testdata/weakref.ts deleted file mode 100644 index 47c3985fe..000000000 --- a/cli/tests/testdata/weakref.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(WeakRef, FinalizationRegistry); diff --git a/cli/tests/testdata/weakref.ts.out b/cli/tests/testdata/weakref.ts.out deleted file mode 100644 index 32bafcf2d..000000000 --- a/cli/tests/testdata/weakref.ts.out +++ /dev/null @@ -1 +0,0 @@ -[Function: WeakRef] [Function: FinalizationRegistry] diff --git a/cli/tests/testdata/webgpu/computepass_shader.wgsl b/cli/tests/testdata/webgpu/computepass_shader.wgsl new file mode 100644 index 000000000..41af4363a --- /dev/null +++ b/cli/tests/testdata/webgpu/computepass_shader.wgsl @@ -0,0 +1,38 @@ +@group(0) +@binding(0) +var v_indices: array; // this is used as both input and output for convenience + +// The Collatz Conjecture states that for any integer n: +// If n is even, n = n/2 +// If n is odd, n = 3n+1 +// And repeat this process for each new n, you will always eventually reach 1. +// Though the conjecture has not been proven, no counterexample has ever been found. +// This function returns how many times this recurrence needs to be applied to reach 1. +fn collatz_iterations(n_base: u32) -> u32{ + var n: u32 = n_base; + var i: u32 = 0u; + loop { + if (n <= 1u) { + break; + } + if (n % 2u == 0u) { + n = n / 2u; + } + else { + // Overflow? (i.e. 3*n + 1 > 0xffffffffu?) + if (n >= 1431655765u) { // 0x55555555u + return 4294967295u; // 0xffffffffu + } + + n = 3u * n + 1u; + } + i = i + 1u; + } + return i; +} + +@compute +@workgroup_size(1) +fn main(@builtin(global_invocation_id) global_id: vec3) { + v_indices[global_id.x] = collatz_iterations(v_indices[global_id.x]); +} diff --git a/cli/tests/testdata/webgpu/hellotriangle.out b/cli/tests/testdata/webgpu/hellotriangle.out new file mode 100644 index 000000000..91454dbfc Binary files /dev/null and b/cli/tests/testdata/webgpu/hellotriangle.out differ diff --git a/cli/tests/testdata/webgpu/hellotriangle_shader.wgsl b/cli/tests/testdata/webgpu/hellotriangle_shader.wgsl new file mode 100644 index 000000000..f84ccfe94 --- /dev/null +++ b/cli/tests/testdata/webgpu/hellotriangle_shader.wgsl @@ -0,0 +1,11 @@ +@vertex +fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4 { + let x = f32(i32(in_vertex_index) - 1); + let y = f32(i32(in_vertex_index & 1u) * 2 - 1); + return vec4(x, y, 0.0, 1.0); +} + +@fragment +fn fs_main() -> @location(0) vec4 { + return vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/cli/tests/testdata/webgpu_computepass_shader.wgsl b/cli/tests/testdata/webgpu_computepass_shader.wgsl deleted file mode 100644 index 41af4363a..000000000 --- a/cli/tests/testdata/webgpu_computepass_shader.wgsl +++ /dev/null @@ -1,38 +0,0 @@ -@group(0) -@binding(0) -var v_indices: array; // this is used as both input and output for convenience - -// The Collatz Conjecture states that for any integer n: -// If n is even, n = n/2 -// If n is odd, n = 3n+1 -// And repeat this process for each new n, you will always eventually reach 1. -// Though the conjecture has not been proven, no counterexample has ever been found. -// This function returns how many times this recurrence needs to be applied to reach 1. -fn collatz_iterations(n_base: u32) -> u32{ - var n: u32 = n_base; - var i: u32 = 0u; - loop { - if (n <= 1u) { - break; - } - if (n % 2u == 0u) { - n = n / 2u; - } - else { - // Overflow? (i.e. 3*n + 1 > 0xffffffffu?) - if (n >= 1431655765u) { // 0x55555555u - return 4294967295u; // 0xffffffffu - } - - n = 3u * n + 1u; - } - i = i + 1u; - } - return i; -} - -@compute -@workgroup_size(1) -fn main(@builtin(global_invocation_id) global_id: vec3) { - v_indices[global_id.x] = collatz_iterations(v_indices[global_id.x]); -} diff --git a/cli/tests/testdata/webgpu_hellotriangle.out b/cli/tests/testdata/webgpu_hellotriangle.out deleted file mode 100644 index 91454dbfc..000000000 Binary files a/cli/tests/testdata/webgpu_hellotriangle.out and /dev/null differ diff --git a/cli/tests/testdata/webgpu_hellotriangle_shader.wgsl b/cli/tests/testdata/webgpu_hellotriangle_shader.wgsl deleted file mode 100644 index f84ccfe94..000000000 --- a/cli/tests/testdata/webgpu_hellotriangle_shader.wgsl +++ /dev/null @@ -1,11 +0,0 @@ -@vertex -fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4 { - let x = f32(i32(in_vertex_index) - 1); - let y = f32(i32(in_vertex_index & 1u) * 2 - 1); - return vec4(x, y, 0.0, 1.0); -} - -@fragment -fn fs_main() -> @location(0) vec4 { - return vec4(1.0, 0.0, 0.0, 1.0); -} diff --git a/cli/tests/testdata/websocket_server_idletimeout.ts b/cli/tests/testdata/websocket_server_idletimeout.ts deleted file mode 100644 index 9ae6698cb..000000000 --- a/cli/tests/testdata/websocket_server_idletimeout.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { assertEquals } from "../../../test_util/std/testing/asserts.ts"; -import { deferred } from "../../../test_util/std/async/deferred.ts"; - -const errorDeferred = deferred(); -const closeDeferred = deferred(); - -const listener = Deno.listen({ port: 4509 }); -console.log("READY"); -const httpConn = Deno.serveHttp(await listener.accept()); -const { request, respondWith } = (await httpConn.nextRequest())!; -const { response, socket } = Deno.upgradeWebSocket(request, { - idleTimeout: 1, -}); -socket.onerror = (e) => { - assertEquals((e as ErrorEvent).message, "No response from ping frame."); - errorDeferred.resolve(); -}; -socket.onclose = (e) => { - assertEquals(e.reason, "No response from ping frame."); - closeDeferred.resolve(); -}; -await respondWith(response); - -await errorDeferred; -await closeDeferred; -listener.close(); diff --git a/cli/tests/testdata/websocket_server_multi_field_connection_header_test.ts b/cli/tests/testdata/websocket_server_multi_field_connection_header_test.ts deleted file mode 100644 index a662ce9ef..000000000 --- a/cli/tests/testdata/websocket_server_multi_field_connection_header_test.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { deferred } from "../unit/test_util.ts"; - -const promise = deferred(); -const listener = Deno.listen({ port: 4319 }); -console.log("READY"); -const conn = await listener.accept(); -const httpConn = Deno.serveHttp(conn); -const { request, respondWith } = (await httpConn.nextRequest())!; -const { - response, - socket, -} = Deno.upgradeWebSocket(request); -socket.onerror = () => Deno.exit(1); -socket.onopen = () => socket.close(); -socket.onclose = () => promise.resolve(); -await respondWith(response); -await promise; diff --git a/cli/tests/testdata/websocket_test.ts b/cli/tests/testdata/websocket_test.ts deleted file mode 100644 index 1572e0e67..000000000 --- a/cli/tests/testdata/websocket_test.ts +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -import { - assert, - assertEquals, - assertThrows, - fail, -} from "../../../test_util/std/testing/asserts.ts"; -import { deferred } from "../../../test_util/std/async/deferred.ts"; - -Deno.test("invalid scheme", () => { - assertThrows(() => new WebSocket("foo://localhost:4242")); -}); - -Deno.test("fragment", () => { - assertThrows(() => new WebSocket("ws://localhost:4242/#")); - assertThrows(() => new WebSocket("ws://localhost:4242/#foo")); -}); - -Deno.test("duplicate protocols", () => { - assertThrows(() => new WebSocket("ws://localhost:4242", ["foo", "foo"])); -}); - -Deno.test("invalid server", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:2121"); - let err = false; - ws.onerror = () => { - err = true; - }; - ws.onclose = () => { - if (err) { - promise.resolve(); - } else { - fail(); - } - }; - ws.onopen = () => fail(); - await promise; -}); - -Deno.test("connect & close", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => { - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("connect & abort", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.close(); - let err = false; - ws.onerror = () => { - err = true; - }; - ws.onclose = () => { - if (err) { - promise.resolve(); - } else { - fail(); - } - }; - ws.onopen = () => fail(); - await promise; -}); - -Deno.test("connect & close custom valid code", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => ws.close(1000); - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("connect & close custom invalid code", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => { - assertThrows(() => ws.close(1001)); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("connect & close custom valid reason", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => ws.close(1000, "foo"); - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("connect & close custom invalid reason", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => { - assertThrows(() => ws.close(1000, "".padEnd(124, "o"))); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo string", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => ws.send("foo"); - ws.onmessage = (e) => { - assertEquals(e.data, "foo"); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo string tls", async () => { - const promise1 = deferred(); - const promise2 = deferred(); - const ws = new WebSocket("wss://localhost:4243"); - ws.onerror = () => fail(); - ws.onopen = () => ws.send("foo"); - ws.onmessage = (e) => { - assertEquals(e.data, "foo"); - ws.close(); - promise1.resolve(); - }; - ws.onclose = () => { - promise2.resolve(); - }; - await promise1; - await promise2; -}); - -Deno.test("websocket error", async () => { - const promise1 = deferred(); - const ws = new WebSocket("wss://localhost:4242"); - ws.onopen = () => fail(); - ws.onerror = (err) => { - assert(err instanceof ErrorEvent); - - // Error message got changed because we don't use warp in test_util - assertEquals(err.message, "UnexpectedEof: tls handshake eof"); - promise1.resolve(); - }; - await promise1; -}); - -Deno.test("echo blob with binaryType blob", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - const blob = new Blob(["foo"]); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(blob); - ws.onmessage = (e) => { - e.data.text().then((actual: string) => { - blob.text().then((expected) => { - assertEquals(actual, expected); - }); - }); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo blob with binaryType arraybuffer", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.binaryType = "arraybuffer"; - const blob = new Blob(["foo"]); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(blob); - ws.onmessage = (e) => { - blob.arrayBuffer().then((expected) => { - assertEquals(e.data, expected); - }); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo uint8array with binaryType blob", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - const uint = new Uint8Array([102, 111, 111]); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(uint); - ws.onmessage = (e) => { - e.data.arrayBuffer().then((actual: ArrayBuffer) => { - assertEquals(actual, uint.buffer); - }); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo uint8array with binaryType arraybuffer", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.binaryType = "arraybuffer"; - const uint = new Uint8Array([102, 111, 111]); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(uint); - ws.onmessage = (e) => { - assertEquals(e.data, uint.buffer); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo arraybuffer with binaryType blob", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - const buffer = new ArrayBuffer(3); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(buffer); - ws.onmessage = (e) => { - e.data.arrayBuffer().then((actual: ArrayBuffer) => { - assertEquals(actual, buffer); - }); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo arraybuffer with binaryType arraybuffer", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.binaryType = "arraybuffer"; - const buffer = new ArrayBuffer(3); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(buffer); - ws.onmessage = (e) => { - assertEquals(e.data, buffer); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("Event Handlers order", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - const arr: number[] = []; - ws.onerror = () => fail(); - ws.addEventListener("message", () => arr.push(1)); - ws.onmessage = () => fail(); - ws.addEventListener("message", () => { - arr.push(3); - ws.close(); - assertEquals(arr, [1, 2, 3]); - }); - ws.onmessage = () => arr.push(2); - ws.onopen = () => ws.send("Echo"); - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("Close without frame", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4244"); - ws.onerror = () => fail(); - ws.onclose = (e) => { - assertEquals(e.code, 1005); - promise.resolve(); - }; - await promise; -}); diff --git a/cli/tests/testdata/websocketstream_ping_test.ts b/cli/tests/testdata/websocketstream_ping_test.ts deleted file mode 100644 index 12f847cd8..000000000 --- a/cli/tests/testdata/websocketstream_ping_test.ts +++ /dev/null @@ -1,5 +0,0 @@ -const wss = new WebSocketStream("ws://127.0.0.1:4513"); -const { readable } = await wss.connection; -for await (const _ of readable) { - // -} diff --git a/cli/tests/testdata/websocketstream_test.ts b/cli/tests/testdata/websocketstream_test.ts deleted file mode 100644 index 71969314e..000000000 --- a/cli/tests/testdata/websocketstream_test.ts +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. - -import { - assert, - assertEquals, - assertNotEquals, - assertRejects, - assertThrows, - unreachable, -} from "../../../test_util/std/testing/asserts.ts"; - -Deno.test("fragment", () => { - assertThrows(() => new WebSocketStream("ws://localhost:4242/#")); - assertThrows(() => new WebSocketStream("ws://localhost:4242/#foo")); -}); - -Deno.test("duplicate protocols", () => { - assertThrows(() => - new WebSocketStream("ws://localhost:4242", { - protocols: ["foo", "foo"], - }) - ); -}); - -Deno.test("connect & close custom valid code", async () => { - const ws = new WebSocketStream("ws://localhost:4242"); - await ws.connection; - ws.close({ code: 1000 }); - await ws.closed; -}); - -Deno.test("connect & close custom invalid reason", async () => { - const ws = new WebSocketStream("ws://localhost:4242"); - await ws.connection; - assertThrows(() => ws.close({ code: 1000, reason: "".padEnd(124, "o") })); - ws.close(); - await ws.closed; -}); - -Deno.test("echo string", async () => { - const ws = new WebSocketStream("ws://localhost:4242"); - const { readable, writable } = await ws.connection; - await writable.getWriter().write("foo"); - const res = await readable.getReader().read(); - assertEquals(res.value, "foo"); - ws.close(); - await ws.closed; -}); - -Deno.test("echo string tls", async () => { - const ws = new WebSocketStream("wss://localhost:4243"); - const { readable, writable } = await ws.connection; - await writable.getWriter().write("foo"); - const res = await readable.getReader().read(); - assertEquals(res.value, "foo"); - ws.close(); - await ws.closed; -}); - -Deno.test("websocket error", async () => { - const ws = new WebSocketStream("wss://localhost:4242"); - await Promise.all([ - assertRejects( - () => ws.connection, - Deno.errors.UnexpectedEof, - "tls handshake eof", - ), - assertRejects( - () => ws.closed, - Deno.errors.UnexpectedEof, - "tls handshake eof", - ), - ]); -}); - -Deno.test("echo uint8array", async () => { - const ws = new WebSocketStream("ws://localhost:4242"); - const { readable, writable } = await ws.connection; - const uint = new Uint8Array([102, 111, 111]); - await writable.getWriter().write(uint); - const res = await readable.getReader().read(); - assertEquals(res.value, uint); - ws.close(); - await ws.closed; -}); - -Deno.test("aborting immediately throws an AbortError", async () => { - const controller = new AbortController(); - const wss = new WebSocketStream("ws://localhost:4242", { - signal: controller.signal, - }); - controller.abort(); - await assertRejects( - () => wss.connection, - (error: Error) => { - assert(error instanceof DOMException); - assertEquals(error.name, "AbortError"); - }, - ); - await assertRejects( - () => wss.closed, - (error: Error) => { - assert(error instanceof DOMException); - assertEquals(error.name, "AbortError"); - }, - ); -}); - -Deno.test("aborting immediately with a reason throws that reason", async () => { - const controller = new AbortController(); - const wss = new WebSocketStream("ws://localhost:4242", { - signal: controller.signal, - }); - const abortReason = new Error(); - controller.abort(abortReason); - await assertRejects( - () => wss.connection, - (error: Error) => assertEquals(error, abortReason), - ); - await assertRejects( - () => wss.closed, - (error: Error) => assertEquals(error, abortReason), - ); -}); - -Deno.test("aborting immediately with a primitive as reason throws that primitive", async () => { - const controller = new AbortController(); - const wss = new WebSocketStream("ws://localhost:4242", { - signal: controller.signal, - }); - controller.abort("Some string"); - await wss.connection.then( - () => unreachable(), - (e) => assertEquals(e, "Some string"), - ); - await wss.closed.then( - () => unreachable(), - (e) => assertEquals(e, "Some string"), - ); -}); - -Deno.test("headers", async () => { - const listener = Deno.listen({ port: 4512 }); - const promise = (async () => { - const conn = await listener.accept(); - const httpConn = Deno.serveHttp(conn); - const { request, respondWith } = (await httpConn.nextRequest())!; - assertEquals(request.headers.get("x-some-header"), "foo"); - const { response, socket } = Deno.upgradeWebSocket(request); - socket.onopen = () => socket.close(); - const p = new Promise((resolve) => { - socket.onopen = () => socket.close(); - socket.onclose = () => resolve(); - }); - await respondWith(response); - await p; - })(); - - const ws = new WebSocketStream("ws://localhost:4512", { - headers: [["x-some-header", "foo"]], - }); - await ws.connection; - await promise; - await ws.closed; - listener.close(); -}); - -Deno.test("forbidden headers", async () => { - const forbiddenHeaders = [ - "sec-websocket-accept", - "sec-websocket-extensions", - "sec-websocket-key", - "sec-websocket-protocol", - "sec-websocket-version", - "upgrade", - "connection", - ]; - - const listener = Deno.listen({ port: 4512 }); - const promise = (async () => { - const conn = await listener.accept(); - const httpConn = Deno.serveHttp(conn); - const { request, respondWith } = (await httpConn.nextRequest())!; - for (const [key] of request.headers) { - assertNotEquals(key, "foo"); - } - const { response, socket } = Deno.upgradeWebSocket(request); - const p = new Promise((resolve) => { - socket.onopen = () => socket.close(); - socket.onclose = () => resolve(); - }); - await respondWith(response); - await p; - })(); - - const ws = new WebSocketStream("ws://localhost:4512", { - headers: forbiddenHeaders.map((header) => [header, "foo"]), - }); - await ws.connection; - await promise; - await ws.closed; - listener.close(); -}); - -Deno.test("sync close with empty stream", async () => { - const listener = Deno.listen({ port: 4512 }); - const promise = (async () => { - const conn = await listener.accept(); - const httpConn = Deno.serveHttp(conn); - const { request, respondWith } = (await httpConn.nextRequest())!; - const { response, socket } = Deno.upgradeWebSocket(request); - const p = new Promise((resolve) => { - socket.onopen = () => { - socket.send("first message"); - socket.send("second message"); - }; - socket.onclose = () => resolve(); - }); - await respondWith(response); - await p; - })(); - - const ws = new WebSocketStream("ws://localhost:4512"); - const { readable } = await ws.connection; - const reader = readable.getReader(); - const firstMessage = await reader.read(); - assertEquals(firstMessage.value, "first message"); - const secondMessage = await reader.read(); - assertEquals(secondMessage.value, "second message"); - ws.close({ code: 1000 }); - await ws.closed; - await promise; - listener.close(); -}); - -Deno.test("sync close with unread messages in stream", async () => { - const listener = Deno.listen({ port: 4512 }); - const promise = (async () => { - const conn = await listener.accept(); - const httpConn = Deno.serveHttp(conn); - const { request, respondWith } = (await httpConn.nextRequest())!; - const { response, socket } = Deno.upgradeWebSocket(request); - const p = new Promise((resolve) => { - socket.onopen = () => { - socket.send("first message"); - socket.send("second message"); - socket.send("third message"); - socket.send("fourth message"); - }; - socket.onclose = () => resolve(); - }); - await respondWith(response); - await p; - })(); - - const ws = new WebSocketStream("ws://localhost:4512"); - const { readable } = await ws.connection; - const reader = readable.getReader(); - const firstMessage = await reader.read(); - assertEquals(firstMessage.value, "first message"); - const secondMessage = await reader.read(); - assertEquals(secondMessage.value, "second message"); - ws.close({ code: 1000 }); - await ws.closed; - await promise; - listener.close(); -}); - -Deno.test("async close with empty stream", async () => { - const listener = Deno.listen({ port: 4512 }); - const promise = (async () => { - const conn = await listener.accept(); - const httpConn = Deno.serveHttp(conn); - const { request, respondWith } = (await httpConn.nextRequest())!; - const { response, socket } = Deno.upgradeWebSocket(request); - const p = new Promise((resolve) => { - socket.onopen = () => { - socket.send("first message"); - socket.send("second message"); - }; - socket.onclose = () => resolve(); - }); - await respondWith(response); - await p; - })(); - - const ws = new WebSocketStream("ws://localhost:4512"); - const { readable } = await ws.connection; - const reader = readable.getReader(); - const firstMessage = await reader.read(); - assertEquals(firstMessage.value, "first message"); - const secondMessage = await reader.read(); - assertEquals(secondMessage.value, "second message"); - setTimeout(() => { - ws.close({ code: 1000 }); - }, 0); - await ws.closed; - await promise; - listener.close(); -}); - -Deno.test("async close with unread messages in stream", async () => { - const listener = Deno.listen({ port: 4512 }); - const promise = (async () => { - const conn = await listener.accept(); - const httpConn = Deno.serveHttp(conn); - const { request, respondWith } = (await httpConn.nextRequest())!; - const { response, socket } = Deno.upgradeWebSocket(request); - const p = new Promise((resolve) => { - socket.onopen = () => { - socket.send("first message"); - socket.send("second message"); - socket.send("third message"); - socket.send("fourth message"); - }; - socket.onclose = () => resolve(); - }); - await respondWith(response); - await p; - })(); - - const ws = new WebSocketStream("ws://localhost:4512"); - const { readable } = await ws.connection; - const reader = readable.getReader(); - const firstMessage = await reader.read(); - assertEquals(firstMessage.value, "first message"); - const secondMessage = await reader.read(); - assertEquals(secondMessage.value, "second message"); - setTimeout(() => { - ws.close({ code: 1000 }); - }, 0); - await ws.closed; - await promise; - listener.close(); -}); diff --git a/cli/tests/testdata/webstorage/config_a.jsonc b/cli/tests/testdata/webstorage/config_a.jsonc deleted file mode 100644 index 875cb6001..000000000 --- a/cli/tests/testdata/webstorage/config_a.jsonc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "compilerOptions": {} -} diff --git a/cli/tests/testdata/webstorage/config_b.jsonc b/cli/tests/testdata/webstorage/config_b.jsonc deleted file mode 100644 index 875cb6001..000000000 --- a/cli/tests/testdata/webstorage/config_b.jsonc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "compilerOptions": {} -} diff --git a/cli/tests/testdata/webstorage/fixture.ts b/cli/tests/testdata/webstorage/fixture.ts deleted file mode 100644 index cf4bd9f1f..000000000 --- a/cli/tests/testdata/webstorage/fixture.ts +++ /dev/null @@ -1,2 +0,0 @@ -import "./logger.ts"; -import "./setter.ts"; diff --git a/cli/tests/testdata/webstorage/logger.ts b/cli/tests/testdata/webstorage/logger.ts deleted file mode 100644 index 3898c4445..000000000 --- a/cli/tests/testdata/webstorage/logger.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(window.localStorage); diff --git a/cli/tests/testdata/webstorage/serialization.ts b/cli/tests/testdata/webstorage/serialization.ts deleted file mode 100644 index f3791d355..000000000 --- a/cli/tests/testdata/webstorage/serialization.ts +++ /dev/null @@ -1,4 +0,0 @@ -window.sessionStorage.setItem("hello", "deno"); - -console.log(window.localStorage); -console.log(window.sessionStorage); diff --git a/cli/tests/testdata/webstorage/serialization.ts.out b/cli/tests/testdata/webstorage/serialization.ts.out deleted file mode 100644 index fea76aa43..000000000 --- a/cli/tests/testdata/webstorage/serialization.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -Storage {[WILDCARD] -Storage { length: 1, hello: "deno" } diff --git a/cli/tests/testdata/webstorage/setter.ts b/cli/tests/testdata/webstorage/setter.ts deleted file mode 100644 index ec6d474f5..000000000 --- a/cli/tests/testdata/webstorage/setter.ts +++ /dev/null @@ -1 +0,0 @@ -window.localStorage.setItem("hello", "deno"); diff --git a/cli/tests/testdata/worker_close_in_wasm_reactions.js b/cli/tests/testdata/worker_close_in_wasm_reactions.js deleted file mode 100644 index ed57fa053..000000000 --- a/cli/tests/testdata/worker_close_in_wasm_reactions.js +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. - -// https://github.com/denoland/deno/issues/12263 -// Test for a panic that happens when a worker is closed in the reactions of a -// WASM async operation. - -new Worker( - import.meta.resolve("./workers/close_in_wasm_reactions.js"), - { type: "module" }, -); diff --git a/cli/tests/testdata/worker_close_in_wasm_reactions.js.out b/cli/tests/testdata/worker_close_in_wasm_reactions.js.out deleted file mode 100644 index 6485c620e..000000000 --- a/cli/tests/testdata/worker_close_in_wasm_reactions.js.out +++ /dev/null @@ -1 +0,0 @@ -Error: CompileError: WebAssembly.compile(): expected length: @+10 diff --git a/cli/tests/testdata/worker_close_nested.js b/cli/tests/testdata/worker_close_nested.js deleted file mode 100644 index 865022faa..000000000 --- a/cli/tests/testdata/worker_close_nested.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. - -// Test that closing a worker which has living child workers will automatically -// close the children. - -console.log("Starting the main thread"); - -const worker = new Worker( - import.meta.resolve("./workers/close_nested_parent.js"), - { type: "module" }, -); - -setTimeout(() => { - console.log("About to close"); - worker.postMessage({}); - - // Keep the process running for another two seconds, to make sure there's no - // output from the child worker. - setTimeout(() => {}, 2000); -}, 1000); diff --git a/cli/tests/testdata/worker_close_nested.js.out b/cli/tests/testdata/worker_close_nested.js.out deleted file mode 100644 index 496bc6251..000000000 --- a/cli/tests/testdata/worker_close_nested.js.out +++ /dev/null @@ -1,5 +0,0 @@ -Starting the main thread -Starting the parent worker -Starting the child worker -About to close -Closing diff --git a/cli/tests/testdata/worker_close_race.js b/cli/tests/testdata/worker_close_race.js deleted file mode 100644 index ff2b0eb8f..000000000 --- a/cli/tests/testdata/worker_close_race.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. - -// https://github.com/denoland/deno/issues/11416 -// Test for a race condition between a worker's `close()` and the main thread's -// `Worker.prototype.terminate()`. - -const worker = new Worker( - import.meta.resolve("./workers/close_race_worker.js"), - { type: "module" }, -); - -worker.onmessage = () => { - worker.terminate(); -}; diff --git a/cli/tests/testdata/worker_close_race.js.out b/cli/tests/testdata/worker_close_race.js.out deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/testdata/worker_drop_handle_race.js b/cli/tests/testdata/worker_drop_handle_race.js deleted file mode 100644 index 78f2d6cab..000000000 --- a/cli/tests/testdata/worker_drop_handle_race.js +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. - -// https://github.com/denoland/deno/issues/11342 -// Test for a panic that happens when the main thread's event loop finishes -// running while the worker's event loop is still spinning. - -// The exception thrown in the worker will not terminate the worker, but it will -// propagate to the main thread and cause it to exit. -new Worker( - import.meta.resolve("./workers/drop_handle_race.js"), - { type: "module" }, -); diff --git a/cli/tests/testdata/worker_drop_handle_race.js.out b/cli/tests/testdata/worker_drop_handle_race.js.out deleted file mode 100644 index a81684bfa..000000000 --- a/cli/tests/testdata/worker_drop_handle_race.js.out +++ /dev/null @@ -1,8 +0,0 @@ -error: Uncaught (in worker "") Error - throw new Error(); - ^ - at [WILDCARD]/workers/drop_handle_race.js:2:9 - at Object.action (deno:ext/web/02_timers.js:[WILDCARD]) - at handleTimerMacrotask (deno:ext/web/02_timers.js:[WILDCARD]) -error: Uncaught (in promise) Error: Unhandled error in child worker. - at Worker.#pollControl (deno:runtime/js/11_workers.js:[WILDCARD]) diff --git a/cli/tests/testdata/worker_drop_handle_race_terminate.js b/cli/tests/testdata/worker_drop_handle_race_terminate.js deleted file mode 100644 index 93c324fdf..000000000 --- a/cli/tests/testdata/worker_drop_handle_race_terminate.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. - -// Test that the panic in https://github.com/denoland/deno/issues/11342 does not -// happen when calling worker.terminate() after fixing -// https://github.com/denoland/deno/issues/13705 - -function getCodeBlobUrl(code) { - const blob = new Blob([code], { type: "text/javascript" }); - return URL.createObjectURL(blob); -} - -const WORKER2 = getCodeBlobUrl(` - console.log("Worker 2"); - self.postMessage(undefined); - - // We sleep synchronously for slightly under 2 seconds in order to make sure - // that worker 1 has closed, and that this worker's thread finishes normally - // rather than being killed (which happens 2 seconds after calling terminate). - Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 1800); - console.log("Finished sleeping in worker 2"); -`); - -const WORKER1 = getCodeBlobUrl(` - console.log("Worker 1"); - const worker = new Worker(${JSON.stringify(WORKER2)}, { type: "module" }); - - worker.addEventListener("message", () => { - console.log("Terminating"); - worker.terminate(); - self.close(); - }); -`); - -new Worker(WORKER1, { type: "module" }); - -// Don't kill the process before worker 2 is finished. -setTimeout(() => {}, 3000); diff --git a/cli/tests/testdata/worker_drop_handle_race_terminate.js.out b/cli/tests/testdata/worker_drop_handle_race_terminate.js.out deleted file mode 100644 index 5ec1e7ff8..000000000 --- a/cli/tests/testdata/worker_drop_handle_race_terminate.js.out +++ /dev/null @@ -1,4 +0,0 @@ -Worker 1 -Worker 2 -Terminating -Finished sleeping in worker 2 diff --git a/cli/tests/testdata/worker_event_handler_test.js b/cli/tests/testdata/worker_event_handler_test.js deleted file mode 100644 index c4e816a4d..000000000 --- a/cli/tests/testdata/worker_event_handler_test.js +++ /dev/null @@ -1,5 +0,0 @@ -const w = new Worker( - import.meta.resolve("./workers/worker_event_handlers.js"), - { type: "module" }, -); -w.postMessage({}); diff --git a/cli/tests/testdata/worker_event_handler_test.js.out b/cli/tests/testdata/worker_event_handler_test.js.out deleted file mode 100644 index b3eed7f6c..000000000 --- a/cli/tests/testdata/worker_event_handler_test.js.out +++ /dev/null @@ -1,11 +0,0 @@ -Target from self.onmessage: [object DedicatedWorkerGlobalScope] -Target from message event listener: [object DedicatedWorkerGlobalScope] -Arguments from self.onerror: [ - "Uncaught Error: Some error message", - "[WILDCARD]/worker_event_handlers.js", - 9, - 9, - Error: Some error message - at [WILDCARD] -] -Is event canceled?: true diff --git a/cli/tests/testdata/worker_message_before_close.js b/cli/tests/testdata/worker_message_before_close.js deleted file mode 100644 index a5769af60..000000000 --- a/cli/tests/testdata/worker_message_before_close.js +++ /dev/null @@ -1,26 +0,0 @@ -const messagesReceived = new Set(); - -for (let i = 0; i < 4; i++) { - const worker = new Worker( - import.meta.resolve("./workers/message_before_close.js"), - { type: "module", name: String(i) }, - ); - - worker.addEventListener("message", () => { - messagesReceived.add(i); - if (messagesReceived.size == 4) { - console.log("received all 4 responses from the workers"); - } - }); - - worker.postMessage({}); -} - -globalThis.addEventListener("unload", () => { - if (messagesReceived.size !== 4) { - console.log( - "received only %d responses from the workers", - messagesReceived.size, - ); - } -}); diff --git a/cli/tests/testdata/worker_message_before_close.js.out b/cli/tests/testdata/worker_message_before_close.js.out deleted file mode 100644 index f91b7b4cb..000000000 --- a/cli/tests/testdata/worker_message_before_close.js.out +++ /dev/null @@ -1 +0,0 @@ -received all 4 responses from the workers diff --git a/cli/tests/testdata/workers/custom_inspect/main.out b/cli/tests/testdata/workers/custom_inspect/main.out new file mode 100644 index 000000000..b34300c40 --- /dev/null +++ b/cli/tests/testdata/workers/custom_inspect/main.out @@ -0,0 +1,2 @@ +[WILDCARD]ReadableStream { locked: false } +[WILDCARD] diff --git a/cli/tests/testdata/workers/custom_inspect/main.ts b/cli/tests/testdata/workers/custom_inspect/main.ts new file mode 100644 index 000000000..93d4eec2d --- /dev/null +++ b/cli/tests/testdata/workers/custom_inspect/main.ts @@ -0,0 +1,4 @@ +new Worker( + import.meta.resolve("./worker.ts"), + { type: "module" }, +); diff --git a/cli/tests/testdata/workers/custom_inspect/worker.ts b/cli/tests/testdata/workers/custom_inspect/worker.ts new file mode 100644 index 000000000..5be82724e --- /dev/null +++ b/cli/tests/testdata/workers/custom_inspect/worker.ts @@ -0,0 +1,2 @@ +console.log(new ReadableStream()); +close(); diff --git a/cli/tests/testdata/workers/error_worker_permissions_local.ts b/cli/tests/testdata/workers/error_worker_permissions_local.ts new file mode 100644 index 000000000..1a4b4c0a9 --- /dev/null +++ b/cli/tests/testdata/workers/error_worker_permissions_local.ts @@ -0,0 +1,4 @@ +new Worker( + import.meta.resolve("../subdir/worker_types.ts"), + { type: "module" }, +); diff --git a/cli/tests/testdata/workers/error_worker_permissions_local.ts.out b/cli/tests/testdata/workers/error_worker_permissions_local.ts.out new file mode 100644 index 000000000..e6404e8e3 --- /dev/null +++ b/cli/tests/testdata/workers/error_worker_permissions_local.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +error: Uncaught (in worker "") Requires read access to "[WILDCARD]worker_types.ts", run again with the --allow-read flag +[WILDCARD] diff --git a/cli/tests/testdata/workers/error_worker_permissions_remote.ts b/cli/tests/testdata/workers/error_worker_permissions_remote.ts new file mode 100644 index 000000000..878c7080a --- /dev/null +++ b/cli/tests/testdata/workers/error_worker_permissions_remote.ts @@ -0,0 +1,4 @@ +new Worker( + "http://localhost:4545/subdir/worker_types.ts", + { type: "module" }, +); diff --git a/cli/tests/testdata/workers/error_worker_permissions_remote.ts.out b/cli/tests/testdata/workers/error_worker_permissions_remote.ts.out new file mode 100644 index 000000000..74c7c3974 --- /dev/null +++ b/cli/tests/testdata/workers/error_worker_permissions_remote.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +error: Uncaught (in worker "") Requires net access to "localhost:4545", run again with the --allow-net flag +[WILDCARD] diff --git a/cli/tests/testdata/x_deno_warning_redirect.js b/cli/tests/testdata/x_deno_warning_redirect.js deleted file mode 100644 index 34b950566..000000000 --- a/cli/tests/testdata/x_deno_warning_redirect.js +++ /dev/null @@ -1 +0,0 @@ -console.log("testing x-deno-warning header"); diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index cbb2cd680..096ea5ab0 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -93,40 +93,40 @@ Deno.test( ); Deno.test({ permissions: { net: true } }, async function fetchJsonSuccess() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const json = await response.json(); assertEquals(json.name, "deno"); }); Deno.test({ permissions: { net: false } }, async function fetchPerm() { await assertRejects(async () => { - await fetch("http://localhost:4545/fixture.json"); + await fetch("http://localhost:4545/assets/fixture.json"); }, Deno.errors.PermissionDenied); }); Deno.test({ permissions: { net: true } }, async function fetchUrl() { - const response = await fetch("http://localhost:4545/fixture.json"); - assertEquals(response.url, "http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); + assertEquals(response.url, "http://localhost:4545/assets/fixture.json"); const _json = await response.json(); }); Deno.test({ permissions: { net: true } }, async function fetchURL() { const response = await fetch( - new URL("http://localhost:4545/fixture.json"), + new URL("http://localhost:4545/assets/fixture.json"), ); - assertEquals(response.url, "http://localhost:4545/fixture.json"); + assertEquals(response.url, "http://localhost:4545/assets/fixture.json"); const _json = await response.json(); }); Deno.test({ permissions: { net: true } }, async function fetchHeaders() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const headers = response.headers; assertEquals(headers.get("Content-Type"), "application/json"); const _json = await response.json(); }); Deno.test({ permissions: { net: true } }, async function fetchBlob() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const headers = response.headers; const blob = await response.blob(); assertEquals(blob.type, headers.get("Content-Type")); @@ -137,7 +137,7 @@ Deno.test( { permissions: { net: true } }, async function fetchBodyUsedReader() { const response = await fetch( - "http://localhost:4545/fixture.json", + "http://localhost:4545/assets/fixture.json", ); assert(response.body !== null); @@ -155,7 +155,7 @@ Deno.test( { permissions: { net: true } }, async function fetchBodyUsedCancelStream() { const response = await fetch( - "http://localhost:4545/fixture.json", + "http://localhost:4545/assets/fixture.json", ); assert(response.body !== null); @@ -167,7 +167,7 @@ Deno.test( ); Deno.test({ permissions: { net: true } }, async function fetchAsyncIterator() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const headers = response.headers; assert(response.body !== null); @@ -181,7 +181,7 @@ Deno.test({ permissions: { net: true } }, async function fetchAsyncIterator() { }); Deno.test({ permissions: { net: true } }, async function fetchBodyReader() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const headers = response.headers; assert(response.body !== null); const reader = response.body.getReader(); @@ -220,7 +220,7 @@ Deno.test( ); Deno.test({ permissions: { net: true } }, async function responseClone() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const response1 = response.clone(); assert(response !== response1); assertEquals(response.status, response1.status); @@ -359,10 +359,10 @@ Deno.test( permissions: { net: true }, }, async function fetchWithRedirection() { - const response = await fetch("http://localhost:4546/hello.txt"); + const response = await fetch("http://localhost:4546/assets/hello.txt"); assertEquals(response.status, 200); assertEquals(response.statusText, "OK"); - assertEquals(response.url, "http://localhost:4545/hello.txt"); + assertEquals(response.url, "http://localhost:4545/assets/hello.txt"); const body = await response.text(); assert(body.includes("Hello world!")); }, @@ -374,7 +374,7 @@ Deno.test( }, async function fetchWithRelativeRedirection() { const response = await fetch( - "http://localhost:4545/001_hello.js", + "http://localhost:4545/run/001_hello.js", ); assertEquals(response.status, 200); assertEquals(response.statusText, "OK"); @@ -449,7 +449,7 @@ Deno.test( { permissions: { net: true } }, async function fetchSeparateInit() { // related to: https://github.com/denoland/deno/issues/10396 - const req = new Request("http://localhost:4545/001_hello.js"); + const req = new Request("http://localhost:4545/run/001_hello.js"); const init = { method: "GET", }; @@ -901,7 +901,7 @@ Deno.test(async function responseWithoutBody() { }); Deno.test({ permissions: { net: true } }, async function fetchBodyReadTwice() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); // Read body const _json = await response.json(); @@ -925,7 +925,7 @@ Deno.test( { permissions: { net: true } }, async function fetchBodyReaderAfterRead() { const response = await fetch( - "http://localhost:4545/fixture.json", + "http://localhost:4545/assets/fixture.json", ); assert(response.body !== null); const reader = await response.body.getReader(); @@ -1005,7 +1005,7 @@ Deno.test( Deno.test( { permissions: { net: true } }, async function fetchResourceCloseAfterStreamCancel() { - const res = await fetch("http://localhost:4545/fixture.json"); + const res = await fetch("http://localhost:4545/assets/fixture.json"); assert(res.body !== null); // After ReadableStream.cancel is called, resource handle must be closed @@ -1113,7 +1113,7 @@ Deno.test( > { const caCert = Deno.readTextFileSync("cli/tests/testdata/tls/RootCA.pem"); const client = Deno.createHttpClient({ caCerts: [caCert] }); - const response = await fetch("https://localhost:5545/fixture.json", { + const response = await fetch("https://localhost:5545/assets/fixture.json", { client, }); const json = await response.json(); @@ -1286,7 +1286,7 @@ Deno.test( "cli/tests/testdata/tls/localhost.key", ), }); - await fetch("https://localhost:5552/fixture.json", { + await fetch("https://localhost:5552/assets/fixture.json", { client, }); }, Deno.errors.InvalidData); @@ -1303,7 +1303,7 @@ Deno.test( ), privateKey: "bad data", }); - await fetch("https://localhost:5552/fixture.json", { + await fetch("https://localhost:5552/assets/fixture.json", { client, }); }, Deno.errors.InvalidData); @@ -1320,7 +1320,7 @@ Deno.test( ), privateKey: "", }); - await fetch("https://localhost:5552/fixture.json", { + await fetch("https://localhost:5552/assets/fixture.json", { client, }); }, Deno.errors.InvalidData); diff --git a/cli/tests/unit/files_test.ts b/cli/tests/unit/files_test.ts index d15f1f538..bb095072c 100644 --- a/cli/tests/unit/files_test.ts +++ b/cli/tests/unit/files_test.ts @@ -17,7 +17,7 @@ Deno.test(function filesStdioFileDescriptors() { }); Deno.test({ permissions: { read: true } }, async function filesCopyToStdout() { - const filename = "cli/tests/testdata/fixture.json"; + const filename = "cli/tests/testdata/assets/fixture.json"; const file = await Deno.open(filename); assert(file.rid > 2); const bytesWritten = await copy(file, Deno.stdout); @@ -27,7 +27,7 @@ Deno.test({ permissions: { read: true } }, async function filesCopyToStdout() { }); Deno.test({ permissions: { read: true } }, async function filesIter() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); let totalSize = 0; @@ -42,7 +42,7 @@ Deno.test({ permissions: { read: true } }, async function filesIter() { Deno.test( { permissions: { read: true } }, async function filesIterCustomBufSize() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); let totalSize = 0; @@ -59,7 +59,7 @@ Deno.test( ); Deno.test({ permissions: { read: true } }, function filesIterSync() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = Deno.openSync(filename); let totalSize = 0; @@ -74,7 +74,7 @@ Deno.test({ permissions: { read: true } }, function filesIterSync() { Deno.test( { permissions: { read: true } }, function filesIterSyncCustomBufSize() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = Deno.openSync(filename); let totalSize = 0; @@ -264,7 +264,7 @@ Deno.test( ); Deno.test(async function openOptions() { - const filename = "cli/tests/testdata/fixture.json"; + const filename = "cli/tests/testdata/assets/fixture.json"; await assertRejects( async () => { await Deno.open(filename, { write: false }); @@ -558,7 +558,7 @@ Deno.test( ); Deno.test({ permissions: { read: true } }, async function seekStart() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); const seekPosition = 6; // Deliberately move 1 step forward @@ -575,7 +575,7 @@ Deno.test({ permissions: { read: true } }, async function seekStart() { }); Deno.test({ permissions: { read: true } }, function seekSyncStart() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = Deno.openSync(filename); const seekPosition = 6; // Deliberately move 1 step forward @@ -592,7 +592,7 @@ Deno.test({ permissions: { read: true } }, function seekSyncStart() { }); Deno.test({ permissions: { read: true } }, async function seekCurrent() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); // Deliberately move 1 step forward await file.read(new Uint8Array(1)); // "H" @@ -609,7 +609,7 @@ Deno.test({ permissions: { read: true } }, async function seekCurrent() { }); Deno.test({ permissions: { read: true } }, function seekSyncCurrent() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = Deno.openSync(filename); // Deliberately move 1 step forward file.readSync(new Uint8Array(1)); // "H" @@ -626,7 +626,7 @@ Deno.test({ permissions: { read: true } }, function seekSyncCurrent() { }); Deno.test({ permissions: { read: true } }, async function seekEnd() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); const seekPosition = -6; // seek from end of file that has 12 chars, 12 - 6 = 6 @@ -640,7 +640,7 @@ Deno.test({ permissions: { read: true } }, async function seekEnd() { }); Deno.test({ permissions: { read: true } }, function seekSyncEnd() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = Deno.openSync(filename); const seekPosition = -6; // seek from end of file that has 12 chars, 12 - 6 = 6 @@ -654,7 +654,7 @@ Deno.test({ permissions: { read: true } }, function seekSyncEnd() { }); Deno.test({ permissions: { read: true } }, async function seekMode() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); await assertRejects( async () => { @@ -747,7 +747,7 @@ Deno.test(async function fileStatSuccess() { }); Deno.test({ permissions: { read: true } }, async function readableStream() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); assert(file.readable instanceof ReadableStream); const chunks = []; @@ -761,7 +761,7 @@ Deno.test({ permissions: { read: true } }, async function readableStream() { Deno.test( { permissions: { read: true } }, async function readableStreamTextEncoderPipe() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); const readable = file.readable.pipeThrough(new TextDecoderStream()); const chunks = []; diff --git a/cli/tests/unit/flock_test.ts b/cli/tests/unit/flock_test.ts index fbc061593..7ece1695c 100644 --- a/cli/tests/unit/flock_test.ts +++ b/cli/tests/unit/flock_test.ts @@ -108,7 +108,7 @@ async function checkFirstBlocksSecond(opts: { } function runFlockTestProcess(opts: { exclusive: boolean; sync: boolean }) { - const path = "cli/tests/testdata/fixture.json"; + const path = "cli/tests/testdata/assets/fixture.json"; const scriptText = ` const { rid } = Deno.openSync("${path}"); diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts index c7a081bf4..10fed0c47 100644 --- a/cli/tests/unit/net_test.ts +++ b/cli/tests/unit/net_test.ts @@ -778,7 +778,7 @@ Deno.test({ permissions: { net: true } }, async function whatwgStreams() { Deno.test( { permissions: { read: true } }, async function readableStreamTextEncoderPipe() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); const readable = file.readable.pipeThrough(new TextDecoderStream()); const chunks = []; diff --git a/cli/tests/unit/read_dir_test.ts b/cli/tests/unit/read_dir_test.ts index fecddd6c4..1c81e860a 100644 --- a/cli/tests/unit/read_dir_test.ts +++ b/cli/tests/unit/read_dir_test.ts @@ -41,10 +41,10 @@ Deno.test({ permissions: { read: false } }, function readDirSyncPerm() { Deno.test({ permissions: { read: true } }, function readDirSyncNotDir() { assertThrows( () => { - Deno.readDirSync("cli/tests/testdata/fixture.json"); + Deno.readDirSync("cli/tests/testdata/assets/fixture.json"); }, Error, - `readdir 'cli/tests/testdata/fixture.json'`, + `readdir 'cli/tests/testdata/assets/fixture.json'`, ); }); diff --git a/cli/tests/unit/read_file_test.ts b/cli/tests/unit/read_file_test.ts index 07935b7fb..c18cdf059 100644 --- a/cli/tests/unit/read_file_test.ts +++ b/cli/tests/unit/read_file_test.ts @@ -9,7 +9,7 @@ import { } from "./test_util.ts"; Deno.test({ permissions: { read: true } }, function readFileSyncSuccess() { - const data = Deno.readFileSync("cli/tests/testdata/fixture.json"); + const data = Deno.readFileSync("cli/tests/testdata/assets/fixture.json"); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); const json = decoder.decode(data); @@ -19,7 +19,7 @@ Deno.test({ permissions: { read: true } }, function readFileSyncSuccess() { Deno.test({ permissions: { read: true } }, function readFileSyncUrl() { const data = Deno.readFileSync( - pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/assets/fixture.json"), ); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); @@ -30,7 +30,7 @@ Deno.test({ permissions: { read: true } }, function readFileSyncUrl() { Deno.test({ permissions: { read: false } }, function readFileSyncPerm() { assertThrows(() => { - Deno.readFileSync("cli/tests/testdata/fixture.json"); + Deno.readFileSync("cli/tests/testdata/assets/fixture.json"); }, Deno.errors.PermissionDenied); }); @@ -42,7 +42,7 @@ Deno.test({ permissions: { read: true } }, function readFileSyncNotFound() { Deno.test({ permissions: { read: true } }, async function readFileUrl() { const data = await Deno.readFile( - pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/assets/fixture.json"), ); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); @@ -52,7 +52,7 @@ Deno.test({ permissions: { read: true } }, async function readFileUrl() { }); Deno.test({ permissions: { read: true } }, async function readFileSuccess() { - const data = await Deno.readFile("cli/tests/testdata/fixture.json"); + const data = await Deno.readFile("cli/tests/testdata/assets/fixture.json"); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); const json = decoder.decode(data); @@ -62,13 +62,13 @@ Deno.test({ permissions: { read: true } }, async function readFileSuccess() { Deno.test({ permissions: { read: false } }, async function readFilePerm() { await assertRejects(async () => { - await Deno.readFile("cli/tests/testdata/fixture.json"); + await Deno.readFile("cli/tests/testdata/assets/fixture.json"); }, Deno.errors.PermissionDenied); }); Deno.test({ permissions: { read: true } }, function readFileSyncLoop() { for (let i = 0; i < 256; i++) { - Deno.readFileSync("cli/tests/testdata/fixture.json"); + Deno.readFileSync("cli/tests/testdata/assets/fixture.json"); } }); @@ -97,7 +97,7 @@ Deno.test( queueMicrotask(() => ac.abort()); await assertRejects( async () => { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); }, @@ -117,7 +117,7 @@ Deno.test( queueMicrotask(() => ac.abort(abortReason)); await assertRejects( async () => { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); }, @@ -134,7 +134,7 @@ Deno.test( const ac = new AbortController(); queueMicrotask(() => ac.abort("Some string")); try { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); unreachable(); diff --git a/cli/tests/unit/read_text_file_test.ts b/cli/tests/unit/read_text_file_test.ts index 48d246dad..119c650b6 100644 --- a/cli/tests/unit/read_text_file_test.ts +++ b/cli/tests/unit/read_text_file_test.ts @@ -8,7 +8,7 @@ import { } from "./test_util.ts"; Deno.test({ permissions: { read: true } }, function readTextFileSyncSuccess() { - const data = Deno.readTextFileSync("cli/tests/testdata/fixture.json"); + const data = Deno.readTextFileSync("cli/tests/testdata/assets/fixture.json"); assert(data.length > 0); const pkg = JSON.parse(data); assertEquals(pkg.name, "deno"); @@ -16,7 +16,7 @@ Deno.test({ permissions: { read: true } }, function readTextFileSyncSuccess() { Deno.test({ permissions: { read: true } }, function readTextFileSyncByUrl() { const data = Deno.readTextFileSync( - pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/assets/fixture.json"), ); assert(data.length > 0); const pkg = JSON.parse(data); @@ -25,7 +25,7 @@ Deno.test({ permissions: { read: true } }, function readTextFileSyncByUrl() { Deno.test({ permissions: { read: false } }, function readTextFileSyncPerm() { assertThrows(() => { - Deno.readTextFileSync("cli/tests/testdata/fixture.json"); + Deno.readTextFileSync("cli/tests/testdata/assets/fixture.json"); }, Deno.errors.PermissionDenied); }); @@ -38,7 +38,9 @@ Deno.test({ permissions: { read: true } }, function readTextFileSyncNotFound() { Deno.test( { permissions: { read: true } }, async function readTextFileSuccess() { - const data = await Deno.readTextFile("cli/tests/testdata/fixture.json"); + const data = await Deno.readTextFile( + "cli/tests/testdata/assets/fixture.json", + ); assert(data.length > 0); const pkg = JSON.parse(data); assertEquals(pkg.name, "deno"); @@ -47,7 +49,7 @@ Deno.test( Deno.test({ permissions: { read: true } }, async function readTextFileByUrl() { const data = await Deno.readTextFile( - pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/assets/fixture.json"), ); assert(data.length > 0); const pkg = JSON.parse(data); @@ -56,13 +58,13 @@ Deno.test({ permissions: { read: true } }, async function readTextFileByUrl() { Deno.test({ permissions: { read: false } }, async function readTextFilePerm() { await assertRejects(async () => { - await Deno.readTextFile("cli/tests/testdata/fixture.json"); + await Deno.readTextFile("cli/tests/testdata/assets/fixture.json"); }, Deno.errors.PermissionDenied); }); Deno.test({ permissions: { read: true } }, function readTextFileSyncLoop() { for (let i = 0; i < 256; i++) { - Deno.readTextFileSync("cli/tests/testdata/fixture.json"); + Deno.readTextFileSync("cli/tests/testdata/assets/fixture.json"); } }); @@ -91,7 +93,7 @@ Deno.test( queueMicrotask(() => ac.abort()); await assertRejects( async () => { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); }, @@ -111,7 +113,7 @@ Deno.test( queueMicrotask(() => ac.abort(abortReason)); await assertRejects( async () => { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); }, @@ -128,7 +130,7 @@ Deno.test( const ac = new AbortController(); queueMicrotask(() => ac.abort("Some string")); try { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); unreachable(); diff --git a/cli/tests/unit/real_path_test.ts b/cli/tests/unit/real_path_test.ts index 2dfb5d214..5297c2b76 100644 --- a/cli/tests/unit/real_path_test.ts +++ b/cli/tests/unit/real_path_test.ts @@ -9,7 +9,7 @@ import { } from "./test_util.ts"; Deno.test({ permissions: { read: true } }, function realPathSyncSuccess() { - const relative = "cli/tests/testdata/fixture.json"; + const relative = "cli/tests/testdata/assets/fixture.json"; const realPath = Deno.realPathSync(relative); if (Deno.build.os !== "windows") { assert(realPath.startsWith("/")); @@ -21,7 +21,7 @@ Deno.test({ permissions: { read: true } }, function realPathSyncSuccess() { }); Deno.test({ permissions: { read: true } }, function realPathSyncUrl() { - const relative = "cli/tests/testdata/fixture.json"; + const relative = "cli/tests/testdata/assets/fixture.json"; const url = pathToAbsoluteFileUrl(relative); assertEquals(Deno.realPathSync(relative), Deno.realPathSync(url)); }); @@ -60,7 +60,7 @@ Deno.test({ permissions: { read: true } }, function realPathSyncNotFound() { }); Deno.test({ permissions: { read: true } }, async function realPathSuccess() { - const relativePath = "cli/tests/testdata/fixture.json"; + const relativePath = "cli/tests/testdata/assets/fixture.json"; const realPath = await Deno.realPath(relativePath); if (Deno.build.os !== "windows") { assert(realPath.startsWith("/")); @@ -74,7 +74,7 @@ Deno.test({ permissions: { read: true } }, async function realPathSuccess() { Deno.test( { permissions: { read: true } }, async function realPathUrl() { - const relative = "cli/tests/testdata/fixture.json"; + const relative = "cli/tests/testdata/assets/fixture.json"; const url = pathToAbsoluteFileUrl(relative); assertEquals(await Deno.realPath(relative), await Deno.realPath(url)); }, diff --git a/cli/tests/unit/resources_test.ts b/cli/tests/unit/resources_test.ts index 08fbfafc4..60325b91d 100644 --- a/cli/tests/unit/resources_test.ts +++ b/cli/tests/unit/resources_test.ts @@ -37,7 +37,7 @@ Deno.test({ permissions: { net: true } }, async function resourcesNet() { Deno.test({ permissions: { read: true } }, async function resourcesFile() { const resourcesBefore = Deno.resources(); - const f = await Deno.open("cli/tests/testdata/hello.txt"); + const f = await Deno.open("cli/tests/testdata/assets/hello.txt"); const resourcesAfter = Deno.resources(); f.close(); diff --git a/cli/tests/unit/stat_test.ts b/cli/tests/unit/stat_test.ts index f39b3be2c..9a504b4fc 100644 --- a/cli/tests/unit/stat_test.ts +++ b/cli/tests/unit/stat_test.ts @@ -146,7 +146,7 @@ Deno.test({ permissions: { read: true } }, function lstatSyncSuccess() { Deno.test({ permissions: { read: false } }, function lstatSyncPerm() { assertThrows(() => { - Deno.lstatSync("hello.txt"); + Deno.lstatSync("assets/hello.txt"); }, Deno.errors.PermissionDenied); }); diff --git a/cli/tests/unit/tty_test.ts b/cli/tests/unit/tty_test.ts index 9feacdf51..e50443aab 100644 --- a/cli/tests/unit/tty_test.ts +++ b/cli/tests/unit/tty_test.ts @@ -4,7 +4,7 @@ import { assert, assertThrows } from "./test_util.ts"; // Note tests for Deno.setRaw is in integration tests. Deno.test({ permissions: { read: true } }, function consoleSizeFile() { - const file = Deno.openSync("cli/tests/testdata/hello.txt"); + const file = Deno.openSync("cli/tests/testdata/assets/hello.txt"); assertThrows(() => { Deno.consoleSize(file.rid); }, Error); @@ -20,7 +20,7 @@ Deno.test(function consoleSizeError() { Deno.test({ permissions: { read: true } }, function isatty() { // CI not under TTY, so cannot test stdin/stdout/stderr. - const f = Deno.openSync("cli/tests/testdata/hello.txt"); + const f = Deno.openSync("cli/tests/testdata/assets/hello.txt"); assert(!Deno.isatty(f.rid)); f.close(); }); diff --git a/cli/tests/unit/wasm_test.ts b/cli/tests/unit/wasm_test.ts index 2bf0a7480..03ed0e298 100644 --- a/cli/tests/unit/wasm_test.ts +++ b/cli/tests/unit/wasm_test.ts @@ -79,7 +79,7 @@ Deno.test(async function wasmInstantiateStreaming() { Deno.test( { permissions: { read: true } }, async function wasmFileStreaming() { - const url = import.meta.resolve("../testdata/unreachable.wasm"); + const url = import.meta.resolve("../testdata/assets/unreachable.wasm"); assert(url.startsWith("file://")); const { module } = await WebAssembly.instantiateStreaming(fetch(url)); @@ -96,7 +96,7 @@ Deno.test( // deno-dom's WASM file is a real-world non-trivial case that gave us // trouble when implementing this. await WebAssembly.instantiateStreaming(fetch( - "http://localhost:4545/deno_dom_0.1.3-alpha2.wasm", + "http://localhost:4545/assets/deno_dom_0.1.3-alpha2.wasm", )); }, ); diff --git a/cli/tests/unit/webgpu_test.ts b/cli/tests/unit/webgpu_test.ts index fa71ffcc8..c903736f8 100644 --- a/cli/tests/unit/webgpu_test.ts +++ b/cli/tests/unit/webgpu_test.ts @@ -27,7 +27,7 @@ Deno.test({ assert(device); const shaderCode = await Deno.readTextFile( - "cli/tests/testdata/webgpu_computepass_shader.wgsl", + "cli/tests/testdata/webgpu/computepass_shader.wgsl", ); const shaderModule = device.createShaderModule({ @@ -116,7 +116,7 @@ Deno.test({ assert(device); const shaderCode = await Deno.readTextFile( - "cli/tests/testdata/webgpu_hellotriangle_shader.wgsl", + "cli/tests/testdata/webgpu/hellotriangle_shader.wgsl", ); const shaderModule = device.createShaderModule({ @@ -202,7 +202,7 @@ Deno.test({ assertEquals( data, - await Deno.readFile("cli/tests/testdata/webgpu_hellotriangle.out"), + await Deno.readFile("cli/tests/testdata/webgpu/hellotriangle.out"), ); outputBuffer.unmap(); -- cgit v1.2.3