summaryrefslogtreecommitdiff
path: root/tests/testdata/run
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testdata/run')
-rw-r--r--tests/testdata/run/001_hello.js1
-rw-r--r--tests/testdata/run/001_hello.js.out1
-rw-r--r--tests/testdata/run/002_hello.ts1
-rw-r--r--tests/testdata/run/002_hello.ts.out1
-rw-r--r--tests/testdata/run/003_relative_import.ts3
-rw-r--r--tests/testdata/run/003_relative_import.ts.out1
-rw-r--r--tests/testdata/run/004_set_timeout.ts11
-rw-r--r--tests/testdata/run/004_set_timeout.ts.out2
-rw-r--r--tests/testdata/run/005_more_imports.ts11
-rw-r--r--tests/testdata/run/005_more_imports.ts.out1
-rw-r--r--tests/testdata/run/006_url_imports.ts3
-rw-r--r--tests/testdata/run/006_url_imports.ts.out2
-rw-r--r--tests/testdata/run/012_async.ts11
-rw-r--r--tests/testdata/run/012_async.ts.out3
-rw-r--r--tests/testdata/run/013_dynamic_import.ts15
-rw-r--r--tests/testdata/run/013_dynamic_import.ts.out1
-rw-r--r--tests/testdata/run/014_duplicate_import.ts9
-rw-r--r--tests/testdata/run/014_duplicate_import.ts.out1
-rw-r--r--tests/testdata/run/015_duplicate_parallel_import.js20
-rw-r--r--tests/testdata/run/015_duplicate_parallel_import.js.out1
-rw-r--r--tests/testdata/run/016_double_await.ts8
-rw-r--r--tests/testdata/run/016_double_await.ts.out2
-rw-r--r--tests/testdata/run/017_import_redirect.ts4
-rw-r--r--tests/testdata/run/017_import_redirect.ts.out1
-rw-r--r--tests/testdata/run/017_import_redirect_info.out7
-rw-r--r--tests/testdata/run/018_async_catch.ts14
-rw-r--r--tests/testdata/run/018_async_catch.ts.out3
-rw-r--r--tests/testdata/run/019_media_types.ts24
-rw-r--r--tests/testdata/run/019_media_types.ts.out1
-rw-r--r--tests/testdata/run/020_json_modules.ts2
-rw-r--r--tests/testdata/run/020_json_modules.ts.out3
-rw-r--r--tests/testdata/run/021_mjs_modules.ts2
-rw-r--r--tests/testdata/run/021_mjs_modules.ts.out1
-rw-r--r--tests/testdata/run/023_no_ext2
-rw-r--r--tests/testdata/run/023_no_ext.out1
-rw-r--r--tests/testdata/run/025_hrtime.ts5
-rw-r--r--tests/testdata/run/025_hrtime.ts.out2
-rw-r--r--tests/testdata/run/025_reload_js_type_error.js6
-rw-r--r--tests/testdata/run/025_reload_js_type_error.js.out1
-rw-r--r--tests/testdata/run/026_redirect_javascript.js2
-rw-r--r--tests/testdata/run/026_redirect_javascript.js.out1
-rw-r--r--tests/testdata/run/027_redirect_typescript.ts2
-rw-r--r--tests/testdata/run/027_redirect_typescript.ts.out1
-rw-r--r--tests/testdata/run/028_args.ts3
-rw-r--r--tests/testdata/run/028_args.ts.out6
-rw-r--r--tests/testdata/run/033_import_map.out7
-rw-r--r--tests/testdata/run/033_import_map_in_config_file.out8
-rw-r--r--tests/testdata/run/033_import_map_in_flag_has_precedence.out1
-rw-r--r--tests/testdata/run/033_import_map_remote.out5
-rw-r--r--tests/testdata/run/035_cached_only_flag.out1
-rw-r--r--tests/testdata/run/038_checkjs.js5
-rw-r--r--tests/testdata/run/038_checkjs.js.out22
-rw-r--r--tests/testdata/run/042_dyn_import_evalcontext.ts5
-rw-r--r--tests/testdata/run/042_dyn_import_evalcontext.ts.out1
-rw-r--r--tests/testdata/run/044_bad_resource.ts3
-rw-r--r--tests/testdata/run/044_bad_resource.ts.out2
-rw-r--r--tests/testdata/run/045_mod.ts5
-rw-r--r--tests/testdata/run/045_output.ts3
-rw-r--r--tests/testdata/run/045_programmatic_proxy_client.ts16
-rw-r--r--tests/testdata/run/045_proxy_client.ts5
-rw-r--r--tests/testdata/run/045_proxy_test.ts121
-rw-r--r--tests/testdata/run/045_proxy_test.ts.out6
-rw-r--r--tests/testdata/run/046_jsx_test.tsx14
-rw-r--r--tests/testdata/run/046_jsx_test.tsx.out1
-rw-r--r--tests/testdata/run/047_jsx_test.jsx7
-rw-r--r--tests/testdata/run/047_jsx_test.jsx.out1
-rw-r--r--tests/testdata/run/048_media_types_jsx.ts32
-rw-r--r--tests/testdata/run/048_media_types_jsx.ts.out2
-rw-r--r--tests/testdata/run/052_no_remote_flag.out1
-rw-r--r--tests/testdata/run/056_make_temp_file_write_perm.out1
-rw-r--r--tests/testdata/run/056_make_temp_file_write_perm.ts9
-rw-r--r--tests/testdata/run/058_tasks_microtasks_close.ts19
-rw-r--r--tests/testdata/run/058_tasks_microtasks_close.ts.out6
-rw-r--r--tests/testdata/run/059_fs_relative_path_perm.ts2
-rw-r--r--tests/testdata/run/059_fs_relative_path_perm.ts.out4
-rw-r--r--tests/testdata/run/061_permissions_request.ts9
-rw-r--r--tests/testdata/run/061_permissions_request_sync.ts8
-rw-r--r--tests/testdata/run/062_permissions_request_global.ts6
-rw-r--r--tests/testdata/run/062_permissions_request_global_sync.ts6
-rw-r--r--tests/testdata/run/063_permissions_revoke.ts6
-rw-r--r--tests/testdata/run/063_permissions_revoke.ts.out3
-rw-r--r--tests/testdata/run/063_permissions_revoke_sync.ts6
-rw-r--r--tests/testdata/run/064_permissions_revoke_global.ts6
-rw-r--r--tests/testdata/run/064_permissions_revoke_global.ts.out3
-rw-r--r--tests/testdata/run/064_permissions_revoke_global_sync.ts6
-rw-r--r--tests/testdata/run/065_permissions_revoke_net.ts6
-rw-r--r--tests/testdata/run/065_permissions_revoke_net.ts.out3
-rw-r--r--tests/testdata/run/066_prompt.ts17
-rw-r--r--tests/testdata/run/070_location.ts18
-rw-r--r--tests/testdata/run/070_location.ts.out15
-rw-r--r--tests/testdata/run/071_location_unset.ts16
-rw-r--r--tests/testdata/run/071_location_unset.ts.out4
-rw-r--r--tests/testdata/run/072_location_relative_fetch.ts2
-rw-r--r--tests/testdata/run/072_location_relative_fetch.ts.out2
-rw-r--r--tests/testdata/run/075_import_local_query_hash.ts2
-rw-r--r--tests/testdata/run/075_import_local_query_hash.ts.out2
-rw-r--r--tests/testdata/run/077_fetch_empty.ts1
-rw-r--r--tests/testdata/run/077_fetch_empty.ts.out2
-rw-r--r--tests/testdata/run/078_unload_on_exit.ts9
-rw-r--r--tests/testdata/run/078_unload_on_exit.ts.out1
-rw-r--r--tests/testdata/run/079_location_authentication.ts1
-rw-r--r--tests/testdata/run/079_location_authentication.ts.out1
-rw-r--r--tests/testdata/run/081_location_relative_fetch_redirect.ts2
-rw-r--r--tests/testdata/run/081_location_relative_fetch_redirect.ts.out1
-rw-r--r--tests/testdata/run/082_prepare_stack_trace_throw.js6
-rw-r--r--tests/testdata/run/082_prepare_stack_trace_throw.js.out2
-rw-r--r--tests/testdata/run/083_legacy_external_source_map.ts2
-rw-r--r--tests/testdata/run/088_dynamic_import_already_evaluating.ts2
-rw-r--r--tests/testdata/run/088_dynamic_import_already_evaluating.ts.out4
-rw-r--r--tests/testdata/run/088_dynamic_import_target.ts3
-rw-r--r--tests/testdata/run/089_run_allow_list.ts12
-rw-r--r--tests/testdata/run/089_run_allow_list.ts.out3
-rw-r--r--tests/testdata/run/090_run_permissions_request.ts18
-rw-r--r--tests/testdata/run/090_run_permissions_request_sync.ts18
-rw-r--r--tests/testdata/run/091_use_define_for_class_fields.ts4
-rw-r--r--tests/testdata/run/091_use_define_for_class_fields.ts.out4
-rw-r--r--tests/testdata/run/092_import_map_unmapped_bare_specifier.ts1
-rw-r--r--tests/testdata/run/092_import_map_unmapped_bare_specifier.ts.out6
-rw-r--r--tests/testdata/run/aggregate_error.out18
-rw-r--r--tests/testdata/run/aggregate_error.ts9
-rw-r--r--tests/testdata/run/async_error.ts9
-rw-r--r--tests/testdata/run/async_error.ts.out8
-rw-r--r--tests/testdata/run/auto_discover_lockfile/deno.json3
-rw-r--r--tests/testdata/run/auto_discover_lockfile/deno.lock7
-rw-r--r--tests/testdata/run/auto_discover_lockfile/main.out5
-rw-r--r--tests/testdata/run/auto_discover_lockfile/main.ts1
-rw-r--r--tests/testdata/run/before_unload.js21
-rw-r--r--tests/testdata/run/before_unload.js.out8
-rw-r--r--tests/testdata/run/blob_gc_finalization.js11
-rw-r--r--tests/testdata/run/blob_gc_finalization.js.out1
-rw-r--r--tests/testdata/run/byte_order_mark.out1
-rw-r--r--tests/testdata/run/byte_order_mark.ts4
-rw-r--r--tests/testdata/run/check_js_points_to_ts/bar.ts3
-rw-r--r--tests/testdata/run/check_js_points_to_ts/foo.d.ts0
-rw-r--r--tests/testdata/run/check_js_points_to_ts/foo.js4
-rw-r--r--tests/testdata/run/check_js_points_to_ts/test.js3
-rw-r--r--tests/testdata/run/check_js_points_to_ts/test.js.out4
-rw-r--r--tests/testdata/run/checkjs.tsconfig.json6
-rw-r--r--tests/testdata/run/cjs_imports/commonjs.cjs1
-rw-r--r--tests/testdata/run/cjs_imports/main.out1
-rw-r--r--tests/testdata/run/cjs_imports/main.ts1
-rw-r--r--tests/testdata/run/classic_workers_event_loop.js4
-rw-r--r--tests/testdata/run/classic_workers_event_loop.js.out1
-rw-r--r--tests/testdata/run/colors_without_globalThis.js1
-rw-r--r--tests/testdata/run/complex_error.ts18
-rw-r--r--tests/testdata/run/complex_error.ts.out44
-rw-r--r--tests/testdata/run/complex_permissions_test.ts53
-rw-r--r--tests/testdata/run/config/main.out4
-rw-r--r--tests/testdata/run/config/main.ts5
-rw-r--r--tests/testdata/run/config/tsconfig.json7
-rw-r--r--tests/testdata/run/config_file_lock_boolean/deno.lock7
-rw-r--r--tests/testdata/run/config_file_lock_boolean/false.json3
-rw-r--r--tests/testdata/run/config_file_lock_boolean/false.main.out2
-rw-r--r--tests/testdata/run/config_file_lock_boolean/main.ts1
-rw-r--r--tests/testdata/run/config_file_lock_boolean/true.json3
-rw-r--r--tests/testdata/run/config_file_lock_boolean/true.main.out3
-rw-r--r--tests/testdata/run/config_file_lock_path.json3
-rw-r--r--tests/testdata/run/config_file_lock_path.out3
-rw-r--r--tests/testdata/run/config_json_import.ts2
-rw-r--r--tests/testdata/run/config_json_import.ts.out3
-rw-r--r--tests/testdata/run/config_types/deno.lock6
-rw-r--r--tests/testdata/run/config_types/main.out1
-rw-r--r--tests/testdata/run/config_types/main.ts1
-rw-r--r--tests/testdata/run/config_types/remote.tsconfig.json7
-rw-r--r--tests/testdata/run/config_types/tsconfig.json7
-rw-r--r--tests/testdata/run/config_types/types.d.ts2
-rw-r--r--tests/testdata/run/custom_inspect_url.js3
-rw-r--r--tests/testdata/run/custom_inspect_url.js.out47
-rw-r--r--tests/testdata/run/decorators/experimental/deno.json5
-rw-r--r--tests/testdata/run/decorators/experimental/no_check/main.out3
-rw-r--r--tests/testdata/run/decorators/experimental/no_check/main.ts21
-rw-r--r--tests/testdata/run/decorators/experimental/runtime/main.out7
-rw-r--r--tests/testdata/run/decorators/experimental/runtime/main.ts42
-rw-r--r--tests/testdata/run/decorators/experimental/ts/main.out2
-rw-r--r--tests/testdata/run/decorators/experimental/ts/main.ts14
-rw-r--r--tests/testdata/run/decorators/tc39_proposal/main.out3
-rw-r--r--tests/testdata/run/decorators/tc39_proposal/main.ts21
-rw-r--r--tests/testdata/run/delete_window.js1
-rw-r--r--tests/testdata/run/deno_exit_tampering.ts3
-rw-r--r--tests/testdata/run/deny_all_permission_args.js8
-rw-r--r--tests/testdata/run/deny_all_permission_args.out8
-rw-r--r--tests/testdata/run/deny_some_permission_args.js22
-rw-r--r--tests/testdata/run/deny_some_permission_args.out22
-rw-r--r--tests/testdata/run/disallow_http_from_https.js2
-rw-r--r--tests/testdata/run/disallow_http_from_https.ts2
-rw-r--r--tests/testdata/run/disallow_http_from_https_js.out3
-rw-r--r--tests/testdata/run/disallow_http_from_https_ts.out3
-rw-r--r--tests/testdata/run/dom_exception_formatting.ts1
-rw-r--r--tests/testdata/run/dom_exception_formatting.ts.out3
-rw-r--r--tests/testdata/run/dynamic_import_already_rejected/error_001.ts9
-rw-r--r--tests/testdata/run/dynamic_import_already_rejected/main.out4
-rw-r--r--tests/testdata/run/dynamic_import_already_rejected/main.ts15
-rw-r--r--tests/testdata/run/dynamic_import_async_error/delayed_error.ts2
-rw-r--r--tests/testdata/run/dynamic_import_async_error/main.out2
-rw-r--r--tests/testdata/run/dynamic_import_async_error/main.ts7
-rw-r--r--tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out100
-rw-r--r--tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts16
-rw-r--r--tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts7
-rw-r--r--tests/testdata/run/dynamic_import_conditional.js3
-rw-r--r--tests/testdata/run/dynamic_import_conditional.js.out1
-rw-r--r--tests/testdata/run/dynamic_import_syntax_error.js1
-rw-r--r--tests/testdata/run/dynamic_import_syntax_error.js.out4
-rw-r--r--tests/testdata/run/dynamic_import_syntax_error_import.js5
-rw-r--r--tests/testdata/run/empty.ts0
-rw-r--r--tests/testdata/run/env_file.out4
-rw-r--r--tests/testdata/run/env_file.ts3
-rw-r--r--tests/testdata/run/env_file_missing.out4
-rw-r--r--tests/testdata/run/error_001.ts9
-rw-r--r--tests/testdata/run/error_001.ts.out6
-rw-r--r--tests/testdata/run/error_002.ts7
-rw-r--r--tests/testdata/run/error_002.ts.out6
-rw-r--r--tests/testdata/run/error_003_typescript.ts20
-rw-r--r--tests/testdata/run/error_003_typescript.ts.out7
-rw-r--r--tests/testdata/run/error_004_missing_module.ts3
-rw-r--r--tests/testdata/run/error_004_missing_module.ts.out2
-rw-r--r--tests/testdata/run/error_005_missing_dynamic_import.ts3
-rw-r--r--tests/testdata/run/error_005_missing_dynamic_import.ts.out4
-rw-r--r--tests/testdata/run/error_006_import_ext_failure.ts1
-rw-r--r--tests/testdata/run/error_006_import_ext_failure.ts.out2
-rw-r--r--tests/testdata/run/error_007_any.ts1
-rw-r--r--tests/testdata/run/error_007_any.ts.out1
-rw-r--r--tests/testdata/run/error_008_checkjs.js5
-rw-r--r--tests/testdata/run/error_008_checkjs.js.out4
-rw-r--r--tests/testdata/run/error_009_extensions_error.js2
-rw-r--r--tests/testdata/run/error_009_extensions_error.js.out6
-rw-r--r--tests/testdata/run/error_009_missing_js_module.disabled4
-rw-r--r--tests/testdata/run/error_011_bad_module_specifier.ts3
-rw-r--r--tests/testdata/run/error_011_bad_module_specifier.ts.out2
-rw-r--r--tests/testdata/run/error_012_bad_dynamic_import_specifier.ts3
-rw-r--r--tests/testdata/run/error_012_bad_dynamic_import_specifier.ts.out7
-rw-r--r--tests/testdata/run/error_013_missing_script.out1
-rw-r--r--tests/testdata/run/error_014_catch_dynamic_import_error.js31
-rw-r--r--tests/testdata/run/error_014_catch_dynamic_import_error.js.out19
-rw-r--r--tests/testdata/run/error_015_dynamic_import_permissions.js3
-rw-r--r--tests/testdata/run/error_015_dynamic_import_permissions.out4
-rw-r--r--tests/testdata/run/error_016_dynamic_import_permissions2.js5
-rw-r--r--tests/testdata/run/error_016_dynamic_import_permissions2.out7
-rw-r--r--tests/testdata/run/error_017_hide_long_source_ts.ts3
-rw-r--r--tests/testdata/run/error_017_hide_long_source_ts.ts.out3
-rw-r--r--tests/testdata/run/error_018_hide_long_source_js.js3
-rw-r--r--tests/testdata/run/error_018_hide_long_source_js.js.out2
-rw-r--r--tests/testdata/run/error_019_stack_function.ts12
-rw-r--r--tests/testdata/run/error_019_stack_function.ts.out8
-rw-r--r--tests/testdata/run/error_020_stack_constructor.ts14
-rw-r--r--tests/testdata/run/error_020_stack_constructor.ts.out8
-rw-r--r--tests/testdata/run/error_021_stack_method.ts14
-rw-r--r--tests/testdata/run/error_021_stack_method.ts.out8
-rw-r--r--tests/testdata/run/error_022_stack_custom_error.ts14
-rw-r--r--tests/testdata/run/error_022_stack_custom_error.ts.out6
-rw-r--r--tests/testdata/run/error_023_stack_async.ts14
-rw-r--r--tests/testdata/run/error_023_stack_async.ts.out10
-rw-r--r--tests/testdata/run/error_024_stack_promise_all.ts16
-rw-r--r--tests/testdata/run/error_024_stack_promise_all.ts.out10
-rw-r--r--tests/testdata/run/error_025_tab_indent9
-rw-r--r--tests/testdata/run/error_025_tab_indent.out6
-rw-r--r--tests/testdata/run/error_026_remote_import_error.ts1
-rw-r--r--tests/testdata/run/error_026_remote_import_error.ts.out7
-rw-r--r--tests/testdata/run/error_cause.ts14
-rw-r--r--tests/testdata/run/error_cause.ts.out13
-rw-r--r--tests/testdata/run/error_cause_recursive.ts4
-rw-r--r--tests/testdata/run/error_cause_recursive.ts.out7
-rw-r--r--tests/testdata/run/error_for_await.ts12
-rw-r--r--tests/testdata/run/error_for_await.ts.out10
-rw-r--r--tests/testdata/run/error_import_map_unable_to_load.out4
-rw-r--r--tests/testdata/run/error_local_static_import_from_remote.js1
-rw-r--r--tests/testdata/run/error_local_static_import_from_remote.js.out4
-rw-r--r--tests/testdata/run/error_local_static_import_from_remote.ts1
-rw-r--r--tests/testdata/run/error_local_static_import_from_remote.ts.out4
-rw-r--r--tests/testdata/run/error_missing_module_named_import.ts3
-rw-r--r--tests/testdata/run/error_missing_module_named_import.ts.out2
-rw-r--r--tests/testdata/run/error_name_non_string.js8
-rw-r--r--tests/testdata/run/error_name_non_string.js.out4
-rw-r--r--tests/testdata/run/error_no_check.ts1
-rw-r--r--tests/testdata/run/error_no_check.ts.out2
-rw-r--r--tests/testdata/run/error_syntax.js3
-rw-r--r--tests/testdata/run/error_syntax.js.out4
-rw-r--r--tests/testdata/run/error_syntax_empty_trailing_line.mjs2
-rw-r--r--tests/testdata/run/error_syntax_empty_trailing_line.mjs.out4
-rw-r--r--tests/testdata/run/error_type_definitions.ts5
-rw-r--r--tests/testdata/run/error_type_definitions.ts.out2
-rw-r--r--tests/testdata/run/error_with_errors_prop.js10
-rw-r--r--tests/testdata/run/error_with_errors_prop.js.out17
-rw-r--r--tests/testdata/run/es_private_fields.js15
-rw-r--r--tests/testdata/run/es_private_fields.js.out1
-rw-r--r--tests/testdata/run/eval_context_throw_dom_exception.js5
-rw-r--r--tests/testdata/run/eval_context_throw_dom_exception.js.out9
-rw-r--r--tests/testdata/run/event_listener_error.ts6
-rw-r--r--tests/testdata/run/event_listener_error.ts.out7
-rw-r--r--tests/testdata/run/event_listener_error_handled.ts23
-rw-r--r--tests/testdata/run/event_listener_error_handled.ts.out17
-rw-r--r--tests/testdata/run/event_listener_error_immediate_exit.ts12
-rw-r--r--tests/testdata/run/event_listener_error_immediate_exit.ts.out6
-rw-r--r--tests/testdata/run/event_listener_error_immediate_exit_worker.ts4
-rw-r--r--tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out8
-rw-r--r--tests/testdata/run/exec_path.ts1
-rw-r--r--tests/testdata/run/exit_error42.ts3
-rw-r--r--tests/testdata/run/exit_error42.ts.out1
-rw-r--r--tests/testdata/run/explicit_resource_management/main.out5
-rw-r--r--tests/testdata/run/explicit_resource_management/main.ts21
-rw-r--r--tests/testdata/run/export_type_def.ts2
-rw-r--r--tests/testdata/run/extension_dynamic_import.ts1
-rw-r--r--tests/testdata/run/extension_dynamic_import.ts.out4
-rw-r--r--tests/testdata/run/extension_import.ts1
-rw-r--r--tests/testdata/run/extension_import.ts.out8
-rw-r--r--tests/testdata/run/fetch/hello.txt1
-rw-r--r--tests/testdata/run/fetch/other.ts1
-rw-r--r--tests/testdata/run/fetch/test.ts1
-rw-r--r--tests/testdata/run/fetch_async_error_stack.ts1
-rw-r--r--tests/testdata/run/fetch_async_error_stack.ts.out5
-rw-r--r--tests/testdata/run/fetch_response_finalization.js16
-rw-r--r--tests/testdata/run/fetch_response_finalization.js.out2
-rw-r--r--tests/testdata/run/finalization_registry.js20
-rw-r--r--tests/testdata/run/finalization_registry.js.out1
-rw-r--r--tests/testdata/run/fix_dynamic_import_errors.js7
-rw-r--r--tests/testdata/run/fix_dynamic_import_errors.js.out2
-rw-r--r--tests/testdata/run/fix_emittable_skipped.js7
-rw-r--r--tests/testdata/run/fix_emittable_skipped.ts.out1
-rw-r--r--tests/testdata/run/fix_js_import_js.ts3
-rw-r--r--tests/testdata/run/fix_js_import_js.ts.out1
-rw-r--r--tests/testdata/run/fix_js_imports.ts3
-rw-r--r--tests/testdata/run/fix_js_imports.ts.out1
-rw-r--r--tests/testdata/run/fix_tsc_file_exists.out1
-rw-r--r--tests/testdata/run/fix_worker_dispatchevent.ts43
-rw-r--r--tests/testdata/run/fix_worker_dispatchevent.ts.out1
-rw-r--r--tests/testdata/run/followup_dyn_import_resolves/main.ts14
-rw-r--r--tests/testdata/run/followup_dyn_import_resolves/main.ts.out3
-rw-r--r--tests/testdata/run/followup_dyn_import_resolves/sub1.ts2
-rw-r--r--tests/testdata/run/followup_dyn_import_resolves/sub2.ts1
-rw-r--r--tests/testdata/run/heapstats.js37
-rw-r--r--tests/testdata/run/heapstats.js.out2
-rw-r--r--tests/testdata/run/http2_request_url.ts12
-rw-r--r--tests/testdata/run/https_import.ts3
-rw-r--r--tests/testdata/run/https_import.ts.out1
-rw-r--r--tests/testdata/run/if_main.ts6
-rw-r--r--tests/testdata/run/if_main.ts.out1
-rw-r--r--tests/testdata/run/import_blob_url.ts13
-rw-r--r--tests/testdata/run/import_blob_url.ts.out3
-rw-r--r--tests/testdata/run/import_blob_url_error_stack.ts13
-rw-r--r--tests/testdata/run/import_blob_url_error_stack.ts.out5
-rw-r--r--tests/testdata/run/import_blob_url_import_relative.ts8
-rw-r--r--tests/testdata/run/import_blob_url_import_relative.ts.out5
-rw-r--r--tests/testdata/run/import_blob_url_imports.ts11
-rw-r--r--tests/testdata/run/import_blob_url_imports.ts.out1
-rw-r--r--tests/testdata/run/import_blob_url_jsx.ts16
-rw-r--r--tests/testdata/run/import_blob_url_jsx.ts.out1
-rw-r--r--tests/testdata/run/import_compression/brotli2
-rw-r--r--tests/testdata/run/import_compression/gzipedbin0 -> 39 bytes
-rw-r--r--tests/testdata/run/import_compression/main.out4
-rw-r--r--tests/testdata/run/import_compression/main.ts13
-rw-r--r--tests/testdata/run/import_data_url.ts12
-rw-r--r--tests/testdata/run/import_data_url.ts.out3
-rw-r--r--tests/testdata/run/import_data_url_error_stack.ts3
-rw-r--r--tests/testdata/run/import_data_url_error_stack.ts.out5
-rw-r--r--tests/testdata/run/import_data_url_import_relative.ts4
-rw-r--r--tests/testdata/run/import_data_url_import_relative.ts.out2
-rw-r--r--tests/testdata/run/import_data_url_imports.ts4
-rw-r--r--tests/testdata/run/import_data_url_imports.ts.out1
-rw-r--r--tests/testdata/run/import_data_url_jsx.ts10
-rw-r--r--tests/testdata/run/import_data_url_jsx.ts.out1
-rw-r--r--tests/testdata/run/import_dynamic_data_url.ts14
-rw-r--r--tests/testdata/run/import_dynamic_data_url.ts.out3
-rw-r--r--tests/testdata/run/import_extensionless.ts3
-rw-r--r--tests/testdata/run/import_extensionless.ts.out1
-rw-r--r--tests/testdata/run/import_file_with_colon.ts1
-rw-r--r--tests/testdata/run/import_file_with_colon.ts.out1
-rw-r--r--tests/testdata/run/import_maps/test_data.ts1
-rw-r--r--tests/testdata/run/import_maps/test_data.ts.out1
-rw-r--r--tests/testdata/run/import_meta/importmap.json12
-rw-r--r--tests/testdata/run/import_meta/main.out13
-rw-r--r--tests/testdata/run/import_meta/main.ts52
-rw-r--r--tests/testdata/run/import_meta/other.ts7
-rw-r--r--tests/testdata/run/import_type.ts5
-rw-r--r--tests/testdata/run/import_type.ts.out1
-rw-r--r--tests/testdata/run/inline_js_source_map.ts6
-rw-r--r--tests/testdata/run/inline_js_source_map_2.js4
-rw-r--r--tests/testdata/run/inline_js_source_map_2.js.out2
-rw-r--r--tests/testdata/run/inline_js_source_map_2.ts6
-rw-r--r--tests/testdata/run/inline_js_source_map_2_with_inline_contents.js4
-rw-r--r--tests/testdata/run/inline_js_source_map_2_with_inline_contents.js.out2
-rw-r--r--tests/testdata/run/inline_js_source_map_with_contents_from_graph.js4
-rw-r--r--tests/testdata/run/inline_js_source_map_with_contents_from_graph.js.out4
-rw-r--r--tests/testdata/run/issue13562.ts3
-rw-r--r--tests/testdata/run/issue13562.ts.out1
-rw-r--r--tests/testdata/run/issue9750.js6
-rw-r--r--tests/testdata/run/js_import_detect.ts3
-rw-r--r--tests/testdata/run/js_import_detect.ts.out1
-rw-r--r--tests/testdata/run/js_root_with_ts_check.js5
-rw-r--r--tests/testdata/run/js_root_with_ts_check.js.out4
-rw-r--r--tests/testdata/run/jsx_import_from_ts.App.jsx11
-rw-r--r--tests/testdata/run/jsx_import_from_ts.ts3
-rw-r--r--tests/testdata/run/jsx_import_from_ts.ts.out1
-rw-r--r--tests/testdata/run/jsx_import_source.out2
-rw-r--r--tests/testdata/run/jsx_import_source_dev.out2
-rw-r--r--tests/testdata/run/jsx_import_source_error.out2
-rw-r--r--tests/testdata/run/jsx_import_source_import_map.out2
-rw-r--r--tests/testdata/run/jsx_import_source_import_map_dev.out2
-rw-r--r--tests/testdata/run/jsx_import_source_no_pragma.tsx7
-rw-r--r--tests/testdata/run/jsx_import_source_pragma.tsx9
-rw-r--r--tests/testdata/run/jsx_import_source_pragma_import_map.tsx9
-rw-r--r--tests/testdata/run/jsx_precompile/no_pragma.out3
-rw-r--r--tests/testdata/run/jsx_precompile/no_pragma.tsx3
-rw-r--r--tests/testdata/run/lock_check_err.json4
-rw-r--r--tests/testdata/run/lock_check_err.out3
-rw-r--r--tests/testdata/run/lock_check_err2.json10
-rw-r--r--tests/testdata/run/lock_check_err2.out3
-rw-r--r--tests/testdata/run/lock_check_ok.json4
-rw-r--r--tests/testdata/run/lock_check_ok2.json13
-rw-r--r--tests/testdata/run/lock_dynamic_imports.json6
-rw-r--r--tests/testdata/run/lock_dynamic_imports.out4
-rw-r--r--tests/testdata/run/lock_only_http_and_https/b.ts3
-rw-r--r--tests/testdata/run/lock_only_http_and_https/deno.lock7
-rw-r--r--tests/testdata/run/lock_only_http_and_https/main.out5
-rw-r--r--tests/testdata/run/lock_only_http_and_https/main.ts6
-rw-r--r--tests/testdata/run/lock_v2_check_err.json7
-rw-r--r--tests/testdata/run/lock_v2_check_err.out3
-rw-r--r--tests/testdata/run/lock_v2_check_err2.json13
-rw-r--r--tests/testdata/run/lock_v2_check_err2.out3
-rw-r--r--tests/testdata/run/lock_v2_check_ok.json7
-rw-r--r--tests/testdata/run/lock_v2_check_ok2.json13
-rw-r--r--tests/testdata/run/lock_v2_dynamic_imports.json9
-rw-r--r--tests/testdata/run/lock_v2_dynamic_imports.out4
-rw-r--r--tests/testdata/run/lock_write_fetch/file_exists.ts6
-rw-r--r--tests/testdata/run/lock_write_fetch/main.out3
-rw-r--r--tests/testdata/run/lock_write_fetch/main.ts52
-rw-r--r--tests/testdata/run/long_data_url_formatting.ts3
-rw-r--r--tests/testdata/run/long_data_url_formatting.ts.out8
-rw-r--r--tests/testdata/run/main_module/main.out2
-rw-r--r--tests/testdata/run/main_module/main.ts3
-rw-r--r--tests/testdata/run/main_module/other.ts1
-rw-r--r--tests/testdata/run/mts_dmts_mjs.out1
-rw-r--r--tests/testdata/run/nested_error/main.ts3
-rw-r--r--tests/testdata/run/nested_error/main.ts.out4
-rw-r--r--tests/testdata/run/no_check_imports_not_used_as_values/hello.ts2
-rw-r--r--tests/testdata/run/no_check_imports_not_used_as_values/main.out2
-rw-r--r--tests/testdata/run/no_check_imports_not_used_as_values/main.ts4
-rw-r--r--tests/testdata/run/no_check_imports_not_used_as_values/preserve_imports.tsconfig.json5
-rw-r--r--tests/testdata/run/no_check_remote.ts3
-rw-r--r--tests/testdata/run/no_check_remote.ts.disabled.out4
-rw-r--r--tests/testdata/run/no_check_remote.ts.enabled.out1
-rw-r--r--tests/testdata/run/no_lock_flag/deno.json3
-rw-r--r--tests/testdata/run/no_lock_flag/deno.lock7
-rw-r--r--tests/testdata/run/no_lock_flag/main.out2
-rw-r--r--tests/testdata/run/no_lock_flag/main.ts1
-rw-r--r--tests/testdata/run/no_mem_cache.js33
-rw-r--r--tests/testdata/run/no_mem_cache.js.out2
-rw-r--r--tests/testdata/run/no_prompt.ts10
-rw-r--r--tests/testdata/run/no_validate_asm.js20
-rw-r--r--tests/testdata/run/node_builtin_modules/mod.js5
-rw-r--r--tests/testdata/run/node_builtin_modules/mod.js.out3
-rw-r--r--tests/testdata/run/node_builtin_modules/mod.ts5
-rw-r--r--tests/testdata/run/node_builtin_modules/mod.ts.out3
-rw-r--r--tests/testdata/run/node_env_var_allowlist.ts2
-rw-r--r--tests/testdata/run/node_env_var_allowlist.ts.out5
-rw-r--r--tests/testdata/run/node_prefix_missing/config.json1
-rw-r--r--tests/testdata/run/node_prefix_missing/import_map.json1
-rw-r--r--tests/testdata/run/node_prefix_missing/main.ts3
-rw-r--r--tests/testdata/run/node_prefix_missing/main.ts.out3
-rw-r--r--tests/testdata/run/node_prefix_missing/main.ts.out_feature_enabled2
-rw-r--r--tests/testdata/run/onload/imported.ts13
-rw-r--r--tests/testdata/run/onload/main.out15
-rw-r--r--tests/testdata/run/onload/main.ts34
-rw-r--r--tests/testdata/run/onload/nest_imported.ts12
-rw-r--r--tests/testdata/run/op_exit_op_set_exit_code_in_worker.ts13
-rw-r--r--tests/testdata/run/op_exit_op_set_exit_code_worker.js4
-rw-r--r--tests/testdata/run/permission_args.out4
-rw-r--r--tests/testdata/run/permission_request_long.ts1
-rw-r--r--tests/testdata/run/permission_test.ts30
-rw-r--r--tests/testdata/run/permissions_cache.ts5
-rw-r--r--tests/testdata/run/permissions_prompt_allow_all.ts20
-rw-r--r--tests/testdata/run/permissions_prompt_allow_all_2.ts8
-rw-r--r--tests/testdata/run/private_field_presence.ts20
-rw-r--r--tests/testdata/run/private_field_presence.ts.out2
-rw-r--r--tests/testdata/run/proto_exploit.js5
-rw-r--r--tests/testdata/run/proto_exploit.js.out2
-rw-r--r--tests/testdata/run/queue_microtask_error.ts5
-rw-r--r--tests/testdata/run/queue_microtask_error.ts.out6
-rw-r--r--tests/testdata/run/queue_microtask_error_handled.ts21
-rw-r--r--tests/testdata/run/queue_microtask_error_handled.ts.out15
-rw-r--r--tests/testdata/run/reference_types.ts3
-rw-r--r--tests/testdata/run/reference_types.ts.out1
-rw-r--r--tests/testdata/run/reference_types_error.js2
-rw-r--r--tests/testdata/run/reference_types_error.js.out2
-rw-r--r--tests/testdata/run/reference_types_remote.ts3
-rw-r--r--tests/testdata/run/reference_types_remote.ts.out1
-rw-r--r--tests/testdata/run/rejection_handled.out5
-rw-r--r--tests/testdata/run/rejection_handled.ts17
-rw-r--r--tests/testdata/run/remote_type_error/main.ts3
-rw-r--r--tests/testdata/run/remote_type_error/remote.ts5
-rw-r--r--tests/testdata/run/replace_self.js21
-rw-r--r--tests/testdata/run/replace_self.js.out4
-rw-r--r--tests/testdata/run/report_error.ts3
-rw-r--r--tests/testdata/run/report_error.ts.out5
-rw-r--r--tests/testdata/run/report_error_end_of_program.ts1
-rw-r--r--tests/testdata/run/report_error_end_of_program.ts.out4
-rw-r--r--tests/testdata/run/report_error_handled.ts19
-rw-r--r--tests/testdata/run/report_error_handled.ts.out13
-rw-r--r--tests/testdata/run/resolve_dns.ts93
-rw-r--r--tests/testdata/run/resolve_dns.ts.out28
-rw-r--r--tests/testdata/run/resolve_dns.zone.in32
-rw-r--r--tests/testdata/run/runtime_decorators.ts42
-rw-r--r--tests/testdata/run/runtime_decorators.ts.out7
-rw-r--r--tests/testdata/run/seed_random.js11
-rw-r--r--tests/testdata/run/seed_random.js.out22
-rw-r--r--tests/testdata/run/set_exit_code_0.ts2
-rw-r--r--tests/testdata/run/set_exit_code_1.ts2
-rw-r--r--tests/testdata/run/set_exit_code_2.ts2
-rw-r--r--tests/testdata/run/set_timeout_error.ts3
-rw-r--r--tests/testdata/run/set_timeout_error.ts.out5
-rw-r--r--tests/testdata/run/set_timeout_error_handled.ts19
-rw-r--r--tests/testdata/run/set_timeout_error_handled.ts.out13
-rw-r--r--tests/testdata/run/shebang.ts5
-rw-r--r--tests/testdata/run/shebang.ts.out1
-rw-r--r--tests/testdata/run/shebang2.ts3
-rw-r--r--tests/testdata/run/single_compile_with_reload.ts18
-rw-r--r--tests/testdata/run/single_compile_with_reload.ts.out7
-rw-r--r--tests/testdata/run/single_compile_with_reload_dyn.ts11
-rw-r--r--tests/testdata/run/single_compile_with_reload_worker.ts3
-rw-r--r--tests/testdata/run/spawn_stdout_inherit.ts8
-rw-r--r--tests/testdata/run/spawn_stdout_inherit.ts.out2
-rw-r--r--tests/testdata/run/stdin_read_all.out1
-rw-r--r--tests/testdata/run/stdin_read_all.ts17
-rw-r--r--tests/testdata/run/stdio_streams_are_locked_in_permission_prompt/worker.js3
-rw-r--r--tests/testdata/run/stdout_write_all.out100
-rw-r--r--tests/testdata/run/stdout_write_all.ts13
-rw-r--r--tests/testdata/run/stdout_write_sync_async.out200
-rw-r--r--tests/testdata/run/stdout_write_sync_async.ts14
-rw-r--r--tests/testdata/run/swc_syntax_error.ts4
-rw-r--r--tests/testdata/run/swc_syntax_error.ts.out4
-rw-r--r--tests/testdata/run/test_and_bench_in_run.js5
-rw-r--r--tests/testdata/run/textproto.ts173
-rw-r--r--tests/testdata/run/tls.out1
-rw-r--r--tests/testdata/run/tls_connecttls.js66
-rw-r--r--tests/testdata/run/tls_starttls.js65
-rw-r--r--tests/testdata/run/top_level_await/circular.js8
-rw-r--r--tests/testdata/run/top_level_await/circular.out10
-rw-r--r--tests/testdata/run/top_level_await/loop.js20
-rw-r--r--tests/testdata/run/top_level_await/loop.out5
-rw-r--r--tests/testdata/run/top_level_await/nested.out5
-rw-r--r--tests/testdata/run/top_level_await/nested/a.js3
-rw-r--r--tests/testdata/run/top_level_await/nested/b.js1
-rw-r--r--tests/testdata/run/top_level_await/nested/main.js3
-rw-r--r--tests/testdata/run/top_level_await/order.js21
-rw-r--r--tests/testdata/run/top_level_await/order.out2
-rw-r--r--tests/testdata/run/top_level_await/tla/a.js3
-rw-r--r--tests/testdata/run/top_level_await/tla/b.js7
-rw-r--r--tests/testdata/run/top_level_await/tla/c.js3
-rw-r--r--tests/testdata/run/top_level_await/tla/d.js8
-rw-r--r--tests/testdata/run/top_level_await/tla/order.js1
-rw-r--r--tests/testdata/run/top_level_await/tla/parent.js9
-rw-r--r--tests/testdata/run/top_level_await/tla2/a.js5
-rw-r--r--tests/testdata/run/top_level_await/tla2/b.js5
-rw-r--r--tests/testdata/run/top_level_await/tla3/b.js7
-rw-r--r--tests/testdata/run/top_level_await/tla3/timeout_loop.js23
-rw-r--r--tests/testdata/run/top_level_await/top_level_await.js3
-rw-r--r--tests/testdata/run/top_level_await/top_level_await.out3
-rw-r--r--tests/testdata/run/top_level_await/top_level_await.ts3
-rw-r--r--tests/testdata/run/top_level_await/top_level_for_await.js10
-rw-r--r--tests/testdata/run/top_level_await/top_level_for_await.out3
-rw-r--r--tests/testdata/run/top_level_await/top_level_for_await.ts10
-rw-r--r--tests/testdata/run/top_level_await/unresolved.js1
-rw-r--r--tests/testdata/run/top_level_await/unresolved.out4
-rw-r--r--tests/testdata/run/ts_import_from_js/deps.js2
-rw-r--r--tests/testdata/run/ts_import_from_js/main.js3
-rw-r--r--tests/testdata/run/ts_import_from_js/main.out3
-rw-r--r--tests/testdata/run/ts_type_imports.ts5
-rw-r--r--tests/testdata/run/ts_type_imports.ts.out6
-rw-r--r--tests/testdata/run/ts_type_imports_foo.ts1
-rw-r--r--tests/testdata/run/ts_type_only_import.d.ts3
-rw-r--r--tests/testdata/run/ts_type_only_import.ts1
-rw-r--r--tests/testdata/run/ts_type_only_import.ts.out1
-rw-r--r--tests/testdata/run/tsx_imports/Component.tsx1
-rw-r--r--tests/testdata/run/tsx_imports/tsx_imports.ts1
-rw-r--r--tests/testdata/run/tsx_imports/tsx_imports.ts.out2
-rw-r--r--tests/testdata/run/type_definitions.ts12
-rw-r--r--tests/testdata/run/type_definitions.ts.out3
-rw-r--r--tests/testdata/run/type_definitions_for_export.ts7
-rw-r--r--tests/testdata/run/type_definitions_for_export.ts.out5
-rw-r--r--tests/testdata/run/type_directives_01.ts3
-rw-r--r--tests/testdata/run/type_directives_01.ts.out3
-rw-r--r--tests/testdata/run/type_directives_02.ts3
-rw-r--r--tests/testdata/run/type_directives_02.ts.out3
-rw-r--r--tests/testdata/run/type_directives_js_main.js3
-rw-r--r--tests/testdata/run/type_directives_redirect.ts1
-rw-r--r--tests/testdata/run/type_directives_redirect.ts.out5
-rw-r--r--tests/testdata/run/type_headers_deno_types.ts18
-rw-r--r--tests/testdata/run/type_headers_deno_types.ts.out5
-rw-r--r--tests/testdata/run/unbuffered_stderr.ts1
-rw-r--r--tests/testdata/run/unbuffered_stderr.ts.out1
-rw-r--r--tests/testdata/run/unbuffered_stdout.ts1
-rw-r--r--tests/testdata/run/unbuffered_stdout.ts.out1
-rw-r--r--tests/testdata/run/unhandled_rejection.ts13
-rw-r--r--tests/testdata/run/unhandled_rejection.ts.out9
-rw-r--r--tests/testdata/run/unhandled_rejection_dynamic_import/import.ts5
-rw-r--r--tests/testdata/run/unhandled_rejection_dynamic_import/main.ts1
-rw-r--r--tests/testdata/run/unhandled_rejection_dynamic_import/main.ts.out3
-rw-r--r--tests/testdata/run/unhandled_rejection_dynamic_import2/import.ts3
-rw-r--r--tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts21
-rw-r--r--tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts.out5
-rw-r--r--tests/testdata/run/unhandled_rejection_sync_error.ts6
-rw-r--r--tests/testdata/run/unhandled_rejection_sync_error.ts.out6
-rw-r--r--tests/testdata/run/unsafe_proto/main.js5
-rw-r--r--tests/testdata/run/unsafe_proto/main.out2
-rw-r--r--tests/testdata/run/unsafe_proto/main_with_unsafe_proto_flag.out2
-rw-r--r--tests/testdata/run/unsafe_proto/worker.js2
-rw-r--r--tests/testdata/run/unstable.js1
-rw-r--r--tests/testdata/run/unstable.ts1
-rw-r--r--tests/testdata/run/unstable_broadcast_channel.disabled.out2
-rw-r--r--tests/testdata/run/unstable_broadcast_channel.enabled.out2
-rw-r--r--tests/testdata/run/unstable_broadcast_channel.js10
-rw-r--r--tests/testdata/run/unstable_cron.disabled.out2
-rw-r--r--tests/testdata/run/unstable_cron.enabled.out2
-rw-r--r--tests/testdata/run/unstable_cron.js10
-rw-r--r--tests/testdata/run/unstable_disabled_js.out1
-rw-r--r--tests/testdata/run/unstable_enabled.out1
-rw-r--r--tests/testdata/run/unstable_enabled_js.out1
-rw-r--r--tests/testdata/run/unstable_ffi.disabled.out10
-rw-r--r--tests/testdata/run/unstable_ffi.enabled.out10
-rw-r--r--tests/testdata/run/unstable_ffi.js14
-rw-r--r--tests/testdata/run/unstable_fs.disabled.out10
-rw-r--r--tests/testdata/run/unstable_fs.enabled.out10
-rw-r--r--tests/testdata/run/unstable_fs.js14
-rw-r--r--tests/testdata/run/unstable_http.disabled.out12
-rw-r--r--tests/testdata/run/unstable_http.enabled.out12
-rw-r--r--tests/testdata/run/unstable_http.js15
-rw-r--r--tests/testdata/run/unstable_kv.disabled.out10
-rw-r--r--tests/testdata/run/unstable_kv.enabled.out10
-rw-r--r--tests/testdata/run/unstable_kv.js14
-rw-r--r--tests/testdata/run/unstable_net.disabled.out4
-rw-r--r--tests/testdata/run/unstable_net.enabled.out4
-rw-r--r--tests/testdata/run/unstable_net.js11
-rw-r--r--tests/testdata/run/unstable_temporal_api/main.out12
-rw-r--r--tests/testdata/run/unstable_temporal_api/main.ts71
-rw-r--r--tests/testdata/run/unstable_temporal_api/missing_flag.js1
-rw-r--r--tests/testdata/run/unstable_temporal_api/missing_flag.out4
-rw-r--r--tests/testdata/run/unstable_webgpu.disabled.out2
-rw-r--r--tests/testdata/run/unstable_webgpu.enabled.out2
-rw-r--r--tests/testdata/run/unstable_webgpu.js10
-rw-r--r--tests/testdata/run/unstable_worker.ts6
-rw-r--r--tests/testdata/run/unstable_worker.ts.out2
-rw-r--r--tests/testdata/run/unstable_worker_options.disabled.out1
-rw-r--r--tests/testdata/run/unstable_worker_options.enabled.out2
-rw-r--r--tests/testdata/run/unstable_worker_options.js19
-rw-r--r--tests/testdata/run/unsupported_dynamic_import_scheme.out7
-rw-r--r--tests/testdata/run/v8_flags.js1
-rw-r--r--tests/testdata/run/v8_flags.js.out1
-rw-r--r--tests/testdata/run/v8_flags_unrecognized.out5
-rw-r--r--tests/testdata/run/v8_help.out4
-rw-r--r--tests/testdata/run/warn_on_deprecated_api/main.js32
-rw-r--r--tests/testdata/run/warn_on_deprecated_api/main.out16
-rw-r--r--tests/testdata/run/warn_on_deprecated_api/main.verbose.out65
-rw-r--r--tests/testdata/run/warn_on_deprecated_api/main_disabled_env.out15
-rw-r--r--tests/testdata/run/warn_on_deprecated_api/main_disabled_flag.out14
-rw-r--r--tests/testdata/run/warn_on_deprecated_api/mod.ts11
-rw-r--r--tests/testdata/run/wasm.ts16
-rw-r--r--tests/testdata/run/wasm.ts.out1
-rw-r--r--tests/testdata/run/wasm_async.js27
-rw-r--r--tests/testdata/run/wasm_async.out1
-rw-r--r--tests/testdata/run/wasm_shared.out0
-rw-r--r--tests/testdata/run/wasm_shared.ts6
-rw-r--r--tests/testdata/run/wasm_streaming_panic_test.js3
-rw-r--r--tests/testdata/run/wasm_streaming_panic_test.js.out2
-rw-r--r--tests/testdata/run/wasm_unreachable.js9
-rw-r--r--tests/testdata/run/wasm_unreachable.out3
-rw-r--r--tests/testdata/run/wasm_url.js8
-rw-r--r--tests/testdata/run/wasm_url.out3
-rw-r--r--tests/testdata/run/weakref.ts1
-rw-r--r--tests/testdata/run/weakref.ts.out1
-rw-r--r--tests/testdata/run/websocket_server_idletimeout.ts25
-rw-r--r--tests/testdata/run/websocket_server_multi_field_connection_header_test.ts15
-rw-r--r--tests/testdata/run/websocketstream_ping_test.ts5
-rw-r--r--tests/testdata/run/webstorage/config_a.jsonc3
-rw-r--r--tests/testdata/run/webstorage/config_b.jsonc3
-rw-r--r--tests/testdata/run/webstorage/fixture.ts2
-rw-r--r--tests/testdata/run/webstorage/logger.ts1
-rw-r--r--tests/testdata/run/webstorage/serialization.ts4
-rw-r--r--tests/testdata/run/webstorage/serialization.ts.out2
-rw-r--r--tests/testdata/run/webstorage/setter.ts1
-rw-r--r--tests/testdata/run/with_config/auto_discovery_log.out4
-rw-r--r--tests/testdata/run/with_config/deno.jsonc6
-rw-r--r--tests/testdata/run/with_config/frontend_work.ts4
-rw-r--r--tests/testdata/run/with_config/no_auto_discovery.out4
-rw-r--r--tests/testdata/run/with_config/server_side_work.ts2
-rw-r--r--tests/testdata/run/with_package_json/no_deno_json/main.out4
-rw-r--r--tests/testdata/run/with_package_json/no_deno_json/main.ts4
-rw-r--r--tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.out1
-rw-r--r--tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.ts1
-rw-r--r--tests/testdata/run/with_package_json/no_deno_json/noconfig.out4
-rw-r--r--tests/testdata/run/with_package_json/no_deno_json/noconfig.ts8
-rw-r--r--tests/testdata/run/with_package_json/no_deno_json/package.json9
-rw-r--r--tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.js3
-rw-r--r--tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.out7
-rw-r--r--tests/testdata/run/with_package_json/npm_binary/main.out7
-rw-r--r--tests/testdata/run/with_package_json/npm_binary/package.json8
-rw-r--r--tests/testdata/run/with_package_json/with_stop/main.out5
-rw-r--r--tests/testdata/run/with_package_json/with_stop/package.json8
-rw-r--r--tests/testdata/run/with_package_json/with_stop/some/nested/deno.json5
-rw-r--r--tests/testdata/run/with_package_json/with_stop/some/nested/dir/main.ts6
-rw-r--r--tests/testdata/run/worker_close_in_wasm_reactions.js10
-rw-r--r--tests/testdata/run/worker_close_in_wasm_reactions.js.out2
-rw-r--r--tests/testdata/run/worker_close_nested.js20
-rw-r--r--tests/testdata/run/worker_close_nested.js.out5
-rw-r--r--tests/testdata/run/worker_close_race.js14
-rw-r--r--tests/testdata/run/worker_close_race.js.out0
-rw-r--r--tests/testdata/run/worker_drop_handle_race.js12
-rw-r--r--tests/testdata/run/worker_drop_handle_race.js.out8
-rw-r--r--tests/testdata/run/worker_drop_handle_race_terminate.js37
-rw-r--r--tests/testdata/run/worker_drop_handle_race_terminate.js.out4
-rw-r--r--tests/testdata/run/worker_event_handler_test.js5
-rw-r--r--tests/testdata/run/worker_event_handler_test.js.out11
-rw-r--r--tests/testdata/run/worker_message_before_close.js26
-rw-r--r--tests/testdata/run/worker_message_before_close.js.out1
-rw-r--r--tests/testdata/run/workspaces/basic/bar/deno.json8
-rw-r--r--tests/testdata/run/workspaces/basic/bar/fizz/buzz.ts1
-rw-r--r--tests/testdata/run/workspaces/basic/bar/mod.ts5
-rw-r--r--tests/testdata/run/workspaces/basic/bar/some_mod/hello.ts1
-rw-r--r--tests/testdata/run/workspaces/basic/deno.json9
-rw-r--r--tests/testdata/run/workspaces/basic/foo/bar/hello.ts1
-rw-r--r--tests/testdata/run/workspaces/basic/foo/deno.json8
-rw-r--r--tests/testdata/run/workspaces/basic/foo/fizz/buzz.ts1
-rw-r--r--tests/testdata/run/workspaces/basic/foo/mod.ts5
-rw-r--r--tests/testdata/run/workspaces/basic/main.out21
-rw-r--r--tests/testdata/run/workspaces/basic/main.ts5
-rw-r--r--tests/testdata/run/workspaces/member_outside_root_dir/deno.json9
-rw-r--r--tests/testdata/run/workspaces/member_outside_root_dir/foo/bar/hello.ts1
-rw-r--r--tests/testdata/run/workspaces/member_outside_root_dir/foo/deno.json8
-rw-r--r--tests/testdata/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts1
-rw-r--r--tests/testdata/run/workspaces/member_outside_root_dir/foo/mod.ts5
-rw-r--r--tests/testdata/run/workspaces/member_outside_root_dir/main.out1
-rw-r--r--tests/testdata/run/workspaces/member_outside_root_dir/main.ts4
-rw-r--r--tests/testdata/run/workspaces/nested_member/bar/deno.json8
-rw-r--r--tests/testdata/run/workspaces/nested_member/bar/fizz/buzz.ts1
-rw-r--r--tests/testdata/run/workspaces/nested_member/bar/mod.ts5
-rw-r--r--tests/testdata/run/workspaces/nested_member/bar/some_mod/hello.ts1
-rw-r--r--tests/testdata/run/workspaces/nested_member/deno.json6
-rw-r--r--tests/testdata/run/workspaces/nested_member/foo/bar/deno.json7
-rw-r--r--tests/testdata/run/workspaces/nested_member/foo/bar/hello.ts3
-rw-r--r--tests/testdata/run/workspaces/nested_member/foo/deno.json7
-rw-r--r--tests/testdata/run/workspaces/nested_member/foo/fizz/buzz.ts1
-rw-r--r--tests/testdata/run/workspaces/nested_member/foo/mod.ts3
-rw-r--r--tests/testdata/run/workspaces/nested_member/main.out1
-rw-r--r--tests/testdata/run/workspaces/nested_member/main.ts4
741 files changed, 5837 insertions, 0 deletions
diff --git a/tests/testdata/run/001_hello.js b/tests/testdata/run/001_hello.js
new file mode 100644
index 000000000..accefceba
--- /dev/null
+++ b/tests/testdata/run/001_hello.js
@@ -0,0 +1 @@
+console.log("Hello World");
diff --git a/tests/testdata/run/001_hello.js.out b/tests/testdata/run/001_hello.js.out
new file mode 100644
index 000000000..557db03de
--- /dev/null
+++ b/tests/testdata/run/001_hello.js.out
@@ -0,0 +1 @@
+Hello World
diff --git a/tests/testdata/run/002_hello.ts b/tests/testdata/run/002_hello.ts
new file mode 100644
index 000000000..accefceba
--- /dev/null
+++ b/tests/testdata/run/002_hello.ts
@@ -0,0 +1 @@
+console.log("Hello World");
diff --git a/tests/testdata/run/002_hello.ts.out b/tests/testdata/run/002_hello.ts.out
new file mode 100644
index 000000000..557db03de
--- /dev/null
+++ b/tests/testdata/run/002_hello.ts.out
@@ -0,0 +1 @@
+Hello World
diff --git a/tests/testdata/run/003_relative_import.ts b/tests/testdata/run/003_relative_import.ts
new file mode 100644
index 000000000..840121bfe
--- /dev/null
+++ b/tests/testdata/run/003_relative_import.ts
@@ -0,0 +1,3 @@
+import { printHello } from "../subdir/print_hello.ts";
+
+printHello();
diff --git a/tests/testdata/run/003_relative_import.ts.out b/tests/testdata/run/003_relative_import.ts.out
new file mode 100644
index 000000000..e965047ad
--- /dev/null
+++ b/tests/testdata/run/003_relative_import.ts.out
@@ -0,0 +1 @@
+Hello
diff --git a/tests/testdata/run/004_set_timeout.ts b/tests/testdata/run/004_set_timeout.ts
new file mode 100644
index 000000000..214b25086
--- /dev/null
+++ b/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/tests/testdata/run/004_set_timeout.ts.out b/tests/testdata/run/004_set_timeout.ts.out
new file mode 100644
index 000000000..f9264f7fb
--- /dev/null
+++ b/tests/testdata/run/004_set_timeout.ts.out
@@ -0,0 +1,2 @@
+Hello
+World
diff --git a/tests/testdata/run/005_more_imports.ts b/tests/testdata/run/005_more_imports.ts
new file mode 100644
index 000000000..6c96fac64
--- /dev/null
+++ b/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/tests/testdata/run/005_more_imports.ts.out b/tests/testdata/run/005_more_imports.ts.out
new file mode 100644
index 000000000..e965047ad
--- /dev/null
+++ b/tests/testdata/run/005_more_imports.ts.out
@@ -0,0 +1 @@
+Hello
diff --git a/tests/testdata/run/006_url_imports.ts b/tests/testdata/run/006_url_imports.ts
new file mode 100644
index 000000000..4036f27ed
--- /dev/null
+++ b/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/tests/testdata/run/006_url_imports.ts.out b/tests/testdata/run/006_url_imports.ts.out
new file mode 100644
index 000000000..989ce33e9
--- /dev/null
+++ b/tests/testdata/run/006_url_imports.ts.out
@@ -0,0 +1,2 @@
+Hello
+success
diff --git a/tests/testdata/run/012_async.ts b/tests/testdata/run/012_async.ts
new file mode 100644
index 000000000..536197b68
--- /dev/null
+++ b/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/tests/testdata/run/012_async.ts.out b/tests/testdata/run/012_async.ts.out
new file mode 100644
index 000000000..01e79c32a
--- /dev/null
+++ b/tests/testdata/run/012_async.ts.out
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/tests/testdata/run/013_dynamic_import.ts b/tests/testdata/run/013_dynamic_import.ts
new file mode 100644
index 000000000..fc231936c
--- /dev/null
+++ b/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/tests/testdata/run/013_dynamic_import.ts.out b/tests/testdata/run/013_dynamic_import.ts.out
new file mode 100644
index 000000000..e965047ad
--- /dev/null
+++ b/tests/testdata/run/013_dynamic_import.ts.out
@@ -0,0 +1 @@
+Hello
diff --git a/tests/testdata/run/014_duplicate_import.ts b/tests/testdata/run/014_duplicate_import.ts
new file mode 100644
index 000000000..c7dd881cf
--- /dev/null
+++ b/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/tests/testdata/run/014_duplicate_import.ts.out b/tests/testdata/run/014_duplicate_import.ts.out
new file mode 100644
index 000000000..4effa19f4
--- /dev/null
+++ b/tests/testdata/run/014_duplicate_import.ts.out
@@ -0,0 +1 @@
+hello!
diff --git a/tests/testdata/run/015_duplicate_parallel_import.js b/tests/testdata/run/015_duplicate_parallel_import.js
new file mode 100644
index 000000000..2fbe2c732
--- /dev/null
+++ b/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/tests/testdata/run/015_duplicate_parallel_import.js.out b/tests/testdata/run/015_duplicate_parallel_import.js.out
new file mode 100644
index 000000000..e965047ad
--- /dev/null
+++ b/tests/testdata/run/015_duplicate_parallel_import.js.out
@@ -0,0 +1 @@
+Hello
diff --git a/tests/testdata/run/016_double_await.ts b/tests/testdata/run/016_double_await.ts
new file mode 100644
index 000000000..457a53ff3
--- /dev/null
+++ b/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/tests/testdata/run/016_double_await.ts.out b/tests/testdata/run/016_double_await.ts.out
new file mode 100644
index 000000000..da29283aa
--- /dev/null
+++ b/tests/testdata/run/016_double_await.ts.out
@@ -0,0 +1,2 @@
+true
+false
diff --git a/tests/testdata/run/017_import_redirect.ts b/tests/testdata/run/017_import_redirect.ts
new file mode 100644
index 000000000..1265dd4ed
--- /dev/null
+++ b/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/tests/testdata/run/017_import_redirect.ts.out b/tests/testdata/run/017_import_redirect.ts.out
new file mode 100644
index 000000000..e965047ad
--- /dev/null
+++ b/tests/testdata/run/017_import_redirect.ts.out
@@ -0,0 +1 @@
+Hello
diff --git a/tests/testdata/run/017_import_redirect_info.out b/tests/testdata/run/017_import_redirect_info.out
new file mode 100644
index 000000000..d1850ccb5
--- /dev/null
+++ b/tests/testdata/run/017_import_redirect_info.out
@@ -0,0 +1,7 @@
+local: [WILDCARD]017_import_redirect.ts
+type: TypeScript
+dependencies: 1 unique
+size: 278B
+
+file:///[WILDCARD]/017_import_redirect.ts ([WILDCARD])
+└── https://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts ([WILDCARD])
diff --git a/tests/testdata/run/018_async_catch.ts b/tests/testdata/run/018_async_catch.ts
new file mode 100644
index 000000000..ac43a52e8
--- /dev/null
+++ b/tests/testdata/run/018_async_catch.ts
@@ -0,0 +1,14 @@
+function fn(): Promise<never> {
+ 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/tests/testdata/run/018_async_catch.ts.out b/tests/testdata/run/018_async_catch.ts.out
new file mode 100644
index 000000000..4fc219973
--- /dev/null
+++ b/tests/testdata/run/018_async_catch.ts.out
@@ -0,0 +1,3 @@
+before await fn()
+catch
+after try-catch
diff --git a/tests/testdata/run/019_media_types.ts b/tests/testdata/run/019_media_types.ts
new file mode 100644
index 000000000..d985bd249
--- /dev/null
+++ b/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/tests/testdata/run/019_media_types.ts.out b/tests/testdata/run/019_media_types.ts.out
new file mode 100644
index 000000000..b3e94678c
--- /dev/null
+++ b/tests/testdata/run/019_media_types.ts.out
@@ -0,0 +1 @@
+[WILDCARD]success true true true true true true true true
diff --git a/tests/testdata/run/020_json_modules.ts b/tests/testdata/run/020_json_modules.ts
new file mode 100644
index 000000000..b4ae60665
--- /dev/null
+++ b/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/tests/testdata/run/020_json_modules.ts.out b/tests/testdata/run/020_json_modules.ts.out
new file mode 100644
index 000000000..948901724
--- /dev/null
+++ b/tests/testdata/run/020_json_modules.ts.out
@@ -0,0 +1,3 @@
+error: Expected a JavaScript or TypeScript module, but identified a Json module. Consider importing Json modules with an import attribute with the type of "json".
+ Specifier: [WILDCARD]/subdir/config.json
+[WILDCARD] \ No newline at end of file
diff --git a/tests/testdata/run/021_mjs_modules.ts b/tests/testdata/run/021_mjs_modules.ts
new file mode 100644
index 000000000..838cd2c38
--- /dev/null
+++ b/tests/testdata/run/021_mjs_modules.ts
@@ -0,0 +1,2 @@
+import { isMod5 } from "../subdir/mod5.mjs";
+console.log(isMod5);
diff --git a/tests/testdata/run/021_mjs_modules.ts.out b/tests/testdata/run/021_mjs_modules.ts.out
new file mode 100644
index 000000000..27ba77dda
--- /dev/null
+++ b/tests/testdata/run/021_mjs_modules.ts.out
@@ -0,0 +1 @@
+true
diff --git a/tests/testdata/run/023_no_ext b/tests/testdata/run/023_no_ext
new file mode 100644
index 000000000..d2cd6a037
--- /dev/null
+++ b/tests/testdata/run/023_no_ext
@@ -0,0 +1,2 @@
+import * as mod4 from "../subdir/mod4.js";
+console.log(mod4.isMod4);
diff --git a/tests/testdata/run/023_no_ext.out b/tests/testdata/run/023_no_ext.out
new file mode 100644
index 000000000..27ba77dda
--- /dev/null
+++ b/tests/testdata/run/023_no_ext.out
@@ -0,0 +1 @@
+true
diff --git a/tests/testdata/run/025_hrtime.ts b/tests/testdata/run/025_hrtime.ts
new file mode 100644
index 000000000..b69d61488
--- /dev/null
+++ b/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/tests/testdata/run/025_hrtime.ts.out b/tests/testdata/run/025_hrtime.ts.out
new file mode 100644
index 000000000..bb101b641
--- /dev/null
+++ b/tests/testdata/run/025_hrtime.ts.out
@@ -0,0 +1,2 @@
+true
+true
diff --git a/tests/testdata/run/025_reload_js_type_error.js b/tests/testdata/run/025_reload_js_type_error.js
new file mode 100644
index 000000000..3b7c23cc9
--- /dev/null
+++ b/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/tests/testdata/run/025_reload_js_type_error.js.out b/tests/testdata/run/025_reload_js_type_error.js.out
new file mode 100644
index 000000000..ce0136250
--- /dev/null
+++ b/tests/testdata/run/025_reload_js_type_error.js.out
@@ -0,0 +1 @@
+hello
diff --git a/tests/testdata/run/026_redirect_javascript.js b/tests/testdata/run/026_redirect_javascript.js
new file mode 100644
index 000000000..226a6b622
--- /dev/null
+++ b/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/tests/testdata/run/026_redirect_javascript.js.out b/tests/testdata/run/026_redirect_javascript.js.out
new file mode 100644
index 000000000..290864299
--- /dev/null
+++ b/tests/testdata/run/026_redirect_javascript.js.out
@@ -0,0 +1 @@
+3 imports 1
diff --git a/tests/testdata/run/027_redirect_typescript.ts b/tests/testdata/run/027_redirect_typescript.ts
new file mode 100644
index 000000000..584341975
--- /dev/null
+++ b/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/tests/testdata/run/027_redirect_typescript.ts.out b/tests/testdata/run/027_redirect_typescript.ts.out
new file mode 100644
index 000000000..480d4e8ca
--- /dev/null
+++ b/tests/testdata/run/027_redirect_typescript.ts.out
@@ -0,0 +1 @@
+4 imports 1
diff --git a/tests/testdata/run/028_args.ts b/tests/testdata/run/028_args.ts
new file mode 100644
index 000000000..ec41d52f9
--- /dev/null
+++ b/tests/testdata/run/028_args.ts
@@ -0,0 +1,3 @@
+Deno.args.forEach((arg) => {
+ console.log(arg);
+});
diff --git a/tests/testdata/run/028_args.ts.out b/tests/testdata/run/028_args.ts.out
new file mode 100644
index 000000000..0f1b5c59e
--- /dev/null
+++ b/tests/testdata/run/028_args.ts.out
@@ -0,0 +1,6 @@
+--arg1
+val1
+--arg2=val2
+--
+arg3
+arg4
diff --git a/tests/testdata/run/033_import_map.out b/tests/testdata/run/033_import_map.out
new file mode 100644
index 000000000..e9b9160e9
--- /dev/null
+++ b/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/tests/testdata/run/033_import_map_in_config_file.out b/tests/testdata/run/033_import_map_in_config_file.out
new file mode 100644
index 000000000..72df124a2
--- /dev/null
+++ b/tests/testdata/run/033_import_map_in_config_file.out
@@ -0,0 +1,8 @@
+Warning "importMap" setting is ignored when "imports" or "scopes" are specified in the config file.
+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/tests/testdata/run/033_import_map_in_flag_has_precedence.out b/tests/testdata/run/033_import_map_in_flag_has_precedence.out
new file mode 100644
index 000000000..e9b183ee6
--- /dev/null
+++ b/tests/testdata/run/033_import_map_in_flag_has_precedence.out
@@ -0,0 +1 @@
+error: Relative import path [WILDCARD] not prefixed with / or ./ or ../ and not in import map [WILDCARD]
diff --git a/tests/testdata/run/033_import_map_remote.out b/tests/testdata/run/033_import_map_remote.out
new file mode 100644
index 000000000..804fa0d57
--- /dev/null
+++ b/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/tests/testdata/run/035_cached_only_flag.out b/tests/testdata/run/035_cached_only_flag.out
new file mode 100644
index 000000000..f677ec915
--- /dev/null
+++ b/tests/testdata/run/035_cached_only_flag.out
@@ -0,0 +1 @@
+error: Specifier not found in cache: "http://127.0.0.1:4545/run/019_media_types.ts", --cached-only is specified.
diff --git a/tests/testdata/run/038_checkjs.js b/tests/testdata/run/038_checkjs.js
new file mode 100644
index 000000000..f0856d94c
--- /dev/null
+++ b/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/tests/testdata/run/038_checkjs.js.out b/tests/testdata/run/038_checkjs.js.out
new file mode 100644
index 000000000..4ea473e4f
--- /dev/null
+++ b/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/tests/testdata/run/042_dyn_import_evalcontext.ts b/tests/testdata/run/042_dyn_import_evalcontext.ts
new file mode 100644
index 000000000..386ae48ec
--- /dev/null
+++ b/tests/testdata/run/042_dyn_import_evalcontext.ts
@@ -0,0 +1,5 @@
+// @ts-expect-error "Deno[Deno.internal].core" is not a public interface
+Deno[Deno.internal].core.evalContext(
+ "(async () => console.log(await import('./subdir/mod4.js')))()",
+ new URL("..", import.meta.url).href,
+);
diff --git a/tests/testdata/run/042_dyn_import_evalcontext.ts.out b/tests/testdata/run/042_dyn_import_evalcontext.ts.out
new file mode 100644
index 000000000..89e16b478
--- /dev/null
+++ b/tests/testdata/run/042_dyn_import_evalcontext.ts.out
@@ -0,0 +1 @@
+[Module: null prototype] { isMod4: true }
diff --git a/tests/testdata/run/044_bad_resource.ts b/tests/testdata/run/044_bad_resource.ts
new file mode 100644
index 000000000..b956a3e3f
--- /dev/null
+++ b/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/tests/testdata/run/044_bad_resource.ts.out b/tests/testdata/run/044_bad_resource.ts.out
new file mode 100644
index 000000000..c9912711d
--- /dev/null
+++ b/tests/testdata/run/044_bad_resource.ts.out
@@ -0,0 +1,2 @@
+[WILDCARD]error: Uncaught[WILDCARD] BadResource: Bad resource ID
+[WILDCARD]
diff --git a/tests/testdata/run/045_mod.ts b/tests/testdata/run/045_mod.ts
new file mode 100644
index 000000000..b5f2a0b5b
--- /dev/null
+++ b/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/tests/testdata/run/045_output.ts b/tests/testdata/run/045_output.ts
new file mode 100644
index 000000000..398760ca0
--- /dev/null
+++ b/tests/testdata/run/045_output.ts
@@ -0,0 +1,3 @@
+export function output(text: string) {
+ console.log(text);
+}
diff --git a/tests/testdata/run/045_programmatic_proxy_client.ts b/tests/testdata/run/045_programmatic_proxy_client.ts
new file mode 100644
index 000000000..73af590c7
--- /dev/null
+++ b/tests/testdata/run/045_programmatic_proxy_client.ts
@@ -0,0 +1,16 @@
+// Copyright 2018-2024 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/tests/testdata/run/045_proxy_client.ts b/tests/testdata/run/045_proxy_client.ts
new file mode 100644
index 000000000..41deae2a5
--- /dev/null
+++ b/tests/testdata/run/045_proxy_client.ts
@@ -0,0 +1,5 @@
+// Copyright 2018-2024 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/tests/testdata/run/045_proxy_test.ts b/tests/testdata/run/045_proxy_test.ts
new file mode 100644
index 000000000..1929ed6bc
--- /dev/null
+++ b/tests/testdata/run/045_proxy_test.ts
@@ -0,0 +1,121 @@
+// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+import { Server } from "../../../test_util/std/http/server.ts";
+import { assertEquals } from "../../../test_util/std/assert/mod.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<Response> {
+ 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 new Deno.Command(Deno.execPath(), {
+ args: [
+ "run",
+ "--quiet",
+ "--reload",
+ "--allow-net",
+ "run/045_proxy_client.ts",
+ ],
+ env: {
+ HTTP_PROXY: `http://${addr}`,
+ },
+ }).output();
+
+ assertEquals(code, 0);
+}
+
+async function testModuleDownload() {
+ const { code } = await new Deno.Command(Deno.execPath(), {
+ args: [
+ "cache",
+ "--reload",
+ "--quiet",
+ "http://localhost:4545/run/045_mod.ts",
+ ],
+ env: {
+ HTTP_PROXY: `http://${addr}`,
+ },
+ }).output();
+
+ assertEquals(code, 0);
+}
+
+async function testFetchNoProxy() {
+ const { code } = await new Deno.Command(Deno.execPath(), {
+ args: [
+ "run",
+ "--quiet",
+ "--reload",
+ "--allow-net",
+ "run/045_proxy_client.ts",
+ ],
+ env: {
+ HTTP_PROXY: "http://not.exising.proxy.server",
+ NO_PROXY: "localhost",
+ },
+ }).output();
+
+ assertEquals(code, 0);
+}
+
+async function testModuleDownloadNoProxy() {
+ const { code } = await new Deno.Command(Deno.execPath(), {
+ args: [
+ "cache",
+ "--reload",
+ "--quiet",
+ "http://localhost:4545/run/045_mod.ts",
+ ],
+ env: {
+ HTTP_PROXY: "http://not.exising.proxy.server",
+ NO_PROXY: "localhost",
+ },
+ }).output();
+
+ assertEquals(code, 0);
+}
+
+async function testFetchProgrammaticProxy() {
+ const { code } = await new Deno.Command(Deno.execPath(), {
+ args: [
+ "run",
+ "--quiet",
+ "--reload",
+ "--allow-net=localhost:4545,localhost:4555",
+ "--unstable",
+ "run/045_programmatic_proxy_client.ts",
+ ],
+ }).output();
+ assertEquals(code, 0);
+}
+
+proxyServer();
+await testFetch();
+await testModuleDownload();
+await testFetchNoProxy();
+await testModuleDownloadNoProxy();
+await testFetchProgrammaticProxy();
+Deno.exit(0);
diff --git a/tests/testdata/run/045_proxy_test.ts.out b/tests/testdata/run/045_proxy_test.ts.out
new file mode 100644
index 000000000..a1e567a14
--- /dev/null
+++ b/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/tests/testdata/run/046_jsx_test.tsx b/tests/testdata/run/046_jsx_test.tsx
new file mode 100644
index 000000000..5ed3ff2fa
--- /dev/null
+++ b/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 = () => <div class="deno">land</div>;
+console.log(<View />);
diff --git a/tests/testdata/run/046_jsx_test.tsx.out b/tests/testdata/run/046_jsx_test.tsx.out
new file mode 100644
index 000000000..85cfe824b
--- /dev/null
+++ b/tests/testdata/run/046_jsx_test.tsx.out
@@ -0,0 +1 @@
+{ factory: [Function: View], props: null, children: [] }
diff --git a/tests/testdata/run/047_jsx_test.jsx b/tests/testdata/run/047_jsx_test.jsx
new file mode 100644
index 000000000..4c2314072
--- /dev/null
+++ b/tests/testdata/run/047_jsx_test.jsx
@@ -0,0 +1,7 @@
+const React = {
+ createElement(factory, props, ...children) {
+ return { factory, props, children };
+ },
+};
+const View = () => <div class="deno">land</div>;
+console.log(<View />);
diff --git a/tests/testdata/run/047_jsx_test.jsx.out b/tests/testdata/run/047_jsx_test.jsx.out
new file mode 100644
index 000000000..85cfe824b
--- /dev/null
+++ b/tests/testdata/run/047_jsx_test.jsx.out
@@ -0,0 +1 @@
+{ factory: [Function: View], props: null, children: [] }
diff --git a/tests/testdata/run/048_media_types_jsx.ts b/tests/testdata/run/048_media_types_jsx.ts
new file mode 100644
index 000000000..8dcd0ad68
--- /dev/null
+++ b/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/tests/testdata/run/048_media_types_jsx.ts.out b/tests/testdata/run/048_media_types_jsx.ts.out
new file mode 100644
index 000000000..266cc5741
--- /dev/null
+++ b/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/tests/testdata/run/052_no_remote_flag.out b/tests/testdata/run/052_no_remote_flag.out
new file mode 100644
index 000000000..2f5950ee8
--- /dev/null
+++ b/tests/testdata/run/052_no_remote_flag.out
@@ -0,0 +1 @@
+error: A remote specifier was requested: "http://127.0.0.1:4545/run/019_media_types.ts", but --no-remote is specified.
diff --git a/tests/testdata/run/056_make_temp_file_write_perm.out b/tests/testdata/run/056_make_temp_file_write_perm.out
new file mode 100644
index 000000000..c56aae43f
--- /dev/null
+++ b/tests/testdata/run/056_make_temp_file_write_perm.out
@@ -0,0 +1 @@
+good [WILDCARD]subdir[WILDCARD]
diff --git a/tests/testdata/run/056_make_temp_file_write_perm.ts b/tests/testdata/run/056_make_temp_file_write_perm.ts
new file mode 100644
index 000000000..c0deda8a2
--- /dev/null
+++ b/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/tests/testdata/run/058_tasks_microtasks_close.ts b/tests/testdata/run/058_tasks_microtasks_close.ts
new file mode 100644
index 000000000..38e156044
--- /dev/null
+++ b/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/tests/testdata/run/058_tasks_microtasks_close.ts.out b/tests/testdata/run/058_tasks_microtasks_close.ts.out
new file mode 100644
index 000000000..218273cab
--- /dev/null
+++ b/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/tests/testdata/run/059_fs_relative_path_perm.ts b/tests/testdata/run/059_fs_relative_path_perm.ts
new file mode 100644
index 000000000..26630fe1c
--- /dev/null
+++ b/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/tests/testdata/run/059_fs_relative_path_perm.ts.out b/tests/testdata/run/059_fs_relative_path_perm.ts.out
new file mode 100644
index 000000000..b23628cd6
--- /dev/null
+++ b/tests/testdata/run/059_fs_relative_path_perm.ts.out
@@ -0,0 +1,4 @@
+[WILDCARD]error: Uncaught (in promise) PermissionDenied: Requires read access to "non-existent", run again with the --allow-read flag
+Deno.readFileSync("non-existent");
+ ^
+ at [WILDCARD]
diff --git a/tests/testdata/run/061_permissions_request.ts b/tests/testdata/run/061_permissions_request.ts
new file mode 100644
index 000000000..c31e7ac42
--- /dev/null
+++ b/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/tests/testdata/run/061_permissions_request_sync.ts b/tests/testdata/run/061_permissions_request_sync.ts
new file mode 100644
index 000000000..52d225c47
--- /dev/null
+++ b/tests/testdata/run/061_permissions_request_sync.ts
@@ -0,0 +1,8 @@
+const status1 =
+ Deno.permissions.requestSync({ name: "read", path: "foo" }).state;
+const status2 = Deno.permissions.querySync({ name: "read", path: "bar" }).state;
+const status3 =
+ Deno.permissions.requestSync({ name: "read", path: "bar" }).state;
+console.log(status1);
+console.log(status2);
+console.log(status3);
diff --git a/tests/testdata/run/062_permissions_request_global.ts b/tests/testdata/run/062_permissions_request_global.ts
new file mode 100644
index 000000000..e431bc31b
--- /dev/null
+++ b/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/tests/testdata/run/062_permissions_request_global_sync.ts b/tests/testdata/run/062_permissions_request_global_sync.ts
new file mode 100644
index 000000000..d0e17c7ed
--- /dev/null
+++ b/tests/testdata/run/062_permissions_request_global_sync.ts
@@ -0,0 +1,6 @@
+const status1 = Deno.permissions.requestSync({ name: "read" });
+console.log(status1);
+const status2 = Deno.permissions.querySync({ name: "read", path: "foo" });
+console.log(status2);
+const status3 = Deno.permissions.querySync({ name: "read", path: "bar" });
+console.log(status3);
diff --git a/tests/testdata/run/063_permissions_revoke.ts b/tests/testdata/run/063_permissions_revoke.ts
new file mode 100644
index 000000000..a81eee7cb
--- /dev/null
+++ b/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/tests/testdata/run/063_permissions_revoke.ts.out b/tests/testdata/run/063_permissions_revoke.ts.out
new file mode 100644
index 000000000..bbd64c557
--- /dev/null
+++ b/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/tests/testdata/run/063_permissions_revoke_sync.ts b/tests/testdata/run/063_permissions_revoke_sync.ts
new file mode 100644
index 000000000..267ef3785
--- /dev/null
+++ b/tests/testdata/run/063_permissions_revoke_sync.ts
@@ -0,0 +1,6 @@
+const status1 = Deno.permissions.revokeSync({ name: "read", path: "foo" });
+console.log(status1);
+const status2 = Deno.permissions.querySync({ name: "read", path: "bar" });
+console.log(status2);
+const status3 = Deno.permissions.revokeSync({ name: "read", path: "bar" });
+console.log(status3);
diff --git a/tests/testdata/run/064_permissions_revoke_global.ts b/tests/testdata/run/064_permissions_revoke_global.ts
new file mode 100644
index 000000000..a9b1fcd40
--- /dev/null
+++ b/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/tests/testdata/run/064_permissions_revoke_global.ts.out b/tests/testdata/run/064_permissions_revoke_global.ts.out
new file mode 100644
index 000000000..f7e389a76
--- /dev/null
+++ b/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/tests/testdata/run/064_permissions_revoke_global_sync.ts b/tests/testdata/run/064_permissions_revoke_global_sync.ts
new file mode 100644
index 000000000..597b1481d
--- /dev/null
+++ b/tests/testdata/run/064_permissions_revoke_global_sync.ts
@@ -0,0 +1,6 @@
+const status1 = Deno.permissions.revokeSync({ name: "read" });
+console.log(status1);
+const status2 = Deno.permissions.querySync({ name: "read", path: "foo" });
+console.log(status2);
+const status3 = Deno.permissions.querySync({ name: "read", path: "bar" });
+console.log(status3);
diff --git a/tests/testdata/run/065_permissions_revoke_net.ts b/tests/testdata/run/065_permissions_revoke_net.ts
new file mode 100644
index 000000000..40c9d413a
--- /dev/null
+++ b/tests/testdata/run/065_permissions_revoke_net.ts
@@ -0,0 +1,6 @@
+const status1 = await Deno.permissions.query({ name: "net" });
+console.log(status1);
+const status2 = await Deno.permissions.revoke({ name: "net" });
+console.log(status2);
+const status3 = await Deno.permissions.query({ name: "net" });
+console.log(status3);
diff --git a/tests/testdata/run/065_permissions_revoke_net.ts.out b/tests/testdata/run/065_permissions_revoke_net.ts.out
new file mode 100644
index 000000000..a9c941ecd
--- /dev/null
+++ b/tests/testdata/run/065_permissions_revoke_net.ts.out
@@ -0,0 +1,3 @@
+PermissionStatus { state: "granted", onchange: null }
+PermissionStatus { state: "prompt", onchange: null }
+PermissionStatus { state: "prompt", onchange: null }
diff --git a/tests/testdata/run/066_prompt.ts b/tests/testdata/run/066_prompt.ts
new file mode 100644
index 000000000..f059be685
--- /dev/null
+++ b/tests/testdata/run/066_prompt.ts
@@ -0,0 +1,17 @@
+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");
diff --git a/tests/testdata/run/070_location.ts b/tests/testdata/run/070_location.ts
new file mode 100644
index 000000000..05e5abdf1
--- /dev/null
+++ b/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/tests/testdata/run/070_location.ts.out b/tests/testdata/run/070_location.ts.out
new file mode 100644
index 000000000..a03cf6477
--- /dev/null
+++ b/tests/testdata/run/070_location.ts.out
@@ -0,0 +1,15 @@
+[class Location]
+Object [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".
diff --git a/tests/testdata/run/071_location_unset.ts b/tests/testdata/run/071_location_unset.ts
new file mode 100644
index 000000000..f560d2716
--- /dev/null
+++ b/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/tests/testdata/run/071_location_unset.ts.out b/tests/testdata/run/071_location_unset.ts.out
new file mode 100644
index 000000000..c9482011f
--- /dev/null
+++ b/tests/testdata/run/071_location_unset.ts.out
@@ -0,0 +1,4 @@
+[class Location]
+Object [Location] {}
+undefined
+/bar
diff --git a/tests/testdata/run/072_location_relative_fetch.ts b/tests/testdata/run/072_location_relative_fetch.ts
new file mode 100644
index 000000000..b2a291693
--- /dev/null
+++ b/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/tests/testdata/run/072_location_relative_fetch.ts.out b/tests/testdata/run/072_location_relative_fetch.ts.out
new file mode 100644
index 000000000..8151f6f88
--- /dev/null
+++ b/tests/testdata/run/072_location_relative_fetch.ts.out
@@ -0,0 +1,2 @@
+[WILDCARD]Hello, world!
+
diff --git a/tests/testdata/run/075_import_local_query_hash.ts b/tests/testdata/run/075_import_local_query_hash.ts
new file mode 100644
index 000000000..99c7ceab4
--- /dev/null
+++ b/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/tests/testdata/run/075_import_local_query_hash.ts.out b/tests/testdata/run/075_import_local_query_hash.ts.out
new file mode 100644
index 000000000..340777742
--- /dev/null
+++ b/tests/testdata/run/075_import_local_query_hash.ts.out
@@ -0,0 +1,2 @@
+[WILDCARD]Hello World
+Hello World
diff --git a/tests/testdata/run/077_fetch_empty.ts b/tests/testdata/run/077_fetch_empty.ts
new file mode 100644
index 000000000..b10a9094e
--- /dev/null
+++ b/tests/testdata/run/077_fetch_empty.ts
@@ -0,0 +1 @@
+await fetch("");
diff --git a/tests/testdata/run/077_fetch_empty.ts.out b/tests/testdata/run/077_fetch_empty.ts.out
new file mode 100644
index 000000000..f11e0f563
--- /dev/null
+++ b/tests/testdata/run/077_fetch_empty.ts.out
@@ -0,0 +1,2 @@
+[WILDCARD]error: Uncaught (in promise) TypeError: Invalid URL: ''
+[WILDCARD]
diff --git a/tests/testdata/run/078_unload_on_exit.ts b/tests/testdata/run/078_unload_on_exit.ts
new file mode 100644
index 000000000..43d33eb25
--- /dev/null
+++ b/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/tests/testdata/run/078_unload_on_exit.ts.out b/tests/testdata/run/078_unload_on_exit.ts.out
new file mode 100644
index 000000000..e213f9632
--- /dev/null
+++ b/tests/testdata/run/078_unload_on_exit.ts.out
@@ -0,0 +1 @@
+[WILDCARD]onunload is called
diff --git a/tests/testdata/run/079_location_authentication.ts b/tests/testdata/run/079_location_authentication.ts
new file mode 100644
index 000000000..4989312ac
--- /dev/null
+++ b/tests/testdata/run/079_location_authentication.ts
@@ -0,0 +1 @@
+console.log(location.href);
diff --git a/tests/testdata/run/079_location_authentication.ts.out b/tests/testdata/run/079_location_authentication.ts.out
new file mode 100644
index 000000000..0dd73f999
--- /dev/null
+++ b/tests/testdata/run/079_location_authentication.ts.out
@@ -0,0 +1 @@
+https://baz/qux
diff --git a/tests/testdata/run/081_location_relative_fetch_redirect.ts b/tests/testdata/run/081_location_relative_fetch_redirect.ts
new file mode 100644
index 000000000..742ef0afb
--- /dev/null
+++ b/tests/testdata/run/081_location_relative_fetch_redirect.ts
@@ -0,0 +1,2 @@
+const response = await fetch("/");
+console.log(response.url);
diff --git a/tests/testdata/run/081_location_relative_fetch_redirect.ts.out b/tests/testdata/run/081_location_relative_fetch_redirect.ts.out
new file mode 100644
index 000000000..f62b93195
--- /dev/null
+++ b/tests/testdata/run/081_location_relative_fetch_redirect.ts.out
@@ -0,0 +1 @@
+[WILDCARD]http://localhost:4545/
diff --git a/tests/testdata/run/082_prepare_stack_trace_throw.js b/tests/testdata/run/082_prepare_stack_trace_throw.js
new file mode 100644
index 000000000..8137bfdc8
--- /dev/null
+++ b/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/tests/testdata/run/082_prepare_stack_trace_throw.js.out b/tests/testdata/run/082_prepare_stack_trace_throw.js.out
new file mode 100644
index 000000000..b6715c749
--- /dev/null
+++ b/tests/testdata/run/082_prepare_stack_trace_throw.js.out
@@ -0,0 +1,2 @@
+[WILDCARD]error: Uncaught (in promise) Error: foo
+[WILDCARD]
diff --git a/tests/testdata/run/083_legacy_external_source_map.ts b/tests/testdata/run/083_legacy_external_source_map.ts
new file mode 100644
index 000000000..73d267b87
--- /dev/null
+++ b/tests/testdata/run/083_legacy_external_source_map.ts
@@ -0,0 +1,2 @@
+// -
+throw new Error("foo");
diff --git a/tests/testdata/run/088_dynamic_import_already_evaluating.ts b/tests/testdata/run/088_dynamic_import_already_evaluating.ts
new file mode 100644
index 000000000..272163a5d
--- /dev/null
+++ b/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/tests/testdata/run/088_dynamic_import_already_evaluating.ts.out b/tests/testdata/run/088_dynamic_import_already_evaluating.ts.out
new file mode 100644
index 000000000..a36dd11e7
--- /dev/null
+++ b/tests/testdata/run/088_dynamic_import_already_evaluating.ts.out
@@ -0,0 +1,4 @@
+[WILDCARD]1
+2
+3
+3
diff --git a/tests/testdata/run/088_dynamic_import_target.ts b/tests/testdata/run/088_dynamic_import_target.ts
new file mode 100644
index 000000000..226f1851a
--- /dev/null
+++ b/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/tests/testdata/run/089_run_allow_list.ts b/tests/testdata/run/089_run_allow_list.ts
new file mode 100644
index 000000000..d9cabba84
--- /dev/null
+++ b/tests/testdata/run/089_run_allow_list.ts
@@ -0,0 +1,12 @@
+try {
+ await new Deno.Command("ls").output();
+} catch (e) {
+ console.log(e);
+}
+
+const { success } = await new Deno.Command("curl", {
+ args: ["--help"],
+ stdout: "null",
+ stderr: "inherit",
+}).output();
+console.log(success);
diff --git a/tests/testdata/run/089_run_allow_list.ts.out b/tests/testdata/run/089_run_allow_list.ts.out
new file mode 100644
index 000000000..68a4a2ac5
--- /dev/null
+++ b/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/tests/testdata/run/090_run_permissions_request.ts b/tests/testdata/run/090_run_permissions_request.ts
new file mode 100644
index 000000000..8ecad2b3b
--- /dev/null
+++ b/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/tests/testdata/run/090_run_permissions_request_sync.ts b/tests/testdata/run/090_run_permissions_request_sync.ts
new file mode 100644
index 000000000..40ff84522
--- /dev/null
+++ b/tests/testdata/run/090_run_permissions_request_sync.ts
@@ -0,0 +1,18 @@
+const status1 =
+ Deno.permissions.requestSync({ name: "run", command: "ls" }).state;
+if (status1 != "granted") {
+ throw Error(`unexpected status1 ${status1}`);
+}
+const status2 =
+ Deno.permissions.querySync({ name: "run", command: "cat" }).state;
+if (status2 != "prompt") {
+ throw Error(`unexpected status2 ${status2}`);
+}
+const status3 =
+ Deno.permissions.requestSync({ 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/tests/testdata/run/091_use_define_for_class_fields.ts b/tests/testdata/run/091_use_define_for_class_fields.ts
new file mode 100644
index 000000000..46be3ac0b
--- /dev/null
+++ b/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/tests/testdata/run/091_use_define_for_class_fields.ts.out b/tests/testdata/run/091_use_define_for_class_fields.ts.out
new file mode 100644
index 000000000..08f94a967
--- /dev/null
+++ b/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/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts b/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts
new file mode 100644
index 000000000..87684430d
--- /dev/null
+++ b/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts
@@ -0,0 +1 @@
+await import("unmapped");
diff --git a/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts.out b/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts.out
new file mode 100644
index 000000000..7f35b8b4f
--- /dev/null
+++ b/tests/testdata/run/092_import_map_unmapped_bare_specifier.ts.out
@@ -0,0 +1,6 @@
+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/tests/testdata/run/aggregate_error.out b/tests/testdata/run/aggregate_error.out
new file mode 100644
index 000000000..59c0fb2a5
--- /dev/null
+++ b/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 (in promise) 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/tests/testdata/run/aggregate_error.ts b/tests/testdata/run/aggregate_error.ts
new file mode 100644
index 000000000..ce4b54376
--- /dev/null
+++ b/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/tests/testdata/run/async_error.ts b/tests/testdata/run/async_error.ts
new file mode 100644
index 000000000..b55c73aeb
--- /dev/null
+++ b/tests/testdata/run/async_error.ts
@@ -0,0 +1,9 @@
+console.log("hello");
+// deno-lint-ignore require-await
+const foo = async (): Promise<never> => {
+ console.log("before error");
+ throw Error("error");
+};
+
+foo();
+console.log("world");
diff --git a/tests/testdata/run/async_error.ts.out b/tests/testdata/run/async_error.ts.out
new file mode 100644
index 000000000..b424f9072
--- /dev/null
+++ b/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/tests/testdata/run/auto_discover_lockfile/deno.json b/tests/testdata/run/auto_discover_lockfile/deno.json
new file mode 100644
index 000000000..90faa728a
--- /dev/null
+++ b/tests/testdata/run/auto_discover_lockfile/deno.json
@@ -0,0 +1,3 @@
+{
+ "tasks": {}
+}
diff --git a/tests/testdata/run/auto_discover_lockfile/deno.lock b/tests/testdata/run/auto_discover_lockfile/deno.lock
new file mode 100644
index 000000000..059f66789
--- /dev/null
+++ b/tests/testdata/run/auto_discover_lockfile/deno.lock
@@ -0,0 +1,7 @@
+{
+ "version": "2",
+ "remote": {
+ "http://localhost:4545/subdir/mod2.ts": "cae1d3e9f3c38cd415ff52dff854be8f3d17d35f8d7b3d285e813fb0f6393a2f",
+ "http://localhost:4545/subdir/print_hello.ts": "foobar"
+ }
+}
diff --git a/tests/testdata/run/auto_discover_lockfile/main.out b/tests/testdata/run/auto_discover_lockfile/main.out
new file mode 100644
index 000000000..28f4724e9
--- /dev/null
+++ b/tests/testdata/run/auto_discover_lockfile/main.out
@@ -0,0 +1,5 @@
+Download http://localhost:4545/subdir/mod2.ts
+Download http://localhost:4545/subdir/print_hello.ts
+error: The source code is invalid, as it does not match the expected hash in the lock file.
+ Specifier: http://localhost:4545/subdir/print_hello.ts
+ Lock file: [WILDCARD]auto_discover_lockfile[WILDCARD]deno.lock
diff --git a/tests/testdata/run/auto_discover_lockfile/main.ts b/tests/testdata/run/auto_discover_lockfile/main.ts
new file mode 100644
index 000000000..baa52775d
--- /dev/null
+++ b/tests/testdata/run/auto_discover_lockfile/main.ts
@@ -0,0 +1 @@
+import "http://localhost:4545/subdir/mod2.ts";
diff --git a/tests/testdata/run/before_unload.js b/tests/testdata/run/before_unload.js
new file mode 100644
index 000000000..2572e512b
--- /dev/null
+++ b/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/tests/testdata/run/before_unload.js.out b/tests/testdata/run/before_unload.js.out
new file mode 100644
index 000000000..f1f2ab49a
--- /dev/null
+++ b/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/tests/testdata/run/blob_gc_finalization.js b/tests/testdata/run/blob_gc_finalization.js
new file mode 100644
index 000000000..c721e6b45
--- /dev/null
+++ b/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/tests/testdata/run/blob_gc_finalization.js.out b/tests/testdata/run/blob_gc_finalization.js.out
new file mode 100644
index 000000000..dcc4500f8
--- /dev/null
+++ b/tests/testdata/run/blob_gc_finalization.js.out
@@ -0,0 +1 @@
+GCed all blobs
diff --git a/tests/testdata/run/byte_order_mark.out b/tests/testdata/run/byte_order_mark.out
new file mode 100644
index 000000000..557db03de
--- /dev/null
+++ b/tests/testdata/run/byte_order_mark.out
@@ -0,0 +1 @@
+Hello World
diff --git a/tests/testdata/run/byte_order_mark.ts b/tests/testdata/run/byte_order_mark.ts
new file mode 100644
index 000000000..40eb23c1d
--- /dev/null
+++ b/tests/testdata/run/byte_order_mark.ts
@@ -0,0 +1,4 @@
+import "./001_hello.js";
+// Note this file starts with special byte order mark <U+FEFF>
+// it's important that this file is a .ts typescript file which is passed to
+// deno through `--no-check` mode.
diff --git a/tests/testdata/run/check_js_points_to_ts/bar.ts b/tests/testdata/run/check_js_points_to_ts/bar.ts
new file mode 100644
index 000000000..026cd2f1e
--- /dev/null
+++ b/tests/testdata/run/check_js_points_to_ts/bar.ts
@@ -0,0 +1,3 @@
+export function bar(): string {
+ return 42;
+}
diff --git a/tests/testdata/run/check_js_points_to_ts/foo.d.ts b/tests/testdata/run/check_js_points_to_ts/foo.d.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testdata/run/check_js_points_to_ts/foo.d.ts
diff --git a/tests/testdata/run/check_js_points_to_ts/foo.js b/tests/testdata/run/check_js_points_to_ts/foo.js
new file mode 100644
index 000000000..9ac1a14ff
--- /dev/null
+++ b/tests/testdata/run/check_js_points_to_ts/foo.js
@@ -0,0 +1,4 @@
+import { bar } from "./bar.ts";
+export function foo() {
+ bar();
+}
diff --git a/tests/testdata/run/check_js_points_to_ts/test.js b/tests/testdata/run/check_js_points_to_ts/test.js
new file mode 100644
index 000000000..00d894451
--- /dev/null
+++ b/tests/testdata/run/check_js_points_to_ts/test.js
@@ -0,0 +1,3 @@
+// @deno-types="./foo.d.ts"
+import { foo } from "./foo.js";
+foo();
diff --git a/tests/testdata/run/check_js_points_to_ts/test.js.out b/tests/testdata/run/check_js_points_to_ts/test.js.out
new file mode 100644
index 000000000..67cda9a65
--- /dev/null
+++ b/tests/testdata/run/check_js_points_to_ts/test.js.out
@@ -0,0 +1,4 @@
+error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
+ return 42;
+ ~~~~~~
+ at [WILDCARD]
diff --git a/tests/testdata/run/checkjs.tsconfig.json b/tests/testdata/run/checkjs.tsconfig.json
new file mode 100644
index 000000000..46d96db9e
--- /dev/null
+++ b/tests/testdata/run/checkjs.tsconfig.json
@@ -0,0 +1,6 @@
+{
+ "compilerOptions": {
+ "allowJs": true,
+ "checkJs": true
+ }
+}
diff --git a/tests/testdata/run/cjs_imports/commonjs.cjs b/tests/testdata/run/cjs_imports/commonjs.cjs
new file mode 100644
index 000000000..accefceba
--- /dev/null
+++ b/tests/testdata/run/cjs_imports/commonjs.cjs
@@ -0,0 +1 @@
+console.log("Hello World");
diff --git a/tests/testdata/run/cjs_imports/main.out b/tests/testdata/run/cjs_imports/main.out
new file mode 100644
index 000000000..557db03de
--- /dev/null
+++ b/tests/testdata/run/cjs_imports/main.out
@@ -0,0 +1 @@
+Hello World
diff --git a/tests/testdata/run/cjs_imports/main.ts b/tests/testdata/run/cjs_imports/main.ts
new file mode 100644
index 000000000..d8b77c22e
--- /dev/null
+++ b/tests/testdata/run/cjs_imports/main.ts
@@ -0,0 +1 @@
+import "./commonjs.cjs";
diff --git a/tests/testdata/run/classic_workers_event_loop.js b/tests/testdata/run/classic_workers_event_loop.js
new file mode 100644
index 000000000..810a6df7f
--- /dev/null
+++ b/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/tests/testdata/run/classic_workers_event_loop.js.out b/tests/testdata/run/classic_workers_event_loop.js.out
new file mode 100644
index 000000000..19f86f493
--- /dev/null
+++ b/tests/testdata/run/classic_workers_event_loop.js.out
@@ -0,0 +1 @@
+done
diff --git a/tests/testdata/run/colors_without_globalThis.js b/tests/testdata/run/colors_without_globalThis.js
new file mode 100644
index 000000000..f9d4b68fc
--- /dev/null
+++ b/tests/testdata/run/colors_without_globalThis.js
@@ -0,0 +1 @@
+console.log(delete globalThis.globalThis);
diff --git a/tests/testdata/run/complex_error.ts b/tests/testdata/run/complex_error.ts
new file mode 100644
index 000000000..b462992ac
--- /dev/null
+++ b/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/tests/testdata/run/complex_error.ts.out b/tests/testdata/run/complex_error.ts.out
new file mode 100644
index 000000000..3c3c26eaf
--- /dev/null
+++ b/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 (in promise) 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/tests/testdata/run/complex_permissions_test.ts b/tests/testdata/run/complex_permissions_test.ts
new file mode 100644
index 000000000..bae157246
--- /dev/null
+++ b/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<void> } = {
+ 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/tests/testdata/run/config/main.out b/tests/testdata/run/config/main.out
new file mode 100644
index 000000000..277314807
--- /dev/null
+++ b/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/tests/testdata/run/config/main.ts b/tests/testdata/run/config/main.ts
new file mode 100644
index 000000000..51a61e447
--- /dev/null
+++ b/tests/testdata/run/config/main.ts
@@ -0,0 +1,5 @@
+function foo(bar) {
+ return bar;
+}
+
+foo(1);
diff --git a/tests/testdata/run/config/tsconfig.json b/tests/testdata/run/config/tsconfig.json
new file mode 100644
index 000000000..0f0881920
--- /dev/null
+++ b/tests/testdata/run/config/tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "compilerOptions": {
+ "module": "amd",
+ "strict": false,
+ "target": "es5"
+ }
+}
diff --git a/tests/testdata/run/config_file_lock_boolean/deno.lock b/tests/testdata/run/config_file_lock_boolean/deno.lock
new file mode 100644
index 000000000..059f66789
--- /dev/null
+++ b/tests/testdata/run/config_file_lock_boolean/deno.lock
@@ -0,0 +1,7 @@
+{
+ "version": "2",
+ "remote": {
+ "http://localhost:4545/subdir/mod2.ts": "cae1d3e9f3c38cd415ff52dff854be8f3d17d35f8d7b3d285e813fb0f6393a2f",
+ "http://localhost:4545/subdir/print_hello.ts": "foobar"
+ }
+}
diff --git a/tests/testdata/run/config_file_lock_boolean/false.json b/tests/testdata/run/config_file_lock_boolean/false.json
new file mode 100644
index 000000000..358b7d299
--- /dev/null
+++ b/tests/testdata/run/config_file_lock_boolean/false.json
@@ -0,0 +1,3 @@
+{
+ "lock": false
+}
diff --git a/tests/testdata/run/config_file_lock_boolean/false.main.out b/tests/testdata/run/config_file_lock_boolean/false.main.out
new file mode 100644
index 000000000..0d8f0a237
--- /dev/null
+++ b/tests/testdata/run/config_file_lock_boolean/false.main.out
@@ -0,0 +1,2 @@
+Download http://localhost:4545/subdir/mod2.ts
+Download http://localhost:4545/subdir/print_hello.ts
diff --git a/tests/testdata/run/config_file_lock_boolean/main.ts b/tests/testdata/run/config_file_lock_boolean/main.ts
new file mode 100644
index 000000000..baa52775d
--- /dev/null
+++ b/tests/testdata/run/config_file_lock_boolean/main.ts
@@ -0,0 +1 @@
+import "http://localhost:4545/subdir/mod2.ts";
diff --git a/tests/testdata/run/config_file_lock_boolean/true.json b/tests/testdata/run/config_file_lock_boolean/true.json
new file mode 100644
index 000000000..090481af9
--- /dev/null
+++ b/tests/testdata/run/config_file_lock_boolean/true.json
@@ -0,0 +1,3 @@
+{
+ "lock": true
+}
diff --git a/tests/testdata/run/config_file_lock_boolean/true.main.out b/tests/testdata/run/config_file_lock_boolean/true.main.out
new file mode 100644
index 000000000..313c0eb0c
--- /dev/null
+++ b/tests/testdata/run/config_file_lock_boolean/true.main.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/print_hello.ts
+ Lock file: [WILDCARD]deno.lock
diff --git a/tests/testdata/run/config_file_lock_path.json b/tests/testdata/run/config_file_lock_path.json
new file mode 100644
index 000000000..2c393f76e
--- /dev/null
+++ b/tests/testdata/run/config_file_lock_path.json
@@ -0,0 +1,3 @@
+{
+ "lock": "./lock_check_err2.json"
+}
diff --git a/tests/testdata/run/config_file_lock_path.out b/tests/testdata/run/config_file_lock_path.out
new file mode 100644
index 000000000..97d35337f
--- /dev/null
+++ b/tests/testdata/run/config_file_lock_path.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: [WILDCARD]lock_check_err2.json
diff --git a/tests/testdata/run/config_json_import.ts b/tests/testdata/run/config_json_import.ts
new file mode 100644
index 000000000..9cf1cceaa
--- /dev/null
+++ b/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/tests/testdata/run/config_json_import.ts.out b/tests/testdata/run/config_json_import.ts.out
new file mode 100644
index 000000000..aa55be7d5
--- /dev/null
+++ b/tests/testdata/run/config_json_import.ts.out
@@ -0,0 +1,3 @@
+{
+ compilerOptions: { jsx: "react-jsx", jsxImportSource: "http://localhost:4545/jsx" }
+}
diff --git a/tests/testdata/run/config_types/deno.lock b/tests/testdata/run/config_types/deno.lock
new file mode 100644
index 000000000..157bd98a2
--- /dev/null
+++ b/tests/testdata/run/config_types/deno.lock
@@ -0,0 +1,6 @@
+{
+ "version": "2",
+ "remote": {
+ "http://localhost:4545/run/config_types/types.d.ts": "741c39165e37de0c12acc5c081841f4362487e3f17dc4cad7017b70af72c4605"
+ }
+}
diff --git a/tests/testdata/run/config_types/main.out b/tests/testdata/run/config_types/main.out
new file mode 100644
index 000000000..417b7b537
--- /dev/null
+++ b/tests/testdata/run/config_types/main.out
@@ -0,0 +1 @@
+undefined
diff --git a/tests/testdata/run/config_types/main.ts b/tests/testdata/run/config_types/main.ts
new file mode 100644
index 000000000..f1a8d6583
--- /dev/null
+++ b/tests/testdata/run/config_types/main.ts
@@ -0,0 +1 @@
+console.log(globalThis.a);
diff --git a/tests/testdata/run/config_types/remote.tsconfig.json b/tests/testdata/run/config_types/remote.tsconfig.json
new file mode 100644
index 000000000..255ff5def
--- /dev/null
+++ b/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/tests/testdata/run/config_types/tsconfig.json b/tests/testdata/run/config_types/tsconfig.json
new file mode 100644
index 000000000..85f1549e0
--- /dev/null
+++ b/tests/testdata/run/config_types/tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "compilerOptions": {
+ "types": [
+ "./types.d.ts"
+ ]
+ }
+}
diff --git a/tests/testdata/run/config_types/types.d.ts b/tests/testdata/run/config_types/types.d.ts
new file mode 100644
index 000000000..536a6d0a6
--- /dev/null
+++ b/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/tests/testdata/run/custom_inspect_url.js b/tests/testdata/run/custom_inspect_url.js
new file mode 100644
index 000000000..69aa2dc49
--- /dev/null
+++ b/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/tests/testdata/run/custom_inspect_url.js.out b/tests/testdata/run/custom_inspect_url.js.out
new file mode 100644
index 000000000..1c714e34e
--- /dev/null
+++ b/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/tests/testdata/run/decorators/experimental/deno.json b/tests/testdata/run/decorators/experimental/deno.json
new file mode 100644
index 000000000..504cd646e
--- /dev/null
+++ b/tests/testdata/run/decorators/experimental/deno.json
@@ -0,0 +1,5 @@
+{
+ "compilerOptions": {
+ "experimentalDecorators": true
+ }
+}
diff --git a/tests/testdata/run/decorators/experimental/no_check/main.out b/tests/testdata/run/decorators/experimental/no_check/main.out
new file mode 100644
index 000000000..015f7076e
--- /dev/null
+++ b/tests/testdata/run/decorators/experimental/no_check/main.out
@@ -0,0 +1,3 @@
+a(): evaluated
+a(): called
+method
diff --git a/tests/testdata/run/decorators/experimental/no_check/main.ts b/tests/testdata/run/decorators/experimental/no_check/main.ts
new file mode 100644
index 000000000..9f7ec550d
--- /dev/null
+++ b/tests/testdata/run/decorators/experimental/no_check/main.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/tests/testdata/run/decorators/experimental/runtime/main.out b/tests/testdata/run/decorators/experimental/runtime/main.out
new file mode 100644
index 000000000..0fc1d4590
--- /dev/null
+++ b/tests/testdata/run/decorators/experimental/runtime/main.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/tests/testdata/run/decorators/experimental/runtime/main.ts b/tests/testdata/run/decorators/experimental/runtime/main.ts
new file mode 100644
index 000000000..40a26bbd4
--- /dev/null
+++ b/tests/testdata/run/decorators/experimental/runtime/main.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/tests/testdata/run/decorators/experimental/ts/main.out b/tests/testdata/run/decorators/experimental/ts/main.out
new file mode 100644
index 000000000..ee77417cf
--- /dev/null
+++ b/tests/testdata/run/decorators/experimental/ts/main.out
@@ -0,0 +1,2 @@
+Check [WILDCARD]
+SomeClass { someField: "asdf" }
diff --git a/tests/testdata/run/decorators/experimental/ts/main.ts b/tests/testdata/run/decorators/experimental/ts/main.ts
new file mode 100644
index 000000000..95fba6cd4
--- /dev/null
+++ b/tests/testdata/run/decorators/experimental/ts/main.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/tests/testdata/run/decorators/tc39_proposal/main.out b/tests/testdata/run/decorators/tc39_proposal/main.out
new file mode 100644
index 000000000..39394952e
--- /dev/null
+++ b/tests/testdata/run/decorators/tc39_proposal/main.out
@@ -0,0 +1,3 @@
+starting m with arguments 1
+C.m 1
+ending m
diff --git a/tests/testdata/run/decorators/tc39_proposal/main.ts b/tests/testdata/run/decorators/tc39_proposal/main.ts
new file mode 100644
index 000000000..00c8a8502
--- /dev/null
+++ b/tests/testdata/run/decorators/tc39_proposal/main.ts
@@ -0,0 +1,21 @@
+// deno-lint-ignore no-explicit-any
+function logged(value: any, { kind, name }: { kind: string; name: string }) {
+ if (kind === "method") {
+ return function (...args: unknown[]) {
+ console.log(`starting ${name} with arguments ${args.join(", ")}`);
+ // @ts-ignore this has implicit any type
+ const ret = value.call(this, ...args);
+ console.log(`ending ${name}`);
+ return ret;
+ };
+ }
+}
+
+class C {
+ @logged
+ m(arg: number) {
+ console.log("C.m", arg);
+ }
+}
+
+new C().m(1);
diff --git a/tests/testdata/run/delete_window.js b/tests/testdata/run/delete_window.js
new file mode 100644
index 000000000..f2f16820d
--- /dev/null
+++ b/tests/testdata/run/delete_window.js
@@ -0,0 +1 @@
+console.log(delete globalThis.window);
diff --git a/tests/testdata/run/deno_exit_tampering.ts b/tests/testdata/run/deno_exit_tampering.ts
new file mode 100644
index 000000000..3b24261e2
--- /dev/null
+++ b/tests/testdata/run/deno_exit_tampering.ts
@@ -0,0 +1,3 @@
+delete globalThis.dispatchEvent;
+delete EventTarget.prototype.dispatchEvent;
+Deno.exit(42);
diff --git a/tests/testdata/run/deny_all_permission_args.js b/tests/testdata/run/deny_all_permission_args.js
new file mode 100644
index 000000000..b0ca864fb
--- /dev/null
+++ b/tests/testdata/run/deny_all_permission_args.js
@@ -0,0 +1,8 @@
+console.log(Deno.permissions.querySync({ name: "env" }));
+console.log(Deno.permissions.querySync({ name: "read" }));
+console.log(Deno.permissions.querySync({ name: "write" }));
+console.log(Deno.permissions.querySync({ name: "ffi" }));
+console.log(Deno.permissions.querySync({ name: "run" }));
+console.log(Deno.permissions.querySync({ name: "sys" }));
+console.log(Deno.permissions.querySync({ name: "net" }));
+console.log(Deno.permissions.querySync({ name: "hrtime" }));
diff --git a/tests/testdata/run/deny_all_permission_args.out b/tests/testdata/run/deny_all_permission_args.out
new file mode 100644
index 000000000..2a5228d62
--- /dev/null
+++ b/tests/testdata/run/deny_all_permission_args.out
@@ -0,0 +1,8 @@
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "denied", onchange: null }
diff --git a/tests/testdata/run/deny_some_permission_args.js b/tests/testdata/run/deny_some_permission_args.js
new file mode 100644
index 000000000..320376b6f
--- /dev/null
+++ b/tests/testdata/run/deny_some_permission_args.js
@@ -0,0 +1,22 @@
+console.log(Deno.permissions.querySync({ name: "env" }));
+console.log(Deno.permissions.querySync({ name: "env", variable: "FOO" }));
+console.log(Deno.permissions.querySync({ name: "env", variable: "BAR" }));
+console.log(Deno.permissions.querySync({ name: "read" }));
+console.log(Deno.permissions.querySync({ name: "read", path: "/foo" }));
+console.log(Deno.permissions.querySync({ name: "read", path: "/bar" }));
+console.log(Deno.permissions.querySync({ name: "write" }));
+console.log(Deno.permissions.querySync({ name: "write", path: "/foo" }));
+console.log(Deno.permissions.querySync({ name: "write", path: "/bar" }));
+console.log(Deno.permissions.querySync({ name: "ffi" }));
+console.log(Deno.permissions.querySync({ name: "ffi", path: "/foo" }));
+console.log(Deno.permissions.querySync({ name: "ffi", path: "/bar" }));
+console.log(Deno.permissions.querySync({ name: "run" }));
+console.log(Deno.permissions.querySync({ name: "run", command: "foo" }));
+console.log(Deno.permissions.querySync({ name: "run", command: "bar" }));
+console.log(Deno.permissions.querySync({ name: "sys" }));
+console.log(Deno.permissions.querySync({ name: "sys", kind: "hostname" }));
+console.log(Deno.permissions.querySync({ name: "sys", kind: "loadavg" }));
+console.log(Deno.permissions.querySync({ name: "net" }));
+console.log(Deno.permissions.querySync({ name: "net", host: "127.0.0.1" }));
+console.log(Deno.permissions.querySync({ name: "net", host: "192.168.0.1" }));
+console.log(Deno.permissions.querySync({ name: "hrtime" }));
diff --git a/tests/testdata/run/deny_some_permission_args.out b/tests/testdata/run/deny_some_permission_args.out
new file mode 100644
index 000000000..80c37159b
--- /dev/null
+++ b/tests/testdata/run/deny_some_permission_args.out
@@ -0,0 +1,22 @@
+PermissionStatus { state: "granted", onchange: null, partial: true }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "granted", onchange: null }
+PermissionStatus { state: "granted", onchange: null, partial: true }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "granted", onchange: null }
+PermissionStatus { state: "granted", onchange: null, partial: true }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "granted", onchange: null }
+PermissionStatus { state: "granted", onchange: null, partial: true }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "granted", onchange: null }
+PermissionStatus { state: "granted", onchange: null, partial: true }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "granted", onchange: null }
+PermissionStatus { state: "granted", onchange: null, partial: true }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "granted", onchange: null }
+PermissionStatus { state: "granted", onchange: null, partial: true }
+PermissionStatus { state: "denied", onchange: null }
+PermissionStatus { state: "granted", onchange: null }
+PermissionStatus { state: "denied", onchange: null }
diff --git a/tests/testdata/run/disallow_http_from_https.js b/tests/testdata/run/disallow_http_from_https.js
new file mode 100644
index 000000000..b8ddff170
--- /dev/null
+++ b/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/tests/testdata/run/disallow_http_from_https.ts b/tests/testdata/run/disallow_http_from_https.ts
new file mode 100644
index 000000000..b8ddff170
--- /dev/null
+++ b/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/tests/testdata/run/disallow_http_from_https_js.out b/tests/testdata/run/disallow_http_from_https_js.out
new file mode 100644
index 000000000..5dc327975
--- /dev/null
+++ b/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/tests/testdata/run/disallow_http_from_https_ts.out b/tests/testdata/run/disallow_http_from_https_ts.out
new file mode 100644
index 000000000..e3b8f4390
--- /dev/null
+++ b/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/tests/testdata/run/dom_exception_formatting.ts b/tests/testdata/run/dom_exception_formatting.ts
new file mode 100644
index 000000000..0209ec81e
--- /dev/null
+++ b/tests/testdata/run/dom_exception_formatting.ts
@@ -0,0 +1 @@
+throw new DOMException("foo", "SyntaxError");
diff --git a/tests/testdata/run/dom_exception_formatting.ts.out b/tests/testdata/run/dom_exception_formatting.ts.out
new file mode 100644
index 000000000..75615d0a8
--- /dev/null
+++ b/tests/testdata/run/dom_exception_formatting.ts.out
@@ -0,0 +1,3 @@
+[WILDCARD]error: Uncaught (in promise) SyntaxError: foo
+[WILDCARD]
+ at file:///[WILDCARD]/dom_exception_formatting.ts:[WILDCARD]
diff --git a/tests/testdata/run/dynamic_import_already_rejected/error_001.ts b/tests/testdata/run/dynamic_import_already_rejected/error_001.ts
new file mode 100644
index 000000000..b01068bc0
--- /dev/null
+++ b/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/tests/testdata/run/dynamic_import_already_rejected/main.out b/tests/testdata/run/dynamic_import_already_rejected/main.out
new file mode 100644
index 000000000..c3eb66f9e
--- /dev/null
+++ b/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/tests/testdata/run/dynamic_import_already_rejected/main.ts b/tests/testdata/run/dynamic_import_already_rejected/main.ts
new file mode 100644
index 000000000..249de8d8b
--- /dev/null
+++ b/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/tests/testdata/run/dynamic_import_async_error/delayed_error.ts b/tests/testdata/run/dynamic_import_async_error/delayed_error.ts
new file mode 100644
index 000000000..76057e627
--- /dev/null
+++ b/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/tests/testdata/run/dynamic_import_async_error/main.out b/tests/testdata/run/dynamic_import_async_error/main.out
new file mode 100644
index 000000000..974c2e426
--- /dev/null
+++ b/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/tests/testdata/run/dynamic_import_async_error/main.ts b/tests/testdata/run/dynamic_import_async_error/main.ts
new file mode 100644
index 000000000..998e7ed3e
--- /dev/null
+++ b/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/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out b/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out
new file mode 100644
index 000000000..c344d0aae
--- /dev/null
+++ b/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out
@@ -0,0 +1,100 @@
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
diff --git a/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts b/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts
new file mode 100644
index 000000000..0832e40be
--- /dev/null
+++ b/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts
@@ -0,0 +1,16 @@
+import * as path from "http://localhost:4545/deno_std/path/mod.ts";
+
+const currentDir = path.dirname(path.fromFileUrl(import.meta.url));
+const url = path.toFileUrl(path.join(currentDir, "./mod.ts"));
+const urls = [];
+
+// this is hard to reproduce, but doing this will help
+for (let i = 0; i < 100; i++) {
+ urls.push(url.toString() + "#" + i);
+}
+
+const results = await Promise.all(urls.map((url) => import(url)));
+
+for (const result of results) {
+ result.outputValue();
+}
diff --git a/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts b/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts
new file mode 100644
index 000000000..56f2002ed
--- /dev/null
+++ b/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts
@@ -0,0 +1,7 @@
+// sleep a bit so many concurrent tasks end up
+// attempting to build the graph at the same time
+import "http://localhost:4545/sleep/10";
+
+export function outputValue() {
+ console.log(parseInt(new URL(import.meta.url).hash.slice(1), 10));
+}
diff --git a/tests/testdata/run/dynamic_import_conditional.js b/tests/testdata/run/dynamic_import_conditional.js
new file mode 100644
index 000000000..1b4193e3e
--- /dev/null
+++ b/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/tests/testdata/run/dynamic_import_conditional.js.out b/tests/testdata/run/dynamic_import_conditional.js.out
new file mode 100644
index 000000000..27ba77dda
--- /dev/null
+++ b/tests/testdata/run/dynamic_import_conditional.js.out
@@ -0,0 +1 @@
+true
diff --git a/tests/testdata/run/dynamic_import_syntax_error.js b/tests/testdata/run/dynamic_import_syntax_error.js
new file mode 100644
index 000000000..be8ec132f
--- /dev/null
+++ b/tests/testdata/run/dynamic_import_syntax_error.js
@@ -0,0 +1 @@
+await import("./dynamic_import_syntax_error_import.js");
diff --git a/tests/testdata/run/dynamic_import_syntax_error.js.out b/tests/testdata/run/dynamic_import_syntax_error.js.out
new file mode 100644
index 000000000..91e69eac7
--- /dev/null
+++ b/tests/testdata/run/dynamic_import_syntax_error.js.out
@@ -0,0 +1,4 @@
+error: Uncaught (in promise) SyntaxError: Unexpected reserved word at [WILDCARD]/dynamic_import_syntax_error_import.js:3:3
+await import("./dynamic_import_syntax_error_import.js");
+^
+ at async [WILDCARD]/dynamic_import_syntax_error.js:1:1
diff --git a/tests/testdata/run/dynamic_import_syntax_error_import.js b/tests/testdata/run/dynamic_import_syntax_error_import.js
new file mode 100644
index 000000000..bcf075638
--- /dev/null
+++ b/tests/testdata/run/dynamic_import_syntax_error_import.js
@@ -0,0 +1,5 @@
+// deno-lint-ignore-file
+function foo() {
+ await Promise.resolve();
+}
+foo();
diff --git a/tests/testdata/run/empty.ts b/tests/testdata/run/empty.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testdata/run/empty.ts
diff --git a/tests/testdata/run/env_file.out b/tests/testdata/run/env_file.out
new file mode 100644
index 000000000..54a0bf25d
--- /dev/null
+++ b/tests/testdata/run/env_file.out
@@ -0,0 +1,4 @@
+BAR
+ANOTHER_BAR
+First Line
+Second Line
diff --git a/tests/testdata/run/env_file.ts b/tests/testdata/run/env_file.ts
new file mode 100644
index 000000000..48488ce72
--- /dev/null
+++ b/tests/testdata/run/env_file.ts
@@ -0,0 +1,3 @@
+console.log(Deno.env.get("FOO"));
+console.log(Deno.env.get("ANOTHER_FOO"));
+console.log(Deno.env.get("MULTILINE"));
diff --git a/tests/testdata/run/env_file_missing.out b/tests/testdata/run/env_file_missing.out
new file mode 100644
index 000000000..ae1f8f595
--- /dev/null
+++ b/tests/testdata/run/env_file_missing.out
@@ -0,0 +1,4 @@
+Warning The `--env` flag was used, but the dotenv file 'missing' was not found.
+undefined
+undefined
+undefined
diff --git a/tests/testdata/run/error_001.ts b/tests/testdata/run/error_001.ts
new file mode 100644
index 000000000..b01068bc0
--- /dev/null
+++ b/tests/testdata/run/error_001.ts
@@ -0,0 +1,9 @@
+function foo(): never {
+ throw Error("bad");
+}
+
+function bar() {
+ foo();
+}
+
+bar();
diff --git a/tests/testdata/run/error_001.ts.out b/tests/testdata/run/error_001.ts.out
new file mode 100644
index 000000000..9d8559917
--- /dev/null
+++ b/tests/testdata/run/error_001.ts.out
@@ -0,0 +1,6 @@
+[WILDCARD]error: Uncaught (in promise) 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/tests/testdata/run/error_002.ts b/tests/testdata/run/error_002.ts
new file mode 100644
index 000000000..5f8179bbe
--- /dev/null
+++ b/tests/testdata/run/error_002.ts
@@ -0,0 +1,7 @@
+import { throwsError } from "../subdir/mod1.ts";
+
+function foo() {
+ throwsError();
+}
+
+foo();
diff --git a/tests/testdata/run/error_002.ts.out b/tests/testdata/run/error_002.ts.out
new file mode 100644
index 000000000..9fec5d968
--- /dev/null
+++ b/tests/testdata/run/error_002.ts.out
@@ -0,0 +1,6 @@
+[WILDCARD]error: Uncaught (in promise) 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/tests/testdata/run/error_003_typescript.ts b/tests/testdata/run/error_003_typescript.ts
new file mode 100644
index 000000000..e1f882123
--- /dev/null
+++ b/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/tests/testdata/run/error_003_typescript.ts.out b/tests/testdata/run/error_003_typescript.ts.out
new file mode 100644
index 000000000..bbb2ec470
--- /dev/null
+++ b/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/tests/testdata/run/error_004_missing_module.ts b/tests/testdata/run/error_004_missing_module.ts
new file mode 100644
index 000000000..82b281181
--- /dev/null
+++ b/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/tests/testdata/run/error_004_missing_module.ts.out b/tests/testdata/run/error_004_missing_module.ts.out
new file mode 100644
index 000000000..9a2cfb8a8
--- /dev/null
+++ b/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/tests/testdata/run/error_005_missing_dynamic_import.ts b/tests/testdata/run/error_005_missing_dynamic_import.ts
new file mode 100644
index 000000000..8ea8ff94e
--- /dev/null
+++ b/tests/testdata/run/error_005_missing_dynamic_import.ts
@@ -0,0 +1,3 @@
+(async () => {
+ const _badModule = await import("./bad-module.ts");
+})();
diff --git a/tests/testdata/run/error_005_missing_dynamic_import.ts.out b/tests/testdata/run/error_005_missing_dynamic_import.ts.out
new file mode 100644
index 000000000..55e4a8524
--- /dev/null
+++ b/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/tests/testdata/run/error_006_import_ext_failure.ts b/tests/testdata/run/error_006_import_ext_failure.ts
new file mode 100644
index 000000000..3c32303a3
--- /dev/null
+++ b/tests/testdata/run/error_006_import_ext_failure.ts
@@ -0,0 +1 @@
+import "./non-existent";
diff --git a/tests/testdata/run/error_006_import_ext_failure.ts.out b/tests/testdata/run/error_006_import_ext_failure.ts.out
new file mode 100644
index 000000000..667579bd8
--- /dev/null
+++ b/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/tests/testdata/run/error_007_any.ts b/tests/testdata/run/error_007_any.ts
new file mode 100644
index 000000000..bfef1289b
--- /dev/null
+++ b/tests/testdata/run/error_007_any.ts
@@ -0,0 +1 @@
+throw { foo: "bar" };
diff --git a/tests/testdata/run/error_007_any.ts.out b/tests/testdata/run/error_007_any.ts.out
new file mode 100644
index 000000000..8d13dadb9
--- /dev/null
+++ b/tests/testdata/run/error_007_any.ts.out
@@ -0,0 +1 @@
+[WILDCARD]error: Uncaught (in promise) { foo: "bar" }
diff --git a/tests/testdata/run/error_008_checkjs.js b/tests/testdata/run/error_008_checkjs.js
new file mode 100644
index 000000000..f0856d94c
--- /dev/null
+++ b/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/tests/testdata/run/error_008_checkjs.js.out b/tests/testdata/run/error_008_checkjs.js.out
new file mode 100644
index 000000000..bab481422
--- /dev/null
+++ b/tests/testdata/run/error_008_checkjs.js.out
@@ -0,0 +1,4 @@
+[WILDCARD]error: Uncaught (in promise) ReferenceError: consol is not defined
+consol.log("hello world!");
+^
+ at [WILDCARD]/error_008_checkjs.js:2:1
diff --git a/tests/testdata/run/error_009_extensions_error.js b/tests/testdata/run/error_009_extensions_error.js
new file mode 100644
index 000000000..01b97ea38
--- /dev/null
+++ b/tests/testdata/run/error_009_extensions_error.js
@@ -0,0 +1,2 @@
+// Missing arg.
+new Event();
diff --git a/tests/testdata/run/error_009_extensions_error.js.out b/tests/testdata/run/error_009_extensions_error.js.out
new file mode 100644
index 000000000..0fd1306de
--- /dev/null
+++ b/tests/testdata/run/error_009_extensions_error.js.out
@@ -0,0 +1,6 @@
+[WILDCARD]error: Uncaught (in promise) TypeError: Failed to construct 'Event': 1 argument required, but only 0 present.
+new Event();
+^
+ at [WILDCARD]
+ at new Event (ext:deno_web/[WILDCARD])
+ at [WILDCARD]
diff --git a/tests/testdata/run/error_009_missing_js_module.disabled b/tests/testdata/run/error_009_missing_js_module.disabled
new file mode 100644
index 000000000..3156fc94b
--- /dev/null
+++ b/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/tests/testdata/run/error_011_bad_module_specifier.ts b/tests/testdata/run/error_011_bad_module_specifier.ts
new file mode 100644
index 000000000..1c57e37a5
--- /dev/null
+++ b/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/tests/testdata/run/error_011_bad_module_specifier.ts.out b/tests/testdata/run/error_011_bad_module_specifier.ts.out
new file mode 100644
index 000000000..81be915d1
--- /dev/null
+++ b/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/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts b/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts
new file mode 100644
index 000000000..5f39f407c
--- /dev/null
+++ b/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/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts.out b/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts.out
new file mode 100644
index 000000000..7acd66713
--- /dev/null
+++ b/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/tests/testdata/run/error_013_missing_script.out b/tests/testdata/run/error_013_missing_script.out
new file mode 100644
index 000000000..7ee268de4
--- /dev/null
+++ b/tests/testdata/run/error_013_missing_script.out
@@ -0,0 +1 @@
+error: Module not found "[WILDCARD]missing_file_name".
diff --git a/tests/testdata/run/error_014_catch_dynamic_import_error.js b/tests/testdata/run/error_014_catch_dynamic_import_error.js
new file mode 100644
index 000000000..c58e54dcb
--- /dev/null
+++ b/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/tests/testdata/run/error_014_catch_dynamic_import_error.js.out b/tests/testdata/run/error_014_catch_dynamic_import_error.js.out
new file mode 100644
index 000000000..868c97194
--- /dev/null
+++ b/tests/testdata/run/error_014_catch_dynamic_import_error.js.out
@@ -0,0 +1,19 @@
+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 [WILDCARD]/error_014_catch_dynamic_import_error.js:3:5 {
+ code: "ERR_MODULE_NOT_FOUND"
+}
+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 {
+ code: "ERR_MODULE_NOT_FOUND"
+}
+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/tests/testdata/run/error_015_dynamic_import_permissions.js b/tests/testdata/run/error_015_dynamic_import_permissions.js
new file mode 100644
index 000000000..47961cf63
--- /dev/null
+++ b/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/tests/testdata/run/error_015_dynamic_import_permissions.out b/tests/testdata/run/error_015_dynamic_import_permissions.out
new file mode 100644
index 000000000..87ce43e9c
--- /dev/null
+++ b/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/tests/testdata/run/error_016_dynamic_import_permissions2.js b/tests/testdata/run/error_016_dynamic_import_permissions2.js
new file mode 100644
index 000000000..f018d4a2e
--- /dev/null
+++ b/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/tests/testdata/run/error_016_dynamic_import_permissions2.out b/tests/testdata/run/error_016_dynamic_import_permissions2.out
new file mode 100644
index 000000000..710871f41
--- /dev/null
+++ b/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/tests/testdata/run/error_017_hide_long_source_ts.ts b/tests/testdata/run/error_017_hide_long_source_ts.ts
new file mode 100644
index 000000000..d61cb1277
--- /dev/null
+++ b/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/tests/testdata/run/error_017_hide_long_source_ts.ts.out b/tests/testdata/run/error_017_hide_long_source_ts.ts.out
new file mode 100644
index 000000000..917061ab9
--- /dev/null
+++ b/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/tests/testdata/run/error_018_hide_long_source_js.js b/tests/testdata/run/error_018_hide_long_source_js.js
new file mode 100644
index 000000000..d61cb1277
--- /dev/null
+++ b/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/tests/testdata/run/error_018_hide_long_source_js.js.out b/tests/testdata/run/error_018_hide_long_source_js.js.out
new file mode 100644
index 000000000..0897a100c
--- /dev/null
+++ b/tests/testdata/run/error_018_hide_long_source_js.js.out
@@ -0,0 +1,2 @@
+error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'a')
+ at file:///[WILDCARD]/error_018_hide_long_source_js.js:3:206
diff --git a/tests/testdata/run/error_019_stack_function.ts b/tests/testdata/run/error_019_stack_function.ts
new file mode 100644
index 000000000..a6a69d146
--- /dev/null
+++ b/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/tests/testdata/run/error_019_stack_function.ts.out b/tests/testdata/run/error_019_stack_function.ts.out
new file mode 100644
index 000000000..edaff27c0
--- /dev/null
+++ b/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 (in promise) 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/tests/testdata/run/error_020_stack_constructor.ts b/tests/testdata/run/error_020_stack_constructor.ts
new file mode 100644
index 000000000..526d1a661
--- /dev/null
+++ b/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/tests/testdata/run/error_020_stack_constructor.ts.out b/tests/testdata/run/error_020_stack_constructor.ts.out
new file mode 100644
index 000000000..9e48b8f98
--- /dev/null
+++ b/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 (in promise) 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/tests/testdata/run/error_021_stack_method.ts b/tests/testdata/run/error_021_stack_method.ts
new file mode 100644
index 000000000..b6ebe1f5e
--- /dev/null
+++ b/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/tests/testdata/run/error_021_stack_method.ts.out b/tests/testdata/run/error_021_stack_method.ts.out
new file mode 100644
index 000000000..9df9b1b7c
--- /dev/null
+++ b/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 (in promise) 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/tests/testdata/run/error_022_stack_custom_error.ts b/tests/testdata/run/error_022_stack_custom_error.ts
new file mode 100644
index 000000000..b95743503
--- /dev/null
+++ b/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/tests/testdata/run/error_022_stack_custom_error.ts.out b/tests/testdata/run/error_022_stack_custom_error.ts.out
new file mode 100644
index 000000000..73e033e52
--- /dev/null
+++ b/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 (in promise) CustomError: custom error
+const error = new CustomError();
+ ^
+ at [WILDCARD]/error_022_stack_custom_error.ts:[WILDCARD]
diff --git a/tests/testdata/run/error_023_stack_async.ts b/tests/testdata/run/error_023_stack_async.ts
new file mode 100644
index 000000000..fdabaa5df
--- /dev/null
+++ b/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/tests/testdata/run/error_023_stack_async.ts.out b/tests/testdata/run/error_023_stack_async.ts.out
new file mode 100644
index 000000000..2d122d986
--- /dev/null
+++ b/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 (in promise) 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/tests/testdata/run/error_024_stack_promise_all.ts b/tests/testdata/run/error_024_stack_promise_all.ts
new file mode 100644
index 000000000..8ca7b203c
--- /dev/null
+++ b/tests/testdata/run/error_024_stack_promise_all.ts
@@ -0,0 +1,16 @@
+const p = Promise.all([
+ Promise.resolve(),
+ (async (): Promise<never> => {
+ 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/tests/testdata/run/error_024_stack_promise_all.ts.out b/tests/testdata/run/error_024_stack_promise_all.ts.out
new file mode 100644
index 000000000..c7d10a649
--- /dev/null
+++ b/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 (in promise) 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/tests/testdata/run/error_025_tab_indent b/tests/testdata/run/error_025_tab_indent
new file mode 100644
index 000000000..35a25bcea
--- /dev/null
+++ b/tests/testdata/run/error_025_tab_indent
@@ -0,0 +1,9 @@
+function foo() {
+ throw Error("bad");
+}
+
+function bar() {
+ foo();
+}
+
+bar();
diff --git a/tests/testdata/run/error_025_tab_indent.out b/tests/testdata/run/error_025_tab_indent.out
new file mode 100644
index 000000000..edf525c90
--- /dev/null
+++ b/tests/testdata/run/error_025_tab_indent.out
@@ -0,0 +1,6 @@
+[WILDCARD]error: Uncaught (in promise) 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/tests/testdata/run/error_026_remote_import_error.ts b/tests/testdata/run/error_026_remote_import_error.ts
new file mode 100644
index 000000000..1b230d06b
--- /dev/null
+++ b/tests/testdata/run/error_026_remote_import_error.ts
@@ -0,0 +1 @@
+import "http://localhost:4545/run/error_001.ts";
diff --git a/tests/testdata/run/error_026_remote_import_error.ts.out b/tests/testdata/run/error_026_remote_import_error.ts.out
new file mode 100644
index 000000000..f3f8c0068
--- /dev/null
+++ b/tests/testdata/run/error_026_remote_import_error.ts.out
@@ -0,0 +1,7 @@
+[WILDCARD]
+error: Uncaught (in promise) 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
diff --git a/tests/testdata/run/error_cause.ts b/tests/testdata/run/error_cause.ts
new file mode 100644
index 000000000..385ce2a03
--- /dev/null
+++ b/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/tests/testdata/run/error_cause.ts.out b/tests/testdata/run/error_cause.ts.out
new file mode 100644
index 000000000..4dc439ac9
--- /dev/null
+++ b/tests/testdata/run/error_cause.ts.out
@@ -0,0 +1,13 @@
+error: Uncaught (in promise) 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"
diff --git a/tests/testdata/run/error_cause_recursive.ts b/tests/testdata/run/error_cause_recursive.ts
new file mode 100644
index 000000000..a6999b1ff
--- /dev/null
+++ b/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/tests/testdata/run/error_cause_recursive.ts.out b/tests/testdata/run/error_cause_recursive.ts.out
new file mode 100644
index 000000000..52d5a03a1
--- /dev/null
+++ b/tests/testdata/run/error_cause_recursive.ts.out
@@ -0,0 +1,7 @@
+error: Uncaught (in promise) Error: bar <ref *1>
+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: [Circular *1]
diff --git a/tests/testdata/run/error_for_await.ts b/tests/testdata/run/error_for_await.ts
new file mode 100644
index 000000000..64c81abe4
--- /dev/null
+++ b/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/tests/testdata/run/error_for_await.ts.out b/tests/testdata/run/error_for_await.ts.out
new file mode 100644
index 000000000..db3cdecb4
--- /dev/null
+++ b/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/tests/testdata/run/error_import_map_unable_to_load.out b/tests/testdata/run/error_import_map_unable_to_load.out
new file mode 100644
index 000000000..50760e438
--- /dev/null
+++ b/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/tests/testdata/run/error_local_static_import_from_remote.js b/tests/testdata/run/error_local_static_import_from_remote.js
new file mode 100644
index 000000000..eb7fd23ba
--- /dev/null
+++ b/tests/testdata/run/error_local_static_import_from_remote.js
@@ -0,0 +1 @@
+import "file:///some/dir/file.js";
diff --git a/tests/testdata/run/error_local_static_import_from_remote.js.out b/tests/testdata/run/error_local_static_import_from_remote.js.out
new file mode 100644
index 000000000..34f9e81e1
--- /dev/null
+++ b/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/tests/testdata/run/error_local_static_import_from_remote.ts b/tests/testdata/run/error_local_static_import_from_remote.ts
new file mode 100644
index 000000000..a831db0c4
--- /dev/null
+++ b/tests/testdata/run/error_local_static_import_from_remote.ts
@@ -0,0 +1 @@
+import "file:///some/dir/file.ts";
diff --git a/tests/testdata/run/error_local_static_import_from_remote.ts.out b/tests/testdata/run/error_local_static_import_from_remote.ts.out
new file mode 100644
index 000000000..88990a049
--- /dev/null
+++ b/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/tests/testdata/run/error_missing_module_named_import.ts b/tests/testdata/run/error_missing_module_named_import.ts
new file mode 100644
index 000000000..9eb5239ff
--- /dev/null
+++ b/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/tests/testdata/run/error_missing_module_named_import.ts.out b/tests/testdata/run/error_missing_module_named_import.ts.out
new file mode 100644
index 000000000..700377d65
--- /dev/null
+++ b/tests/testdata/run/error_missing_module_named_import.ts.out
@@ -0,0 +1,2 @@
+error: Module not found "file://[WILDCARD]/does_not_exist.js".
+ at file:///[WILDCARD]/error_missing_module_named_import.ts:[WILDCARD]
diff --git a/tests/testdata/run/error_name_non_string.js b/tests/testdata/run/error_name_non_string.js
new file mode 100644
index 000000000..ae9609927
--- /dev/null
+++ b/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/tests/testdata/run/error_name_non_string.js.out b/tests/testdata/run/error_name_non_string.js.out
new file mode 100644
index 000000000..14fa56c62
--- /dev/null
+++ b/tests/testdata/run/error_name_non_string.js.out
@@ -0,0 +1,4 @@
+error: Uncaught (in promise) Error
+throw new ErrorNameNonString();
+ ^
+ at file:///[WILDCARD]/error_name_non_string.js:[WILDCARD]
diff --git a/tests/testdata/run/error_no_check.ts b/tests/testdata/run/error_no_check.ts
new file mode 100644
index 000000000..2da01e639
--- /dev/null
+++ b/tests/testdata/run/error_no_check.ts
@@ -0,0 +1 @@
+export { AnInterface, isAnInterface } from "../subdir/type_and_code.ts";
diff --git a/tests/testdata/run/error_no_check.ts.out b/tests/testdata/run/error_no_check.ts.out
new file mode 100644
index 000000000..78f478045
--- /dev/null
+++ b/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/tests/testdata/run/error_syntax.js b/tests/testdata/run/error_syntax.js
new file mode 100644
index 000000000..c0414c356
--- /dev/null
+++ b/tests/testdata/run/error_syntax.js
@@ -0,0 +1,3 @@
+
+// deno-fmt-ignore-file
+(the following is a syntax error ^^ ! )
diff --git a/tests/testdata/run/error_syntax.js.out b/tests/testdata/run/error_syntax.js.out
new file mode 100644
index 000000000..fa4d51686
--- /dev/null
+++ b/tests/testdata/run/error_syntax.js.out
@@ -0,0 +1,4 @@
+error: The module's source code could not be parsed: Expected ',', got 'following' at [WILDCARD]/error_syntax.js:3:6
+
+ (the following is a syntax error ^^ ! )
+ ~~~~~~~~~
diff --git a/tests/testdata/run/error_syntax_empty_trailing_line.mjs b/tests/testdata/run/error_syntax_empty_trailing_line.mjs
new file mode 100644
index 000000000..864dfb0c7
--- /dev/null
+++ b/tests/testdata/run/error_syntax_empty_trailing_line.mjs
@@ -0,0 +1,2 @@
+// Deliberately using .mjs to avoid triggering dprint
+setTimeout(() => {}),
diff --git a/tests/testdata/run/error_syntax_empty_trailing_line.mjs.out b/tests/testdata/run/error_syntax_empty_trailing_line.mjs.out
new file mode 100644
index 000000000..2eb290bb5
--- /dev/null
+++ b/tests/testdata/run/error_syntax_empty_trailing_line.mjs.out
@@ -0,0 +1,4 @@
+error: The module's source code could not be parsed: Unexpected eof at [WILDCARD]/error_syntax_empty_trailing_line.mjs:2:22
+
+ setTimeout(() => {}),
+ ~
diff --git a/tests/testdata/run/error_type_definitions.ts b/tests/testdata/run/error_type_definitions.ts
new file mode 100644
index 000000000..86675cbaa
--- /dev/null
+++ b/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/tests/testdata/run/error_type_definitions.ts.out b/tests/testdata/run/error_type_definitions.ts.out
new file mode 100644
index 000000000..d60d4d483
--- /dev/null
+++ b/tests/testdata/run/error_type_definitions.ts.out
@@ -0,0 +1,2 @@
+[WILDCARD]error: Failed resolving types. Relative import path "baz" not prefixed with / or ./ or ../
+ at [WILDCARD]/type_definitions/bar.d.ts:[WILDCARD]
diff --git a/tests/testdata/run/error_with_errors_prop.js b/tests/testdata/run/error_with_errors_prop.js
new file mode 100644
index 000000000..d1c6bbfaa
--- /dev/null
+++ b/tests/testdata/run/error_with_errors_prop.js
@@ -0,0 +1,10 @@
+const error = new Error("Error with errors prop.");
+error.errors = [
+ new Error("Error message 1."),
+ new Error("Error message 2."),
+];
+console.log(error.stack);
+console.log();
+console.log(error);
+console.log();
+throw error;
diff --git a/tests/testdata/run/error_with_errors_prop.js.out b/tests/testdata/run/error_with_errors_prop.js.out
new file mode 100644
index 000000000..d958996af
--- /dev/null
+++ b/tests/testdata/run/error_with_errors_prop.js.out
@@ -0,0 +1,17 @@
+Error: Error with errors prop.
+ at [WILDCARD]/error_with_errors_prop.js:1:15
+
+Error: Error with errors prop.
+ at [WILDCARD]/error_with_errors_prop.js:1:15 {
+ errors: [
+ Error: Error message 1.
+ at [WILDCARD]/error_with_errors_prop.js:3:3,
+ Error: Error message 2.
+ at [WILDCARD]/error_with_errors_prop.js:4:3
+ ]
+}
+
+error: Uncaught (in promise) Error: Error with errors prop.
+const error = new Error("Error with errors prop.");
+ ^
+ at [WILDCARD]/error_with_errors_prop.js:1:15
diff --git a/tests/testdata/run/es_private_fields.js b/tests/testdata/run/es_private_fields.js
new file mode 100644
index 000000000..b5f83e39c
--- /dev/null
+++ b/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/tests/testdata/run/es_private_fields.js.out b/tests/testdata/run/es_private_fields.js.out
new file mode 100644
index 000000000..be1970b05
--- /dev/null
+++ b/tests/testdata/run/es_private_fields.js.out
@@ -0,0 +1 @@
+PRIVATE
diff --git a/tests/testdata/run/eval_context_throw_dom_exception.js b/tests/testdata/run/eval_context_throw_dom_exception.js
new file mode 100644
index 000000000..99eaa0f4a
--- /dev/null
+++ b/tests/testdata/run/eval_context_throw_dom_exception.js
@@ -0,0 +1,5 @@
+const [, errorInfo] = Deno[Deno.internal].core.evalContext(
+ 'throw new DOMException("foo")',
+ new URL("..", import.meta.url).href,
+);
+console.log(errorInfo);
diff --git a/tests/testdata/run/eval_context_throw_dom_exception.js.out b/tests/testdata/run/eval_context_throw_dom_exception.js.out
new file mode 100644
index 000000000..f7d368471
--- /dev/null
+++ b/tests/testdata/run/eval_context_throw_dom_exception.js.out
@@ -0,0 +1,9 @@
+[Object: null prototype] {
+ thrown: DOMException: foo
+ at new DOMException (ext:deno_web/01_dom_exception.js:[WILDCARD])
+ at [WILDCARD]
+ at Object.evalContext (ext:core/01_core.js:[WILDCARD])
+ at file:///[WILDCARD]/eval_context_throw_dom_exception.js:1:48,
+ isNativeError: true,
+ isCompileError: false
+}
diff --git a/tests/testdata/run/event_listener_error.ts b/tests/testdata/run/event_listener_error.ts
new file mode 100644
index 000000000..1cbdf7bc2
--- /dev/null
+++ b/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/tests/testdata/run/event_listener_error.ts.out b/tests/testdata/run/event_listener_error.ts.out
new file mode 100644
index 000000000..a20a91dfd
--- /dev/null
+++ b/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/tests/testdata/run/event_listener_error_handled.ts b/tests/testdata/run/event_listener_error_handled.ts
new file mode 100644
index 000000000..c4c8fd1cd
--- /dev/null
+++ b/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/tests/testdata/run/event_listener_error_handled.ts.out b/tests/testdata/run/event_listener_error_handled.ts.out
new file mode 100644
index 000000000..d3cf525c3
--- /dev/null
+++ b/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/tests/testdata/run/event_listener_error_immediate_exit.ts b/tests/testdata/run/event_listener_error_immediate_exit.ts
new file mode 100644
index 000000000..292a0df00
--- /dev/null
+++ b/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[Deno.internal].core
+Deno[Deno.internal].core.setNextTickCallback(() => console.log("nextTick"));
+// @ts-ignore Deno[Deno.internal].core
+Deno[Deno.internal].core.setHasTickScheduled(true);
+dispatchEvent(new CustomEvent("foo"));
+console.log(2);
diff --git a/tests/testdata/run/event_listener_error_immediate_exit.ts.out b/tests/testdata/run/event_listener_error_immediate_exit.ts.out
new file mode 100644
index 000000000..8f03f71b8
--- /dev/null
+++ b/tests/testdata/run/event_listener_error_immediate_exit.ts.out
@@ -0,0 +1,6 @@
+1
+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/tests/testdata/run/event_listener_error_immediate_exit_worker.ts b/tests/testdata/run/event_listener_error_immediate_exit_worker.ts
new file mode 100644
index 000000000..58c45d1bb
--- /dev/null
+++ b/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/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out b/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out
new file mode 100644
index 000000000..85b52190b
--- /dev/null
+++ b/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[WILDCARD]
+ 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/tests/testdata/run/exec_path.ts b/tests/testdata/run/exec_path.ts
new file mode 100644
index 000000000..b70b23237
--- /dev/null
+++ b/tests/testdata/run/exec_path.ts
@@ -0,0 +1 @@
+console.log(Deno.execPath());
diff --git a/tests/testdata/run/exit_error42.ts b/tests/testdata/run/exit_error42.ts
new file mode 100644
index 000000000..e4db41f3a
--- /dev/null
+++ b/tests/testdata/run/exit_error42.ts
@@ -0,0 +1,3 @@
+console.log("before");
+Deno.exit(42);
+console.log("after");
diff --git a/tests/testdata/run/exit_error42.ts.out b/tests/testdata/run/exit_error42.ts.out
new file mode 100644
index 000000000..90be1f305
--- /dev/null
+++ b/tests/testdata/run/exit_error42.ts.out
@@ -0,0 +1 @@
+before
diff --git a/tests/testdata/run/explicit_resource_management/main.out b/tests/testdata/run/explicit_resource_management/main.out
new file mode 100644
index 000000000..ff5ac4b59
--- /dev/null
+++ b/tests/testdata/run/explicit_resource_management/main.out
@@ -0,0 +1,5 @@
+A
+Disposed
+B
+Async disposed
+C
diff --git a/tests/testdata/run/explicit_resource_management/main.ts b/tests/testdata/run/explicit_resource_management/main.ts
new file mode 100644
index 000000000..0201a51f9
--- /dev/null
+++ b/tests/testdata/run/explicit_resource_management/main.ts
@@ -0,0 +1,21 @@
+class Resource {
+ [Symbol.dispose]() {
+ console.log("Disposed");
+ }
+}
+class AsyncResource {
+ async [Symbol.asyncDispose]() {
+ await new Promise((resolve) => setTimeout(resolve, 10));
+ console.log("Async disposed");
+ }
+}
+
+{
+ using resource = new Resource();
+ console.log("A");
+}
+{
+ await using resource = new AsyncResource();
+ console.log("B");
+}
+console.log("C");
diff --git a/tests/testdata/run/export_type_def.ts b/tests/testdata/run/export_type_def.ts
new file mode 100644
index 000000000..9a1e2b0fe
--- /dev/null
+++ b/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/tests/testdata/run/extension_dynamic_import.ts b/tests/testdata/run/extension_dynamic_import.ts
new file mode 100644
index 000000000..6fb3ac3a0
--- /dev/null
+++ b/tests/testdata/run/extension_dynamic_import.ts
@@ -0,0 +1 @@
+await import("ext:runtime/01_errors.js");
diff --git a/tests/testdata/run/extension_dynamic_import.ts.out b/tests/testdata/run/extension_dynamic_import.ts.out
new file mode 100644
index 000000000..b22717d62
--- /dev/null
+++ b/tests/testdata/run/extension_dynamic_import.ts.out
@@ -0,0 +1,4 @@
+error: Uncaught (in promise) TypeError: Importing ext: modules is only allowed from ext: and node: modules. Tried to import ext:runtime/01_errors.js from [WILDCARD]/testdata/run/extension_dynamic_import.ts
+await import("ext:runtime/01_errors.js");
+^
+ at async [WILDCARD]/run/extension_dynamic_import.ts:1:1
diff --git a/tests/testdata/run/extension_import.ts b/tests/testdata/run/extension_import.ts
new file mode 100644
index 000000000..7bbbab799
--- /dev/null
+++ b/tests/testdata/run/extension_import.ts
@@ -0,0 +1 @@
+import "ext:runtime/01_errors.js";
diff --git a/tests/testdata/run/extension_import.ts.out b/tests/testdata/run/extension_import.ts.out
new file mode 100644
index 000000000..88039a9ce
--- /dev/null
+++ b/tests/testdata/run/extension_import.ts.out
@@ -0,0 +1,8 @@
+error: Unsupported scheme "ext" for module "ext:runtime/01_errors.js". Supported schemes: [
+ "data",
+ "blob",
+ "file",
+ "http",
+ "https",
+]
+ at [WILDCARD]/extension_import.ts:1:8
diff --git a/tests/testdata/run/fetch/hello.txt b/tests/testdata/run/fetch/hello.txt
new file mode 100644
index 000000000..af5626b4a
--- /dev/null
+++ b/tests/testdata/run/fetch/hello.txt
@@ -0,0 +1 @@
+Hello, world!
diff --git a/tests/testdata/run/fetch/other.ts b/tests/testdata/run/fetch/other.ts
new file mode 100644
index 000000000..91fe376b3
--- /dev/null
+++ b/tests/testdata/run/fetch/other.ts
@@ -0,0 +1 @@
+import "http://localhost:4545/subdir/mt_text_typescript.t1.ts";
diff --git a/tests/testdata/run/fetch/test.ts b/tests/testdata/run/fetch/test.ts
new file mode 100644
index 000000000..baa52775d
--- /dev/null
+++ b/tests/testdata/run/fetch/test.ts
@@ -0,0 +1 @@
+import "http://localhost:4545/subdir/mod2.ts";
diff --git a/tests/testdata/run/fetch_async_error_stack.ts b/tests/testdata/run/fetch_async_error_stack.ts
new file mode 100644
index 000000000..f583192c2
--- /dev/null
+++ b/tests/testdata/run/fetch_async_error_stack.ts
@@ -0,0 +1 @@
+await fetch("https://nonexistent.deno.land/");
diff --git a/tests/testdata/run/fetch_async_error_stack.ts.out b/tests/testdata/run/fetch_async_error_stack.ts.out
new file mode 100644
index 000000000..e8169228f
--- /dev/null
+++ b/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 (ext:[WILDCARD])
+ at async file:///[WILDCARD]/fetch_async_error_stack.ts:1:1
diff --git a/tests/testdata/run/fetch_response_finalization.js b/tests/testdata/run/fetch_response_finalization.js
new file mode 100644
index 000000000..85fc6afa3
--- /dev/null
+++ b/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[Deno.internal].core.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[Deno.internal].core.resources()); // print the current resources
diff --git a/tests/testdata/run/fetch_response_finalization.js.out b/tests/testdata/run/fetch_response_finalization.js.out
new file mode 100644
index 000000000..645842a5b
--- /dev/null
+++ b/tests/testdata/run/fetch_response_finalization.js.out
@@ -0,0 +1,2 @@
+{ "0": "stdin", "1": "stdout", "2": "stderr", "5": "fetchResponse" }
+{ "0": "stdin", "1": "stdout", "2": "stderr" }
diff --git a/tests/testdata/run/finalization_registry.js b/tests/testdata/run/finalization_registry.js
new file mode 100644
index 000000000..ee9dc384f
--- /dev/null
+++ b/tests/testdata/run/finalization_registry.js
@@ -0,0 +1,20 @@
+// Copyright 2018-2024 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[Deno.internal].core.print("FinalizationRegistry called!\n");
+});
+
+(function () {
+ let x = {};
+ registry.register(x, "called!");
+ x = null;
+})();
+
+gc();
diff --git a/tests/testdata/run/finalization_registry.js.out b/tests/testdata/run/finalization_registry.js.out
new file mode 100644
index 000000000..fee61413a
--- /dev/null
+++ b/tests/testdata/run/finalization_registry.js.out
@@ -0,0 +1 @@
+FinalizationRegistry called!
diff --git a/tests/testdata/run/fix_dynamic_import_errors.js b/tests/testdata/run/fix_dynamic_import_errors.js
new file mode 100644
index 000000000..1d7be37e0
--- /dev/null
+++ b/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/tests/testdata/run/fix_dynamic_import_errors.js.out b/tests/testdata/run/fix_dynamic_import_errors.js.out
new file mode 100644
index 000000000..e7856fb9c
--- /dev/null
+++ b/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/tests/testdata/run/fix_emittable_skipped.js b/tests/testdata/run/fix_emittable_skipped.js
new file mode 100644
index 000000000..a4ccc9efd
--- /dev/null
+++ b/tests/testdata/run/fix_emittable_skipped.js
@@ -0,0 +1,7 @@
+/// <reference types="../subdir/emittable.d.ts" />
+
+import "../subdir/polyfill.ts";
+
+export const a = "a";
+
+console.log(globalThis.polyfill);
diff --git a/tests/testdata/run/fix_emittable_skipped.ts.out b/tests/testdata/run/fix_emittable_skipped.ts.out
new file mode 100644
index 000000000..865759299
--- /dev/null
+++ b/tests/testdata/run/fix_emittable_skipped.ts.out
@@ -0,0 +1 @@
+[Function (anonymous)]
diff --git a/tests/testdata/run/fix_js_import_js.ts b/tests/testdata/run/fix_js_import_js.ts
new file mode 100644
index 000000000..0f01877cd
--- /dev/null
+++ b/tests/testdata/run/fix_js_import_js.ts
@@ -0,0 +1,3 @@
+import { isMod4 } from "../subdir/mod6.js";
+
+console.log(isMod4);
diff --git a/tests/testdata/run/fix_js_import_js.ts.out b/tests/testdata/run/fix_js_import_js.ts.out
new file mode 100644
index 000000000..27ba77dda
--- /dev/null
+++ b/tests/testdata/run/fix_js_import_js.ts.out
@@ -0,0 +1 @@
+true
diff --git a/tests/testdata/run/fix_js_imports.ts b/tests/testdata/run/fix_js_imports.ts
new file mode 100644
index 000000000..6ed13bae3
--- /dev/null
+++ b/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/tests/testdata/run/fix_js_imports.ts.out b/tests/testdata/run/fix_js_imports.ts.out
new file mode 100644
index 000000000..c427932a4
--- /dev/null
+++ b/tests/testdata/run/fix_js_imports.ts.out
@@ -0,0 +1 @@
+[Module: null prototype] { }
diff --git a/tests/testdata/run/fix_tsc_file_exists.out b/tests/testdata/run/fix_tsc_file_exists.out
new file mode 100644
index 000000000..ce0136250
--- /dev/null
+++ b/tests/testdata/run/fix_tsc_file_exists.out
@@ -0,0 +1 @@
+hello
diff --git a/tests/testdata/run/fix_worker_dispatchevent.ts b/tests/testdata/run/fix_worker_dispatchevent.ts
new file mode 100644
index 000000000..1b73b52dc
--- /dev/null
+++ b/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/tests/testdata/run/fix_worker_dispatchevent.ts.out b/tests/testdata/run/fix_worker_dispatchevent.ts.out
new file mode 100644
index 000000000..2e9ba477f
--- /dev/null
+++ b/tests/testdata/run/fix_worker_dispatchevent.ts.out
@@ -0,0 +1 @@
+success
diff --git a/tests/testdata/run/followup_dyn_import_resolves/main.ts b/tests/testdata/run/followup_dyn_import_resolves/main.ts
new file mode 100644
index 000000000..a8508f942
--- /dev/null
+++ b/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/tests/testdata/run/followup_dyn_import_resolves/main.ts.out b/tests/testdata/run/followup_dyn_import_resolves/main.ts.out
new file mode 100644
index 000000000..a19976d4a
--- /dev/null
+++ b/tests/testdata/run/followup_dyn_import_resolves/main.ts.out
@@ -0,0 +1,3 @@
+sub2
+sub1
+Done.
diff --git a/tests/testdata/run/followup_dyn_import_resolves/sub1.ts b/tests/testdata/run/followup_dyn_import_resolves/sub1.ts
new file mode 100644
index 000000000..d06c30221
--- /dev/null
+++ b/tests/testdata/run/followup_dyn_import_resolves/sub1.ts
@@ -0,0 +1,2 @@
+await import("./sub2.ts");
+console.log("sub1");
diff --git a/tests/testdata/run/followup_dyn_import_resolves/sub2.ts b/tests/testdata/run/followup_dyn_import_resolves/sub2.ts
new file mode 100644
index 000000000..cce2b524c
--- /dev/null
+++ b/tests/testdata/run/followup_dyn_import_resolves/sub2.ts
@@ -0,0 +1 @@
+console.log("sub2");
diff --git a/tests/testdata/run/heapstats.js b/tests/testdata/run/heapstats.js
new file mode 100644
index 000000000..b93c9c120
--- /dev/null
+++ b/tests/testdata/run/heapstats.js
@@ -0,0 +1,37 @@
+// Copyright 2018-2024 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/tests/testdata/run/heapstats.js.out b/tests/testdata/run/heapstats.js.out
new file mode 100644
index 000000000..954266333
--- /dev/null
+++ b/tests/testdata/run/heapstats.js.out
@@ -0,0 +1,2 @@
+Allocated: 8MB
+Freed: -8MB
diff --git a/tests/testdata/run/http2_request_url.ts b/tests/testdata/run/http2_request_url.ts
new file mode 100644
index 000000000..5acff8cc2
--- /dev/null
+++ b/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/tests/testdata/run/https_import.ts b/tests/testdata/run/https_import.ts
new file mode 100644
index 000000000..3bcc90326
--- /dev/null
+++ b/tests/testdata/run/https_import.ts
@@ -0,0 +1,3 @@
+import { printHello } from "https://localhost:5545/subdir/print_hello.ts";
+
+printHello();
diff --git a/tests/testdata/run/https_import.ts.out b/tests/testdata/run/https_import.ts.out
new file mode 100644
index 000000000..e965047ad
--- /dev/null
+++ b/tests/testdata/run/https_import.ts.out
@@ -0,0 +1 @@
+Hello
diff --git a/tests/testdata/run/if_main.ts b/tests/testdata/run/if_main.ts
new file mode 100644
index 000000000..4dcfecea0
--- /dev/null
+++ b/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/tests/testdata/run/if_main.ts.out b/tests/testdata/run/if_main.ts.out
new file mode 100644
index 000000000..ba2906d06
--- /dev/null
+++ b/tests/testdata/run/if_main.ts.out
@@ -0,0 +1 @@
+main
diff --git a/tests/testdata/run/import_blob_url.ts b/tests/testdata/run/import_blob_url.ts
new file mode 100644
index 000000000..86bb634e1
--- /dev/null
+++ b/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/tests/testdata/run/import_blob_url.ts.out b/tests/testdata/run/import_blob_url.ts.out
new file mode 100644
index 000000000..bfa0b9d94
--- /dev/null
+++ b/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/tests/testdata/run/import_blob_url_error_stack.ts b/tests/testdata/run/import_blob_url_error_stack.ts
new file mode 100644
index 000000000..f9c4f2e9d
--- /dev/null
+++ b/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/tests/testdata/run/import_blob_url_error_stack.ts.out b/tests/testdata/run/import_blob_url_error_stack.ts.out
new file mode 100644
index 000000000..201556b8a
--- /dev/null
+++ b/tests/testdata/run/import_blob_url_error_stack.ts.out
@@ -0,0 +1,5 @@
+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
diff --git a/tests/testdata/run/import_blob_url_import_relative.ts b/tests/testdata/run/import_blob_url_import_relative.ts
new file mode 100644
index 000000000..ad130bdac
--- /dev/null
+++ b/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/tests/testdata/run/import_blob_url_import_relative.ts.out b/tests/testdata/run/import_blob_url_import_relative.ts.out
new file mode 100644
index 000000000..59a6f07fb
--- /dev/null
+++ b/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/tests/testdata/run/import_blob_url_imports.ts b/tests/testdata/run/import_blob_url_imports.ts
new file mode 100644
index 000000000..a7c639152
--- /dev/null
+++ b/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/tests/testdata/run/import_blob_url_imports.ts.out b/tests/testdata/run/import_blob_url_imports.ts.out
new file mode 100644
index 000000000..e965047ad
--- /dev/null
+++ b/tests/testdata/run/import_blob_url_imports.ts.out
@@ -0,0 +1 @@
+Hello
diff --git a/tests/testdata/run/import_blob_url_jsx.ts b/tests/testdata/run/import_blob_url_jsx.ts
new file mode 100644
index 000000000..8d645796a
--- /dev/null
+++ b/tests/testdata/run/import_blob_url_jsx.ts
@@ -0,0 +1,16 @@
+const blob = new Blob(
+ ["export default function() {\n return <div>Hello Deno!</div>\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/tests/testdata/run/import_blob_url_jsx.ts.out b/tests/testdata/run/import_blob_url_jsx.ts.out
new file mode 100644
index 000000000..c1c85f250
--- /dev/null
+++ b/tests/testdata/run/import_blob_url_jsx.ts.out
@@ -0,0 +1 @@
+div null Hello Deno!
diff --git a/tests/testdata/run/import_compression/brotli b/tests/testdata/run/import_compression/brotli
new file mode 100644
index 000000000..65f679d57
--- /dev/null
+++ b/tests/testdata/run/import_compression/brotli
@@ -0,0 +1,2 @@
+‹
+€console.log('brotli'); \ No newline at end of file
diff --git a/tests/testdata/run/import_compression/gziped b/tests/testdata/run/import_compression/gziped
new file mode 100644
index 000000000..9f9a7bc69
--- /dev/null
+++ b/tests/testdata/run/import_compression/gziped
Binary files differ
diff --git a/tests/testdata/run/import_compression/main.out b/tests/testdata/run/import_compression/main.out
new file mode 100644
index 000000000..371994979
--- /dev/null
+++ b/tests/testdata/run/import_compression/main.out
@@ -0,0 +1,4 @@
+gzip
+brotli
+console.log('gzip')
+console.log('brotli');
diff --git a/tests/testdata/run/import_compression/main.ts b/tests/testdata/run/import_compression/main.ts
new file mode 100644
index 000000000..3dcd6fa24
--- /dev/null
+++ b/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/tests/testdata/run/import_data_url.ts b/tests/testdata/run/import_data_url.ts
new file mode 100644
index 000000000..258514a5e
--- /dev/null
+++ b/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/tests/testdata/run/import_data_url.ts.out b/tests/testdata/run/import_data_url.ts.out
new file mode 100644
index 000000000..bfa0b9d94
--- /dev/null
+++ b/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/tests/testdata/run/import_data_url_error_stack.ts b/tests/testdata/run/import_data_url_error_stack.ts
new file mode 100644
index 000000000..022e49fe1
--- /dev/null
+++ b/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/tests/testdata/run/import_data_url_error_stack.ts.out b/tests/testdata/run/import_data_url_error_stack.ts.out
new file mode 100644
index 000000000..83eed611d
--- /dev/null
+++ b/tests/testdata/run/import_data_url_error_stack.ts.out
@@ -0,0 +1,5 @@
+error: Uncaught (in promise) 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
diff --git a/tests/testdata/run/import_data_url_import_relative.ts b/tests/testdata/run/import_data_url_import_relative.ts
new file mode 100644
index 000000000..23947fe60
--- /dev/null
+++ b/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/tests/testdata/run/import_data_url_import_relative.ts.out b/tests/testdata/run/import_data_url_import_relative.ts.out
new file mode 100644
index 000000000..821c3e4df
--- /dev/null
+++ b/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/tests/testdata/run/import_data_url_imports.ts b/tests/testdata/run/import_data_url_imports.ts
new file mode 100644
index 000000000..df7dae727
--- /dev/null
+++ b/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/tests/testdata/run/import_data_url_imports.ts.out b/tests/testdata/run/import_data_url_imports.ts.out
new file mode 100644
index 000000000..e965047ad
--- /dev/null
+++ b/tests/testdata/run/import_data_url_imports.ts.out
@@ -0,0 +1 @@
+Hello
diff --git a/tests/testdata/run/import_data_url_jsx.ts b/tests/testdata/run/import_data_url_jsx.ts
new file mode 100644
index 000000000..1881211f9
--- /dev/null
+++ b/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/tests/testdata/run/import_data_url_jsx.ts.out b/tests/testdata/run/import_data_url_jsx.ts.out
new file mode 100644
index 000000000..c1c85f250
--- /dev/null
+++ b/tests/testdata/run/import_data_url_jsx.ts.out
@@ -0,0 +1 @@
+div null Hello Deno!
diff --git a/tests/testdata/run/import_dynamic_data_url.ts b/tests/testdata/run/import_dynamic_data_url.ts
new file mode 100644
index 000000000..53a0fbcd3
--- /dev/null
+++ b/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/tests/testdata/run/import_dynamic_data_url.ts.out b/tests/testdata/run/import_dynamic_data_url.ts.out
new file mode 100644
index 000000000..bfa0b9d94
--- /dev/null
+++ b/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/tests/testdata/run/import_extensionless.ts b/tests/testdata/run/import_extensionless.ts
new file mode 100644
index 000000000..689d553ff
--- /dev/null
+++ b/tests/testdata/run/import_extensionless.ts
@@ -0,0 +1,3 @@
+import { printHello3 } from "http://localhost:4545/v1/extensionless";
+
+printHello3();
diff --git a/tests/testdata/run/import_extensionless.ts.out b/tests/testdata/run/import_extensionless.ts.out
new file mode 100644
index 000000000..e965047ad
--- /dev/null
+++ b/tests/testdata/run/import_extensionless.ts.out
@@ -0,0 +1 @@
+Hello
diff --git a/tests/testdata/run/import_file_with_colon.ts b/tests/testdata/run/import_file_with_colon.ts
new file mode 100644
index 000000000..619bdd66d
--- /dev/null
+++ b/tests/testdata/run/import_file_with_colon.ts
@@ -0,0 +1 @@
+import "http://localhost:4545/subdir/file_with_:_in_name.ts";
diff --git a/tests/testdata/run/import_file_with_colon.ts.out b/tests/testdata/run/import_file_with_colon.ts.out
new file mode 100644
index 000000000..f60bbf4b1
--- /dev/null
+++ b/tests/testdata/run/import_file_with_colon.ts.out
@@ -0,0 +1 @@
+Hello from file_with_:_in_name.ts
diff --git a/tests/testdata/run/import_maps/test_data.ts b/tests/testdata/run/import_maps/test_data.ts
new file mode 100644
index 000000000..5e8efea69
--- /dev/null
+++ b/tests/testdata/run/import_maps/test_data.ts
@@ -0,0 +1 @@
+import "test_server/import_maps/lodash/lodash.ts";
diff --git a/tests/testdata/run/import_maps/test_data.ts.out b/tests/testdata/run/import_maps/test_data.ts.out
new file mode 100644
index 000000000..da996dc0d
--- /dev/null
+++ b/tests/testdata/run/import_maps/test_data.ts.out
@@ -0,0 +1 @@
+Hello from remapped lodash!
diff --git a/tests/testdata/run/import_meta/importmap.json b/tests/testdata/run/import_meta/importmap.json
new file mode 100644
index 000000000..d85fe3028
--- /dev/null
+++ b/tests/testdata/run/import_meta/importmap.json
@@ -0,0 +1,12 @@
+{
+ "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",
+ "npm:preact": "https://example.com/preact"
+ }
+}
diff --git a/tests/testdata/run/import_meta/main.out b/tests/testdata/run/import_meta/main.out
new file mode 100644
index 000000000..5a86d6240
--- /dev/null
+++ b/tests/testdata/run/import_meta/main.out
@@ -0,0 +1,13 @@
+other remote [WILDCARD]other.ts false undefined undefined
+other [WILDCARD]other.ts false [WILDCARD]other.ts [WILDCARD]
+main [WILDCARD]main.ts true [WILDCARD]main.ts [WILDCARD]
+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
+Resolving npm:cowsay npm:cowsay
+Resolving npm:cowsay@1 npm:cowsay@1
+Resolving npm:preact from import map https://example.com/preact
diff --git a/tests/testdata/run/import_meta/main.ts b/tests/testdata/run/import_meta/main.ts
new file mode 100644
index 000000000..61880e2c1
--- /dev/null
+++ b/tests/testdata/run/import_meta/main.ts
@@ -0,0 +1,52 @@
+import { assertThrows } from "../../../../test_util/std/assert/mod.ts";
+import "http://localhost:4545/run/import_meta/other.ts";
+import "./other.ts";
+
+console.log(
+ "main",
+ import.meta.url,
+ import.meta.main,
+ import.meta.filename,
+ import.meta.dirname,
+);
+
+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);
+console.log(
+ "Resolving npm:cowsay",
+ import.meta.resolve("npm:cowsay"),
+);
+console.log(
+ "Resolving npm:cowsay@1",
+ import.meta.resolve("npm:cowsay@1"),
+);
+console.log(
+ "Resolving npm:preact from import map",
+ import.meta.resolve("npm:preact"),
+);
diff --git a/tests/testdata/run/import_meta/other.ts b/tests/testdata/run/import_meta/other.ts
new file mode 100644
index 000000000..5da6a4936
--- /dev/null
+++ b/tests/testdata/run/import_meta/other.ts
@@ -0,0 +1,7 @@
+console.log(
+ import.meta.url.startsWith("http") ? "other remote" : "other",
+ import.meta.url,
+ import.meta.main,
+ import.meta.filename,
+ import.meta.dirname,
+);
diff --git a/tests/testdata/run/import_type.ts b/tests/testdata/run/import_type.ts
new file mode 100644
index 000000000..22c639cbc
--- /dev/null
+++ b/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/tests/testdata/run/import_type.ts.out b/tests/testdata/run/import_type.ts.out
new file mode 100644
index 000000000..e35539e35
--- /dev/null
+++ b/tests/testdata/run/import_type.ts.out
@@ -0,0 +1 @@
+B { a: "a" }
diff --git a/tests/testdata/run/inline_js_source_map.ts b/tests/testdata/run/inline_js_source_map.ts
new file mode 100644
index 000000000..5ae7c226a
--- /dev/null
+++ b/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/tests/testdata/run/inline_js_source_map_2.js b/tests/testdata/run/inline_js_source_map_2.js
new file mode 100644
index 000000000..d14d906b8
--- /dev/null
+++ b/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/tests/testdata/run/inline_js_source_map_2.js.out b/tests/testdata/run/inline_js_source_map_2.js.out
new file mode 100644
index 000000000..ba3053eba
--- /dev/null
+++ b/tests/testdata/run/inline_js_source_map_2.js.out
@@ -0,0 +1,2 @@
+error: Uncaught (in promise) Error: Hello world!
+ at http://localhost:4545/run/inline_js_source_map_2.ts:6:7
diff --git a/tests/testdata/run/inline_js_source_map_2.ts b/tests/testdata/run/inline_js_source_map_2.ts
new file mode 100644
index 000000000..fa50586e6
--- /dev/null
+++ b/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/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js b/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js
new file mode 100644
index 000000000..7660cc229
--- /dev/null
+++ b/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/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js.out b/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js.out
new file mode 100644
index 000000000..ba3053eba
--- /dev/null
+++ b/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js.out
@@ -0,0 +1,2 @@
+error: Uncaught (in promise) Error: Hello world!
+ at http://localhost:4545/run/inline_js_source_map_2.ts:6:7
diff --git a/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js b/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js
new file mode 100644
index 000000000..887f02320
--- /dev/null
+++ b/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/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js.out b/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js.out
new file mode 100644
index 000000000..d80a1c7bb
--- /dev/null
+++ b/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js.out
@@ -0,0 +1,4 @@
+error: Uncaught (in promise) 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/tests/testdata/run/issue13562.ts b/tests/testdata/run/issue13562.ts
new file mode 100644
index 000000000..afbf69f99
--- /dev/null
+++ b/tests/testdata/run/issue13562.ts
@@ -0,0 +1,3 @@
+import { printHello3 } from "../subdir/mod1.ts?q=.json";
+
+printHello3();
diff --git a/tests/testdata/run/issue13562.ts.out b/tests/testdata/run/issue13562.ts.out
new file mode 100644
index 000000000..e965047ad
--- /dev/null
+++ b/tests/testdata/run/issue13562.ts.out
@@ -0,0 +1 @@
+Hello
diff --git a/tests/testdata/run/issue9750.js b/tests/testdata/run/issue9750.js
new file mode 100644
index 000000000..89fd61629
--- /dev/null
+++ b/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/tests/testdata/run/js_import_detect.ts b/tests/testdata/run/js_import_detect.ts
new file mode 100644
index 000000000..751741996
--- /dev/null
+++ b/tests/testdata/run/js_import_detect.ts
@@ -0,0 +1,3 @@
+function define(_foo: string[]) {}
+define(["long"]);
+console.log("ok");
diff --git a/tests/testdata/run/js_import_detect.ts.out b/tests/testdata/run/js_import_detect.ts.out
new file mode 100644
index 000000000..9766475a4
--- /dev/null
+++ b/tests/testdata/run/js_import_detect.ts.out
@@ -0,0 +1 @@
+ok
diff --git a/tests/testdata/run/js_root_with_ts_check.js b/tests/testdata/run/js_root_with_ts_check.js
new file mode 100644
index 000000000..adca847ee
--- /dev/null
+++ b/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/tests/testdata/run/js_root_with_ts_check.js.out b/tests/testdata/run/js_root_with_ts_check.js.out
new file mode 100644
index 000000000..34e2fa61e
--- /dev/null
+++ b/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/tests/testdata/run/jsx_import_from_ts.App.jsx b/tests/testdata/run/jsx_import_from_ts.App.jsx
new file mode 100644
index 000000000..649230613
--- /dev/null
+++ b/tests/testdata/run/jsx_import_from_ts.App.jsx
@@ -0,0 +1,11 @@
+const React = {
+ createElement() {},
+};
+
+export default function app() {
+ return (
+ <div>
+ <h2>asdf</h2>
+ </div>
+ );
+}
diff --git a/tests/testdata/run/jsx_import_from_ts.ts b/tests/testdata/run/jsx_import_from_ts.ts
new file mode 100644
index 000000000..3cc916698
--- /dev/null
+++ b/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/tests/testdata/run/jsx_import_from_ts.ts.out b/tests/testdata/run/jsx_import_from_ts.ts.out
new file mode 100644
index 000000000..d449b8c9a
--- /dev/null
+++ b/tests/testdata/run/jsx_import_from_ts.ts.out
@@ -0,0 +1 @@
+[Function: app]
diff --git a/tests/testdata/run/jsx_import_source.out b/tests/testdata/run/jsx_import_source.out
new file mode 100644
index 000000000..b9555987a
--- /dev/null
+++ b/tests/testdata/run/jsx_import_source.out
@@ -0,0 +1,2 @@
+[WILDCARD]
+imported http://localhost:4545/jsx/jsx-runtime
diff --git a/tests/testdata/run/jsx_import_source_dev.out b/tests/testdata/run/jsx_import_source_dev.out
new file mode 100644
index 000000000..38d7a12f0
--- /dev/null
+++ b/tests/testdata/run/jsx_import_source_dev.out
@@ -0,0 +1,2 @@
+[WILDCARD]
+imported http://localhost:4545/jsx/jsx-dev-runtime
diff --git a/tests/testdata/run/jsx_import_source_error.out b/tests/testdata/run/jsx_import_source_error.out
new file mode 100644
index 000000000..634a5b09b
--- /dev/null
+++ b/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/tests/testdata/run/jsx_import_source_import_map.out b/tests/testdata/run/jsx_import_source_import_map.out
new file mode 100644
index 000000000..0d3238967
--- /dev/null
+++ b/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/tests/testdata/run/jsx_import_source_import_map_dev.out b/tests/testdata/run/jsx_import_source_import_map_dev.out
new file mode 100644
index 000000000..56f514d90
--- /dev/null
+++ b/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/tests/testdata/run/jsx_import_source_no_pragma.tsx b/tests/testdata/run/jsx_import_source_no_pragma.tsx
new file mode 100644
index 000000000..2c756054f
--- /dev/null
+++ b/tests/testdata/run/jsx_import_source_no_pragma.tsx
@@ -0,0 +1,7 @@
+function A() {
+ return "hello";
+}
+
+export function B() {
+ return <A></A>;
+}
diff --git a/tests/testdata/run/jsx_import_source_pragma.tsx b/tests/testdata/run/jsx_import_source_pragma.tsx
new file mode 100644
index 000000000..c19e53d4f
--- /dev/null
+++ b/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 <A></A>;
+}
diff --git a/tests/testdata/run/jsx_import_source_pragma_import_map.tsx b/tests/testdata/run/jsx_import_source_pragma_import_map.tsx
new file mode 100644
index 000000000..548365f18
--- /dev/null
+++ b/tests/testdata/run/jsx_import_source_pragma_import_map.tsx
@@ -0,0 +1,9 @@
+/** @jsxImportSource jsx */
+
+function A() {
+ return "hello";
+}
+
+export function B() {
+ return <A></A>;
+}
diff --git a/tests/testdata/run/jsx_precompile/no_pragma.out b/tests/testdata/run/jsx_precompile/no_pragma.out
new file mode 100644
index 000000000..437995923
--- /dev/null
+++ b/tests/testdata/run/jsx_precompile/no_pragma.out
@@ -0,0 +1,3 @@
+Download http://localhost:4545/jsx/jsx-precompile/index.ts
+Check file:///[WILDCARD]/run/jsx_precompile/no_pragma.tsx
+imported http://localhost:4545/jsx/jsx-precompile/index.ts
diff --git a/tests/testdata/run/jsx_precompile/no_pragma.tsx b/tests/testdata/run/jsx_precompile/no_pragma.tsx
new file mode 100644
index 000000000..7ba21d80d
--- /dev/null
+++ b/tests/testdata/run/jsx_precompile/no_pragma.tsx
@@ -0,0 +1,3 @@
+export function A() {
+ return <h1>hello</h1>;
+}
diff --git a/tests/testdata/run/lock_check_err.json b/tests/testdata/run/lock_check_err.json
new file mode 100644
index 000000000..fc6c2d45c
--- /dev/null
+++ b/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/tests/testdata/run/lock_check_err.out b/tests/testdata/run/lock_check_err.out
new file mode 100644
index 000000000..e4cc7b81a
--- /dev/null
+++ b/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/tests/testdata/run/lock_check_err2.json b/tests/testdata/run/lock_check_err2.json
new file mode 100644
index 000000000..a59cbc9e3
--- /dev/null
+++ b/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/tests/testdata/run/lock_check_err2.out b/tests/testdata/run/lock_check_err2.out
new file mode 100644
index 000000000..065c7434b
--- /dev/null
+++ b/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/tests/testdata/run/lock_check_ok.json b/tests/testdata/run/lock_check_ok.json
new file mode 100644
index 000000000..94de0f630
--- /dev/null
+++ b/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/tests/testdata/run/lock_check_ok2.json b/tests/testdata/run/lock_check_ok2.json
new file mode 100644
index 000000000..14d8b7117
--- /dev/null
+++ b/tests/testdata/run/lock_check_ok2.json
@@ -0,0 +1,13 @@
+{
+ "version": "3",
+ "remote": {
+ "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/tests/testdata/run/lock_dynamic_imports.json b/tests/testdata/run/lock_dynamic_imports.json
new file mode 100644
index 000000000..0269b9409
--- /dev/null
+++ b/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/tests/testdata/run/lock_dynamic_imports.out b/tests/testdata/run/lock_dynamic_imports.out
new file mode 100644
index 000000000..acc65c8e6
--- /dev/null
+++ b/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/tests/testdata/run/lock_only_http_and_https/b.ts b/tests/testdata/run/lock_only_http_and_https/b.ts
new file mode 100644
index 000000000..3bf5ac26a
--- /dev/null
+++ b/tests/testdata/run/lock_only_http_and_https/b.ts
@@ -0,0 +1,3 @@
+export function b() {
+ return "b";
+}
diff --git a/tests/testdata/run/lock_only_http_and_https/deno.lock b/tests/testdata/run/lock_only_http_and_https/deno.lock
new file mode 100644
index 000000000..695926fd5
--- /dev/null
+++ b/tests/testdata/run/lock_only_http_and_https/deno.lock
@@ -0,0 +1,7 @@
+{
+ "version": "2",
+ "remote": {
+ "http://127.0.0.1:4545/run/003_relative_import.ts": "a1572e8fd2c2712b33f04aed2561505b5feb2c8696f1f2cded3de7127931b97e",
+ "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c"
+ }
+}
diff --git a/tests/testdata/run/lock_only_http_and_https/main.out b/tests/testdata/run/lock_only_http_and_https/main.out
new file mode 100644
index 000000000..cc47b50f3
--- /dev/null
+++ b/tests/testdata/run/lock_only_http_and_https/main.out
@@ -0,0 +1,5 @@
+Download http://127.0.0.1:4545/run/003_relative_import.ts
+Download http://127.0.0.1:4545/subdir/print_hello.ts
+Hello
+[Function: a]
+[Function: b]
diff --git a/tests/testdata/run/lock_only_http_and_https/main.ts b/tests/testdata/run/lock_only_http_and_https/main.ts
new file mode 100644
index 000000000..879e825ed
--- /dev/null
+++ b/tests/testdata/run/lock_only_http_and_https/main.ts
@@ -0,0 +1,6 @@
+import "http://127.0.0.1:4545/run/003_relative_import.ts";
+import { a } from "data:application/typescript;base64,ZW51bSBBIHsKICBBLAogIEIsCiAgQywKIH0KIAogZXhwb3J0IGZ1bmN0aW9uIGEoKSB7CiAgIHRocm93IG5ldyBFcnJvcihgSGVsbG8gJHtBLkN9YCk7CiB9CiA=";
+import { b } from "./b.ts";
+
+console.log(a);
+console.log(b);
diff --git a/tests/testdata/run/lock_v2_check_err.json b/tests/testdata/run/lock_v2_check_err.json
new file mode 100644
index 000000000..6bd6491c6
--- /dev/null
+++ b/tests/testdata/run/lock_v2_check_err.json
@@ -0,0 +1,7 @@
+{
+ "version": "2",
+ "remote": {
+ "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/tests/testdata/run/lock_v2_check_err.out b/tests/testdata/run/lock_v2_check_err.out
new file mode 100644
index 000000000..28ad01cf4
--- /dev/null
+++ b/tests/testdata/run/lock_v2_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_v2_check_err.json
diff --git a/tests/testdata/run/lock_v2_check_err2.json b/tests/testdata/run/lock_v2_check_err2.json
new file mode 100644
index 000000000..30fbcdf4b
--- /dev/null
+++ b/tests/testdata/run/lock_v2_check_err2.json
@@ -0,0 +1,13 @@
+{
+ "version": "2",
+ "remote": {
+ "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/tests/testdata/run/lock_v2_check_err2.out b/tests/testdata/run/lock_v2_check_err2.out
new file mode 100644
index 000000000..3d82cba27
--- /dev/null
+++ b/tests/testdata/run/lock_v2_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_v2_check_err2.json
diff --git a/tests/testdata/run/lock_v2_check_ok.json b/tests/testdata/run/lock_v2_check_ok.json
new file mode 100644
index 000000000..63bec862a
--- /dev/null
+++ b/tests/testdata/run/lock_v2_check_ok.json
@@ -0,0 +1,7 @@
+{
+ "version": "2",
+ "remote": {
+ "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/tests/testdata/run/lock_v2_check_ok2.json b/tests/testdata/run/lock_v2_check_ok2.json
new file mode 100644
index 000000000..4356c9421
--- /dev/null
+++ b/tests/testdata/run/lock_v2_check_ok2.json
@@ -0,0 +1,13 @@
+{
+ "version": "2",
+ "remote": {
+ "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/tests/testdata/run/lock_v2_dynamic_imports.json b/tests/testdata/run/lock_v2_dynamic_imports.json
new file mode 100644
index 000000000..eadbee272
--- /dev/null
+++ b/tests/testdata/run/lock_v2_dynamic_imports.json
@@ -0,0 +1,9 @@
+{
+ "version": "2",
+ "remote": {
+ "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/tests/testdata/run/lock_v2_dynamic_imports.out b/tests/testdata/run/lock_v2_dynamic_imports.out
new file mode 100644
index 000000000..36c2c9b5c
--- /dev/null
+++ b/tests/testdata/run/lock_v2_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_v2_dynamic_imports.json
diff --git a/tests/testdata/run/lock_write_fetch/file_exists.ts b/tests/testdata/run/lock_write_fetch/file_exists.ts
new file mode 100644
index 000000000..20de4d4f2
--- /dev/null
+++ b/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/tests/testdata/run/lock_write_fetch/main.out b/tests/testdata/run/lock_write_fetch/main.out
new file mode 100644
index 000000000..bfdb952f9
--- /dev/null
+++ b/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/tests/testdata/run/lock_write_fetch/main.ts b/tests/testdata/run/lock_write_fetch/main.ts
new file mode 100644
index 000000000..57bc54d02
--- /dev/null
+++ b/tests/testdata/run/lock_write_fetch/main.ts
@@ -0,0 +1,52 @@
+try {
+ Deno.removeSync("./lock_write_fetch.json");
+} catch {
+ // pass
+}
+
+const fetchProc = await new Deno.Command(Deno.execPath(), {
+ stdout: "null",
+ stderr: "null",
+ args: [
+ "cache",
+ "--reload",
+ "--lock=lock_write_fetch.json",
+ "--lock-write",
+ "--cert=tls/RootCA.pem",
+ "run/https_import.ts",
+ ],
+}).output();
+
+console.log(`fetch code: ${fetchProc.code}`);
+
+const fetchCheckProc = await new Deno.Command(Deno.execPath(), {
+ stdout: "null",
+ stderr: "null",
+ args: [
+ "cache",
+ "--lock=lock_write_fetch.json",
+ "--cert=tls/RootCA.pem",
+ "run/https_import.ts",
+ ],
+}).output();
+
+console.log(`fetch check code: ${fetchCheckProc.code}`);
+
+Deno.removeSync("./lock_write_fetch.json");
+
+const runProc = await new Deno.Command(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",
+ ],
+}).output();
+
+console.log(`run code: ${runProc.code}`);
+
+Deno.removeSync("./lock_write_fetch.json");
diff --git a/tests/testdata/run/long_data_url_formatting.ts b/tests/testdata/run/long_data_url_formatting.ts
new file mode 100644
index 000000000..2ed2d5a03
--- /dev/null
+++ b/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/tests/testdata/run/long_data_url_formatting.ts.out b/tests/testdata/run/long_data_url_formatting.ts.out
new file mode 100644
index 000000000..ea78c2591
--- /dev/null
+++ b/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/tests/testdata/run/main_module/main.out b/tests/testdata/run/main_module/main.out
new file mode 100644
index 000000000..29f592c2a
--- /dev/null
+++ b/tests/testdata/run/main_module/main.out
@@ -0,0 +1,2 @@
+other [WILDCARD]/main.ts
+main [WILDCARD]/main.ts
diff --git a/tests/testdata/run/main_module/main.ts b/tests/testdata/run/main_module/main.ts
new file mode 100644
index 000000000..d2f2c66ee
--- /dev/null
+++ b/tests/testdata/run/main_module/main.ts
@@ -0,0 +1,3 @@
+console.log("main", Deno.mainModule);
+
+import "./other.ts";
diff --git a/tests/testdata/run/main_module/other.ts b/tests/testdata/run/main_module/other.ts
new file mode 100644
index 000000000..b3e524b0a
--- /dev/null
+++ b/tests/testdata/run/main_module/other.ts
@@ -0,0 +1 @@
+console.log("other", Deno.mainModule);
diff --git a/tests/testdata/run/mts_dmts_mjs.out b/tests/testdata/run/mts_dmts_mjs.out
new file mode 100644
index 000000000..789819226
--- /dev/null
+++ b/tests/testdata/run/mts_dmts_mjs.out
@@ -0,0 +1 @@
+a
diff --git a/tests/testdata/run/nested_error/main.ts b/tests/testdata/run/nested_error/main.ts
new file mode 100644
index 000000000..69828e1ca
--- /dev/null
+++ b/tests/testdata/run/nested_error/main.ts
@@ -0,0 +1,3 @@
+throw {
+ foo: new Error(),
+};
diff --git a/tests/testdata/run/nested_error/main.ts.out b/tests/testdata/run/nested_error/main.ts.out
new file mode 100644
index 000000000..05780bc6a
--- /dev/null
+++ b/tests/testdata/run/nested_error/main.ts.out
@@ -0,0 +1,4 @@
+error: Uncaught (in promise) {
+ foo: Error
+ at file:///[WILDCARD]/main.ts:2:8
+}
diff --git a/tests/testdata/run/no_check_imports_not_used_as_values/hello.ts b/tests/testdata/run/no_check_imports_not_used_as_values/hello.ts
new file mode 100644
index 000000000..1a9d8f114
--- /dev/null
+++ b/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/tests/testdata/run/no_check_imports_not_used_as_values/main.out b/tests/testdata/run/no_check_imports_not_used_as_values/main.out
new file mode 100644
index 000000000..f744c4183
--- /dev/null
+++ b/tests/testdata/run/no_check_imports_not_used_as_values/main.out
@@ -0,0 +1,2 @@
+[WILDCARD]Hello, world!
+Hi!
diff --git a/tests/testdata/run/no_check_imports_not_used_as_values/main.ts b/tests/testdata/run/no_check_imports_not_used_as_values/main.ts
new file mode 100644
index 000000000..80e17aa35
--- /dev/null
+++ b/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/tests/testdata/run/no_check_imports_not_used_as_values/preserve_imports.tsconfig.json b/tests/testdata/run/no_check_imports_not_used_as_values/preserve_imports.tsconfig.json
new file mode 100644
index 000000000..9b19291aa
--- /dev/null
+++ b/tests/testdata/run/no_check_imports_not_used_as_values/preserve_imports.tsconfig.json
@@ -0,0 +1,5 @@
+{
+ "compilerOptions": {
+ "importsNotUsedAsValues": "preserve"
+ }
+}
diff --git a/tests/testdata/run/no_check_remote.ts b/tests/testdata/run/no_check_remote.ts
new file mode 100644
index 000000000..2ae8c2692
--- /dev/null
+++ b/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/tests/testdata/run/no_check_remote.ts.disabled.out b/tests/testdata/run/no_check_remote.ts.disabled.out
new file mode 100644
index 000000000..344264634
--- /dev/null
+++ b/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/tests/testdata/run/no_check_remote.ts.enabled.out b/tests/testdata/run/no_check_remote.ts.enabled.out
new file mode 100644
index 000000000..48082f72f
--- /dev/null
+++ b/tests/testdata/run/no_check_remote.ts.enabled.out
@@ -0,0 +1 @@
+12
diff --git a/tests/testdata/run/no_lock_flag/deno.json b/tests/testdata/run/no_lock_flag/deno.json
new file mode 100644
index 000000000..90faa728a
--- /dev/null
+++ b/tests/testdata/run/no_lock_flag/deno.json
@@ -0,0 +1,3 @@
+{
+ "tasks": {}
+}
diff --git a/tests/testdata/run/no_lock_flag/deno.lock b/tests/testdata/run/no_lock_flag/deno.lock
new file mode 100644
index 000000000..059f66789
--- /dev/null
+++ b/tests/testdata/run/no_lock_flag/deno.lock
@@ -0,0 +1,7 @@
+{
+ "version": "2",
+ "remote": {
+ "http://localhost:4545/subdir/mod2.ts": "cae1d3e9f3c38cd415ff52dff854be8f3d17d35f8d7b3d285e813fb0f6393a2f",
+ "http://localhost:4545/subdir/print_hello.ts": "foobar"
+ }
+}
diff --git a/tests/testdata/run/no_lock_flag/main.out b/tests/testdata/run/no_lock_flag/main.out
new file mode 100644
index 000000000..0d8f0a237
--- /dev/null
+++ b/tests/testdata/run/no_lock_flag/main.out
@@ -0,0 +1,2 @@
+Download http://localhost:4545/subdir/mod2.ts
+Download http://localhost:4545/subdir/print_hello.ts
diff --git a/tests/testdata/run/no_lock_flag/main.ts b/tests/testdata/run/no_lock_flag/main.ts
new file mode 100644
index 000000000..baa52775d
--- /dev/null
+++ b/tests/testdata/run/no_lock_flag/main.ts
@@ -0,0 +1 @@
+import "http://localhost:4545/subdir/mod2.ts";
diff --git a/tests/testdata/run/no_mem_cache.js b/tests/testdata/run/no_mem_cache.js
new file mode 100644
index 000000000..a486732b6
--- /dev/null
+++ b/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/tests/testdata/run/no_mem_cache.js.out b/tests/testdata/run/no_mem_cache.js.out
new file mode 100644
index 000000000..a32119c8a
--- /dev/null
+++ b/tests/testdata/run/no_mem_cache.js.out
@@ -0,0 +1,2 @@
+hello
+goodbye
diff --git a/tests/testdata/run/no_prompt.ts b/tests/testdata/run/no_prompt.ts
new file mode 100644
index 000000000..17d54b92c
--- /dev/null
+++ b/tests/testdata/run/no_prompt.ts
@@ -0,0 +1,10 @@
+new Worker("data:,setTimeout(() => Deno.exit(2), 200)", { type: "module" });
+
+try {
+ await new Deno.Command("ps", {
+ stdout: "inherit",
+ stderr: "inherit",
+ }).output();
+} catch {
+ Deno.exit(0);
+}
diff --git a/tests/testdata/run/no_validate_asm.js b/tests/testdata/run/no_validate_asm.js
new file mode 100644
index 000000000..ef999e080
--- /dev/null
+++ b/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/tests/testdata/run/node_builtin_modules/mod.js b/tests/testdata/run/node_builtin_modules/mod.js
new file mode 100644
index 000000000..a01ac4422
--- /dev/null
+++ b/tests/testdata/run/node_builtin_modules/mod.js
@@ -0,0 +1,5 @@
+import { createRequire } from "node:module";
+console.log(createRequire);
+import process from "node:process";
+console.log(process.version);
+console.log(process.argv);
diff --git a/tests/testdata/run/node_builtin_modules/mod.js.out b/tests/testdata/run/node_builtin_modules/mod.js.out
new file mode 100644
index 000000000..844e3d927
--- /dev/null
+++ b/tests/testdata/run/node_builtin_modules/mod.js.out
@@ -0,0 +1,3 @@
+[Function: createRequire]
+v[WILDCARD].[WILDCARD].[WILDCARD]
+[ [Getter], [Getter], "hello", "there" ]
diff --git a/tests/testdata/run/node_builtin_modules/mod.ts b/tests/testdata/run/node_builtin_modules/mod.ts
new file mode 100644
index 000000000..a01ac4422
--- /dev/null
+++ b/tests/testdata/run/node_builtin_modules/mod.ts
@@ -0,0 +1,5 @@
+import { createRequire } from "node:module";
+console.log(createRequire);
+import process from "node:process";
+console.log(process.version);
+console.log(process.argv);
diff --git a/tests/testdata/run/node_builtin_modules/mod.ts.out b/tests/testdata/run/node_builtin_modules/mod.ts.out
new file mode 100644
index 000000000..844e3d927
--- /dev/null
+++ b/tests/testdata/run/node_builtin_modules/mod.ts.out
@@ -0,0 +1,3 @@
+[Function: createRequire]
+v[WILDCARD].[WILDCARD].[WILDCARD]
+[ [Getter], [Getter], "hello", "there" ]
diff --git a/tests/testdata/run/node_env_var_allowlist.ts b/tests/testdata/run/node_env_var_allowlist.ts
new file mode 100644
index 000000000..95da38c24
--- /dev/null
+++ b/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/tests/testdata/run/node_env_var_allowlist.ts.out b/tests/testdata/run/node_env_var_allowlist.ts.out
new file mode 100644
index 000000000..ea66a2965
--- /dev/null
+++ b/tests/testdata/run/node_env_var_allowlist.ts.out
@@ -0,0 +1,5 @@
+ok
+[WILDCARD]error: Uncaught (in promise) 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/tests/testdata/run/node_prefix_missing/config.json b/tests/testdata/run/node_prefix_missing/config.json
new file mode 100644
index 000000000..67480c3d4
--- /dev/null
+++ b/tests/testdata/run/node_prefix_missing/config.json
@@ -0,0 +1 @@
+{ "unstable": ["bare-node-builtins"] }
diff --git a/tests/testdata/run/node_prefix_missing/import_map.json b/tests/testdata/run/node_prefix_missing/import_map.json
new file mode 100644
index 000000000..3add7d009
--- /dev/null
+++ b/tests/testdata/run/node_prefix_missing/import_map.json
@@ -0,0 +1 @@
+{ "imports": {} }
diff --git a/tests/testdata/run/node_prefix_missing/main.ts b/tests/testdata/run/node_prefix_missing/main.ts
new file mode 100644
index 000000000..c5c1885a2
--- /dev/null
+++ b/tests/testdata/run/node_prefix_missing/main.ts
@@ -0,0 +1,3 @@
+import fs from "fs";
+
+console.log(fs.writeFile);
diff --git a/tests/testdata/run/node_prefix_missing/main.ts.out b/tests/testdata/run/node_prefix_missing/main.ts.out
new file mode 100644
index 000000000..fd19ed55f
--- /dev/null
+++ b/tests/testdata/run/node_prefix_missing/main.ts.out
@@ -0,0 +1,3 @@
+error: Relative import path "fs" not prefixed with / or ./ or ../
+If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs").
+ at file:///[WILDCARD]/main.ts:1:16
diff --git a/tests/testdata/run/node_prefix_missing/main.ts.out_feature_enabled b/tests/testdata/run/node_prefix_missing/main.ts.out_feature_enabled
new file mode 100644
index 000000000..513b411ce
--- /dev/null
+++ b/tests/testdata/run/node_prefix_missing/main.ts.out_feature_enabled
@@ -0,0 +1,2 @@
+[WILDCARD]Warning: Resolving "fs" as "node:fs" at file:///[WILDCARD]/tests/testdata/run/node_prefix_missing/main.ts:1:16. If you want to use a built-in Node module, add a "node:" prefix.
+[Function: writeFile]
diff --git a/tests/testdata/run/onload/imported.ts b/tests/testdata/run/onload/imported.ts
new file mode 100644
index 000000000..d2a93c8d2
--- /dev/null
+++ b/tests/testdata/run/onload/imported.ts
@@ -0,0 +1,13 @@
+// deno-lint-ignore-file no-window-prefix
+import { assert } from "../../../../test_util/std/assert/mod.ts";
+import "./nest_imported.ts";
+
+const handler = (e: Event) => {
+ assert(e.type === "beforeunload" ? e.cancelable : !e.cancelable);
+ console.log(`got ${e.type} event in event handler (imported)`);
+};
+
+window.addEventListener("load", handler);
+window.addEventListener("beforeunload", handler);
+window.addEventListener("unload", handler);
+console.log("log from imported script");
diff --git a/tests/testdata/run/onload/main.out b/tests/testdata/run/onload/main.out
new file mode 100644
index 000000000..b25d33fa8
--- /dev/null
+++ b/tests/testdata/run/onload/main.out
@@ -0,0 +1,15 @@
+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 beforeunload event in event handler (nest_imported)
+got beforeunload event in event handler (imported)
+got beforeunload event in event handler (main)
+got beforeunload event in onbeforeunload 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/tests/testdata/run/onload/main.ts b/tests/testdata/run/onload/main.ts
new file mode 100644
index 000000000..990a21131
--- /dev/null
+++ b/tests/testdata/run/onload/main.ts
@@ -0,0 +1,34 @@
+// deno-lint-ignore-file no-window-prefix no-prototype-builtins
+import { assert } from "../../../../test_util/std/assert/mod.ts";
+import "./imported.ts";
+
+assert(window.hasOwnProperty("onload"));
+assert(window.onload === null);
+
+const eventHandler = (e: Event) => {
+ assert(e.type === "beforeunload" ? e.cancelable : !e.cancelable);
+ console.log(`got ${e.type} event in event handler (main)`);
+};
+
+window.addEventListener("load", eventHandler);
+
+window.addEventListener("beforeunload", eventHandler);
+
+window.addEventListener("unload", eventHandler);
+
+window.onload = (e: Event) => {
+ assert(!e.cancelable);
+ console.log(`got ${e.type} event in onload function`);
+};
+
+window.onbeforeunload = (e: BeforeUnloadEvent) => {
+ assert(e.cancelable);
+ console.log(`got ${e.type} event in onbeforeunload 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/tests/testdata/run/onload/nest_imported.ts b/tests/testdata/run/onload/nest_imported.ts
new file mode 100644
index 000000000..2151f4185
--- /dev/null
+++ b/tests/testdata/run/onload/nest_imported.ts
@@ -0,0 +1,12 @@
+// deno-lint-ignore-file no-window-prefix
+import { assert } from "../../../../test_util/std/assert/mod.ts";
+
+const handler = (e: Event) => {
+ assert(e.type === "beforeunload" ? e.cancelable : !e.cancelable);
+ console.log(`got ${e.type} event in event handler (nest_imported)`);
+};
+
+window.addEventListener("load", handler);
+window.addEventListener("beforeunload", handler);
+window.addEventListener("unload", handler);
+console.log("log from nest_imported script");
diff --git a/tests/testdata/run/op_exit_op_set_exit_code_in_worker.ts b/tests/testdata/run/op_exit_op_set_exit_code_in_worker.ts
new file mode 100644
index 000000000..b6a776439
--- /dev/null
+++ b/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[Deno.internal].core doesn't have type-defs
+Deno[Deno.internal].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/tests/testdata/run/op_exit_op_set_exit_code_worker.js b/tests/testdata/run/op_exit_op_set_exit_code_worker.js
new file mode 100644
index 000000000..9b284c37d
--- /dev/null
+++ b/tests/testdata/run/op_exit_op_set_exit_code_worker.js
@@ -0,0 +1,4 @@
+self.onmessage = () => {
+ Deno[Deno.internal].core.ops.op_set_exit_code(42);
+ Deno.exit();
+};
diff --git a/tests/testdata/run/permission_args.out b/tests/testdata/run/permission_args.out
new file mode 100644
index 000000000..6a1e1787c
--- /dev/null
+++ b/tests/testdata/run/permission_args.out
@@ -0,0 +1,4 @@
+Permission flags have likely been incorrectly set after the script argument.
+To grant permissions, set them before the script argument. For example:
+ deno run --allow-read=. main.js
+Hello World
diff --git a/tests/testdata/run/permission_request_long.ts b/tests/testdata/run/permission_request_long.ts
new file mode 100644
index 000000000..05937e95a
--- /dev/null
+++ b/tests/testdata/run/permission_request_long.ts
@@ -0,0 +1 @@
+Deno.open("a".repeat(1e5));
diff --git a/tests/testdata/run/permission_test.ts b/tests/testdata/run/permission_test.ts
new file mode 100644
index 000000000..a2312e3ac
--- /dev/null
+++ b/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<void> } = {
+ 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 new Deno.Command(Deno.build.os === "windows" ? "cmd.exe" : "printf", {
+ args: Deno.build.os === "windows" ? ["/c", "echo hello"] : ["hello"],
+ }).output();
+ },
+};
+
+if (!test[name]) {
+ console.log("Unknown test:", name);
+ Deno.exit(1);
+}
+
+test[name]();
diff --git a/tests/testdata/run/permissions_cache.ts b/tests/testdata/run/permissions_cache.ts
new file mode 100644
index 000000000..c77ee0f36
--- /dev/null
+++ b/tests/testdata/run/permissions_cache.ts
@@ -0,0 +1,5 @@
+const status = await Deno.permissions.query({ name: "read", path: "foo" });
+console.log(status.state);
+status.onchange = () => console.log(status.state);
+await Deno.permissions.request({ name: "read", path: "foo" }); // y
+await Deno.permissions.revoke({ name: "read", path: "foo" });
diff --git a/tests/testdata/run/permissions_prompt_allow_all.ts b/tests/testdata/run/permissions_prompt_allow_all.ts
new file mode 100644
index 000000000..8aa7d040e
--- /dev/null
+++ b/tests/testdata/run/permissions_prompt_allow_all.ts
@@ -0,0 +1,20 @@
+Deno.permissions.requestSync({ name: "run", command: "FOO" });
+Deno.permissions.requestSync({ name: "run", command: "BAR" });
+
+Deno.permissions.requestSync({ name: "read", path: "FOO" });
+Deno.permissions.requestSync({ name: "read", path: "BAR" });
+
+Deno.permissions.requestSync({ name: "write", path: "FOO" });
+Deno.permissions.requestSync({ name: "write", path: "BAR" });
+
+Deno.permissions.requestSync({ name: "net", host: "FOO" });
+Deno.permissions.requestSync({ name: "net", host: "BAR" });
+
+Deno.permissions.requestSync({ name: "env", variable: "FOO" });
+Deno.permissions.requestSync({ name: "env", variable: "BAR" });
+
+Deno.permissions.requestSync({ name: "sys", kind: "loadavg" });
+Deno.permissions.requestSync({ name: "sys", kind: "hostname" });
+
+Deno.permissions.requestSync({ name: "ffi", path: "FOO" });
+Deno.permissions.requestSync({ name: "ffi", path: "BAR" });
diff --git a/tests/testdata/run/permissions_prompt_allow_all_2.ts b/tests/testdata/run/permissions_prompt_allow_all_2.ts
new file mode 100644
index 000000000..f42b35753
--- /dev/null
+++ b/tests/testdata/run/permissions_prompt_allow_all_2.ts
@@ -0,0 +1,8 @@
+Deno.env.get("FOO");
+Deno.env.get("BAR");
+
+Deno.loadavg();
+Deno.hostname();
+
+Deno.cwd();
+Deno.lstatSync(new URL("../", import.meta.url));
diff --git a/tests/testdata/run/private_field_presence.ts b/tests/testdata/run/private_field_presence.ts
new file mode 100644
index 000000000..7ce2840d8
--- /dev/null
+++ b/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/tests/testdata/run/private_field_presence.ts.out b/tests/testdata/run/private_field_presence.ts.out
new file mode 100644
index 000000000..1d474d525
--- /dev/null
+++ b/tests/testdata/run/private_field_presence.ts.out
@@ -0,0 +1,2 @@
+false
+true
diff --git a/tests/testdata/run/proto_exploit.js b/tests/testdata/run/proto_exploit.js
new file mode 100644
index 000000000..8bd22cfe5
--- /dev/null
+++ b/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/tests/testdata/run/proto_exploit.js.out b/tests/testdata/run/proto_exploit.js.out
new file mode 100644
index 000000000..fde881dc5
--- /dev/null
+++ b/tests/testdata/run/proto_exploit.js.out
@@ -0,0 +1,2 @@
+Before: [object Object]
+After: [object Object]
diff --git a/tests/testdata/run/queue_microtask_error.ts b/tests/testdata/run/queue_microtask_error.ts
new file mode 100644
index 000000000..b2e9642c5
--- /dev/null
+++ b/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/tests/testdata/run/queue_microtask_error.ts.out b/tests/testdata/run/queue_microtask_error.ts.out
new file mode 100644
index 000000000..a8ce13170
--- /dev/null
+++ b/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 ext:core/[WILDCARD]
diff --git a/tests/testdata/run/queue_microtask_error_handled.ts b/tests/testdata/run/queue_microtask_error_handled.ts
new file mode 100644
index 000000000..47ea2d32e
--- /dev/null
+++ b/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?.slice?.(-100),
+ 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/tests/testdata/run/queue_microtask_error_handled.ts.out b/tests/testdata/run/queue_microtask_error_handled.ts.out
new file mode 100644
index 000000000..bdc8eafa1
--- /dev/null
+++ b/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 ext:core/[WILDCARD]
+}
+onerror() called Error: foo
+ at [WILDCARD]/queue_microtask_error_handled.ts:18:9
+ at ext:core/[WILDCARD]
+2
diff --git a/tests/testdata/run/reference_types.ts b/tests/testdata/run/reference_types.ts
new file mode 100644
index 000000000..105e23b37
--- /dev/null
+++ b/tests/testdata/run/reference_types.ts
@@ -0,0 +1,3 @@
+/// <reference types="./subdir/types.d.ts" />
+
+console.log(globalThis.a);
diff --git a/tests/testdata/run/reference_types.ts.out b/tests/testdata/run/reference_types.ts.out
new file mode 100644
index 000000000..417b7b537
--- /dev/null
+++ b/tests/testdata/run/reference_types.ts.out
@@ -0,0 +1 @@
+undefined
diff --git a/tests/testdata/run/reference_types_error.js b/tests/testdata/run/reference_types_error.js
new file mode 100644
index 000000000..68b6c2136
--- /dev/null
+++ b/tests/testdata/run/reference_types_error.js
@@ -0,0 +1,2 @@
+/// <reference types="./nonexistent.d.ts" />
+export const a = 1;
diff --git a/tests/testdata/run/reference_types_error.js.out b/tests/testdata/run/reference_types_error.js.out
new file mode 100644
index 000000000..86055f3ac
--- /dev/null
+++ b/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:22
diff --git a/tests/testdata/run/reference_types_remote.ts b/tests/testdata/run/reference_types_remote.ts
new file mode 100644
index 000000000..e7fa81b2c
--- /dev/null
+++ b/tests/testdata/run/reference_types_remote.ts
@@ -0,0 +1,3 @@
+/// <reference types="http://localhost:4545/subdir/types.d.ts" />
+
+console.log(globalThis.a);
diff --git a/tests/testdata/run/reference_types_remote.ts.out b/tests/testdata/run/reference_types_remote.ts.out
new file mode 100644
index 000000000..417b7b537
--- /dev/null
+++ b/tests/testdata/run/reference_types_remote.ts.out
@@ -0,0 +1 @@
+undefined
diff --git a/tests/testdata/run/rejection_handled.out b/tests/testdata/run/rejection_handled.out
new file mode 100644
index 000000000..5c06fcd2b
--- /dev/null
+++ b/tests/testdata/run/rejection_handled.out
@@ -0,0 +1,5 @@
+[WILDCARD]
+unhandledrejection 1 Promise { <rejected> 1 }
+Added catch handler to the promise
+rejectionhandled 1 Promise { <rejected> 1 }
+Success
diff --git a/tests/testdata/run/rejection_handled.ts b/tests/testdata/run/rejection_handled.ts
new file mode 100644
index 000000000..f058ff966
--- /dev/null
+++ b/tests/testdata/run/rejection_handled.ts
@@ -0,0 +1,17 @@
+window.addEventListener("unhandledrejection", (event) => {
+ console.log("unhandledrejection", event.reason, event.promise);
+ event.preventDefault();
+});
+
+window.addEventListener("rejectionhandled", (event) => {
+ console.log("rejectionhandled", event.reason, event.promise);
+});
+
+const a = Promise.reject(1);
+setTimeout(async () => {
+ a.catch(() => console.log("Added catch handler to the promise"));
+}, 10);
+
+setTimeout(() => {
+ console.log("Success");
+}, 50);
diff --git a/tests/testdata/run/remote_type_error/main.ts b/tests/testdata/run/remote_type_error/main.ts
new file mode 100644
index 000000000..00f8a52df
--- /dev/null
+++ b/tests/testdata/run/remote_type_error/main.ts
@@ -0,0 +1,3 @@
+import { doAction } from "http://localhost:4545/run/remote_type_error/remote.ts";
+
+doAction();
diff --git a/tests/testdata/run/remote_type_error/remote.ts b/tests/testdata/run/remote_type_error/remote.ts
new file mode 100644
index 000000000..6e9bf4adb
--- /dev/null
+++ b/tests/testdata/run/remote_type_error/remote.ts
@@ -0,0 +1,5 @@
+export function doAction() {
+ // this is an intentional type error
+ const val: number = "test";
+ console.log(val);
+}
diff --git a/tests/testdata/run/replace_self.js b/tests/testdata/run/replace_self.js
new file mode 100644
index 000000000..cfd473cd3
--- /dev/null
+++ b/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/tests/testdata/run/replace_self.js.out b/tests/testdata/run/replace_self.js.out
new file mode 100644
index 000000000..aaffb5a62
--- /dev/null
+++ b/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/tests/testdata/run/report_error.ts b/tests/testdata/run/report_error.ts
new file mode 100644
index 000000000..a6d4af1fd
--- /dev/null
+++ b/tests/testdata/run/report_error.ts
@@ -0,0 +1,3 @@
+console.log(1);
+reportError(new Error("foo"));
+console.log(2);
diff --git a/tests/testdata/run/report_error.ts.out b/tests/testdata/run/report_error.ts.out
new file mode 100644
index 000000000..185db62a5
--- /dev/null
+++ b/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/tests/testdata/run/report_error_end_of_program.ts b/tests/testdata/run/report_error_end_of_program.ts
new file mode 100644
index 000000000..cd7ce7f9c
--- /dev/null
+++ b/tests/testdata/run/report_error_end_of_program.ts
@@ -0,0 +1 @@
+reportError(new Error("foo"));
diff --git a/tests/testdata/run/report_error_end_of_program.ts.out b/tests/testdata/run/report_error_end_of_program.ts.out
new file mode 100644
index 000000000..ecca63389
--- /dev/null
+++ b/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/tests/testdata/run/report_error_handled.ts b/tests/testdata/run/report_error_handled.ts
new file mode 100644
index 000000000..d18996c13
--- /dev/null
+++ b/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?.slice?.(-100),
+ 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/tests/testdata/run/report_error_handled.ts.out b/tests/testdata/run/report_error_handled.ts.out
new file mode 100644
index 000000000..89fa30314
--- /dev/null
+++ b/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/tests/testdata/run/resolve_dns.ts b/tests/testdata/run/resolve_dns.ts
new file mode 100644
index 000000000..a2d0fd046
--- /dev/null
+++ b/tests/testdata/run/resolve_dns.ts
@@ -0,0 +1,93 @@
+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`,
+ );
+}
+
+try {
+ // @ts-ignore testing invalid overloads
+ await Deno.resolveDns("example.com", "SSHFP", nameServer);
+} catch (e) {
+ console.log(e.message);
+}
+
+try {
+ const ac = new AbortController();
+ queueMicrotask(() => ac.abort());
+ await Deno.resolveDns("www.example.com", "A", {
+ ...nameServer,
+ signal: ac.signal,
+ });
+} catch (e) {
+ console.log(e.name);
+}
+
+try {
+ const ac = new AbortController();
+ ac.abort();
+ await Deno.resolveDns("www.example.com", "A", {
+ ...nameServer,
+ signal: ac.signal,
+ });
+} catch (e) {
+ console.log(e.name);
+}
diff --git a/tests/testdata/run/resolve_dns.ts.out b/tests/testdata/run/resolve_dns.ts.out
new file mode 100644
index 000000000..025028395
--- /dev/null
+++ b/tests/testdata/run/resolve_dns.ts.out
@@ -0,0 +1,28 @@
+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
+Provided record type is not supported
+AbortError
+AbortError
diff --git a/tests/testdata/run/resolve_dns.zone.in b/tests/testdata/run/resolve_dns.zone.in
new file mode 100644
index 000000000..94d5b9fc3
--- /dev/null
+++ b/tests/testdata/run/resolve_dns.zone.in
@@ -0,0 +1,32 @@
+@ 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.
+@ IN SSHFP 1 1 436C6F7564666C
diff --git a/tests/testdata/run/runtime_decorators.ts b/tests/testdata/run/runtime_decorators.ts
new file mode 100644
index 000000000..40a26bbd4
--- /dev/null
+++ b/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/tests/testdata/run/runtime_decorators.ts.out b/tests/testdata/run/runtime_decorators.ts.out
new file mode 100644
index 000000000..0fc1d4590
--- /dev/null
+++ b/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/tests/testdata/run/seed_random.js b/tests/testdata/run/seed_random.js
new file mode 100644
index 000000000..7f6e336df
--- /dev/null
+++ b/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/tests/testdata/run/seed_random.js.out b/tests/testdata/run/seed_random.js.out
new file mode 100644
index 000000000..4d1ebd081
--- /dev/null
+++ b/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/tests/testdata/run/set_exit_code_0.ts b/tests/testdata/run/set_exit_code_0.ts
new file mode 100644
index 000000000..8a0103c8f
--- /dev/null
+++ b/tests/testdata/run/set_exit_code_0.ts
@@ -0,0 +1,2 @@
+Deno[Deno.internal].core.ops.op_set_exit_code(42);
+Deno.exit(0); // Takes precedence.
diff --git a/tests/testdata/run/set_exit_code_1.ts b/tests/testdata/run/set_exit_code_1.ts
new file mode 100644
index 000000000..45027ccf7
--- /dev/null
+++ b/tests/testdata/run/set_exit_code_1.ts
@@ -0,0 +1,2 @@
+Deno[Deno.internal].core.ops.op_set_exit_code(42);
+Deno.exit();
diff --git a/tests/testdata/run/set_exit_code_2.ts b/tests/testdata/run/set_exit_code_2.ts
new file mode 100644
index 000000000..48469c17d
--- /dev/null
+++ b/tests/testdata/run/set_exit_code_2.ts
@@ -0,0 +1,2 @@
+Deno[Deno.internal].core.ops.op_set_exit_code(42);
+// Exits naturally.
diff --git a/tests/testdata/run/set_timeout_error.ts b/tests/testdata/run/set_timeout_error.ts
new file mode 100644
index 000000000..2864574e7
--- /dev/null
+++ b/tests/testdata/run/set_timeout_error.ts
@@ -0,0 +1,3 @@
+setTimeout(() => {
+ throw new Error("foo");
+}, 0);
diff --git a/tests/testdata/run/set_timeout_error.ts.out b/tests/testdata/run/set_timeout_error.ts.out
new file mode 100644
index 000000000..9db053f6c
--- /dev/null
+++ b/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/tests/testdata/run/set_timeout_error_handled.ts b/tests/testdata/run/set_timeout_error_handled.ts
new file mode 100644
index 000000000..aee2d97d2
--- /dev/null
+++ b/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/tests/testdata/run/set_timeout_error_handled.ts.out b/tests/testdata/run/set_timeout_error_handled.ts.out
new file mode 100644
index 000000000..054dd9b6b
--- /dev/null
+++ b/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/tests/testdata/run/shebang.ts b/tests/testdata/run/shebang.ts
new file mode 100644
index 000000000..00feb2da0
--- /dev/null
+++ b/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/tests/testdata/run/shebang.ts.out b/tests/testdata/run/shebang.ts.out
new file mode 100644
index 000000000..d81cc0710
--- /dev/null
+++ b/tests/testdata/run/shebang.ts.out
@@ -0,0 +1 @@
+42
diff --git a/tests/testdata/run/shebang2.ts b/tests/testdata/run/shebang2.ts
new file mode 100644
index 000000000..da0d7bf0c
--- /dev/null
+++ b/tests/testdata/run/shebang2.ts
@@ -0,0 +1,3 @@
+#!/usr/bin/env -S deno run
+
+export default 42;
diff --git a/tests/testdata/run/single_compile_with_reload.ts b/tests/testdata/run/single_compile_with_reload.ts
new file mode 100644
index 000000000..9478ad523
--- /dev/null
+++ b/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/tests/testdata/run/single_compile_with_reload.ts.out b/tests/testdata/run/single_compile_with_reload.ts.out
new file mode 100644
index 000000000..a3986e3af
--- /dev/null
+++ b/tests/testdata/run/single_compile_with_reload.ts.out
@@ -0,0 +1,7 @@
+Hello
+1
+2
+Hello from worker
+3
+Hello from worker
+4
diff --git a/tests/testdata/run/single_compile_with_reload_dyn.ts b/tests/testdata/run/single_compile_with_reload_dyn.ts
new file mode 100644
index 000000000..6c96fac64
--- /dev/null
+++ b/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/tests/testdata/run/single_compile_with_reload_worker.ts b/tests/testdata/run/single_compile_with_reload_worker.ts
new file mode 100644
index 000000000..103cafe20
--- /dev/null
+++ b/tests/testdata/run/single_compile_with_reload_worker.ts
@@ -0,0 +1,3 @@
+console.log("Hello from worker");
+postMessage(null);
+close();
diff --git a/tests/testdata/run/spawn_stdout_inherit.ts b/tests/testdata/run/spawn_stdout_inherit.ts
new file mode 100644
index 000000000..04f635cea
--- /dev/null
+++ b/tests/testdata/run/spawn_stdout_inherit.ts
@@ -0,0 +1,8 @@
+await new Deno.Command(Deno.execPath(), {
+ args: ["eval", "--quiet", "console.log('Hello, world! 1')"],
+ stdout: "inherit",
+}).output();
+new Deno.Command(Deno.execPath(), {
+ args: ["eval", "--quiet", "console.log('Hello, world! 2')"],
+ stdout: "inherit",
+}).outputSync();
diff --git a/tests/testdata/run/spawn_stdout_inherit.ts.out b/tests/testdata/run/spawn_stdout_inherit.ts.out
new file mode 100644
index 000000000..474891cf2
--- /dev/null
+++ b/tests/testdata/run/spawn_stdout_inherit.ts.out
@@ -0,0 +1,2 @@
+Hello, world! 1
+Hello, world! 2
diff --git a/tests/testdata/run/stdin_read_all.out b/tests/testdata/run/stdin_read_all.out
new file mode 100644
index 000000000..2f0dfb71a
--- /dev/null
+++ b/tests/testdata/run/stdin_read_all.out
@@ -0,0 +1 @@
+01234567890123456789012345678901234567890123456789
diff --git a/tests/testdata/run/stdin_read_all.ts b/tests/testdata/run/stdin_read_all.ts
new file mode 100644
index 000000000..d683a2bf6
--- /dev/null
+++ b/tests/testdata/run/stdin_read_all.ts
@@ -0,0 +1,17 @@
+const encoder = new TextEncoder();
+
+const pending = [];
+
+// do this a bunch of times to ensure it doesn't race
+// and everything happens in order
+for (let i = 0; i < 50; i++) {
+ const buf = new Uint8Array(1);
+ pending.push(
+ Deno.stdin.read(buf).then(() => {
+ return Deno.stdout.write(buf);
+ }),
+ );
+}
+
+await Promise.all(pending);
+await Deno.stdout.write(encoder.encode("\n"));
diff --git a/tests/testdata/run/stdio_streams_are_locked_in_permission_prompt/worker.js b/tests/testdata/run/stdio_streams_are_locked_in_permission_prompt/worker.js
new file mode 100644
index 000000000..287027c83
--- /dev/null
+++ b/tests/testdata/run/stdio_streams_are_locked_in_permission_prompt/worker.js
@@ -0,0 +1,3 @@
+setTimeout(() => {
+ console.log("Are you sure you want to continue?");
+}, 10); // ensure we don't output too quickly before the permission prompt
diff --git a/tests/testdata/run/stdout_write_all.out b/tests/testdata/run/stdout_write_all.out
new file mode 100644
index 000000000..d0e667fd4
--- /dev/null
+++ b/tests/testdata/run/stdout_write_all.out
@@ -0,0 +1,100 @@
+Hello, world! 0
+Hello, world! 1
+Hello, world! 2
+Hello, world! 3
+Hello, world! 4
+Hello, world! 5
+Hello, world! 6
+Hello, world! 7
+Hello, world! 8
+Hello, world! 9
+Hello, world! 10
+Hello, world! 11
+Hello, world! 12
+Hello, world! 13
+Hello, world! 14
+Hello, world! 15
+Hello, world! 16
+Hello, world! 17
+Hello, world! 18
+Hello, world! 19
+Hello, world! 20
+Hello, world! 21
+Hello, world! 22
+Hello, world! 23
+Hello, world! 24
+Hello, world! 25
+Hello, world! 26
+Hello, world! 27
+Hello, world! 28
+Hello, world! 29
+Hello, world! 30
+Hello, world! 31
+Hello, world! 32
+Hello, world! 33
+Hello, world! 34
+Hello, world! 35
+Hello, world! 36
+Hello, world! 37
+Hello, world! 38
+Hello, world! 39
+Hello, world! 40
+Hello, world! 41
+Hello, world! 42
+Hello, world! 43
+Hello, world! 44
+Hello, world! 45
+Hello, world! 46
+Hello, world! 47
+Hello, world! 48
+Hello, world! 49
+Hello, world! 50
+Hello, world! 51
+Hello, world! 52
+Hello, world! 53
+Hello, world! 54
+Hello, world! 55
+Hello, world! 56
+Hello, world! 57
+Hello, world! 58
+Hello, world! 59
+Hello, world! 60
+Hello, world! 61
+Hello, world! 62
+Hello, world! 63
+Hello, world! 64
+Hello, world! 65
+Hello, world! 66
+Hello, world! 67
+Hello, world! 68
+Hello, world! 69
+Hello, world! 70
+Hello, world! 71
+Hello, world! 72
+Hello, world! 73
+Hello, world! 74
+Hello, world! 75
+Hello, world! 76
+Hello, world! 77
+Hello, world! 78
+Hello, world! 79
+Hello, world! 80
+Hello, world! 81
+Hello, world! 82
+Hello, world! 83
+Hello, world! 84
+Hello, world! 85
+Hello, world! 86
+Hello, world! 87
+Hello, world! 88
+Hello, world! 89
+Hello, world! 90
+Hello, world! 91
+Hello, world! 92
+Hello, world! 93
+Hello, world! 94
+Hello, world! 95
+Hello, world! 96
+Hello, world! 97
+Hello, world! 98
+Hello, world! 99
diff --git a/tests/testdata/run/stdout_write_all.ts b/tests/testdata/run/stdout_write_all.ts
new file mode 100644
index 000000000..cfb2981e4
--- /dev/null
+++ b/tests/testdata/run/stdout_write_all.ts
@@ -0,0 +1,13 @@
+const encoder = new TextEncoder();
+
+const pending = [];
+
+// do this a bunch of times to ensure it doesn't race
+// and everything happens in order
+for (let i = 0; i < 100; i++) {
+ pending.push(Deno.stdout.write(encoder.encode("Hello, ")));
+ pending.push(Deno.stdout.write(encoder.encode(`world! ${i}`)));
+ pending.push(Deno.stdout.write(encoder.encode("\n")));
+}
+
+await Promise.all(pending);
diff --git a/tests/testdata/run/stdout_write_sync_async.out b/tests/testdata/run/stdout_write_sync_async.out
new file mode 100644
index 000000000..91ebda1ca
--- /dev/null
+++ b/tests/testdata/run/stdout_write_sync_async.out
@@ -0,0 +1,200 @@
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello
diff --git a/tests/testdata/run/stdout_write_sync_async.ts b/tests/testdata/run/stdout_write_sync_async.ts
new file mode 100644
index 000000000..648999d8a
--- /dev/null
+++ b/tests/testdata/run/stdout_write_sync_async.ts
@@ -0,0 +1,14 @@
+const encoder = new TextEncoder();
+const pending = [];
+
+for (let i = 0; i < 100; i++) {
+ // some code that will cause stdout to be written
+ // synchronously while the async write might be occurring
+ console.log("Hello");
+ pending.push(Deno.stdout.write(encoder.encode("Hello\n")));
+ if (i % 10) {
+ await new Promise((resolve) => setTimeout(resolve, 0));
+ }
+}
+
+await Promise.all(pending);
diff --git a/tests/testdata/run/swc_syntax_error.ts b/tests/testdata/run/swc_syntax_error.ts
new file mode 100644
index 000000000..991ca9214
--- /dev/null
+++ b/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/tests/testdata/run/swc_syntax_error.ts.out b/tests/testdata/run/swc_syntax_error.ts.out
new file mode 100644
index 000000000..81b0c1949
--- /dev/null
+++ b/tests/testdata/run/swc_syntax_error.ts.out
@@ -0,0 +1,4 @@
+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/tests/testdata/run/test_and_bench_in_run.js b/tests/testdata/run/test_and_bench_in_run.js
new file mode 100644
index 000000000..108ae937a
--- /dev/null
+++ b/tests/testdata/run/test_and_bench_in_run.js
@@ -0,0 +1,5 @@
+Deno.test(function foo() {
+});
+
+Deno.bench(function bar() {
+});
diff --git a/tests/testdata/run/textproto.ts b/tests/testdata/run/textproto.ts
new file mode 100644
index 000000000..cf9a4dce9
--- /dev/null
+++ b/tests/testdata/run/textproto.ts
@@ -0,0 +1,173 @@
+// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/** **Deprecated**. Use `TextLineStream` from `std/steams` for line-by-line text reading instead.
+ *
+ * A reader for dealing with low level text based protocols.
+ *
+ * Based on
+ * [net/textproto](https://github.com/golang/go/tree/master/src/net/textproto).
+ *
+ * @deprecated (will be removed after 0.159.0) Use `TextLineStream` from `std/steams` for line-by-line text reading instead.
+ * @module
+ */
+
+import type {
+ BufReader,
+ ReadLineResult,
+} from "../../../test_util/std/io/buf_reader.ts";
+import { concat } from "../../../test_util/std/bytes/concat.ts";
+
+// Constants created for DRY
+const CHAR_SPACE: number = " ".charCodeAt(0);
+const CHAR_TAB: number = "\t".charCodeAt(0);
+const CHAR_COLON: number = ":".charCodeAt(0);
+
+const WHITESPACES: Array<number> = [CHAR_SPACE, CHAR_TAB];
+
+const decoder = new TextDecoder();
+
+// FROM https://github.com/denoland/deno/blob/b34628a26ab0187a827aa4ebe256e23178e25d39/cli/js/web/headers.ts#L9
+const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/g;
+
+function str(buf: Uint8Array | null | undefined): string {
+ return !buf ? "" : decoder.decode(buf);
+}
+
+/**
+ * @deprecated (will be removed after 0.159.0) Use `TextLineStream` from `std/steams` for line-by-line text reading instead.
+ */
+export class TextProtoReader {
+ constructor(readonly r: BufReader) {}
+
+ /** readLine() reads a single line from the TextProtoReader,
+ * eliding the final \n or \r\n from the returned string.
+ */
+ async readLine(): Promise<string | null> {
+ const s = await this.readLineSlice();
+ return s === null ? null : str(s);
+ }
+
+ /** ReadMimeHeader reads a MIME-style header from r.
+ * The header is a sequence of possibly continued Key: Value lines
+ * ending in a blank line.
+ * The returned map m maps CanonicalMIMEHeaderKey(key) to a
+ * sequence of values in the same order encountered in the input.
+ *
+ * For example, consider this input:
+ *
+ * My-Key: Value 1
+ * Long-Key: Even
+ * Longer Value
+ * My-Key: Value 2
+ *
+ * Given that input, ReadMIMEHeader returns the map:
+ *
+ * map[string][]string{
+ * "My-Key": {"Value 1", "Value 2"},
+ * "Long-Key": {"Even Longer Value"},
+ * }
+ */
+ async readMimeHeader(): Promise<Headers | null> {
+ const m = new Headers();
+ let line: Uint8Array | undefined;
+
+ // The first line cannot start with a leading space.
+ let buf = await this.r.peek(1);
+ if (buf === null) {
+ return null;
+ } else if (WHITESPACES.includes(buf[0])) {
+ line = (await this.readLineSlice()) as Uint8Array;
+ }
+
+ buf = await this.r.peek(1);
+ if (buf === null) {
+ throw new Deno.errors.UnexpectedEof();
+ } else if (WHITESPACES.includes(buf[0])) {
+ throw new Deno.errors.InvalidData(
+ `malformed MIME header initial line: ${str(line)}`,
+ );
+ }
+
+ while (true) {
+ const kv = await this.readLineSlice(); // readContinuedLineSlice
+ if (kv === null) throw new Deno.errors.UnexpectedEof();
+ if (kv.byteLength === 0) return m;
+
+ // Key ends at first colon
+ let i = kv.indexOf(CHAR_COLON);
+ if (i < 0) {
+ throw new Deno.errors.InvalidData(
+ `malformed MIME header line: ${str(kv)}`,
+ );
+ }
+
+ //let key = canonicalMIMEHeaderKey(kv.subarray(0, endKey));
+ const key = str(kv.subarray(0, i));
+
+ // As per RFC 7230 field-name is a token,
+ // tokens consist of one or more chars.
+ // We could throw `Deno.errors.InvalidData` here,
+ // but better to be liberal in what we
+ // accept, so if we get an empty key, skip it.
+ if (key == "") {
+ continue;
+ }
+
+ // Skip initial spaces in value.
+ i++; // skip colon
+ while (
+ i < kv.byteLength &&
+ (WHITESPACES.includes(kv[i]))
+ ) {
+ i++;
+ }
+ const value = str(kv.subarray(i)).replace(
+ invalidHeaderCharRegex,
+ encodeURI,
+ );
+
+ // In case of invalid header we swallow the error
+ // example: "Audio Mode" => invalid due to space in the key
+ try {
+ m.append(key, value);
+ } catch {
+ // Pass
+ }
+ }
+ }
+
+ async readLineSlice(): Promise<Uint8Array | null> {
+ let line = new Uint8Array(0);
+ let r: ReadLineResult | null = null;
+
+ do {
+ r = await this.r.readLine();
+ // TODO(ry):
+ // This skipSpace() is definitely misplaced, but I don't know where it
+ // comes from nor how to fix it.
+
+ //TODO(SmashingQuasar): Kept skipSpace to preserve behavior but it should be looked into to check if it makes sense when this is used.
+
+ if (r !== null && this.skipSpace(r.line) !== 0) {
+ line = concat(line, r.line);
+ }
+ } while (r !== null && r.more);
+
+ return r === null ? null : line;
+ }
+
+ skipSpace(l: Uint8Array): number {
+ let n = 0;
+
+ for (const val of l) {
+ if (!WHITESPACES.includes(val)) {
+ n++;
+ }
+ }
+
+ return n;
+ }
+}
diff --git a/tests/testdata/run/tls.out b/tests/testdata/run/tls.out
new file mode 100644
index 000000000..c8e8a135c
--- /dev/null
+++ b/tests/testdata/run/tls.out
@@ -0,0 +1 @@
+DONE
diff --git a/tests/testdata/run/tls_connecttls.js b/tests/testdata/run/tls_connecttls.js
new file mode 100644
index 000000000..f085d7a8f
--- /dev/null
+++ b/tests/testdata/run/tls_connecttls.js
@@ -0,0 +1,66 @@
+import { assert, assertEquals } from "../../../test_util/std/assert/mod.ts";
+import { BufReader, BufWriter } from "../../../test_util/std/io/mod.ts";
+import { TextProtoReader } from "./textproto.ts";
+
+const encoder = new TextEncoder();
+const decoder = new TextDecoder();
+
+const { promise, resolve } = Promise.withResolvers();
+const hostname = "localhost";
+const port = 3505;
+
+const listener = Deno.listenTls({
+ hostname,
+ port,
+ cert: Deno.readTextFileSync("./tls/localhost.crt"),
+ key: Deno.readTextFileSync("./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();
+ 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 promise;
+
+console.log("DONE");
diff --git a/tests/testdata/run/tls_starttls.js b/tests/testdata/run/tls_starttls.js
new file mode 100644
index 000000000..5f5428ecd
--- /dev/null
+++ b/tests/testdata/run/tls_starttls.js
@@ -0,0 +1,65 @@
+import { assert, assertEquals } from "../../../test_util/std/assert/mod.ts";
+import { BufReader } from "../../../test_util/std/io/buf_reader.ts";
+import { BufWriter } from "../../../test_util/std/io/buf_writer.ts";
+import { TextProtoReader } from "./textproto.ts";
+
+const encoder = new TextEncoder();
+const decoder = new TextDecoder();
+
+const { promise, resolve } = Promise.withResolvers();
+const hostname = "localhost";
+const port = 3504;
+
+const listener = Deno.listenTls({
+ hostname,
+ port,
+ cert: Deno.readTextFileSync("./tls/localhost.crt"),
+ key: Deno.readTextFileSync("./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();
+ 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 promise;
+
+console.log("DONE");
diff --git a/tests/testdata/run/top_level_await/circular.js b/tests/testdata/run/top_level_await/circular.js
new file mode 100644
index 000000000..ff2964b6a
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/circular.out b/tests/testdata/run/top_level_await/circular.out
new file mode 100644
index 000000000..c88978961
--- /dev/null
+++ b/tests/testdata/run/top_level_await/circular.out
@@ -0,0 +1,10 @@
+timeout loop 0
+timeout loop 1
+timeout loop 2
+timeout loop 3
+timeout loop 4
+timeout loop 5
+error: Top-level await promise never resolved
+const mod = await import("./tla3/b.js");
+ ^
+ at <anonymous> ([WILDCARD]/top_level_await/circular.js:5:13)
diff --git a/tests/testdata/run/top_level_await/loop.js b/tests/testdata/run/top_level_await/loop.js
new file mode 100644
index 000000000..415db5ec7
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/loop.out b/tests/testdata/run/top_level_await/loop.out
new file mode 100644
index 000000000..1bdffbf66
--- /dev/null
+++ b/tests/testdata/run/top_level_await/loop.out
@@ -0,0 +1,5 @@
+loading [WILDCARD]a.js
+loaded [Module: null prototype] { default: [class Foo] }
+loading [WILDCARD]b.js
+loaded [Module: null prototype] { default: [class Bar] }
+all loaded
diff --git a/tests/testdata/run/top_level_await/nested.out b/tests/testdata/run/top_level_await/nested.out
new file mode 100644
index 000000000..8a1218a10
--- /dev/null
+++ b/tests/testdata/run/top_level_await/nested.out
@@ -0,0 +1,5 @@
+1
+2
+3
+4
+5
diff --git a/tests/testdata/run/top_level_await/nested/a.js b/tests/testdata/run/top_level_await/nested/a.js
new file mode 100644
index 000000000..74837d4ba
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/nested/b.js b/tests/testdata/run/top_level_await/nested/b.js
new file mode 100644
index 000000000..3bd241b50
--- /dev/null
+++ b/tests/testdata/run/top_level_await/nested/b.js
@@ -0,0 +1 @@
+console.log(3);
diff --git a/tests/testdata/run/top_level_await/nested/main.js b/tests/testdata/run/top_level_await/nested/main.js
new file mode 100644
index 000000000..ed46a4717
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/order.js b/tests/testdata/run/top_level_await/order.js
new file mode 100644
index 000000000..30659cdfb
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/order.out b/tests/testdata/run/top_level_await/order.out
new file mode 100644
index 000000000..4cc27858c
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/tla/a.js b/tests/testdata/run/top_level_await/tla/a.js
new file mode 100644
index 000000000..c3ef3f7db
--- /dev/null
+++ b/tests/testdata/run/top_level_await/tla/a.js
@@ -0,0 +1,3 @@
+import order from "./order.js";
+
+order.push("b");
diff --git a/tests/testdata/run/top_level_await/tla/b.js b/tests/testdata/run/top_level_await/tla/b.js
new file mode 100644
index 000000000..3271c92d8
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/tla/c.js b/tests/testdata/run/top_level_await/tla/c.js
new file mode 100644
index 000000000..806eb0a8b
--- /dev/null
+++ b/tests/testdata/run/top_level_await/tla/c.js
@@ -0,0 +1,3 @@
+import order from "./order.js";
+
+order.push("c");
diff --git a/tests/testdata/run/top_level_await/tla/d.js b/tests/testdata/run/top_level_await/tla/d.js
new file mode 100644
index 000000000..283ebf817
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/tla/order.js b/tests/testdata/run/top_level_await/tla/order.js
new file mode 100644
index 000000000..f213a562c
--- /dev/null
+++ b/tests/testdata/run/top_level_await/tla/order.js
@@ -0,0 +1 @@
+export default ["order"];
diff --git a/tests/testdata/run/top_level_await/tla/parent.js b/tests/testdata/run/top_level_await/tla/parent.js
new file mode 100644
index 000000000..1ecc15463
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/tla2/a.js b/tests/testdata/run/top_level_await/tla2/a.js
new file mode 100644
index 000000000..d07bcb94d
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/tla2/b.js b/tests/testdata/run/top_level_await/tla2/b.js
new file mode 100644
index 000000000..68e357c1e
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/tla3/b.js b/tests/testdata/run/top_level_await/tla3/b.js
new file mode 100644
index 000000000..d0349545e
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/tla3/timeout_loop.js b/tests/testdata/run/top_level_await/tla3/timeout_loop.js
new file mode 100644
index 000000000..860e6cd2a
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/top_level_await.js b/tests/testdata/run/top_level_await/top_level_await.js
new file mode 100644
index 000000000..ea319ea12
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/top_level_await.out b/tests/testdata/run/top_level_await/top_level_await.out
new file mode 100644
index 000000000..4b65d15fe
--- /dev/null
+++ b/tests/testdata/run/top_level_await/top_level_await.out
@@ -0,0 +1,3 @@
+Hello world!
+
+write 12
diff --git a/tests/testdata/run/top_level_await/top_level_await.ts b/tests/testdata/run/top_level_await/top_level_await.ts
new file mode 100644
index 000000000..8d47ceb21
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/top_level_for_await.js b/tests/testdata/run/top_level_await/top_level_for_await.js
new file mode 100644
index 000000000..a330f6c71
--- /dev/null
+++ b/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/tests/testdata/run/top_level_await/top_level_for_await.out b/tests/testdata/run/top_level_await/top_level_for_await.out
new file mode 100644
index 000000000..4539bbf2d
--- /dev/null
+++ b/tests/testdata/run/top_level_await/top_level_for_await.out
@@ -0,0 +1,3 @@
+0
+1
+2
diff --git a/tests/testdata/run/top_level_await/top_level_for_await.ts b/tests/testdata/run/top_level_await/top_level_for_await.ts
new file mode 100644
index 000000000..9179322d7
--- /dev/null
+++ b/tests/testdata/run/top_level_await/top_level_for_await.ts
@@ -0,0 +1,10 @@
+async function* asyncGenerator(): AsyncIterableIterator<number> {
+ let i = 0;
+ while (i < 3) {
+ yield i++;
+ }
+}
+
+for await (const num of asyncGenerator()) {
+ console.log(num);
+}
diff --git a/tests/testdata/run/top_level_await/unresolved.js b/tests/testdata/run/top_level_await/unresolved.js
new file mode 100644
index 000000000..231a8cd63
--- /dev/null
+++ b/tests/testdata/run/top_level_await/unresolved.js
@@ -0,0 +1 @@
+await new Promise(() => {});
diff --git a/tests/testdata/run/top_level_await/unresolved.out b/tests/testdata/run/top_level_await/unresolved.out
new file mode 100644
index 000000000..1f4ea5d38
--- /dev/null
+++ b/tests/testdata/run/top_level_await/unresolved.out
@@ -0,0 +1,4 @@
+error: Top-level await promise never resolved
+await new Promise(() => {});
+^
+ at <anonymous> ([WILDCARD]top_level_await/unresolved.js:1:1)
diff --git a/tests/testdata/run/ts_import_from_js/deps.js b/tests/testdata/run/ts_import_from_js/deps.js
new file mode 100644
index 000000000..746b5cf6b
--- /dev/null
+++ b/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/tests/testdata/run/ts_import_from_js/main.js b/tests/testdata/run/ts_import_from_js/main.js
new file mode 100644
index 000000000..32d6c29a1
--- /dev/null
+++ b/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/tests/testdata/run/ts_import_from_js/main.out b/tests/testdata/run/ts_import_from_js/main.out
new file mode 100644
index 000000000..e1d7a869f
--- /dev/null
+++ b/tests/testdata/run/ts_import_from_js/main.out
@@ -0,0 +1,3 @@
+Hello
+Hello
+success
diff --git a/tests/testdata/run/ts_type_imports.ts b/tests/testdata/run/ts_type_imports.ts
new file mode 100644
index 000000000..73c779156
--- /dev/null
+++ b/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<string, string>();
diff --git a/tests/testdata/run/ts_type_imports.ts.out b/tests/testdata/run/ts_type_imports.ts.out
new file mode 100644
index 000000000..3972d6a97
--- /dev/null
+++ b/tests/testdata/run/ts_type_imports.ts.out
@@ -0,0 +1,6 @@
+Check [WILDCARD]ts_type_imports.ts
+error: TS2322 [ERROR]: Type 'Map<string, string>' is not assignable to type 'Foo'.
+ Type 'string' is not assignable to type 'number'.
+const foo: Foo = new Map<string, string>();
+ ~~~
+ at [WILDCARD]ts_type_imports.ts:5:7
diff --git a/tests/testdata/run/ts_type_imports_foo.ts b/tests/testdata/run/ts_type_imports_foo.ts
new file mode 100644
index 000000000..db20773f6
--- /dev/null
+++ b/tests/testdata/run/ts_type_imports_foo.ts
@@ -0,0 +1 @@
+export type Foo = Map<string, number>;
diff --git a/tests/testdata/run/ts_type_only_import.d.ts b/tests/testdata/run/ts_type_only_import.d.ts
new file mode 100644
index 000000000..d48e4b48a
--- /dev/null
+++ b/tests/testdata/run/ts_type_only_import.d.ts
@@ -0,0 +1,3 @@
+export interface HelloWorld {
+ a: string;
+}
diff --git a/tests/testdata/run/ts_type_only_import.ts b/tests/testdata/run/ts_type_only_import.ts
new file mode 100644
index 000000000..53e114373
--- /dev/null
+++ b/tests/testdata/run/ts_type_only_import.ts
@@ -0,0 +1 @@
+export * from "./ts_type_only_import.d.ts";
diff --git a/tests/testdata/run/ts_type_only_import.ts.out b/tests/testdata/run/ts_type_only_import.ts.out
new file mode 100644
index 000000000..42852cd26
--- /dev/null
+++ b/tests/testdata/run/ts_type_only_import.ts.out
@@ -0,0 +1 @@
+Check file://[WILDCARD]/ts_type_only_import.ts
diff --git a/tests/testdata/run/tsx_imports/Component.tsx b/tests/testdata/run/tsx_imports/Component.tsx
new file mode 100644
index 000000000..c466a28ca
--- /dev/null
+++ b/tests/testdata/run/tsx_imports/Component.tsx
@@ -0,0 +1 @@
+import "../046_jsx_test.tsx";
diff --git a/tests/testdata/run/tsx_imports/tsx_imports.ts b/tests/testdata/run/tsx_imports/tsx_imports.ts
new file mode 100644
index 000000000..44ba10b7a
--- /dev/null
+++ b/tests/testdata/run/tsx_imports/tsx_imports.ts
@@ -0,0 +1 @@
+import "./Component.tsx";
diff --git a/tests/testdata/run/tsx_imports/tsx_imports.ts.out b/tests/testdata/run/tsx_imports/tsx_imports.ts.out
new file mode 100644
index 000000000..1f8b10d32
--- /dev/null
+++ b/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/tests/testdata/run/type_definitions.ts b/tests/testdata/run/type_definitions.ts
new file mode 100644
index 000000000..594842721
--- /dev/null
+++ b/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/tests/testdata/run/type_definitions.ts.out b/tests/testdata/run/type_definitions.ts.out
new file mode 100644
index 000000000..b4fa88c50
--- /dev/null
+++ b/tests/testdata/run/type_definitions.ts.out
@@ -0,0 +1,3 @@
+[WILDCARD]foo
+fizz
+qat
diff --git a/tests/testdata/run/type_definitions_for_export.ts b/tests/testdata/run/type_definitions_for_export.ts
new file mode 100644
index 000000000..1f17b4962
--- /dev/null
+++ b/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/tests/testdata/run/type_definitions_for_export.ts.out b/tests/testdata/run/type_definitions_for_export.ts.out
new file mode 100644
index 000000000..8f1240bc7
--- /dev/null
+++ b/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/tests/testdata/run/type_directives_01.ts b/tests/testdata/run/type_directives_01.ts
new file mode 100644
index 000000000..71305824c
--- /dev/null
+++ b/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/tests/testdata/run/type_directives_01.ts.out b/tests/testdata/run/type_directives_01.ts.out
new file mode 100644
index 000000000..77ed3ae26
--- /dev/null
+++ b/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/tests/testdata/run/type_directives_02.ts b/tests/testdata/run/type_directives_02.ts
new file mode 100644
index 000000000..0c59346e2
--- /dev/null
+++ b/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/tests/testdata/run/type_directives_02.ts.out b/tests/testdata/run/type_directives_02.ts.out
new file mode 100644
index 000000000..b064483b4
--- /dev/null
+++ b/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/tests/testdata/run/type_directives_js_main.js b/tests/testdata/run/type_directives_js_main.js
new file mode 100644
index 000000000..0c59346e2
--- /dev/null
+++ b/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/tests/testdata/run/type_directives_redirect.ts b/tests/testdata/run/type_directives_redirect.ts
new file mode 100644
index 000000000..8b98831fd
--- /dev/null
+++ b/tests/testdata/run/type_directives_redirect.ts
@@ -0,0 +1 @@
+import "http://localhost:4545/run/type_directives_redirect.js";
diff --git a/tests/testdata/run/type_directives_redirect.ts.out b/tests/testdata/run/type_directives_redirect.ts.out
new file mode 100644
index 000000000..471d9c0b4
--- /dev/null
+++ b/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/tests/testdata/run/type_headers_deno_types.ts b/tests/testdata/run/type_headers_deno_types.ts
new file mode 100644
index 000000000..9670f68cd
--- /dev/null
+++ b/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/tests/testdata/run/type_headers_deno_types.ts.out b/tests/testdata/run/type_headers_deno_types.ts.out
new file mode 100644
index 000000000..798f98311
--- /dev/null
+++ b/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/tests/testdata/run/unbuffered_stderr.ts b/tests/testdata/run/unbuffered_stderr.ts
new file mode 100644
index 000000000..0f1d2a999
--- /dev/null
+++ b/tests/testdata/run/unbuffered_stderr.ts
@@ -0,0 +1 @@
+Deno.stderr.write(new TextEncoder().encode("x"));
diff --git a/tests/testdata/run/unbuffered_stderr.ts.out b/tests/testdata/run/unbuffered_stderr.ts.out
new file mode 100644
index 000000000..c1b0730e0
--- /dev/null
+++ b/tests/testdata/run/unbuffered_stderr.ts.out
@@ -0,0 +1 @@
+x \ No newline at end of file
diff --git a/tests/testdata/run/unbuffered_stdout.ts b/tests/testdata/run/unbuffered_stdout.ts
new file mode 100644
index 000000000..9f1e07a97
--- /dev/null
+++ b/tests/testdata/run/unbuffered_stdout.ts
@@ -0,0 +1 @@
+Deno.stdout.write(new TextEncoder().encode("a"));
diff --git a/tests/testdata/run/unbuffered_stdout.ts.out b/tests/testdata/run/unbuffered_stdout.ts.out
new file mode 100644
index 000000000..2e65efe2a
--- /dev/null
+++ b/tests/testdata/run/unbuffered_stdout.ts.out
@@ -0,0 +1 @@
+a \ No newline at end of file
diff --git a/tests/testdata/run/unhandled_rejection.ts b/tests/testdata/run/unhandled_rejection.ts
new file mode 100644
index 000000000..388583434
--- /dev/null
+++ b/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/tests/testdata/run/unhandled_rejection.ts.out b/tests/testdata/run/unhandled_rejection.ts.out
new file mode 100644
index 000000000..6ab1667dc
--- /dev/null
+++ b/tests/testdata/run/unhandled_rejection.ts.out
@@ -0,0 +1,9 @@
+[WILDCARD]
+unhandled rejection at: Promise {
+ <rejected> 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 { <rejected> undefined } reason: undefined
diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import/import.ts b/tests/testdata/run/unhandled_rejection_dynamic_import/import.ts
new file mode 100644
index 000000000..b490f2c20
--- /dev/null
+++ b/tests/testdata/run/unhandled_rejection_dynamic_import/import.ts
@@ -0,0 +1,5 @@
+globalThis.addEventListener("unhandledrejection", () => {
+ console.log("hey");
+});
+console.log("---");
+Promise.reject();
diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import/main.ts b/tests/testdata/run/unhandled_rejection_dynamic_import/main.ts
new file mode 100644
index 000000000..244d84467
--- /dev/null
+++ b/tests/testdata/run/unhandled_rejection_dynamic_import/main.ts
@@ -0,0 +1 @@
+await import("./import.ts");
diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import/main.ts.out b/tests/testdata/run/unhandled_rejection_dynamic_import/main.ts.out
new file mode 100644
index 000000000..f44c6d2ff
--- /dev/null
+++ b/tests/testdata/run/unhandled_rejection_dynamic_import/main.ts.out
@@ -0,0 +1,3 @@
+---
+hey
+error: Uncaught (in promise) undefined
diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import2/import.ts b/tests/testdata/run/unhandled_rejection_dynamic_import2/import.ts
new file mode 100644
index 000000000..f84297afd
--- /dev/null
+++ b/tests/testdata/run/unhandled_rejection_dynamic_import2/import.ts
@@ -0,0 +1,3 @@
+export default {
+ a: "a",
+};
diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts b/tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts
new file mode 100644
index 000000000..3da2e1d19
--- /dev/null
+++ b/tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts
@@ -0,0 +1,21 @@
+globalThis.addEventListener("unhandledrejection", (e) => {
+ console.log("unhandled rejection", e.reason);
+ e.preventDefault();
+});
+
+const dummyImport = (await import("./import.ts")).default;
+
+let a = new Promise((resolve, reject) => {
+ throw "errA";
+});
+
+let i = 0;
+while (true) {
+ await new Promise((resolve) => setTimeout(resolve, 100));
+ i++;
+ console.log("running...");
+
+ if (i > 3) {
+ break;
+ }
+}
diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts.out b/tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts.out
new file mode 100644
index 000000000..0a913a4b5
--- /dev/null
+++ b/tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts.out
@@ -0,0 +1,5 @@
+unhandled rejection errA
+running...
+running...
+running...
+running...
diff --git a/tests/testdata/run/unhandled_rejection_sync_error.ts b/tests/testdata/run/unhandled_rejection_sync_error.ts
new file mode 100644
index 000000000..0dabb1cb7
--- /dev/null
+++ b/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/tests/testdata/run/unhandled_rejection_sync_error.ts.out b/tests/testdata/run/unhandled_rejection_sync_error.ts.out
new file mode 100644
index 000000000..e178373f0
--- /dev/null
+++ b/tests/testdata/run/unhandled_rejection_sync_error.ts.out
@@ -0,0 +1,6 @@
+[WILDCARD]
+unhandled rejection at: Promise {
+ <rejected> 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/tests/testdata/run/unsafe_proto/main.js b/tests/testdata/run/unsafe_proto/main.js
new file mode 100644
index 000000000..eb95c55a0
--- /dev/null
+++ b/tests/testdata/run/unsafe_proto/main.js
@@ -0,0 +1,5 @@
+console.log(Object.hasOwn(Object.prototype, "__proto__"));
+
+new Worker(import.meta.resolve("./worker.js"), {
+ type: "module",
+});
diff --git a/tests/testdata/run/unsafe_proto/main.out b/tests/testdata/run/unsafe_proto/main.out
new file mode 100644
index 000000000..4b095fd0f
--- /dev/null
+++ b/tests/testdata/run/unsafe_proto/main.out
@@ -0,0 +1,2 @@
+false
+false
diff --git a/tests/testdata/run/unsafe_proto/main_with_unsafe_proto_flag.out b/tests/testdata/run/unsafe_proto/main_with_unsafe_proto_flag.out
new file mode 100644
index 000000000..bb101b641
--- /dev/null
+++ b/tests/testdata/run/unsafe_proto/main_with_unsafe_proto_flag.out
@@ -0,0 +1,2 @@
+true
+true
diff --git a/tests/testdata/run/unsafe_proto/worker.js b/tests/testdata/run/unsafe_proto/worker.js
new file mode 100644
index 000000000..b22bc8713
--- /dev/null
+++ b/tests/testdata/run/unsafe_proto/worker.js
@@ -0,0 +1,2 @@
+console.log(Object.hasOwn(Object.prototype, "__proto__"));
+close();
diff --git a/tests/testdata/run/unstable.js b/tests/testdata/run/unstable.js
new file mode 100644
index 000000000..8c01b214e
--- /dev/null
+++ b/tests/testdata/run/unstable.js
@@ -0,0 +1 @@
+console.log(Deno.umask);
diff --git a/tests/testdata/run/unstable.ts b/tests/testdata/run/unstable.ts
new file mode 100644
index 000000000..8c01b214e
--- /dev/null
+++ b/tests/testdata/run/unstable.ts
@@ -0,0 +1 @@
+console.log(Deno.umask);
diff --git a/tests/testdata/run/unstable_broadcast_channel.disabled.out b/tests/testdata/run/unstable_broadcast_channel.disabled.out
new file mode 100644
index 000000000..775866352
--- /dev/null
+++ b/tests/testdata/run/unstable_broadcast_channel.disabled.out
@@ -0,0 +1,2 @@
+main undefined
+worker undefined
diff --git a/tests/testdata/run/unstable_broadcast_channel.enabled.out b/tests/testdata/run/unstable_broadcast_channel.enabled.out
new file mode 100644
index 000000000..b3701ce44
--- /dev/null
+++ b/tests/testdata/run/unstable_broadcast_channel.enabled.out
@@ -0,0 +1,2 @@
+main [class BroadcastChannel extends EventTarget]
+worker [class BroadcastChannel extends EventTarget]
diff --git a/tests/testdata/run/unstable_broadcast_channel.js b/tests/testdata/run/unstable_broadcast_channel.js
new file mode 100644
index 000000000..b8576aa22
--- /dev/null
+++ b/tests/testdata/run/unstable_broadcast_channel.js
@@ -0,0 +1,10 @@
+const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
+
+console.log(scope, globalThis.BroadcastChannel);
+
+if (scope === "worker") {
+ postMessage("done");
+} else {
+ const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
+ worker.onmessage = () => Deno.exit(0);
+}
diff --git a/tests/testdata/run/unstable_cron.disabled.out b/tests/testdata/run/unstable_cron.disabled.out
new file mode 100644
index 000000000..775866352
--- /dev/null
+++ b/tests/testdata/run/unstable_cron.disabled.out
@@ -0,0 +1,2 @@
+main undefined
+worker undefined
diff --git a/tests/testdata/run/unstable_cron.enabled.out b/tests/testdata/run/unstable_cron.enabled.out
new file mode 100644
index 000000000..d18304f1f
--- /dev/null
+++ b/tests/testdata/run/unstable_cron.enabled.out
@@ -0,0 +1,2 @@
+main [Function: cron]
+worker [Function: cron]
diff --git a/tests/testdata/run/unstable_cron.js b/tests/testdata/run/unstable_cron.js
new file mode 100644
index 000000000..3114f6e55
--- /dev/null
+++ b/tests/testdata/run/unstable_cron.js
@@ -0,0 +1,10 @@
+const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
+
+console.log(scope, Deno.cron);
+
+if (scope === "worker") {
+ postMessage("done");
+} else {
+ const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
+ worker.onmessage = () => Deno.exit(0);
+}
diff --git a/tests/testdata/run/unstable_disabled_js.out b/tests/testdata/run/unstable_disabled_js.out
new file mode 100644
index 000000000..417b7b537
--- /dev/null
+++ b/tests/testdata/run/unstable_disabled_js.out
@@ -0,0 +1 @@
+undefined
diff --git a/tests/testdata/run/unstable_enabled.out b/tests/testdata/run/unstable_enabled.out
new file mode 100644
index 000000000..5f88c778c
--- /dev/null
+++ b/tests/testdata/run/unstable_enabled.out
@@ -0,0 +1 @@
+[Function: umask]
diff --git a/tests/testdata/run/unstable_enabled_js.out b/tests/testdata/run/unstable_enabled_js.out
new file mode 100644
index 000000000..5f88c778c
--- /dev/null
+++ b/tests/testdata/run/unstable_enabled_js.out
@@ -0,0 +1 @@
+[Function: umask]
diff --git a/tests/testdata/run/unstable_ffi.disabled.out b/tests/testdata/run/unstable_ffi.disabled.out
new file mode 100644
index 000000000..0d8ac4410
--- /dev/null
+++ b/tests/testdata/run/unstable_ffi.disabled.out
@@ -0,0 +1,10 @@
+main undefined
+main undefined
+main undefined
+main undefined
+main undefined
+worker undefined
+worker undefined
+worker undefined
+worker undefined
+worker undefined
diff --git a/tests/testdata/run/unstable_ffi.enabled.out b/tests/testdata/run/unstable_ffi.enabled.out
new file mode 100644
index 000000000..672b2a2a2
--- /dev/null
+++ b/tests/testdata/run/unstable_ffi.enabled.out
@@ -0,0 +1,10 @@
+main [class UnsafeCallback]
+main [class UnsafeFnPointer]
+main [class UnsafePointer]
+main [class UnsafePointerView]
+main [Function: dlopen]
+worker [class UnsafeCallback]
+worker [class UnsafeFnPointer]
+worker [class UnsafePointer]
+worker [class UnsafePointerView]
+worker [Function: dlopen]
diff --git a/tests/testdata/run/unstable_ffi.js b/tests/testdata/run/unstable_ffi.js
new file mode 100644
index 000000000..4809c5ffe
--- /dev/null
+++ b/tests/testdata/run/unstable_ffi.js
@@ -0,0 +1,14 @@
+const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
+
+console.log(scope, Deno.UnsafeCallback);
+console.log(scope, Deno.UnsafeFnPointer);
+console.log(scope, Deno.UnsafePointer);
+console.log(scope, Deno.UnsafePointerView);
+console.log(scope, Deno.dlopen);
+
+if (scope === "worker") {
+ postMessage("done");
+} else {
+ const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
+ worker.onmessage = () => Deno.exit(0);
+}
diff --git a/tests/testdata/run/unstable_fs.disabled.out b/tests/testdata/run/unstable_fs.disabled.out
new file mode 100644
index 000000000..0d8ac4410
--- /dev/null
+++ b/tests/testdata/run/unstable_fs.disabled.out
@@ -0,0 +1,10 @@
+main undefined
+main undefined
+main undefined
+main undefined
+main undefined
+worker undefined
+worker undefined
+worker undefined
+worker undefined
+worker undefined
diff --git a/tests/testdata/run/unstable_fs.enabled.out b/tests/testdata/run/unstable_fs.enabled.out
new file mode 100644
index 000000000..6938fa9c2
--- /dev/null
+++ b/tests/testdata/run/unstable_fs.enabled.out
@@ -0,0 +1,10 @@
+main [AsyncFunction: flock]
+main [Function: flockSync]
+main [AsyncFunction: funlock]
+main [Function: funlockSync]
+main [Function: umask]
+worker [AsyncFunction: flock]
+worker [Function: flockSync]
+worker [AsyncFunction: funlock]
+worker [Function: funlockSync]
+worker [Function: umask]
diff --git a/tests/testdata/run/unstable_fs.js b/tests/testdata/run/unstable_fs.js
new file mode 100644
index 000000000..83f14f2fd
--- /dev/null
+++ b/tests/testdata/run/unstable_fs.js
@@ -0,0 +1,14 @@
+const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
+
+console.log(scope, Deno.flock);
+console.log(scope, Deno.flockSync);
+console.log(scope, Deno.funlock);
+console.log(scope, Deno.funlockSync);
+console.log(scope, Deno.umask);
+
+if (scope === "worker") {
+ postMessage("done");
+} else {
+ const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
+ worker.onmessage = () => Deno.exit(0);
+}
diff --git a/tests/testdata/run/unstable_http.disabled.out b/tests/testdata/run/unstable_http.disabled.out
new file mode 100644
index 000000000..6eb83832e
--- /dev/null
+++ b/tests/testdata/run/unstable_http.disabled.out
@@ -0,0 +1,12 @@
+main undefined
+main undefined
+main undefined
+main undefined
+main undefined
+main undefined
+worker undefined
+worker undefined
+worker undefined
+worker undefined
+worker undefined
+worker undefined
diff --git a/tests/testdata/run/unstable_http.enabled.out b/tests/testdata/run/unstable_http.enabled.out
new file mode 100644
index 000000000..4f3c65625
--- /dev/null
+++ b/tests/testdata/run/unstable_http.enabled.out
@@ -0,0 +1,12 @@
+main [class HttpClient]
+main [Function: createHttpClient]
+main [class HttpConn]
+main Symbol("[[associated_ws]]")
+main [Function: serve]
+main [Function: upgradeWebSocket]
+worker [class HttpClient]
+worker [Function: createHttpClient]
+worker [class HttpConn]
+worker Symbol("[[associated_ws]]")
+worker [Function: serve]
+worker [Function: upgradeWebSocket]
diff --git a/tests/testdata/run/unstable_http.js b/tests/testdata/run/unstable_http.js
new file mode 100644
index 000000000..1a3ddb2d3
--- /dev/null
+++ b/tests/testdata/run/unstable_http.js
@@ -0,0 +1,15 @@
+const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
+
+console.log(scope, Deno.HttpClient);
+console.log(scope, Deno.createHttpClient);
+console.log(scope, Deno.http?.HttpConn);
+console.log(scope, Deno.http?._ws);
+console.log(scope, Deno.http?.serve);
+console.log(scope, Deno.http?.upgradeWebSocket);
+
+if (scope === "worker") {
+ postMessage("done");
+} else {
+ const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
+ worker.onmessage = () => Deno.exit(0);
+}
diff --git a/tests/testdata/run/unstable_kv.disabled.out b/tests/testdata/run/unstable_kv.disabled.out
new file mode 100644
index 000000000..0d8ac4410
--- /dev/null
+++ b/tests/testdata/run/unstable_kv.disabled.out
@@ -0,0 +1,10 @@
+main undefined
+main undefined
+main undefined
+main undefined
+main undefined
+worker undefined
+worker undefined
+worker undefined
+worker undefined
+worker undefined
diff --git a/tests/testdata/run/unstable_kv.enabled.out b/tests/testdata/run/unstable_kv.enabled.out
new file mode 100644
index 000000000..a1356cefc
--- /dev/null
+++ b/tests/testdata/run/unstable_kv.enabled.out
@@ -0,0 +1,10 @@
+main [class AtomicOperation]
+main [class Kv]
+main [class KvListIterator extends Object]
+main [class KvU64]
+main [AsyncFunction: openKv]
+worker [class AtomicOperation]
+worker [class Kv]
+worker [class KvListIterator extends Object]
+worker [class KvU64]
+worker [AsyncFunction: openKv]
diff --git a/tests/testdata/run/unstable_kv.js b/tests/testdata/run/unstable_kv.js
new file mode 100644
index 000000000..17c0e05aa
--- /dev/null
+++ b/tests/testdata/run/unstable_kv.js
@@ -0,0 +1,14 @@
+const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
+
+console.log(scope, Deno.AtomicOperation);
+console.log(scope, Deno.Kv);
+console.log(scope, Deno.KvListIterator);
+console.log(scope, Deno.KvU64);
+console.log(scope, Deno.openKv);
+
+if (scope === "worker") {
+ postMessage("done");
+} else {
+ const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
+ worker.onmessage = () => Deno.exit(0);
+}
diff --git a/tests/testdata/run/unstable_net.disabled.out b/tests/testdata/run/unstable_net.disabled.out
new file mode 100644
index 000000000..3562f72fd
--- /dev/null
+++ b/tests/testdata/run/unstable_net.disabled.out
@@ -0,0 +1,4 @@
+main undefined
+main undefined
+worker undefined
+worker undefined
diff --git a/tests/testdata/run/unstable_net.enabled.out b/tests/testdata/run/unstable_net.enabled.out
new file mode 100644
index 000000000..8b86637f3
--- /dev/null
+++ b/tests/testdata/run/unstable_net.enabled.out
@@ -0,0 +1,4 @@
+main [Function: listenDatagram]
+main [class WebSocketStream]
+worker [Function: listenDatagram]
+worker [class WebSocketStream]
diff --git a/tests/testdata/run/unstable_net.js b/tests/testdata/run/unstable_net.js
new file mode 100644
index 000000000..4492b202b
--- /dev/null
+++ b/tests/testdata/run/unstable_net.js
@@ -0,0 +1,11 @@
+const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
+
+console.log(scope, Deno.listenDatagram);
+console.log(scope, globalThis.WebSocketStream);
+
+if (scope === "worker") {
+ postMessage("done");
+} else {
+ const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
+ worker.onmessage = () => Deno.exit(0);
+}
diff --git a/tests/testdata/run/unstable_temporal_api/main.out b/tests/testdata/run/unstable_temporal_api/main.out
new file mode 100644
index 000000000..46d25c3ea
--- /dev/null
+++ b/tests/testdata/run/unstable_temporal_api/main.out
@@ -0,0 +1,12 @@
+Check [WILDCARD]
+Temporal.Now [WILDCARD]
+Temporal.Instant 1969-07-20T20:17:00Z
+Temporal.ZonedDateTime 1995-12-07T03:24:30.0000035-08:00[America/Los_Angeles]
+Temporal.PlainDate 2006-08-24
+Temporal.PlainTime 19:39:09.068346205
+Temporal.PlainDateTime 1995-12-07T15:00:00
+Temporal.PlainYearMonth 2020-10
+Temporal.PlainMonthDay 07-14
+Temporal.Duration PT130H20M
+Temporal.TimeZone Africa/Cairo
+Temporal.Calendar 1999-12-31
diff --git a/tests/testdata/run/unstable_temporal_api/main.ts b/tests/testdata/run/unstable_temporal_api/main.ts
new file mode 100644
index 000000000..1641b90bf
--- /dev/null
+++ b/tests/testdata/run/unstable_temporal_api/main.ts
@@ -0,0 +1,71 @@
+console.log("Temporal.Now", Temporal.Now.instant());
+console.log(
+ "Temporal.Instant",
+ Temporal.Instant.from("1969-07-20T20:17Z"),
+);
+console.log(
+ "Temporal.ZonedDateTime",
+ Temporal.ZonedDateTime.from({
+ timeZone: "America/Los_Angeles",
+ year: 1995,
+ month: 12,
+ day: 7,
+ hour: 3,
+ minute: 24,
+ second: 30,
+ millisecond: 0,
+ microsecond: 3,
+ nanosecond: 500,
+ }),
+);
+console.log(
+ "Temporal.PlainDate",
+ Temporal.PlainDate.from({ year: 2006, month: 8, day: 24 }),
+);
+console.log(
+ "Temporal.PlainTime",
+ Temporal.PlainTime.from({
+ hour: 19,
+ minute: 39,
+ second: 9,
+ millisecond: 68,
+ microsecond: 346,
+ nanosecond: 205,
+ }),
+);
+console.log(
+ "Temporal.PlainDateTime",
+ Temporal.PlainDateTime.from({
+ year: 1995,
+ month: 12,
+ day: 7,
+ hour: 15,
+ }),
+);
+console.log(
+ "Temporal.PlainYearMonth",
+ Temporal.PlainYearMonth.from({ year: 2020, month: 10 }),
+);
+console.log(
+ "Temporal.PlainMonthDay",
+ Temporal.PlainMonthDay.from({ month: 7, day: 14 }),
+);
+console.log(
+ "Temporal.Duration",
+ Temporal.Duration.from({
+ hours: 130,
+ minutes: 20,
+ }),
+);
+console.log(
+ "Temporal.TimeZone",
+ Temporal.TimeZone.from("Africa/Cairo"),
+);
+console.log(
+ "Temporal.Calendar",
+ Temporal.Calendar.from("iso8601").dateFromFields({
+ year: 1999,
+ month: 12,
+ day: 31,
+ }, {}),
+);
diff --git a/tests/testdata/run/unstable_temporal_api/missing_flag.js b/tests/testdata/run/unstable_temporal_api/missing_flag.js
new file mode 100644
index 000000000..92aed7931
--- /dev/null
+++ b/tests/testdata/run/unstable_temporal_api/missing_flag.js
@@ -0,0 +1 @@
+Temporal.Now.instant();
diff --git a/tests/testdata/run/unstable_temporal_api/missing_flag.out b/tests/testdata/run/unstable_temporal_api/missing_flag.out
new file mode 100644
index 000000000..8f8e23e70
--- /dev/null
+++ b/tests/testdata/run/unstable_temporal_api/missing_flag.out
@@ -0,0 +1,4 @@
+error: Uncaught (in promise) ReferenceError: Temporal is not defined
+Temporal.Now.instant();
+^
+ at [WILDCARD]missing_flag.js:1:1
diff --git a/tests/testdata/run/unstable_webgpu.disabled.out b/tests/testdata/run/unstable_webgpu.disabled.out
new file mode 100644
index 000000000..775866352
--- /dev/null
+++ b/tests/testdata/run/unstable_webgpu.disabled.out
@@ -0,0 +1,2 @@
+main undefined
+worker undefined
diff --git a/tests/testdata/run/unstable_webgpu.enabled.out b/tests/testdata/run/unstable_webgpu.enabled.out
new file mode 100644
index 000000000..e2cc915ba
--- /dev/null
+++ b/tests/testdata/run/unstable_webgpu.enabled.out
@@ -0,0 +1,2 @@
+main [class GPU]
+worker [class GPU]
diff --git a/tests/testdata/run/unstable_webgpu.js b/tests/testdata/run/unstable_webgpu.js
new file mode 100644
index 000000000..a796b1c4d
--- /dev/null
+++ b/tests/testdata/run/unstable_webgpu.js
@@ -0,0 +1,10 @@
+const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
+
+console.log(scope, globalThis.GPU);
+
+if (scope === "worker") {
+ postMessage("done");
+} else {
+ const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
+ worker.onmessage = () => Deno.exit(0);
+}
diff --git a/tests/testdata/run/unstable_worker.ts b/tests/testdata/run/unstable_worker.ts
new file mode 100644
index 000000000..d111d2c7e
--- /dev/null
+++ b/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/tests/testdata/run/unstable_worker.ts.out b/tests/testdata/run/unstable_worker.ts.out
new file mode 100644
index 000000000..182dc58a4
--- /dev/null
+++ b/tests/testdata/run/unstable_worker.ts.out
@@ -0,0 +1,2 @@
+[Function: query]
+[Function: consoleSize]
diff --git a/tests/testdata/run/unstable_worker_options.disabled.out b/tests/testdata/run/unstable_worker_options.disabled.out
new file mode 100644
index 000000000..ba50ca539
--- /dev/null
+++ b/tests/testdata/run/unstable_worker_options.disabled.out
@@ -0,0 +1 @@
+Unstable API 'Worker.deno.permissions'. The `--unstable-worker-options` flag must be provided.
diff --git a/tests/testdata/run/unstable_worker_options.enabled.out b/tests/testdata/run/unstable_worker_options.enabled.out
new file mode 100644
index 000000000..57a52b019
--- /dev/null
+++ b/tests/testdata/run/unstable_worker_options.enabled.out
@@ -0,0 +1,2 @@
+main ok
+worker ok
diff --git a/tests/testdata/run/unstable_worker_options.js b/tests/testdata/run/unstable_worker_options.js
new file mode 100644
index 000000000..213eb3ee6
--- /dev/null
+++ b/tests/testdata/run/unstable_worker_options.js
@@ -0,0 +1,19 @@
+const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
+
+new Worker(`data:application/javascript;base64,${btoa(`postMessage("ok");`)}`, {
+ type: "module",
+ deno: {
+ permissions: {
+ read: true,
+ },
+ },
+}).onmessage = ({ data }) => {
+ console.log(scope, data);
+
+ if (scope === "main") {
+ const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
+ worker.onmessage = () => Deno.exit(0);
+ } else {
+ postMessage("done");
+ }
+};
diff --git a/tests/testdata/run/unsupported_dynamic_import_scheme.out b/tests/testdata/run/unsupported_dynamic_import_scheme.out
new file mode 100644
index 000000000..c708fced4
--- /dev/null
+++ b/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/tests/testdata/run/v8_flags.js b/tests/testdata/run/v8_flags.js
new file mode 100644
index 000000000..f7999c4af
--- /dev/null
+++ b/tests/testdata/run/v8_flags.js
@@ -0,0 +1 @@
+console.log(typeof gc);
diff --git a/tests/testdata/run/v8_flags.js.out b/tests/testdata/run/v8_flags.js.out
new file mode 100644
index 000000000..e2dbde096
--- /dev/null
+++ b/tests/testdata/run/v8_flags.js.out
@@ -0,0 +1 @@
+function
diff --git a/tests/testdata/run/v8_flags_unrecognized.out b/tests/testdata/run/v8_flags_unrecognized.out
new file mode 100644
index 000000000..56e70f830
--- /dev/null
+++ b/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/tests/testdata/run/v8_help.out b/tests/testdata/run/v8_help.out
new file mode 100644
index 000000000..006d73557
--- /dev/null
+++ b/tests/testdata/run/v8_help.out
@@ -0,0 +1,4 @@
+[WILDCARD]
+Options:
+[WILDCARD]
+ --trace-gc [WILDCARD]
diff --git a/tests/testdata/run/warn_on_deprecated_api/main.js b/tests/testdata/run/warn_on_deprecated_api/main.js
new file mode 100644
index 000000000..a464be60a
--- /dev/null
+++ b/tests/testdata/run/warn_on_deprecated_api/main.js
@@ -0,0 +1,32 @@
+import { runEcho as runEcho2 } from "http://localhost:4545/run/warn_on_deprecated_api/mod.ts";
+
+const p = Deno.run({
+ cmd: [
+ Deno.execPath(),
+ "eval",
+ "console.log('hello world')",
+ ],
+});
+await p.status();
+p.close();
+
+async function runEcho() {
+ const p = Deno.run({
+ cmd: [
+ Deno.execPath(),
+ "eval",
+ "console.log('hello world')",
+ ],
+ });
+ await p.status();
+ p.close();
+}
+
+await runEcho();
+await runEcho();
+
+for (let i = 0; i < 10; i++) {
+ await runEcho();
+}
+
+await runEcho2();
diff --git a/tests/testdata/run/warn_on_deprecated_api/main.out b/tests/testdata/run/warn_on_deprecated_api/main.out
new file mode 100644
index 000000000..ff44c885f
--- /dev/null
+++ b/tests/testdata/run/warn_on_deprecated_api/main.out
@@ -0,0 +1,16 @@
+Download http://localhost:4545/run/warn_on_deprecated_api/mod.ts
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
diff --git a/tests/testdata/run/warn_on_deprecated_api/main.verbose.out b/tests/testdata/run/warn_on_deprecated_api/main.verbose.out
new file mode 100644
index 000000000..184051de1
--- /dev/null
+++ b/tests/testdata/run/warn_on_deprecated_api/main.verbose.out
@@ -0,0 +1,65 @@
+Download http://localhost:4545/run/warn_on_deprecated_api/mod.ts
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
+
+See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
+
+Stack trace:
+ at [WILDCARD]warn_on_deprecated_api/main.js:3:16
+
+hint: Use "Deno.Command()" API instead.
+
+hello world
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
+
+See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
+
+Stack trace:
+ at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
+ at [WILDCARD]warn_on_deprecated_api/main.js:25:7
+
+hint: Use "Deno.Command()" API instead.
+
+hello world
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
+
+See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
+
+Stack trace:
+ at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
+ at [WILDCARD]warn_on_deprecated_api/main.js:26:7
+
+hint: Use "Deno.Command()" API instead.
+
+hello world
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
+
+See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
+
+Stack trace:
+ at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
+ at [WILDCARD]warn_on_deprecated_api/main.js:29:9
+
+hint: Use "Deno.Command()" API instead.
+
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
+
+See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
+
+Stack trace:
+ at runEcho (http://localhost:4545/run/warn_on_deprecated_api/mod.ts:2:18)
+ at [WILDCARD]warn_on_deprecated_api/main.js:32:7
+
+hint: Use "Deno.Command()" API instead.
+hint: It appears this API is used by a remote dependency. Try upgrading to the latest version of that dependency.
+
+hello world
diff --git a/tests/testdata/run/warn_on_deprecated_api/main_disabled_env.out b/tests/testdata/run/warn_on_deprecated_api/main_disabled_env.out
new file mode 100644
index 000000000..ef85a6f99
--- /dev/null
+++ b/tests/testdata/run/warn_on_deprecated_api/main_disabled_env.out
@@ -0,0 +1,15 @@
+Download http://localhost:4545/run/warn_on_deprecated_api/mod.ts
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
diff --git a/tests/testdata/run/warn_on_deprecated_api/main_disabled_flag.out b/tests/testdata/run/warn_on_deprecated_api/main_disabled_flag.out
new file mode 100644
index 000000000..ce3755d16
--- /dev/null
+++ b/tests/testdata/run/warn_on_deprecated_api/main_disabled_flag.out
@@ -0,0 +1,14 @@
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
diff --git a/tests/testdata/run/warn_on_deprecated_api/mod.ts b/tests/testdata/run/warn_on_deprecated_api/mod.ts
new file mode 100644
index 000000000..f74632b2c
--- /dev/null
+++ b/tests/testdata/run/warn_on_deprecated_api/mod.ts
@@ -0,0 +1,11 @@
+export async function runEcho() {
+ const p = Deno.run({
+ cmd: [
+ Deno.execPath(),
+ "eval",
+ "console.log('hello world')",
+ ],
+ });
+ await p.status();
+ p.close();
+}
diff --git a/tests/testdata/run/wasm.ts b/tests/testdata/run/wasm.ts
new file mode 100644
index 000000000..96b5fdffc
--- /dev/null
+++ b/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/tests/testdata/run/wasm.ts.out b/tests/testdata/run/wasm.ts.out
new file mode 100644
index 000000000..d81cc0710
--- /dev/null
+++ b/tests/testdata/run/wasm.ts.out
@@ -0,0 +1 @@
+42
diff --git a/tests/testdata/run/wasm_async.js b/tests/testdata/run/wasm_async.js
new file mode 100644
index 000000000..837460ae9
--- /dev/null
+++ b/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/tests/testdata/run/wasm_async.out b/tests/testdata/run/wasm_async.out
new file mode 100644
index 000000000..5cdf17de7
--- /dev/null
+++ b/tests/testdata/run/wasm_async.out
@@ -0,0 +1 @@
+1 + 3 = 4
diff --git a/tests/testdata/run/wasm_shared.out b/tests/testdata/run/wasm_shared.out
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testdata/run/wasm_shared.out
diff --git a/tests/testdata/run/wasm_shared.ts b/tests/testdata/run/wasm_shared.ts
new file mode 100644
index 000000000..b713385d5
--- /dev/null
+++ b/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/tests/testdata/run/wasm_streaming_panic_test.js b/tests/testdata/run/wasm_streaming_panic_test.js
new file mode 100644
index 000000000..ec017592f
--- /dev/null
+++ b/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/tests/testdata/run/wasm_streaming_panic_test.js.out b/tests/testdata/run/wasm_streaming_panic_test.js.out
new file mode 100644
index 000000000..8a3c68e37
--- /dev/null
+++ b/tests/testdata/run/wasm_streaming_panic_test.js.out
@@ -0,0 +1,2 @@
+error: Uncaught (in promise) TypeError: Invalid WebAssembly content type.
+ at handleWasmStreaming (ext:deno_fetch/26_fetch.js:[WILDCARD])
diff --git a/tests/testdata/run/wasm_unreachable.js b/tests/testdata/run/wasm_unreachable.js
new file mode 100644
index 000000000..d6a4f59db
--- /dev/null
+++ b/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/tests/testdata/run/wasm_unreachable.out b/tests/testdata/run/wasm_unreachable.out
new file mode 100644
index 000000000..c213097ab
--- /dev/null
+++ b/tests/testdata/run/wasm_unreachable.out
@@ -0,0 +1,3 @@
+error: Uncaught[WILDCARD] RuntimeError: unreachable
+ at <anonymous> (wasm://wasm/d1c677ea:1:41)
+ at [WILDCARD]/wasm_unreachable.js:[WILDCARD]
diff --git a/tests/testdata/run/wasm_url.js b/tests/testdata/run/wasm_url.js
new file mode 100644
index 000000000..71686ef7e
--- /dev/null
+++ b/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/tests/testdata/run/wasm_url.out b/tests/testdata/run/wasm_url.out
new file mode 100644
index 000000000..ae3bf491a
--- /dev/null
+++ b/tests/testdata/run/wasm_url.out
@@ -0,0 +1,3 @@
+error: Uncaught (in promise) RuntimeError: unreachable
+ at <anonymous> (http://localhost:4545/assets/unreachable.wasm:1:41)
+ at [WILDCARD]/wasm_url.js:[WILDCARD]
diff --git a/tests/testdata/run/weakref.ts b/tests/testdata/run/weakref.ts
new file mode 100644
index 000000000..47c3985fe
--- /dev/null
+++ b/tests/testdata/run/weakref.ts
@@ -0,0 +1 @@
+console.log(WeakRef, FinalizationRegistry);
diff --git a/tests/testdata/run/weakref.ts.out b/tests/testdata/run/weakref.ts.out
new file mode 100644
index 000000000..32bafcf2d
--- /dev/null
+++ b/tests/testdata/run/weakref.ts.out
@@ -0,0 +1 @@
+[Function: WeakRef] [Function: FinalizationRegistry]
diff --git a/tests/testdata/run/websocket_server_idletimeout.ts b/tests/testdata/run/websocket_server_idletimeout.ts
new file mode 100644
index 000000000..f116c4556
--- /dev/null
+++ b/tests/testdata/run/websocket_server_idletimeout.ts
@@ -0,0 +1,25 @@
+import { assertEquals } from "../../../test_util/std/assert/mod.ts";
+
+const errorDeferred = Promise.withResolvers<void>();
+const closeDeferred = Promise.withResolvers<void>();
+
+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.promise;
+await closeDeferred.promise;
+listener.close();
diff --git a/tests/testdata/run/websocket_server_multi_field_connection_header_test.ts b/tests/testdata/run/websocket_server_multi_field_connection_header_test.ts
new file mode 100644
index 000000000..d94709767
--- /dev/null
+++ b/tests/testdata/run/websocket_server_multi_field_connection_header_test.ts
@@ -0,0 +1,15 @@
+const { promise, resolve } = Promise.withResolvers<void>();
+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 = () => resolve();
+await respondWith(response);
+await promise;
diff --git a/tests/testdata/run/websocketstream_ping_test.ts b/tests/testdata/run/websocketstream_ping_test.ts
new file mode 100644
index 000000000..a4b684468
--- /dev/null
+++ b/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.opened;
+for await (const _ of readable) {
+ //
+}
diff --git a/tests/testdata/run/webstorage/config_a.jsonc b/tests/testdata/run/webstorage/config_a.jsonc
new file mode 100644
index 000000000..875cb6001
--- /dev/null
+++ b/tests/testdata/run/webstorage/config_a.jsonc
@@ -0,0 +1,3 @@
+{
+ "compilerOptions": {}
+}
diff --git a/tests/testdata/run/webstorage/config_b.jsonc b/tests/testdata/run/webstorage/config_b.jsonc
new file mode 100644
index 000000000..875cb6001
--- /dev/null
+++ b/tests/testdata/run/webstorage/config_b.jsonc
@@ -0,0 +1,3 @@
+{
+ "compilerOptions": {}
+}
diff --git a/tests/testdata/run/webstorage/fixture.ts b/tests/testdata/run/webstorage/fixture.ts
new file mode 100644
index 000000000..cf4bd9f1f
--- /dev/null
+++ b/tests/testdata/run/webstorage/fixture.ts
@@ -0,0 +1,2 @@
+import "./logger.ts";
+import "./setter.ts";
diff --git a/tests/testdata/run/webstorage/logger.ts b/tests/testdata/run/webstorage/logger.ts
new file mode 100644
index 000000000..3898c4445
--- /dev/null
+++ b/tests/testdata/run/webstorage/logger.ts
@@ -0,0 +1 @@
+console.log(window.localStorage);
diff --git a/tests/testdata/run/webstorage/serialization.ts b/tests/testdata/run/webstorage/serialization.ts
new file mode 100644
index 000000000..f3791d355
--- /dev/null
+++ b/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/tests/testdata/run/webstorage/serialization.ts.out b/tests/testdata/run/webstorage/serialization.ts.out
new file mode 100644
index 000000000..4d80032f0
--- /dev/null
+++ b/tests/testdata/run/webstorage/serialization.ts.out
@@ -0,0 +1,2 @@
+Storage {[WILDCARD]
+Storage { hello: "deno", length: 1 }
diff --git a/tests/testdata/run/webstorage/setter.ts b/tests/testdata/run/webstorage/setter.ts
new file mode 100644
index 000000000..ec6d474f5
--- /dev/null
+++ b/tests/testdata/run/webstorage/setter.ts
@@ -0,0 +1 @@
+window.localStorage.setItem("hello", "deno");
diff --git a/tests/testdata/run/with_config/auto_discovery_log.out b/tests/testdata/run/with_config/auto_discovery_log.out
new file mode 100644
index 000000000..1a25eb9a7
--- /dev/null
+++ b/tests/testdata/run/with_config/auto_discovery_log.out
@@ -0,0 +1,4 @@
+DEBUG RS - [WILDCARD] - Config file found at '[WILDCARD]deno.jsonc'
+[WILDCARD]
+ok
+[WILDCARD]
diff --git a/tests/testdata/run/with_config/deno.jsonc b/tests/testdata/run/with_config/deno.jsonc
new file mode 100644
index 000000000..9017fac30
--- /dev/null
+++ b/tests/testdata/run/with_config/deno.jsonc
@@ -0,0 +1,6 @@
+{
+ // type settings for frontend dev
+ "compilerOptions": {
+ "lib": ["esnext", "dom"]
+ }
+}
diff --git a/tests/testdata/run/with_config/frontend_work.ts b/tests/testdata/run/with_config/frontend_work.ts
new file mode 100644
index 000000000..783af44e4
--- /dev/null
+++ b/tests/testdata/run/with_config/frontend_work.ts
@@ -0,0 +1,4 @@
+function _main() {
+ console.log(document);
+}
+console.log("ok");
diff --git a/tests/testdata/run/with_config/no_auto_discovery.out b/tests/testdata/run/with_config/no_auto_discovery.out
new file mode 100644
index 000000000..59339ebe5
--- /dev/null
+++ b/tests/testdata/run/with_config/no_auto_discovery.out
@@ -0,0 +1,4 @@
+error: TS2584 [ERROR]: Cannot find name 'document'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.
+ console.log(document);
+ ~~~~~~~~
+ at [WILDCARD]run/with_config/frontend_work.ts:2:15
diff --git a/tests/testdata/run/with_config/server_side_work.ts b/tests/testdata/run/with_config/server_side_work.ts
new file mode 100644
index 000000000..12db2ab05
--- /dev/null
+++ b/tests/testdata/run/with_config/server_side_work.ts
@@ -0,0 +1,2 @@
+const _ = Deno.build.os;
+console.log("ok");
diff --git a/tests/testdata/run/with_package_json/no_deno_json/main.out b/tests/testdata/run/with_package_json/no_deno_json/main.out
new file mode 100644
index 000000000..402b30ed4
--- /dev/null
+++ b/tests/testdata/run/with_package_json/no_deno_json/main.out
@@ -0,0 +1,4 @@
+[WILDCARD]package.json file found at '[WILDCARD]with_package_json[WILDCARD]no_deno_json[WILDCARD]package.json'
+[WILDCARD]
+ok
+[Function (anonymous)] Chalk [WILDCARD]
diff --git a/tests/testdata/run/with_package_json/no_deno_json/main.ts b/tests/testdata/run/with_package_json/no_deno_json/main.ts
new file mode 100644
index 000000000..1e6e50040
--- /dev/null
+++ b/tests/testdata/run/with_package_json/no_deno_json/main.ts
@@ -0,0 +1,4 @@
+import chalk from "chalk";
+
+console.log("ok");
+console.log(chalk);
diff --git a/tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.out b/tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.out
new file mode 100644
index 000000000..7ed6ff82d
--- /dev/null
+++ b/tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.out
@@ -0,0 +1 @@
+5
diff --git a/tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.ts b/tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.ts
new file mode 100644
index 000000000..0f3785f91
--- /dev/null
+++ b/tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.ts
@@ -0,0 +1 @@
+console.log(5);
diff --git a/tests/testdata/run/with_package_json/no_deno_json/noconfig.out b/tests/testdata/run/with_package_json/no_deno_json/noconfig.out
new file mode 100644
index 000000000..b9f9a6dea
--- /dev/null
+++ b/tests/testdata/run/with_package_json/no_deno_json/noconfig.out
@@ -0,0 +1,4 @@
+[WILDCARD]package.json auto-discovery is disabled
+[WILDCARD]
+success
+[WILDCARD]
diff --git a/tests/testdata/run/with_package_json/no_deno_json/noconfig.ts b/tests/testdata/run/with_package_json/no_deno_json/noconfig.ts
new file mode 100644
index 000000000..73b348fbc
--- /dev/null
+++ b/tests/testdata/run/with_package_json/no_deno_json/noconfig.ts
@@ -0,0 +1,8 @@
+// ensure the cwd is this directory
+const cwd = Deno.cwd();
+if (!cwd.endsWith("no_deno_json")) {
+ console.log(cwd);
+ throw "FAIL";
+} else {
+ console.log("success");
+}
diff --git a/tests/testdata/run/with_package_json/no_deno_json/package.json b/tests/testdata/run/with_package_json/no_deno_json/package.json
new file mode 100644
index 000000000..a85b890a8
--- /dev/null
+++ b/tests/testdata/run/with_package_json/no_deno_json/package.json
@@ -0,0 +1,9 @@
+{
+ "dependencies": {
+ "@denotest/check-error": "1.0.0",
+ "chalk": "4"
+ },
+ "devDependencies": {
+ "@denotest/cjs-default-export": "1.0.0"
+ }
+}
diff --git a/tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.js b/tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.js
new file mode 100644
index 000000000..492a8fa40
--- /dev/null
+++ b/tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.js
@@ -0,0 +1,3 @@
+import "chalk";
+console.log(Deno.cwd());
+console.log(Deno.statSync("../node_modules"));
diff --git a/tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.out b/tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.out
new file mode 100644
index 000000000..0ec791960
--- /dev/null
+++ b/tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.out
@@ -0,0 +1,7 @@
+Download http://[WILDCARD]
+[WILDCARD]sub_dir
+{
+ [WILDCARD]
+ isDirectory: true,
+ [WILDCARD]
+}
diff --git a/tests/testdata/run/with_package_json/npm_binary/main.out b/tests/testdata/run/with_package_json/npm_binary/main.out
new file mode 100644
index 000000000..13d196a5e
--- /dev/null
+++ b/tests/testdata/run/with_package_json/npm_binary/main.out
@@ -0,0 +1,7 @@
+[WILDCARD]package.json file found at '[WILDCARD]with_package_json[WILDCARD]npm_binary[WILDCARD]package.json'
+[WILDCARD]
+this
+is
+a
+test
+[WILDCARD]
diff --git a/tests/testdata/run/with_package_json/npm_binary/package.json b/tests/testdata/run/with_package_json/npm_binary/package.json
new file mode 100644
index 000000000..9ee3f39a8
--- /dev/null
+++ b/tests/testdata/run/with_package_json/npm_binary/package.json
@@ -0,0 +1,8 @@
+{
+ "dependencies": {
+ "@denotest/check-error": "1.0.0"
+ },
+ "devDependencies": {
+ "@denotest/cjs-default-export": "1.0.0"
+ }
+}
diff --git a/tests/testdata/run/with_package_json/with_stop/main.out b/tests/testdata/run/with_package_json/with_stop/main.out
new file mode 100644
index 000000000..b199faf8d
--- /dev/null
+++ b/tests/testdata/run/with_package_json/with_stop/main.out
@@ -0,0 +1,5 @@
+[WILDCARD]Config file found at '[WILDCARD]with_package_json[WILDCARD]with_stop[WILDCARD]some[WILDCARD]nested[WILDCARD]deno.json'
+[WILDCARD]No package.json file found
+[WILDCARD]
+error: Relative import path "chalk" not prefixed with / or ./ or ../
+ at file:///[WILDCARD]with_package_json/with_stop/some/nested/dir/main.ts:3:19
diff --git a/tests/testdata/run/with_package_json/with_stop/package.json b/tests/testdata/run/with_package_json/with_stop/package.json
new file mode 100644
index 000000000..9ee3f39a8
--- /dev/null
+++ b/tests/testdata/run/with_package_json/with_stop/package.json
@@ -0,0 +1,8 @@
+{
+ "dependencies": {
+ "@denotest/check-error": "1.0.0"
+ },
+ "devDependencies": {
+ "@denotest/cjs-default-export": "1.0.0"
+ }
+}
diff --git a/tests/testdata/run/with_package_json/with_stop/some/nested/deno.json b/tests/testdata/run/with_package_json/with_stop/some/nested/deno.json
new file mode 100644
index 000000000..36e1765d1
--- /dev/null
+++ b/tests/testdata/run/with_package_json/with_stop/some/nested/deno.json
@@ -0,0 +1,5 @@
+{
+ "tasks": {
+ "dev": "deno run main.ts"
+ }
+}
diff --git a/tests/testdata/run/with_package_json/with_stop/some/nested/dir/main.ts b/tests/testdata/run/with_package_json/with_stop/some/nested/dir/main.ts
new file mode 100644
index 000000000..6016470a1
--- /dev/null
+++ b/tests/testdata/run/with_package_json/with_stop/some/nested/dir/main.ts
@@ -0,0 +1,6 @@
+// This import should fail, because `package.json` is not discovered, as we're
+// stopping the discovery when encountering `deno.json`.
+import chalk from "chalk";
+
+console.log("ok");
+console.log(chalk);
diff --git a/tests/testdata/run/worker_close_in_wasm_reactions.js b/tests/testdata/run/worker_close_in_wasm_reactions.js
new file mode 100644
index 000000000..95f34e944
--- /dev/null
+++ b/tests/testdata/run/worker_close_in_wasm_reactions.js
@@ -0,0 +1,10 @@
+// Copyright 2018-2024 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/tests/testdata/run/worker_close_in_wasm_reactions.js.out b/tests/testdata/run/worker_close_in_wasm_reactions.js.out
new file mode 100644
index 000000000..325180de4
--- /dev/null
+++ b/tests/testdata/run/worker_close_in_wasm_reactions.js.out
@@ -0,0 +1,2 @@
+Error: CompileError: WebAssembly.compile(): reached end while decoding length: @+10
+ at file:///[WILDCARD]/close_in_wasm_reactions.js:18:13
diff --git a/tests/testdata/run/worker_close_nested.js b/tests/testdata/run/worker_close_nested.js
new file mode 100644
index 000000000..37b6ed9c9
--- /dev/null
+++ b/tests/testdata/run/worker_close_nested.js
@@ -0,0 +1,20 @@
+// Copyright 2018-2024 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/tests/testdata/run/worker_close_nested.js.out b/tests/testdata/run/worker_close_nested.js.out
new file mode 100644
index 000000000..496bc6251
--- /dev/null
+++ b/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/tests/testdata/run/worker_close_race.js b/tests/testdata/run/worker_close_race.js
new file mode 100644
index 000000000..1da832425
--- /dev/null
+++ b/tests/testdata/run/worker_close_race.js
@@ -0,0 +1,14 @@
+// Copyright 2018-2024 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/tests/testdata/run/worker_close_race.js.out b/tests/testdata/run/worker_close_race.js.out
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testdata/run/worker_close_race.js.out
diff --git a/tests/testdata/run/worker_drop_handle_race.js b/tests/testdata/run/worker_drop_handle_race.js
new file mode 100644
index 000000000..731a36964
--- /dev/null
+++ b/tests/testdata/run/worker_drop_handle_race.js
@@ -0,0 +1,12 @@
+// Copyright 2018-2024 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/tests/testdata/run/worker_drop_handle_race.js.out b/tests/testdata/run/worker_drop_handle_race.js.out
new file mode 100644
index 000000000..451c3af3d
--- /dev/null
+++ b/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 (ext:deno_web/02_timers.js:[WILDCARD])
+ at handleTimerMacrotask (ext:deno_web/02_timers.js:[WILDCARD])
+error: Uncaught (in promise) Error: Unhandled error in child worker.
+ at Worker.#pollControl [WILDCARD]
diff --git a/tests/testdata/run/worker_drop_handle_race_terminate.js b/tests/testdata/run/worker_drop_handle_race_terminate.js
new file mode 100644
index 000000000..7c4e0b109
--- /dev/null
+++ b/tests/testdata/run/worker_drop_handle_race_terminate.js
@@ -0,0 +1,37 @@
+// Copyright 2018-2024 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/tests/testdata/run/worker_drop_handle_race_terminate.js.out b/tests/testdata/run/worker_drop_handle_race_terminate.js.out
new file mode 100644
index 000000000..5ec1e7ff8
--- /dev/null
+++ b/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/tests/testdata/run/worker_event_handler_test.js b/tests/testdata/run/worker_event_handler_test.js
new file mode 100644
index 000000000..a91b0ec0b
--- /dev/null
+++ b/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/tests/testdata/run/worker_event_handler_test.js.out b/tests/testdata/run/worker_event_handler_test.js.out
new file mode 100644
index 000000000..b3eed7f6c
--- /dev/null
+++ b/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/tests/testdata/run/worker_message_before_close.js b/tests/testdata/run/worker_message_before_close.js
new file mode 100644
index 000000000..569388b9b
--- /dev/null
+++ b/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/tests/testdata/run/worker_message_before_close.js.out b/tests/testdata/run/worker_message_before_close.js.out
new file mode 100644
index 000000000..f91b7b4cb
--- /dev/null
+++ b/tests/testdata/run/worker_message_before_close.js.out
@@ -0,0 +1 @@
+received all 4 responses from the workers
diff --git a/tests/testdata/run/workspaces/basic/bar/deno.json b/tests/testdata/run/workspaces/basic/bar/deno.json
new file mode 100644
index 000000000..ef3bfc37a
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/bar/deno.json
@@ -0,0 +1,8 @@
+{
+ "name": "asdfasdfasdf",
+ "version": "0.0.0",
+ "imports": {
+ "@/": "./",
+ "secret_mod/": "./some_mod/"
+ }
+}
diff --git a/tests/testdata/run/workspaces/basic/bar/fizz/buzz.ts b/tests/testdata/run/workspaces/basic/bar/fizz/buzz.ts
new file mode 100644
index 000000000..f88d62fcc
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/bar/fizz/buzz.ts
@@ -0,0 +1 @@
+export const buzz = "buzz from bar";
diff --git a/tests/testdata/run/workspaces/basic/bar/mod.ts b/tests/testdata/run/workspaces/basic/bar/mod.ts
new file mode 100644
index 000000000..6f898e389
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/bar/mod.ts
@@ -0,0 +1,5 @@
+import { hello } from "secret_mod/hello.ts";
+import { buzz } from "@/fizz/buzz.ts";
+
+console.log(hello);
+console.log(buzz);
diff --git a/tests/testdata/run/workspaces/basic/bar/some_mod/hello.ts b/tests/testdata/run/workspaces/basic/bar/some_mod/hello.ts
new file mode 100644
index 000000000..1013de8d2
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/bar/some_mod/hello.ts
@@ -0,0 +1 @@
+export const hello = "hello from bar";
diff --git a/tests/testdata/run/workspaces/basic/deno.json b/tests/testdata/run/workspaces/basic/deno.json
new file mode 100644
index 000000000..b971c4f3d
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/deno.json
@@ -0,0 +1,9 @@
+{
+ "workspaces": [
+ "foo",
+ "bar"
+ ],
+ "imports": {
+ "chalk": "npm:chalk"
+ }
+}
diff --git a/tests/testdata/run/workspaces/basic/foo/bar/hello.ts b/tests/testdata/run/workspaces/basic/foo/bar/hello.ts
new file mode 100644
index 000000000..c8a7e57c4
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/foo/bar/hello.ts
@@ -0,0 +1 @@
+export const hello = "hello from foo";
diff --git a/tests/testdata/run/workspaces/basic/foo/deno.json b/tests/testdata/run/workspaces/basic/foo/deno.json
new file mode 100644
index 000000000..46d84f06f
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/foo/deno.json
@@ -0,0 +1,8 @@
+{
+ "name": "qwerqwer",
+ "version": "0.0.0",
+ "imports": {
+ "~/": "./",
+ "foo/": "./bar/"
+ }
+}
diff --git a/tests/testdata/run/workspaces/basic/foo/fizz/buzz.ts b/tests/testdata/run/workspaces/basic/foo/fizz/buzz.ts
new file mode 100644
index 000000000..4e03777d1
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/foo/fizz/buzz.ts
@@ -0,0 +1 @@
+export const buzz = "buzz from foo";
diff --git a/tests/testdata/run/workspaces/basic/foo/mod.ts b/tests/testdata/run/workspaces/basic/foo/mod.ts
new file mode 100644
index 000000000..d7b16dcc0
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/foo/mod.ts
@@ -0,0 +1,5 @@
+import { hello } from "foo/hello.ts";
+import { buzz } from "~/fizz/buzz.ts";
+
+console.log(hello);
+console.log(buzz);
diff --git a/tests/testdata/run/workspaces/basic/main.out b/tests/testdata/run/workspaces/basic/main.out
new file mode 100644
index 000000000..77e0de4d1
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/main.out
@@ -0,0 +1,21 @@
+[WILDCARD]Workspace config generated this import map {
+ "imports": {
+ "chalk": "npm:chalk"
+ },
+ "scopes": {
+ "./foo/": {
+ "~/": "./foo/",
+ "foo/": "./foo/bar/"
+ },
+ "./bar/": {
+ "@/": "./bar/",
+ "secret_mod/": "./bar/some_mod/"
+ }
+ }
+}
+[WILDCARD]
+hello from foo
+buzz from foo
+hello from bar
+buzz from bar
+[Function: chalk][WILDCARD] \ No newline at end of file
diff --git a/tests/testdata/run/workspaces/basic/main.ts b/tests/testdata/run/workspaces/basic/main.ts
new file mode 100644
index 000000000..380c97619
--- /dev/null
+++ b/tests/testdata/run/workspaces/basic/main.ts
@@ -0,0 +1,5 @@
+import chalk from "chalk";
+import "./foo/mod.ts";
+import "./bar/mod.ts";
+
+console.log(chalk);
diff --git a/tests/testdata/run/workspaces/member_outside_root_dir/deno.json b/tests/testdata/run/workspaces/member_outside_root_dir/deno.json
new file mode 100644
index 000000000..25feefad8
--- /dev/null
+++ b/tests/testdata/run/workspaces/member_outside_root_dir/deno.json
@@ -0,0 +1,9 @@
+{
+ "workspaces": [
+ "foo",
+ "../other_folder"
+ ],
+ "imports": {
+ "chalk": "npm:chalk"
+ }
+}
diff --git a/tests/testdata/run/workspaces/member_outside_root_dir/foo/bar/hello.ts b/tests/testdata/run/workspaces/member_outside_root_dir/foo/bar/hello.ts
new file mode 100644
index 000000000..c8a7e57c4
--- /dev/null
+++ b/tests/testdata/run/workspaces/member_outside_root_dir/foo/bar/hello.ts
@@ -0,0 +1 @@
+export const hello = "hello from foo";
diff --git a/tests/testdata/run/workspaces/member_outside_root_dir/foo/deno.json b/tests/testdata/run/workspaces/member_outside_root_dir/foo/deno.json
new file mode 100644
index 000000000..46d84f06f
--- /dev/null
+++ b/tests/testdata/run/workspaces/member_outside_root_dir/foo/deno.json
@@ -0,0 +1,8 @@
+{
+ "name": "qwerqwer",
+ "version": "0.0.0",
+ "imports": {
+ "~/": "./",
+ "foo/": "./bar/"
+ }
+}
diff --git a/tests/testdata/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts b/tests/testdata/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts
new file mode 100644
index 000000000..4e03777d1
--- /dev/null
+++ b/tests/testdata/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts
@@ -0,0 +1 @@
+export const buzz = "buzz from foo";
diff --git a/tests/testdata/run/workspaces/member_outside_root_dir/foo/mod.ts b/tests/testdata/run/workspaces/member_outside_root_dir/foo/mod.ts
new file mode 100644
index 000000000..d7b16dcc0
--- /dev/null
+++ b/tests/testdata/run/workspaces/member_outside_root_dir/foo/mod.ts
@@ -0,0 +1,5 @@
+import { hello } from "foo/hello.ts";
+import { buzz } from "~/fizz/buzz.ts";
+
+console.log(hello);
+console.log(buzz);
diff --git a/tests/testdata/run/workspaces/member_outside_root_dir/main.out b/tests/testdata/run/workspaces/member_outside_root_dir/main.out
new file mode 100644
index 000000000..205d95aea
--- /dev/null
+++ b/tests/testdata/run/workspaces/member_outside_root_dir/main.out
@@ -0,0 +1 @@
+error: Workspace member '../other_folder' is outside root configuration directory[WILDCARD] \ No newline at end of file
diff --git a/tests/testdata/run/workspaces/member_outside_root_dir/main.ts b/tests/testdata/run/workspaces/member_outside_root_dir/main.ts
new file mode 100644
index 000000000..182fd8517
--- /dev/null
+++ b/tests/testdata/run/workspaces/member_outside_root_dir/main.ts
@@ -0,0 +1,4 @@
+import chalk from "chalk";
+import "./foo/mod.ts";
+
+console.log(chalk);
diff --git a/tests/testdata/run/workspaces/nested_member/bar/deno.json b/tests/testdata/run/workspaces/nested_member/bar/deno.json
new file mode 100644
index 000000000..ef3bfc37a
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/bar/deno.json
@@ -0,0 +1,8 @@
+{
+ "name": "asdfasdfasdf",
+ "version": "0.0.0",
+ "imports": {
+ "@/": "./",
+ "secret_mod/": "./some_mod/"
+ }
+}
diff --git a/tests/testdata/run/workspaces/nested_member/bar/fizz/buzz.ts b/tests/testdata/run/workspaces/nested_member/bar/fizz/buzz.ts
new file mode 100644
index 000000000..f88d62fcc
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/bar/fizz/buzz.ts
@@ -0,0 +1 @@
+export const buzz = "buzz from bar";
diff --git a/tests/testdata/run/workspaces/nested_member/bar/mod.ts b/tests/testdata/run/workspaces/nested_member/bar/mod.ts
new file mode 100644
index 000000000..6f898e389
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/bar/mod.ts
@@ -0,0 +1,5 @@
+import { hello } from "secret_mod/hello.ts";
+import { buzz } from "@/fizz/buzz.ts";
+
+console.log(hello);
+console.log(buzz);
diff --git a/tests/testdata/run/workspaces/nested_member/bar/some_mod/hello.ts b/tests/testdata/run/workspaces/nested_member/bar/some_mod/hello.ts
new file mode 100644
index 000000000..1013de8d2
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/bar/some_mod/hello.ts
@@ -0,0 +1 @@
+export const hello = "hello from bar";
diff --git a/tests/testdata/run/workspaces/nested_member/deno.json b/tests/testdata/run/workspaces/nested_member/deno.json
new file mode 100644
index 000000000..6d9c09d4d
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/deno.json
@@ -0,0 +1,6 @@
+{
+ "workspaces": [
+ "foo",
+ "foo/bar"
+ ]
+}
diff --git a/tests/testdata/run/workspaces/nested_member/foo/bar/deno.json b/tests/testdata/run/workspaces/nested_member/foo/bar/deno.json
new file mode 100644
index 000000000..d40328b36
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/foo/bar/deno.json
@@ -0,0 +1,7 @@
+{
+ "name": "bar",
+ "version": "0.0.0",
+ "imports": {
+ "chalk": "npm:chalk"
+ }
+}
diff --git a/tests/testdata/run/workspaces/nested_member/foo/bar/hello.ts b/tests/testdata/run/workspaces/nested_member/foo/bar/hello.ts
new file mode 100644
index 000000000..9c1023153
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/foo/bar/hello.ts
@@ -0,0 +1,3 @@
+import chalk from "chalk";
+
+export default chalk;
diff --git a/tests/testdata/run/workspaces/nested_member/foo/deno.json b/tests/testdata/run/workspaces/nested_member/foo/deno.json
new file mode 100644
index 000000000..68e053b02
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/foo/deno.json
@@ -0,0 +1,7 @@
+{
+ "name": "qwerqwer",
+ "version": "0.0.0",
+ "imports": {
+ "~/": "./"
+ }
+}
diff --git a/tests/testdata/run/workspaces/nested_member/foo/fizz/buzz.ts b/tests/testdata/run/workspaces/nested_member/foo/fizz/buzz.ts
new file mode 100644
index 000000000..4e03777d1
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/foo/fizz/buzz.ts
@@ -0,0 +1 @@
+export const buzz = "buzz from foo";
diff --git a/tests/testdata/run/workspaces/nested_member/foo/mod.ts b/tests/testdata/run/workspaces/nested_member/foo/mod.ts
new file mode 100644
index 000000000..b9d4d3c04
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/foo/mod.ts
@@ -0,0 +1,3 @@
+import { buzz } from "~/fizz/buzz.ts";
+
+console.log(buzz);
diff --git a/tests/testdata/run/workspaces/nested_member/main.out b/tests/testdata/run/workspaces/nested_member/main.out
new file mode 100644
index 000000000..98598a306
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/main.out
@@ -0,0 +1 @@
+error: Workspace member 'foo/bar' is nested within other workspace member 'foo'
diff --git a/tests/testdata/run/workspaces/nested_member/main.ts b/tests/testdata/run/workspaces/nested_member/main.ts
new file mode 100644
index 000000000..2bf53f7c2
--- /dev/null
+++ b/tests/testdata/run/workspaces/nested_member/main.ts
@@ -0,0 +1,4 @@
+import "./foo/mod.ts";
+import chalk from "./foo/bar/hello.ts";
+
+console.log(chalk);