From 15a763152f9d392cb80692262f8de5ef8ae15495 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 11 Aug 2021 10:20:47 -0400 Subject: chore: move test files to testdata directory (#11601) --- .dprint.json | 8 +- .gitattributes | 4 +- cli/bench/main.rs | 41 +- cli/bench/throughput.rs | 10 +- cli/config_file.rs | 15 +- cli/file_fetcher.rs | 100 +-- cli/fs_util.rs | 8 +- cli/http_util.rs | 54 +- cli/lsp/sources.rs | 7 +- cli/module_graph.rs | 34 +- cli/specifier_handler.rs | 17 +- cli/tests/001_hello.js | 1 - cli/tests/001_hello.js.out | 1 - cli/tests/002_hello.ts | 1 - cli/tests/002_hello.ts.out | 1 - cli/tests/003_relative_import.ts | 3 - cli/tests/003_relative_import.ts.out | 2 - cli/tests/004_set_timeout.ts | 11 - cli/tests/004_set_timeout.ts.out | 2 - cli/tests/005_more_imports.ts | 11 - cli/tests/005_more_imports.ts.out | 1 - cli/tests/006_url_imports.ts | 3 - cli/tests/006_url_imports.ts.out | 2 - cli/tests/012_async.ts | 11 - cli/tests/012_async.ts.out | 3 - cli/tests/013_dynamic_import.ts | 15 - cli/tests/013_dynamic_import.ts.out | 1 - cli/tests/014_duplicate_import.ts | 9 - cli/tests/014_duplicate_import.ts.out | 1 - cli/tests/015_duplicate_parallel_import.js | 20 - cli/tests/015_duplicate_parallel_import.js.out | 1 - cli/tests/016_double_await.ts | 8 - cli/tests/016_double_await.ts.out | 2 - cli/tests/017_import_redirect.ts | 4 - cli/tests/017_import_redirect.ts.out | 1 - cli/tests/017_import_redirect_info.out | 6 - cli/tests/018_async_catch.ts | 14 - cli/tests/018_async_catch.ts.out | 3 - cli/tests/019_media_types.ts | 24 - cli/tests/019_media_types.ts.out | 1 - cli/tests/020_json_modules.ts | 2 - cli/tests/020_json_modules.ts.out | 5 - cli/tests/021_mjs_modules.ts | 2 - cli/tests/021_mjs_modules.ts.out | 1 - cli/tests/022_info_flag_script.out | 14 - cli/tests/023_no_ext | 2 - cli/tests/023_no_ext.out | 1 - cli/tests/024_import_no_ext_with_headers.ts | 1 - cli/tests/024_import_no_ext_with_headers.ts.out | 1 - cli/tests/025_hrtime.ts | 5 - cli/tests/025_hrtime.ts.out | 2 - cli/tests/025_reload_js_type_error.js | 6 - cli/tests/025_reload_js_type_error.js.out | 1 - cli/tests/026_redirect_javascript.js | 2 - cli/tests/026_redirect_javascript.js.out | 1 - cli/tests/027_redirect_typescript.ts | 2 - cli/tests/027_redirect_typescript.ts.out | 1 - cli/tests/028_args.ts | 3 - cli/tests/028_args.ts.out | 6 - cli/tests/029_eval.out | 1 - cli/tests/030_eval_ts.out | 1 - cli/tests/031_info_ts_error.out | 5 - cli/tests/031_info_ts_error.ts | 1 - cli/tests/033_import_map.out | 7 - cli/tests/033_import_map_remote.out | 5 - cli/tests/034_onload.out | 11 - cli/tests/034_onload/imported.ts | 11 - cli/tests/034_onload/main.ts | 26 - cli/tests/034_onload/nest_imported.ts | 10 - cli/tests/035_cached_only_flag.out | 1 - cli/tests/036_import_map_fetch.out | 0 cli/tests/037_fetch_multiple.out | 5 - cli/tests/038_checkjs.js | 5 - cli/tests/038_checkjs.js.out | 22 - cli/tests/038_checkjs.tsconfig.json | 6 - cli/tests/041_dyn_import_eval.out | 1 - cli/tests/041_info_flag.out | 5 - cli/tests/041_info_flag_location.out | 6 - cli/tests/042_dyn_import_evalcontext.ts | 4 - cli/tests/042_dyn_import_evalcontext.ts.out | 1 - cli/tests/044_bad_resource.ts | 3 - cli/tests/044_bad_resource.ts.out | 2 - cli/tests/045_programmatic_proxy_client.ts | 16 - cli/tests/045_proxy_client.ts | 5 - cli/tests/045_proxy_test.ts | 142 ---- cli/tests/045_proxy_test.ts.out | 6 - cli/tests/046_jsx_test.tsx | 12 - cli/tests/046_jsx_test.tsx.out | 1 - cli/tests/047_jsx_test.jsx | 7 - cli/tests/047_jsx_test.jsx.out | 1 - cli/tests/048_media_types_jsx.ts | 32 - cli/tests/048_media_types_jsx.ts.out | 2 - cli/tests/049_info_flag_script_jsx.out | 14 - cli/tests/052_no_remote_flag.out | 1 - cli/tests/053_import_compression.out | 4 - cli/tests/053_import_compression/brotli | 2 - cli/tests/053_import_compression/gziped | Bin 39 -> 0 bytes cli/tests/053_import_compression/main.ts | 13 - cli/tests/054_info_local_imports.out | 8 - cli/tests/055_info_file_json.out | 53 -- cli/tests/056_make_temp_file_write_perm.out | 1 - cli/tests/056_make_temp_file_write_perm.ts | 9 - cli/tests/058_tasks_microtasks_close.ts | 18 - cli/tests/058_tasks_microtasks_close.ts.out | 6 - cli/tests/059_fs_relative_path_perm.ts | 2 - cli/tests/059_fs_relative_path_perm.ts.out | 4 - ...o_doc_displays_all_overloads_in_details_view.ts | 6 - ...c_displays_all_overloads_in_details_view.ts.out | 12 - cli/tests/061_permissions_request.ts | 9 - cli/tests/061_permissions_request.ts.out | 3 - cli/tests/062_permissions_request_global.ts | 6 - cli/tests/062_permissions_request_global.ts.out | 3 - cli/tests/063_permissions_revoke.ts | 6 - cli/tests/063_permissions_revoke.ts.out | 3 - cli/tests/064_permissions_revoke_global.ts | 6 - cli/tests/064_permissions_revoke_global.ts.out | 3 - cli/tests/065_import_map_info.out | 5 - cli/tests/066_prompt.ts | 21 - cli/tests/066_prompt.ts.out | 10 - cli/tests/070_location.ts | 8 - cli/tests/070_location.ts.out | 15 - cli/tests/071_location_unset.ts | 3 - cli/tests/071_location_unset.ts.out | 4 - cli/tests/072_location_relative_fetch.ts | 2 - cli/tests/072_location_relative_fetch.ts.out | 2 - cli/tests/075_import_local_query_hash.ts | 2 - cli/tests/075_import_local_query_hash.ts.out | 2 - cli/tests/076_info_json_deps_order.out | 78 -- cli/tests/076_info_json_deps_order.ts | 2 - cli/tests/077_fetch_empty.ts | 1 - cli/tests/077_fetch_empty.ts.out | 2 - cli/tests/078_unload_on_exit.ts | 9 - cli/tests/078_unload_on_exit.ts.out | 1 - cli/tests/079_location_authentication.ts | 1 - cli/tests/079_location_authentication.ts.out | 3 - cli/tests/080_deno_emit_permissions.ts | 1 - cli/tests/080_deno_emit_permissions.ts.out | 2 - cli/tests/081_location_relative_fetch_redirect.ts | 2 - .../081_location_relative_fetch_redirect.ts.out | 1 - cli/tests/082_prepare_stack_trace_throw.js | 6 - cli/tests/082_prepare_stack_trace_throw.js.out | 2 - cli/tests/083_legacy_external_source_map.ts | 2 - cli/tests/084_worker_custom_inspect.ts | 4 - cli/tests/084_worker_custom_inspect.ts.out | 2 - cli/tests/084_worker_custom_inspect_worker.ts | 2 - cli/tests/085_dynamic_import_async_error.ts | 5 - cli/tests/085_dynamic_import_async_error.ts.out | 2 - cli/tests/086_dynamic_import_already_rejected.ts | 11 - .../086_dynamic_import_already_rejected.ts.out | 4 - cli/tests/087_hello.ts | 2 - .../087_no_check_imports_not_used_as_values.ts | 4 - .../087_no_check_imports_not_used_as_values.ts.out | 2 - cli/tests/088_dynamic_import_already_evaluating.ts | 2 - .../088_dynamic_import_already_evaluating.ts.out | 4 - cli/tests/088_dynamic_import_target.ts | 3 - cli/tests/089_run_allow_list.ts | 13 - cli/tests/089_run_allow_list.ts.out | 3 - cli/tests/090_run_permissions_request.ts | 9 - cli/tests/090_run_permissions_request.ts.out | 3 - cli/tests/091_use_define_for_class_fields.ts | 4 - cli/tests/091_use_define_for_class_fields.ts.out | 4 - .../092_import_map_unmapped_bare_specifier.ts | 1 - .../092_import_map_unmapped_bare_specifier.ts.out | 4 - cli/tests/095_cache_with_bare_import.ts | 1 - cli/tests/095_cache_with_bare_import.ts.out | 1 - cli/tests/Component.tsx | 1 - cli/tests/DenoWinRunner.cs | 127 --- cli/tests/DenoWinRunner.ps1 | 10 - cli/tests/README.md | 3 - cli/tests/async_error.ts | 9 - cli/tests/async_error.ts.out | 8 - cli/tests/badly_formatted.json | 12 - cli/tests/badly_formatted.md | 46 -- cli/tests/badly_formatted.mjs | 4 - cli/tests/badly_formatted_fixed.js | 2 - cli/tests/badly_formatted_fixed.json | 8 - cli/tests/badly_formatted_fixed.md | 37 - cli/tests/blob_gc_finalization.js | 11 - cli/tests/blob_gc_finalization.js.out | 1 - cli/tests/bundle.test.out | 27 - cli/tests/bundle/file_tests-fixture01.ts | 3 - cli/tests/bundle/file_tests-fixture02.ts | 4 - cli/tests/bundle/file_tests-fixture03.ts | 3 - cli/tests/bundle/file_tests-fixture04.ts | 3 - cli/tests/bundle/file_tests-fixture05.ts | 3 - cli/tests/bundle/file_tests-fixture06.ts | 4 - cli/tests/bundle/file_tests-fixture07.ts | 4 - cli/tests/bundle/file_tests-fixture08.ts | 1 - cli/tests/bundle/file_tests-fixture09.ts | 1 - cli/tests/bundle/file_tests-fixture10.ts | 7 - cli/tests/bundle/file_tests-fixture11.ts | 32 - cli/tests/bundle/file_tests-fixture12.ts | 7 - cli/tests/bundle/file_tests-fixture13.ts | 11 - cli/tests/bundle/file_tests-fixture14.ts | 4 - cli/tests/bundle/file_tests-fixture15.ts | 3 - cli/tests/bundle/file_tests-subdir-a.ts | 1 - cli/tests/bundle/file_tests-subdir-b.ts | 3 - cli/tests/bundle/file_tests-subdir-c.ts | 2 - cli/tests/bundle/file_tests-subdir-d.ts | 3 - cli/tests/bundle/file_tests-subdir-e.ts | 1 - cli/tests/bundle/file_tests-subdir-f.ts | 2 - cli/tests/bundle/file_tests-subdir-g.ts | 12 - cli/tests/bundle/file_tests-subdir-h.ts | 12 - cli/tests/bundle/file_tests-subdir-i.ts | 3 - cli/tests/bundle/file_tests-subdir-j.ts | 3 - cli/tests/bundle/file_tests-subdir-k.ts | 11 - cli/tests/bundle/file_tests-subdir-l.ts | 1 - cli/tests/bundle/file_tests-subdir-m.ts | 2 - cli/tests/bundle/file_tests-subdir-n.ts | 3 - cli/tests/bundle/file_tests-subdir-o.ts | 5 - cli/tests/bundle/file_tests-subdir-p.ts | 1 - cli/tests/bundle/file_tests-subdir-q.ts | 13 - cli/tests/bundle/fixture01.out | 7 - cli/tests/bundle/fixture02.out | 12 - cli/tests/bundle/fixture03.out | 5 - cli/tests/bundle/fixture04.out | 2 - cli/tests/bundle/fixture05.out | 2 - cli/tests/bundle/fixture06.out | 12 - cli/tests/bundle/fixture07.out | 23 - cli/tests/bundle/fixture08.out | 7 - cli/tests/bundle/fixture09.out | 19 - cli/tests/bundle/fixture10.out | 5 - cli/tests/bundle/fixture11.out | 30 - cli/tests/bundle/fixture12.out | 7 - cli/tests/bundle/fixture13.out | 17 - cli/tests/bundle/fixture14.out | 2 - cli/tests/bundle/fixture15.out | 4 - cli/tests/bundle/https_deno.land-x-lib-a.ts | 1 - cli/tests/bundle/https_deno.land-x-lib-b.js | 1 - cli/tests/bundle/https_deno.land-x-lib-c.d.ts | 1 - cli/tests/bundle/https_deno.land-x-lib-c.js | 3 - cli/tests/bundle/https_deno.land-x-lib-mod.d.ts | 9 - cli/tests/bundle/https_deno.land-x-lib-mod.js | 5 - cli/tests/bundle_dynamic_import.ts | 3 - cli/tests/bundle_im.json | 5 - cli/tests/bundle_im.ts | 17 - cli/tests/bundle_jsx.out | 10 - cli/tests/cache_extensionless.out | 2 - cli/tests/cache_random_extension.out | 2 - cli/tests/cafile_info.ts | 24 - cli/tests/cafile_info.ts.out | 13 - cli/tests/cafile_ts_fetch.ts | 3 - cli/tests/cafile_ts_fetch.ts.out | 1 - cli/tests/cafile_ts_fetch_unsafe_ssl.ts.out | 2 - cli/tests/cafile_url_imports.ts | 3 - cli/tests/cafile_url_imports.ts.out | 2 - cli/tests/cafile_url_imports_unsafe_ssl.ts.out | 3 - cli/tests/cat.ts | 10 - cli/tests/circular1.js | 2 - cli/tests/circular1.js.out | 2 - cli/tests/circular2.js | 2 - cli/tests/cjs_imports.ts | 1 - cli/tests/cjs_imports.ts.out | 1 - cli/tests/commonjs.cjs | 1 - cli/tests/compiler_api_test.ts | 504 ------------ cli/tests/complex_permissions_test.ts | 53 -- cli/tests/config.ts | 18 - cli/tests/config.ts.out | 7 - cli/tests/config.tsconfig.json | 7 - cli/tests/config_types.ts | 1 - cli/tests/config_types.ts.out | 1 - cli/tests/config_types.tsconfig.json | 7 - cli/tests/config_types_remote.tsconfig.json | 7 - cli/tests/coverage/branch.ts | 15 - cli/tests/coverage/branch_test.ts | 5 - cli/tests/coverage/complex.ts | 71 -- cli/tests/coverage/complex_test.ts | 5 - cli/tests/coverage/expected_branch.lcov | 27 - cli/tests/coverage/expected_branch.out | 12 - cli/tests/coverage/expected_complex.lcov | 53 -- cli/tests/coverage/expected_complex.out | 19 - cli/tests/delayed_error.ts | 2 - cli/tests/deno_doc.out | 2 - cli/tests/deno_doc.ts | 3 - cli/tests/deno_doc_builtin.out | 3 - cli/tests/deno_dom_0.1.3-alpha2.wasm | Bin 616631 -> 0 bytes cli/tests/deno_land_unsafe_ssl.ts | 2 - cli/tests/deno_land_unsafe_ssl.ts.out | 2 - cli/tests/disallow_http_from_https.js | 2 - cli/tests/disallow_http_from_https.ts | 2 - cli/tests/disallow_http_from_https_js.out | 3 - cli/tests/disallow_http_from_https_ts.out | 3 - cli/tests/doc/import_map.json | 5 - cli/tests/doc/invalid_url.out | 4 - cli/tests/doc/module/fun.js | 2 - cli/tests/doc/types_header.out | 6 - cli/tests/doc/types_header.ts | 1 - cli/tests/doc/types_hint.out | 5 - cli/tests/doc/types_hint.ts | 2 - cli/tests/doc/types_ref.js | 2 - cli/tests/doc/types_ref.out | 5 - cli/tests/doc/use_import_map.js | 1 - cli/tests/doc/use_import_map.out | 5 - cli/tests/dynamic_import/b.js | 2 - cli/tests/dynamic_import/c.js | 2 - cli/tests/dynamic_import/permissions_blob_local.ts | 6 - .../dynamic_import/permissions_blob_local.ts.out | 5 - .../dynamic_import/permissions_blob_remote.ts | 4 - .../dynamic_import/permissions_blob_remote.ts.out | 5 - cli/tests/dynamic_import/permissions_data_local.ts | 5 - .../dynamic_import/permissions_data_local.ts.out | 5 - .../dynamic_import/permissions_data_remote.ts | 3 - .../dynamic_import/permissions_data_remote.ts.out | 5 - .../dynamic_import/permissions_remote_remote.ts | 3 - .../permissions_remote_remote.ts.out | 5 - cli/tests/dynamic_import/static_remote.ts | 2 - cli/tests/dynamic_import_conditional.js | 3 - cli/tests/dynamic_import_conditional.js.out | 1 - cli/tests/echo.ts | 6 - cli/tests/echo_server.ts | 12 - cli/tests/encoding/utf-16be.ts | Bin 58 -> 0 bytes cli/tests/encoding/utf-16le.ts | Bin 58 -> 0 bytes cli/tests/encoding/utf-8.ts | 1 - cli/tests/encoding/windows-1255 | 1 - cli/tests/error_001.ts | 9 - cli/tests/error_001.ts.out | 6 - cli/tests/error_002.ts | 7 - cli/tests/error_002.ts.out | 6 - cli/tests/error_003_typescript.ts | 20 - cli/tests/error_003_typescript.ts.out | 7 - cli/tests/error_004_missing_module.ts | 3 - cli/tests/error_004_missing_module.ts.out | 2 - cli/tests/error_005_missing_dynamic_import.ts | 3 - cli/tests/error_005_missing_dynamic_import.ts.out | 4 - cli/tests/error_006_import_ext_failure.ts | 1 - cli/tests/error_006_import_ext_failure.ts.out | 2 - cli/tests/error_007_any.ts | 1 - cli/tests/error_007_any.ts.out | 1 - cli/tests/error_008_checkjs.js | 5 - cli/tests/error_008_checkjs.js.out | 4 - cli/tests/error_009_extensions_error.js | 2 - cli/tests/error_009_extensions_error.js.out | 6 - cli/tests/error_009_missing_js_module.disabled | 4 - cli/tests/error_009_missing_js_module.js | 1 - cli/tests/error_009_missing_js_module.js.out | 1 - cli/tests/error_010_nonexistent_arg.disabled | 4 - cli/tests/error_010_nonexistent_arg.out | 1 - cli/tests/error_011_bad_module_specifier.ts | 3 - cli/tests/error_011_bad_module_specifier.ts.out | 1 - .../error_012_bad_dynamic_import_specifier.ts | 3 - .../error_012_bad_dynamic_import_specifier.ts.out | 5 - cli/tests/error_013_missing_script.out | 1 - cli/tests/error_014_catch_dynamic_import_error.js | 31 - .../error_014_catch_dynamic_import_error.js.out | 12 - cli/tests/error_015_dynamic_import_permissions.js | 3 - cli/tests/error_015_dynamic_import_permissions.out | 4 - cli/tests/error_016_dynamic_import_permissions2.js | 5 - .../error_016_dynamic_import_permissions2.out | 4 - cli/tests/error_017_hide_long_source_ts.ts | 3 - cli/tests/error_017_hide_long_source_ts.ts.out | 3 - cli/tests/error_018_hide_long_source_js.js | 3 - cli/tests/error_018_hide_long_source_js.js.out | 2 - cli/tests/error_019_stack_function.ts | 10 - cli/tests/error_019_stack_function.ts.out | 8 - cli/tests/error_020_stack_constructor.ts | 12 - cli/tests/error_020_stack_constructor.ts.out | 8 - cli/tests/error_021_stack_method.ts | 12 - cli/tests/error_021_stack_method.ts.out | 8 - cli/tests/error_022_stack_custom_error.ts | 14 - cli/tests/error_022_stack_custom_error.ts.out | 6 - cli/tests/error_023_stack_async.ts | 12 - cli/tests/error_023_stack_async.ts.out | 10 - cli/tests/error_024_stack_promise_all.ts | 14 - cli/tests/error_024_stack_promise_all.ts.out | 10 - cli/tests/error_025_tab_indent | 9 - cli/tests/error_025_tab_indent.out | 6 - cli/tests/error_026_remote_import_error.ts | 1 - cli/tests/error_026_remote_import_error.ts.out | 7 - cli/tests/error_027_bundle_with_bare_import.ts | 1 - cli/tests/error_027_bundle_with_bare_import.ts.out | 1 - cli/tests/error_import_map_unable_to_load.out | 4 - cli/tests/error_local_static_import_from_remote.js | 1 - .../error_local_static_import_from_remote.js.out | 4 - cli/tests/error_local_static_import_from_remote.ts | 1 - .../error_local_static_import_from_remote.ts.out | 4 - cli/tests/error_missing_module_named_import.ts | 3 - cli/tests/error_missing_module_named_import.ts.out | 2 - cli/tests/error_no_check.ts | 1 - cli/tests/error_no_check.ts.out | 2 - cli/tests/error_syntax.js | 3 - cli/tests/error_syntax.js.out | 1 - cli/tests/error_syntax_empty_trailing_line.mjs | 2 - cli/tests/error_syntax_empty_trailing_line.mjs.out | 1 - cli/tests/error_type_definitions.ts | 5 - cli/tests/error_type_definitions.ts.out | 1 - cli/tests/error_worker_permissions_local.ts | 4 - cli/tests/error_worker_permissions_local.ts.out | 3 - cli/tests/error_worker_permissions_remote.ts | 4 - cli/tests/error_worker_permissions_remote.ts.out | 3 - cli/tests/es_private_fields.js | 15 - cli/tests/es_private_fields.js.out | 1 - cli/tests/esm_imports_a.js | 3 - cli/tests/esm_imports_b.js | 4 - cli/tests/exec_path.ts | 1 - cli/tests/exit_error42.ts | 3 - cli/tests/exit_error42.ts.out | 1 - cli/tests/export_type_def.ts | 2 - cli/tests/fetch/hello.txt | 1 - cli/tests/fetch/other.ts | 1 - cli/tests/fetch/test.ts | 1 - cli/tests/fetch_response_finalization.js | 16 - cli/tests/fetch_response_finalization.js.out | 2 - cli/tests/file_exists.ts | 6 - cli/tests/finalization_registry.js | 20 - cli/tests/finalization_registry.js.out | 1 - cli/tests/fix_dynamic_import_errors.js | 7 - cli/tests/fix_dynamic_import_errors.js.out | 2 - cli/tests/fix_emittable_skipped.js | 7 - cli/tests/fix_emittable_skipped.ts.out | 2 - cli/tests/fix_exotic_specifiers.ts | 3 - cli/tests/fix_exotic_specifiers.ts.out | 1 - cli/tests/fix_js_import_js.ts | 3 - cli/tests/fix_js_import_js.ts.out | 1 - cli/tests/fix_js_imports.ts | 3 - cli/tests/fix_js_imports.ts.out | 1 - cli/tests/fix_tsc_file_exists.out | 1 - cli/tests/fix_worker_dispatchevent.ts | 43 -- cli/tests/fix_worker_dispatchevent.ts.out | 1 - cli/tests/fixture.json | 14 - .../fmt/expected_fmt_check_formatted_files.out | 1 - cli/tests/fmt/expected_fmt_check_ignore.out | 1 - cli/tests/fmt/expected_fmt_check_tests_dir.out | 2 - .../expected_fmt_check_verbose_formatted_files.out | 1 - .../fmt/expected_fmt_check_verbose_tests_dir.out | 2 - cli/tests/fmt/formatted1.js | 5 - cli/tests/fmt/formatted2.ts | 5 - cli/tests/fmt/formatted3.md | 17 - cli/tests/fmt/formatted4.jsonc | 4 - cli/tests/heapstats.js | 37 - cli/tests/heapstats.js.out | 2 - cli/tests/hello.txt | 1 - cli/tests/https_import.ts | 3 - cli/tests/https_import.ts.out | 1 - cli/tests/if_main.ts | 6 - cli/tests/if_main.ts.out | 1 - cli/tests/ignore_require.js | 2 - cli/tests/import_blob_url.ts | 13 - cli/tests/import_blob_url.ts.out | 3 - cli/tests/import_blob_url_error_stack.ts | 13 - cli/tests/import_blob_url_error_stack.ts.out | 6 - cli/tests/import_blob_url_import_relative.ts | 8 - cli/tests/import_blob_url_import_relative.ts.out | 4 - cli/tests/import_blob_url_imports.ts | 11 - cli/tests/import_blob_url_imports.ts.out | 1 - cli/tests/import_blob_url_jsx.ts | 16 - cli/tests/import_blob_url_jsx.ts.out | 1 - cli/tests/import_data_url.ts | 12 - cli/tests/import_data_url.ts.out | 3 - cli/tests/import_data_url_error_stack.ts | 3 - cli/tests/import_data_url_error_stack.ts.out | 6 - cli/tests/import_data_url_import_relative.ts | 4 - cli/tests/import_data_url_import_relative.ts.out | 4 - cli/tests/import_data_url_imports.ts | 4 - cli/tests/import_data_url_imports.ts.out | 1 - cli/tests/import_data_url_jsx.ts | 10 - cli/tests/import_data_url_jsx.ts.out | 1 - cli/tests/import_dynamic_data_url.ts | 14 - cli/tests/import_dynamic_data_url.ts.out | 3 - cli/tests/import_file_with_colon.ts | 1 - cli/tests/import_file_with_colon.ts.out | 1 - cli/tests/import_maps/import_map.json | 14 - cli/tests/import_maps/import_map_remote.json | 9 - cli/tests/import_maps/lodash/lodash.ts | 1 - cli/tests/import_maps/lodash/other_file.ts | 1 - cli/tests/import_maps/moment/moment.ts | 1 - cli/tests/import_maps/moment/other_file.ts | 1 - cli/tests/import_maps/scope/scoped.ts | 2 - cli/tests/import_maps/scoped_moment.ts | 1 - cli/tests/import_maps/test.ts | 6 - cli/tests/import_maps/test_remote.ts | 5 - cli/tests/import_maps/vue.ts | 1 - cli/tests/import_meta.ts | 3 - cli/tests/import_meta.ts.out | 2 - cli/tests/import_meta2.ts | 1 - cli/tests/info/data_null_error/data_null_error.out | 6 - cli/tests/info/data_null_error/mod.ts | 1 - cli/tests/info/data_null_error/types.d.ts | 1 - cli/tests/info/types_header.out | 8 - cli/tests/info_json.out | 7 - cli/tests/info_json_location.out | 8 - cli/tests/info_missing_module.out | 6 - cli/tests/info_recursive_imports_test.out | 12 - cli/tests/info_recursive_imports_test.ts | 5 - cli/tests/info_type_import.out | 5 - cli/tests/info_type_import.ts | 3 - cli/tests/inline_js_source_map.ts | 6 - cli/tests/inline_js_source_map_2.js | 4 - cli/tests/inline_js_source_map_2.js.out | 2 - cli/tests/inline_js_source_map_2.ts | 6 - .../inline_js_source_map_2_with_inline_contents.js | 4 - ...ine_js_source_map_2_with_inline_contents.js.out | 4 - ...nline_js_source_map_with_contents_from_graph.js | 4 - ...e_js_source_map_with_contents_from_graph.js.out | 4 - cli/tests/inspector1.js | 3 - cli/tests/inspector2.js | 4 - cli/tests/inspector3.js | 7 - cli/tests/inspector4.js | 5 - cli/tests/integration/bundle_tests.rs | 62 +- cli/tests/integration/cache_tests.rs | 6 +- cli/tests/integration/compile_tests.rs | 40 +- cli/tests/integration/coverage_tests.rs | 24 +- cli/tests/integration/fmt_tests.rs | 23 +- cli/tests/integration/info_tests.rs | 10 +- cli/tests/integration/inspector_tests.rs | 18 +- cli/tests/integration/install_tests.rs | 6 +- cli/tests/integration/lsp_tests.rs | 20 +- cli/tests/integration/mod.rs | 120 ++- cli/tests/integration/repl_tests.rs | 3 +- cli/tests/integration/run_tests.rs | 113 ++- cli/tests/integration/watcher_tests.rs | 24 +- cli/tests/integration/worker_tests.rs | 2 +- cli/tests/js_import_detect.ts | 3 - cli/tests/js_import_detect.ts.out | 1 - cli/tests/jsx_import_from_ts.App.jsx | 11 - cli/tests/jsx_import_from_ts.ts | 3 - cli/tests/jsx_import_from_ts.ts.out | 1 - cli/tests/lib_dom_asynciterable.ts | 23 - cli/tests/lib_dom_asynciterable.ts.out | 2 - cli/tests/lib_ref.ts | 16 - cli/tests/lib_ref.ts.out | 2 - cli/tests/lib_runtime_api.ts | 14 - cli/tests/lib_runtime_api.ts.out | 2 - cli/tests/lint/expected.out | 3 - cli/tests/lint/expected_from_stdin.out | 3 - cli/tests/lint/expected_from_stdin_json.out | 23 - cli/tests/lint/expected_glob.out | 3 - cli/tests/lint/expected_ignore.out | 3 - cli/tests/lint/expected_json.out | 64 -- cli/tests/lint/expected_quiet.out | 14 - cli/tests/lint/expected_rules.out | 2 - cli/tests/lint/expected_verbose.out | 3 - cli/tests/lint/file1.js | 2 - cli/tests/lint/file2.ts | 6 - cli/tests/lint/ignored_file.ts | 3 - cli/tests/lint/malformed.js | 4 - cli/tests/listen_tls_alpn.ts | 12 - cli/tests/localhost_unsafe_ssl.ts.out | 3 - cli/tests/lock_check_err.json | 4 - cli/tests/lock_check_err.out | 3 - cli/tests/lock_check_err2.json | 10 - cli/tests/lock_check_err2.out | 3 - cli/tests/lock_check_err_with_bundle.json | 5 - cli/tests/lock_check_err_with_bundle.out | 4 - cli/tests/lock_check_ok.json | 4 - cli/tests/lock_check_ok2.json | 10 - cli/tests/lock_dynamic_imports.json | 6 - cli/tests/lock_dynamic_imports.out | 4 - cli/tests/lock_write_fetch.ts | 58 -- cli/tests/lock_write_fetch.ts.out | 3 - cli/tests/lock_write_requires_lock.out | 3 - cli/tests/lsp/a.d.ts | 1 - cli/tests/lsp/b.d.ts | 1 - cli/tests/lsp/code_action_ignore_lint_params.json | 39 - .../lsp/code_action_ignore_lint_response.json | 62 -- cli/tests/lsp/code_action_params.json | 39 - cli/tests/lsp/code_action_params_cache.json | 41 - cli/tests/lsp/code_action_params_deadlock.json | 38 - cli/tests/lsp/code_action_params_imports.json | 54 -- cli/tests/lsp/code_action_params_refactor.json | 21 - cli/tests/lsp/code_action_resolve_params.json | 27 - .../lsp/code_action_resolve_params_imports.json | 26 - .../lsp/code_action_resolve_params_refactor.json | 20 - cli/tests/lsp/code_action_resolve_response.json | 91 --- .../lsp/code_action_resolve_response_imports.json | 51 -- .../lsp/code_action_resolve_response_refactor.json | 58 -- cli/tests/lsp/code_action_response.json | 90 --- cli/tests/lsp/code_action_response_cache.json | 36 - cli/tests/lsp/code_action_response_imports.json | 242 ------ .../lsp/code_action_response_no_disabled.json | 22 - cli/tests/lsp/code_action_response_refactor.json | 177 ----- cli/tests/lsp/code_lens_resolve_response.json | 38 - cli/tests/lsp/code_lens_resolve_response_impl.json | 38 - cli/tests/lsp/code_lens_response.json | 34 - cli/tests/lsp/code_lens_response_changed.json | 50 -- cli/tests/lsp/code_lens_response_impl.json | 98 --- cli/tests/lsp/code_lens_response_test.json | 162 ---- .../lsp/completion_request_params_optional.json | 13 - .../lsp/completion_request_response_empty.json | 38 - cli/tests/lsp/completion_resolve_params.json | 14 - .../lsp/completion_resolve_params_optional.json | 15 - .../lsp/completion_resolve_params_registry.json | 20 - cli/tests/lsp/completion_resolve_response.json | 11 - .../lsp/completion_resolve_response_registry.json | 20 - cli/tests/lsp/diagnostics_deno_deps.json | 25 - cli/tests/lsp/diagnostics_deno_types.json | 101 --- cli/tests/lsp/did_open_params_deno_types.json | 8 - cli/tests/lsp/did_open_params_doc_symbol.json | 8 - cli/tests/lsp/did_open_params_import_hover.json | 8 - cli/tests/lsp/did_open_params_large.json | 8 - cli/tests/lsp/did_open_params_semantic_tokens.json | 8 - cli/tests/lsp/did_open_params_test_code_lens.json | 8 - cli/tests/lsp/document_symbol_response.json | 371 --------- cli/tests/lsp/formatting_mbc_response.json | 54 -- cli/tests/lsp/import-map.json | 5 - cli/tests/lsp/incoming_calls_params.json | 28 - cli/tests/lsp/incoming_calls_response.json | 42 - cli/tests/lsp/initialize_params.json | 65 -- .../lsp/initialize_params_bad_config_option.json | 65 -- .../lsp/initialize_params_ca_no_disabled.json | 64 -- .../lsp/initialize_params_code_lens_test.json | 59 -- .../initialize_params_code_lens_test_disabled.json | 64 -- .../lsp/initialize_params_did_config_change.json | 65 -- cli/tests/lsp/initialize_params_disabled.json | 63 -- cli/tests/lsp/initialize_params_registry.json | 65 -- cli/tests/lsp/initialize_params_unstable.json | 63 -- cli/tests/lsp/lib.tsconfig.json | 5 - cli/tests/lsp/outgoing_calls_params.json | 28 - cli/tests/lsp/outgoing_calls_response.json | 42 - cli/tests/lsp/prepare_call_hierarchy_response.json | 28 - cli/tests/lsp/registries/a_latest.json | 4 - cli/tests/lsp/registries/a_v1.0.0.json | 4 - cli/tests/lsp/registries/a_v1.0.1.json | 4 - cli/tests/lsp/registries/a_v2.0.0.json | 4 - cli/tests/lsp/registries/a_versions.json | 5 - cli/tests/lsp/registries/b_latest.json | 4 - cli/tests/lsp/registries/b_v0.0.1.json | 4 - cli/tests/lsp/registries/b_v0.0.2.json | 4 - cli/tests/lsp/registries/b_v0.0.3.json | 4 - cli/tests/lsp/registries/b_versions.json | 5 - .../lsp/registries/deno-import-intellisense.json | 35 - cli/tests/lsp/registries/modules.json | 4 - cli/tests/lsp/rename_response.json | 38 - cli/tests/lsp/selection_range_response.json | 86 --- cli/tests/lsp/types.tsconfig.json | 7 - cli/tests/main_module.ts | 3 - cli/tests/main_module.ts.out | 2 - cli/tests/main_module2.ts | 1 - cli/tests/module_graph/file_tests-a.mjs | 3 - cli/tests/module_graph/file_tests-b-mod.js | 1 - cli/tests/module_graph/file_tests-b.ts | 1 - cli/tests/module_graph/file_tests-c-mod.ts | 1 - .../module_graph/file_tests-checkwithconfig.ts | 5 - cli/tests/module_graph/file_tests-diag.ts | 4 - cli/tests/module_graph/file_tests-dynamicimport.ts | 5 - cli/tests/module_graph/file_tests-importjson.ts | 3 - cli/tests/module_graph/file_tests-importremap.ts | 3 - cli/tests/module_graph/file_tests-main.ts | 4 - cli/tests/module_graph/file_tests-some.json | 5 - cli/tests/module_graph/file_typesref.d.ts | 1 - cli/tests/module_graph/file_typesref.js | 3 - .../https_deno.land-std-http-server.ts | 5 - cli/tests/module_graph/https_deno.land-x-a-mod.ts | 1 - cli/tests/module_graph/https_deno.land-x-a.ts | 1 - .../module_graph/https_deno.land-x-import_map.ts | 4 - cli/tests/module_graph/https_deno.land-x-jquery.js | 3 - cli/tests/module_graph/https_deno.land-x-lib-a.ts | 1 - cli/tests/module_graph/https_deno.land-x-lib-b.js | 1 - .../module_graph/https_deno.land-x-lib-c.d.ts | 1 - cli/tests/module_graph/https_deno.land-x-lib-c.js | 3 - .../module_graph/https_deno.land-x-lib-mod.d.ts | 9 - .../module_graph/https_deno.land-x-lib-mod.js | 5 - cli/tests/module_graph/https_deno.land-x-mod.ts | 3 - .../module_graph/https_deno.land-x-transpile.tsx | 5 - .../module_graph/https_unpkg.com-lodash-index.js | 3 - cli/tests/module_graph/lockfile.json | 8 - cli/tests/module_graph/lockfile_fail.json | 8 - cli/tests/module_graph/tsconfig.json | 6 - cli/tests/module_graph/tsconfig_01.json | 13 - cli/tests/no_check_decorators.ts | 21 - cli/tests/no_check_decorators.ts.out | 3 - cli/tests/no_color.js | 1 - cli/tests/no_mem_cache.js | 33 - cli/tests/no_mem_cache.js.out | 2 - cli/tests/no_validate_asm.js | 20 - cli/tests/performance_stats.out | 16 - cli/tests/permission_test.ts | 33 - cli/tests/preserve_imports.tsconfig.json | 5 - cli/tests/proto_exploit.js | 5 - cli/tests/proto_exploit.js.out | 2 - cli/tests/raw_mode.ts | 18 - cli/tests/raw_mode_cbreak.ts | 17 - cli/tests/recursive_imports/A.ts | 7 - cli/tests/recursive_imports/B.ts | 7 - cli/tests/recursive_imports/C.ts | 8 - cli/tests/recursive_imports/common.ts | 2 - cli/tests/redirect_cache.out | 5 - cli/tests/reference_types.ts | 3 - cli/tests/reference_types.ts.out | 1 - cli/tests/reference_types_remote.ts | 3 - cli/tests/reference_types_remote.ts.out | 1 - cli/tests/resolve_dns.ts | 42 - cli/tests/resolve_dns.ts.out | 17 - cli/tests/runtime_decorators.ts | 42 - cli/tests/runtime_decorators.ts.out | 7 - cli/tests/seed_random.js | 11 - cli/tests/seed_random.js.out | 22 - cli/tests/single_compile_with_reload.ts | 18 - cli/tests/single_compile_with_reload.ts.out | 9 - cli/tests/single_compile_with_reload_dyn.ts | 11 - cli/tests/single_compile_with_reload_worker.ts | 3 - cli/tests/standalone_compiler_ops.ts | 12 - cli/tests/standalone_error.ts | 9 - cli/tests/standalone_import.ts | 2 - cli/tests/standalone_import_datauri.ts | 4 - cli/tests/standalone_runtime_flags.ts | 3 - cli/tests/std_lint.out | 3 - cli/tests/stdout_write_all.out | 1 - cli/tests/stdout_write_all.ts | 8 - cli/tests/subdir/amd_like.js | 3 - cli/tests/subdir/auto_print_hello.ts | 2 - cli/tests/subdir/circular1.ts | 7 - cli/tests/subdir/circular2.ts | 7 - cli/tests/subdir/comment.ts | 4 - cli/tests/subdir/config.json | 6 - cli/tests/subdir/emittable.d.ts | 1 - cli/tests/subdir/empty.ts | 0 cli/tests/subdir/evil_remote_import.js | 4 - cli/tests/subdir/foo_types.d.ts | 3 - cli/tests/subdir/form_urlencoded.txt | 1 - cli/tests/subdir/indirect_import_error.js | 1 - cli/tests/subdir/indirect_throws.js | 1 - cli/tests/subdir/json_1.json | 5 - cli/tests/subdir/json_2.json | 1 - cli/tests/subdir/main.ts | 3 - cli/tests/subdir/mismatch_ext.ts | 1 - cli/tests/subdir/mod1.ts | 17 - cli/tests/subdir/mod2.ts | 1 - cli/tests/subdir/mod3.js | 1 - cli/tests/subdir/mod4.js | 1 - cli/tests/subdir/mod5.mjs | 1 - cli/tests/subdir/mod6.js | 1 - cli/tests/subdir/more_decorators.ts | 18 - cli/tests/subdir/mt_application_ecmascript.j2.js | 1 - .../subdir/mt_application_ecmascript_jsx.j2.jsx | 5 - cli/tests/subdir/mt_application_x_javascript.j4.js | 1 - .../subdir/mt_application_x_javascript_jsx.j4.jsx | 5 - cli/tests/subdir/mt_application_x_typescript.t4.ts | 1 - .../subdir/mt_application_x_typescript_tsx.t4.tsx | 5 - cli/tests/subdir/mt_javascript.js | 1 - cli/tests/subdir/mt_javascript_jsx.jsx | 5 - cli/tests/subdir/mt_text_ecmascript.j3.js | 1 - cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx | 5 - cli/tests/subdir/mt_text_javascript.j1.js | 1 - cli/tests/subdir/mt_text_javascript_jsx.j1.jsx | 5 - cli/tests/subdir/mt_text_typescript.t1.ts | 1 - cli/tests/subdir/mt_text_typescript_tsx.t1.tsx | 5 - cli/tests/subdir/mt_video_mp2t.t3.ts | 1 - cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx | 5 - cli/tests/subdir/mt_video_vdn.t2.ts | 1 - cli/tests/subdir/mt_video_vdn_tsx.t2.tsx | 5 - cli/tests/subdir/no_ext | 1 - cli/tests/subdir/no_js_ext | 3 - cli/tests/subdir/polyfill.ts | 10 - cli/tests/subdir/print_hello.ts | 3 - cli/tests/subdir/redirects/a.ts | 9 - cli/tests/subdir/redirects/b.ts | 5 - cli/tests/subdir/redirects/redirect1.js | 1 - cli/tests/subdir/redirects/redirect1.ts | 1 - cli/tests/subdir/redirects/redirect2.js | 1 - cli/tests/subdir/redirects/redirect3.js | 2 - cli/tests/subdir/redirects/redirect4.ts | 2 - cli/tests/subdir/single_module.ts | 2 - cli/tests/subdir/subdir2/dynamic_import.ts | 6 - cli/tests/subdir/subdir2/mod2.ts | 9 - cli/tests/subdir/test_worker_basic.js | 14 - cli/tests/subdir/throws.js | 6 - cli/tests/subdir/tla.ts | 1 - cli/tests/subdir/type_and_code.ts | 7 - cli/tests/subdir/type_reference.d.ts | 1 - cli/tests/subdir/type_reference.js | 3 - cli/tests/subdir/types.d.ts | 1 - cli/tests/subdir/unknown_ext.deno | 1 - cli/tests/swc_syntax_error.ts | 4 - cli/tests/swc_syntax_error.ts.out | 1 - cli/tests/symlink_to_subdir | 1 - cli/tests/test/allow_all.out | 18 - cli/tests/test/allow_all.ts | 35 - cli/tests/test/allow_none.out | 51 -- cli/tests/test/allow_none.ts | 23 - cli/tests/test/clear_timeout.out | 8 - cli/tests/test/clear_timeout.ts | 5 - cli/tests/test/doc.out | 10 - cli/tests/test/doc.ts | 38 - cli/tests/test/doc_markdown.out | 7 - cli/tests/test/doc_markdown/doc.md | 25 - cli/tests/test/exit_sanitizer.out | 35 - cli/tests/test/exit_sanitizer.ts | 11 - cli/tests/test/fail.out | 81 -- cli/tests/test/fail.ts | 30 - cli/tests/test/fail_fast.out | 18 - cli/tests/test/fail_fast.ts | 30 - cli/tests/test/fail_fast_with_val.out | 23 - cli/tests/test/fail_fast_with_val.ts | 30 - cli/tests/test/finally_timeout.out | 19 - cli/tests/test/finally_timeout.ts | 11 - cli/tests/test/ignore.out | 15 - cli/tests/test/ignore.ts | 9 - cli/tests/test/ignore_permissions.out | 6 - cli/tests/test/ignore_permissions.ts | 16 - cli/tests/test/meta.out | 7 - cli/tests/test/meta.ts | 2 - cli/tests/test/no_check.out | 8 - cli/tests/test/no_check.ts | 1 - cli/tests/test/no_color.ts | 17 - cli/tests/test/no_run.out | 5 - cli/tests/test/no_run.ts | 1 - cli/tests/test/only.out | 7 - cli/tests/test/only.ts | 15 - cli/tests/test/pass.out | 15 - cli/tests/test/pass.ts | 10 - cli/tests/test/quiet.out | 8 - cli/tests/test/quiet.ts | 15 - cli/tests/test/shuffle.out | 39 - cli/tests/test/shuffle/bar_test.ts | 3 - cli/tests/test/shuffle/baz_test.ts | 3 - cli/tests/test/shuffle/foo_test.ts | 3 - cli/tests/test/unhandled_rejection.out | 10 - cli/tests/test/unhandled_rejection.ts | 3 - cli/tests/test/unresolved_promise.out | 6 - cli/tests/test/unresolved_promise.ts | 11 - cli/tests/testdata/001_hello.js | 1 + cli/tests/testdata/001_hello.js.out | 1 + cli/tests/testdata/002_hello.ts | 1 + cli/tests/testdata/002_hello.ts.out | 1 + cli/tests/testdata/003_relative_import.ts | 3 + cli/tests/testdata/003_relative_import.ts.out | 2 + cli/tests/testdata/004_set_timeout.ts | 11 + cli/tests/testdata/004_set_timeout.ts.out | 2 + cli/tests/testdata/005_more_imports.ts | 11 + cli/tests/testdata/005_more_imports.ts.out | 1 + cli/tests/testdata/006_url_imports.ts | 3 + cli/tests/testdata/006_url_imports.ts.out | 2 + cli/tests/testdata/012_async.ts | 11 + cli/tests/testdata/012_async.ts.out | 3 + cli/tests/testdata/013_dynamic_import.ts | 15 + cli/tests/testdata/013_dynamic_import.ts.out | 1 + cli/tests/testdata/014_duplicate_import.ts | 9 + cli/tests/testdata/014_duplicate_import.ts.out | 1 + .../testdata/015_duplicate_parallel_import.js | 20 + .../testdata/015_duplicate_parallel_import.js.out | 1 + cli/tests/testdata/016_double_await.ts | 8 + cli/tests/testdata/016_double_await.ts.out | 2 + cli/tests/testdata/017_import_redirect.ts | 4 + cli/tests/testdata/017_import_redirect.ts.out | 1 + cli/tests/testdata/017_import_redirect_info.out | 6 + cli/tests/testdata/018_async_catch.ts | 14 + cli/tests/testdata/018_async_catch.ts.out | 3 + cli/tests/testdata/019_media_types.ts | 24 + cli/tests/testdata/019_media_types.ts.out | 1 + cli/tests/testdata/020_json_modules.ts | 2 + cli/tests/testdata/020_json_modules.ts.out | 5 + cli/tests/testdata/021_mjs_modules.ts | 2 + cli/tests/testdata/021_mjs_modules.ts.out | 1 + cli/tests/testdata/022_info_flag_script.out | 14 + cli/tests/testdata/023_no_ext | 2 + cli/tests/testdata/023_no_ext.out | 1 + .../testdata/024_import_no_ext_with_headers.ts | 1 + .../testdata/024_import_no_ext_with_headers.ts.out | 1 + cli/tests/testdata/025_hrtime.ts | 5 + cli/tests/testdata/025_hrtime.ts.out | 2 + cli/tests/testdata/025_reload_js_type_error.js | 6 + cli/tests/testdata/025_reload_js_type_error.js.out | 1 + cli/tests/testdata/026_redirect_javascript.js | 2 + cli/tests/testdata/026_redirect_javascript.js.out | 1 + cli/tests/testdata/027_redirect_typescript.ts | 2 + cli/tests/testdata/027_redirect_typescript.ts.out | 1 + cli/tests/testdata/028_args.ts | 3 + cli/tests/testdata/028_args.ts.out | 6 + cli/tests/testdata/029_eval.out | 1 + cli/tests/testdata/030_eval_ts.out | 1 + cli/tests/testdata/031_info_ts_error.out | 5 + cli/tests/testdata/031_info_ts_error.ts | 1 + cli/tests/testdata/033_import_map.out | 7 + cli/tests/testdata/033_import_map_remote.out | 5 + cli/tests/testdata/034_onload.out | 11 + cli/tests/testdata/034_onload/imported.ts | 11 + cli/tests/testdata/034_onload/main.ts | 26 + cli/tests/testdata/034_onload/nest_imported.ts | 10 + cli/tests/testdata/035_cached_only_flag.out | 1 + cli/tests/testdata/036_import_map_fetch.out | 0 cli/tests/testdata/037_fetch_multiple.out | 5 + cli/tests/testdata/038_checkjs.js | 5 + cli/tests/testdata/038_checkjs.js.out | 22 + cli/tests/testdata/038_checkjs.tsconfig.json | 6 + cli/tests/testdata/041_dyn_import_eval.out | 1 + cli/tests/testdata/041_info_flag.out | 5 + cli/tests/testdata/041_info_flag_location.out | 6 + cli/tests/testdata/042_dyn_import_evalcontext.ts | 4 + .../testdata/042_dyn_import_evalcontext.ts.out | 1 + cli/tests/testdata/044_bad_resource.ts | 3 + cli/tests/testdata/044_bad_resource.ts.out | 2 + cli/tests/testdata/045_mod.ts | 5 + cli/tests/testdata/045_output.ts | 3 + .../testdata/045_programmatic_proxy_client.ts | 16 + cli/tests/testdata/045_proxy_client.ts | 5 + cli/tests/testdata/045_proxy_test.ts | 142 ++++ cli/tests/testdata/045_proxy_test.ts.out | 6 + cli/tests/testdata/046_jsx_test.tsx | 12 + cli/tests/testdata/046_jsx_test.tsx.out | 1 + cli/tests/testdata/047_jsx_test.jsx | 7 + cli/tests/testdata/047_jsx_test.jsx.out | 1 + cli/tests/testdata/048_media_types_jsx.ts | 32 + cli/tests/testdata/048_media_types_jsx.ts.out | 2 + cli/tests/testdata/049_info_flag_script_jsx.out | 14 + cli/tests/testdata/052_no_remote_flag.out | 1 + cli/tests/testdata/053_import_compression.out | 4 + cli/tests/testdata/053_import_compression/brotli | 2 + cli/tests/testdata/053_import_compression/gziped | Bin 0 -> 39 bytes cli/tests/testdata/053_import_compression/main.ts | 13 + cli/tests/testdata/054_info_local_imports.out | 8 + cli/tests/testdata/055_info_file_json.out | 53 ++ .../testdata/056_make_temp_file_write_perm.out | 1 + .../testdata/056_make_temp_file_write_perm.ts | 9 + cli/tests/testdata/058_tasks_microtasks_close.ts | 18 + .../testdata/058_tasks_microtasks_close.ts.out | 6 + cli/tests/testdata/059_fs_relative_path_perm.ts | 2 + .../testdata/059_fs_relative_path_perm.ts.out | 4 + ...o_doc_displays_all_overloads_in_details_view.ts | 6 + ...c_displays_all_overloads_in_details_view.ts.out | 12 + cli/tests/testdata/061_permissions_request.ts | 9 + cli/tests/testdata/061_permissions_request.ts.out | 3 + .../testdata/062_permissions_request_global.ts | 6 + .../testdata/062_permissions_request_global.ts.out | 3 + cli/tests/testdata/063_permissions_revoke.ts | 6 + cli/tests/testdata/063_permissions_revoke.ts.out | 3 + .../testdata/064_permissions_revoke_global.ts | 6 + .../testdata/064_permissions_revoke_global.ts.out | 3 + cli/tests/testdata/065_import_map_info.out | 5 + cli/tests/testdata/066_prompt.ts | 21 + cli/tests/testdata/066_prompt.ts.out | 10 + cli/tests/testdata/070_location.ts | 8 + cli/tests/testdata/070_location.ts.out | 15 + cli/tests/testdata/071_location_unset.ts | 3 + cli/tests/testdata/071_location_unset.ts.out | 4 + cli/tests/testdata/072_location_relative_fetch.ts | 2 + .../testdata/072_location_relative_fetch.ts.out | 2 + cli/tests/testdata/075_import_local_query_hash.ts | 2 + .../testdata/075_import_local_query_hash.ts.out | 2 + cli/tests/testdata/076_info_json_deps_order.out | 78 ++ cli/tests/testdata/076_info_json_deps_order.ts | 2 + cli/tests/testdata/077_fetch_empty.ts | 1 + cli/tests/testdata/077_fetch_empty.ts.out | 2 + cli/tests/testdata/078_unload_on_exit.ts | 9 + cli/tests/testdata/078_unload_on_exit.ts.out | 1 + cli/tests/testdata/079_location_authentication.ts | 1 + .../testdata/079_location_authentication.ts.out | 3 + cli/tests/testdata/080_deno_emit_permissions.ts | 1 + .../testdata/080_deno_emit_permissions.ts.out | 2 + .../081_location_relative_fetch_redirect.ts | 2 + .../081_location_relative_fetch_redirect.ts.out | 1 + .../testdata/082_prepare_stack_trace_throw.js | 6 + .../testdata/082_prepare_stack_trace_throw.js.out | 2 + .../testdata/083_legacy_external_source_map.ts | 2 + cli/tests/testdata/084_worker_custom_inspect.ts | 4 + .../testdata/084_worker_custom_inspect.ts.out | 2 + .../testdata/084_worker_custom_inspect_worker.ts | 2 + .../testdata/085_dynamic_import_async_error.ts | 5 + .../testdata/085_dynamic_import_async_error.ts.out | 2 + .../086_dynamic_import_already_rejected.ts | 11 + .../086_dynamic_import_already_rejected.ts.out | 4 + cli/tests/testdata/087_hello.ts | 2 + .../087_no_check_imports_not_used_as_values.ts | 4 + .../087_no_check_imports_not_used_as_values.ts.out | 2 + .../088_dynamic_import_already_evaluating.ts | 2 + .../088_dynamic_import_already_evaluating.ts.out | 4 + cli/tests/testdata/088_dynamic_import_target.ts | 3 + cli/tests/testdata/089_run_allow_list.ts | 13 + cli/tests/testdata/089_run_allow_list.ts.out | 3 + cli/tests/testdata/090_run_permissions_request.ts | 9 + .../testdata/090_run_permissions_request.ts.out | 3 + .../testdata/091_use_define_for_class_fields.ts | 4 + .../091_use_define_for_class_fields.ts.out | 4 + .../092_import_map_unmapped_bare_specifier.ts | 1 + .../092_import_map_unmapped_bare_specifier.ts.out | 4 + cli/tests/testdata/095_cache_with_bare_import.ts | 1 + .../testdata/095_cache_with_bare_import.ts.out | 1 + cli/tests/testdata/Component.tsx | 1 + cli/tests/testdata/DenoWinRunner.cs | 127 +++ cli/tests/testdata/DenoWinRunner.ps1 | 10 + cli/tests/testdata/async_error.ts | 9 + cli/tests/testdata/async_error.ts.out | 8 + cli/tests/testdata/badly_formatted.json | 12 + cli/tests/testdata/badly_formatted.md | 46 ++ cli/tests/testdata/badly_formatted.mjs | 4 + cli/tests/testdata/badly_formatted_fixed.js | 2 + cli/tests/testdata/badly_formatted_fixed.json | 8 + cli/tests/testdata/badly_formatted_fixed.md | 37 + cli/tests/testdata/blob_gc_finalization.js | 11 + cli/tests/testdata/blob_gc_finalization.js.out | 1 + cli/tests/testdata/bundle.test.out | 27 + cli/tests/testdata/bundle/file_tests-fixture01.ts | 3 + cli/tests/testdata/bundle/file_tests-fixture02.ts | 4 + cli/tests/testdata/bundle/file_tests-fixture03.ts | 3 + cli/tests/testdata/bundle/file_tests-fixture04.ts | 3 + cli/tests/testdata/bundle/file_tests-fixture05.ts | 3 + cli/tests/testdata/bundle/file_tests-fixture06.ts | 4 + cli/tests/testdata/bundle/file_tests-fixture07.ts | 4 + cli/tests/testdata/bundle/file_tests-fixture08.ts | 1 + cli/tests/testdata/bundle/file_tests-fixture09.ts | 1 + cli/tests/testdata/bundle/file_tests-fixture10.ts | 7 + cli/tests/testdata/bundle/file_tests-fixture11.ts | 32 + cli/tests/testdata/bundle/file_tests-fixture12.ts | 7 + cli/tests/testdata/bundle/file_tests-fixture13.ts | 11 + cli/tests/testdata/bundle/file_tests-fixture14.ts | 4 + cli/tests/testdata/bundle/file_tests-fixture15.ts | 3 + cli/tests/testdata/bundle/file_tests-subdir-a.ts | 1 + cli/tests/testdata/bundle/file_tests-subdir-b.ts | 3 + cli/tests/testdata/bundle/file_tests-subdir-c.ts | 2 + cli/tests/testdata/bundle/file_tests-subdir-d.ts | 3 + cli/tests/testdata/bundle/file_tests-subdir-e.ts | 1 + cli/tests/testdata/bundle/file_tests-subdir-f.ts | 2 + cli/tests/testdata/bundle/file_tests-subdir-g.ts | 12 + cli/tests/testdata/bundle/file_tests-subdir-h.ts | 12 + cli/tests/testdata/bundle/file_tests-subdir-i.ts | 3 + cli/tests/testdata/bundle/file_tests-subdir-j.ts | 3 + cli/tests/testdata/bundle/file_tests-subdir-k.ts | 11 + cli/tests/testdata/bundle/file_tests-subdir-l.ts | 1 + cli/tests/testdata/bundle/file_tests-subdir-m.ts | 2 + cli/tests/testdata/bundle/file_tests-subdir-n.ts | 3 + cli/tests/testdata/bundle/file_tests-subdir-o.ts | 5 + cli/tests/testdata/bundle/file_tests-subdir-p.ts | 1 + cli/tests/testdata/bundle/file_tests-subdir-q.ts | 13 + cli/tests/testdata/bundle/fixture01.out | 7 + cli/tests/testdata/bundle/fixture02.out | 12 + cli/tests/testdata/bundle/fixture03.out | 5 + cli/tests/testdata/bundle/fixture04.out | 2 + cli/tests/testdata/bundle/fixture05.out | 2 + cli/tests/testdata/bundle/fixture06.out | 12 + cli/tests/testdata/bundle/fixture07.out | 23 + cli/tests/testdata/bundle/fixture08.out | 7 + cli/tests/testdata/bundle/fixture09.out | 19 + cli/tests/testdata/bundle/fixture10.out | 5 + cli/tests/testdata/bundle/fixture11.out | 30 + cli/tests/testdata/bundle/fixture12.out | 7 + cli/tests/testdata/bundle/fixture13.out | 17 + cli/tests/testdata/bundle/fixture14.out | 2 + cli/tests/testdata/bundle/fixture15.out | 4 + .../testdata/bundle/https_deno.land-x-lib-a.ts | 1 + .../testdata/bundle/https_deno.land-x-lib-b.js | 1 + .../testdata/bundle/https_deno.land-x-lib-c.d.ts | 1 + .../testdata/bundle/https_deno.land-x-lib-c.js | 3 + .../testdata/bundle/https_deno.land-x-lib-mod.d.ts | 9 + .../testdata/bundle/https_deno.land-x-lib-mod.js | 5 + cli/tests/testdata/bundle_dynamic_import.ts | 3 + cli/tests/testdata/bundle_im.json | 5 + cli/tests/testdata/bundle_im.ts | 17 + cli/tests/testdata/bundle_jsx.out | 10 + cli/tests/testdata/cache_extensionless.out | 2 + cli/tests/testdata/cache_random_extension.out | 2 + cli/tests/testdata/cafile_info.ts | 24 + cli/tests/testdata/cafile_info.ts.out | 13 + cli/tests/testdata/cafile_ts_fetch.ts | 3 + cli/tests/testdata/cafile_ts_fetch.ts.out | 1 + .../testdata/cafile_ts_fetch_unsafe_ssl.ts.out | 2 + cli/tests/testdata/cafile_url_imports.ts | 3 + cli/tests/testdata/cafile_url_imports.ts.out | 2 + .../testdata/cafile_url_imports_unsafe_ssl.ts.out | 3 + cli/tests/testdata/cat.ts | 10 + cli/tests/testdata/circular1.js | 2 + cli/tests/testdata/circular1.js.out | 2 + cli/tests/testdata/circular2.js | 2 + cli/tests/testdata/cjs_imports.ts | 1 + cli/tests/testdata/cjs_imports.ts.out | 1 + cli/tests/testdata/commonjs.cjs | 1 + cli/tests/testdata/compiler_api_test.ts | 504 ++++++++++++ cli/tests/testdata/complex_permissions_test.ts | 53 ++ cli/tests/testdata/config.ts | 18 + cli/tests/testdata/config.ts.out | 7 + cli/tests/testdata/config.tsconfig.json | 7 + cli/tests/testdata/config_types.ts | 1 + cli/tests/testdata/config_types.ts.out | 1 + cli/tests/testdata/config_types.tsconfig.json | 7 + .../testdata/config_types_remote.tsconfig.json | 7 + cli/tests/testdata/coverage/branch.ts | 15 + cli/tests/testdata/coverage/branch_test.ts | 5 + cli/tests/testdata/coverage/complex.ts | 71 ++ cli/tests/testdata/coverage/complex_test.ts | 5 + cli/tests/testdata/coverage/expected_branch.lcov | 27 + cli/tests/testdata/coverage/expected_branch.out | 12 + cli/tests/testdata/coverage/expected_complex.lcov | 53 ++ cli/tests/testdata/coverage/expected_complex.out | 19 + cli/tests/testdata/delayed_error.ts | 2 + cli/tests/testdata/deno_doc.out | 2 + cli/tests/testdata/deno_doc.ts | 3 + cli/tests/testdata/deno_doc_builtin.out | 3 + cli/tests/testdata/deno_dom_0.1.3-alpha2.wasm | Bin 0 -> 616631 bytes cli/tests/testdata/deno_land_unsafe_ssl.ts | 2 + cli/tests/testdata/deno_land_unsafe_ssl.ts.out | 2 + cli/tests/testdata/disallow_http_from_https.js | 2 + cli/tests/testdata/disallow_http_from_https.ts | 2 + cli/tests/testdata/disallow_http_from_https_js.out | 3 + cli/tests/testdata/disallow_http_from_https_ts.out | 3 + cli/tests/testdata/doc/import_map.json | 5 + cli/tests/testdata/doc/invalid_url.out | 4 + cli/tests/testdata/doc/module/fun.js | 2 + cli/tests/testdata/doc/types_header.out | 6 + cli/tests/testdata/doc/types_header.ts | 1 + cli/tests/testdata/doc/types_hint.out | 5 + cli/tests/testdata/doc/types_hint.ts | 2 + cli/tests/testdata/doc/types_ref.js | 2 + cli/tests/testdata/doc/types_ref.out | 5 + cli/tests/testdata/doc/use_import_map.js | 1 + cli/tests/testdata/doc/use_import_map.out | 5 + cli/tests/testdata/dynamic_import/b.js | 2 + cli/tests/testdata/dynamic_import/c.js | 2 + .../dynamic_import/permissions_blob_local.ts | 6 + .../dynamic_import/permissions_blob_local.ts.out | 5 + .../dynamic_import/permissions_blob_remote.ts | 4 + .../dynamic_import/permissions_blob_remote.ts.out | 5 + .../dynamic_import/permissions_data_local.ts | 5 + .../dynamic_import/permissions_data_local.ts.out | 5 + .../dynamic_import/permissions_data_remote.ts | 3 + .../dynamic_import/permissions_data_remote.ts.out | 5 + .../dynamic_import/permissions_remote_remote.ts | 3 + .../permissions_remote_remote.ts.out | 5 + cli/tests/testdata/dynamic_import/static_remote.ts | 2 + cli/tests/testdata/dynamic_import_conditional.js | 3 + .../testdata/dynamic_import_conditional.js.out | 1 + cli/tests/testdata/echo.ts | 6 + cli/tests/testdata/echo_server.ts | 12 + cli/tests/testdata/encoding/utf-16be.ts | Bin 0 -> 58 bytes cli/tests/testdata/encoding/utf-16le.ts | Bin 0 -> 58 bytes cli/tests/testdata/encoding/utf-8.ts | 1 + cli/tests/testdata/encoding/windows-1255 | 1 + cli/tests/testdata/error_001.ts | 9 + cli/tests/testdata/error_001.ts.out | 6 + cli/tests/testdata/error_002.ts | 7 + cli/tests/testdata/error_002.ts.out | 6 + cli/tests/testdata/error_003_typescript.ts | 20 + cli/tests/testdata/error_003_typescript.ts.out | 7 + cli/tests/testdata/error_004_missing_module.ts | 3 + cli/tests/testdata/error_004_missing_module.ts.out | 2 + .../testdata/error_005_missing_dynamic_import.ts | 3 + .../error_005_missing_dynamic_import.ts.out | 4 + cli/tests/testdata/error_006_import_ext_failure.ts | 1 + .../testdata/error_006_import_ext_failure.ts.out | 2 + cli/tests/testdata/error_007_any.ts | 1 + cli/tests/testdata/error_007_any.ts.out | 1 + cli/tests/testdata/error_008_checkjs.js | 5 + cli/tests/testdata/error_008_checkjs.js.out | 4 + cli/tests/testdata/error_009_extensions_error.js | 2 + .../testdata/error_009_extensions_error.js.out | 6 + .../testdata/error_009_missing_js_module.disabled | 4 + cli/tests/testdata/error_009_missing_js_module.js | 1 + .../testdata/error_009_missing_js_module.js.out | 1 + .../testdata/error_010_nonexistent_arg.disabled | 4 + cli/tests/testdata/error_010_nonexistent_arg.out | 1 + .../testdata/error_011_bad_module_specifier.ts | 3 + .../testdata/error_011_bad_module_specifier.ts.out | 1 + .../error_012_bad_dynamic_import_specifier.ts | 3 + .../error_012_bad_dynamic_import_specifier.ts.out | 5 + cli/tests/testdata/error_013_missing_script.out | 1 + .../error_014_catch_dynamic_import_error.js | 31 + .../error_014_catch_dynamic_import_error.js.out | 12 + .../error_015_dynamic_import_permissions.js | 3 + .../error_015_dynamic_import_permissions.out | 4 + .../error_016_dynamic_import_permissions2.js | 5 + .../error_016_dynamic_import_permissions2.out | 4 + .../testdata/error_017_hide_long_source_ts.ts | 3 + .../testdata/error_017_hide_long_source_ts.ts.out | 3 + .../testdata/error_018_hide_long_source_js.js | 3 + .../testdata/error_018_hide_long_source_js.js.out | 2 + cli/tests/testdata/error_019_stack_function.ts | 10 + cli/tests/testdata/error_019_stack_function.ts.out | 8 + cli/tests/testdata/error_020_stack_constructor.ts | 12 + .../testdata/error_020_stack_constructor.ts.out | 8 + cli/tests/testdata/error_021_stack_method.ts | 12 + cli/tests/testdata/error_021_stack_method.ts.out | 8 + cli/tests/testdata/error_022_stack_custom_error.ts | 14 + .../testdata/error_022_stack_custom_error.ts.out | 6 + cli/tests/testdata/error_023_stack_async.ts | 12 + cli/tests/testdata/error_023_stack_async.ts.out | 10 + cli/tests/testdata/error_024_stack_promise_all.ts | 14 + .../testdata/error_024_stack_promise_all.ts.out | 10 + cli/tests/testdata/error_025_tab_indent | 9 + cli/tests/testdata/error_025_tab_indent.out | 6 + .../testdata/error_026_remote_import_error.ts | 1 + .../testdata/error_026_remote_import_error.ts.out | 7 + .../testdata/error_027_bundle_with_bare_import.ts | 1 + .../error_027_bundle_with_bare_import.ts.out | 1 + .../testdata/error_import_map_unable_to_load.out | 4 + .../error_local_static_import_from_remote.js | 1 + .../error_local_static_import_from_remote.js.out | 4 + .../error_local_static_import_from_remote.ts | 1 + .../error_local_static_import_from_remote.ts.out | 4 + .../testdata/error_missing_module_named_import.ts | 3 + .../error_missing_module_named_import.ts.out | 2 + cli/tests/testdata/error_no_check.ts | 1 + cli/tests/testdata/error_no_check.ts.out | 2 + cli/tests/testdata/error_syntax.js | 3 + cli/tests/testdata/error_syntax.js.out | 1 + .../testdata/error_syntax_empty_trailing_line.mjs | 2 + .../error_syntax_empty_trailing_line.mjs.out | 1 + cli/tests/testdata/error_type_definitions.ts | 5 + cli/tests/testdata/error_type_definitions.ts.out | 1 + .../testdata/error_worker_permissions_local.ts | 4 + .../testdata/error_worker_permissions_local.ts.out | 3 + .../testdata/error_worker_permissions_remote.ts | 4 + .../error_worker_permissions_remote.ts.out | 3 + cli/tests/testdata/es_private_fields.js | 15 + cli/tests/testdata/es_private_fields.js.out | 1 + cli/tests/testdata/esm_imports_a.js | 3 + cli/tests/testdata/esm_imports_b.js | 4 + cli/tests/testdata/exec_path.ts | 1 + cli/tests/testdata/exit_error42.ts | 3 + cli/tests/testdata/exit_error42.ts.out | 1 + cli/tests/testdata/export_type_def.ts | 2 + cli/tests/testdata/fetch/hello.txt | 1 + cli/tests/testdata/fetch/other.ts | 1 + cli/tests/testdata/fetch/test.ts | 1 + cli/tests/testdata/fetch_response_finalization.js | 16 + .../testdata/fetch_response_finalization.js.out | 2 + cli/tests/testdata/file_exists.ts | 6 + cli/tests/testdata/finalization_registry.js | 20 + cli/tests/testdata/finalization_registry.js.out | 1 + cli/tests/testdata/fix_dynamic_import_errors.js | 7 + .../testdata/fix_dynamic_import_errors.js.out | 2 + cli/tests/testdata/fix_emittable_skipped.js | 7 + cli/tests/testdata/fix_emittable_skipped.ts.out | 2 + cli/tests/testdata/fix_exotic_specifiers.ts | 3 + cli/tests/testdata/fix_exotic_specifiers.ts.out | 1 + cli/tests/testdata/fix_js_import_js.ts | 3 + cli/tests/testdata/fix_js_import_js.ts.out | 1 + cli/tests/testdata/fix_js_imports.ts | 3 + cli/tests/testdata/fix_js_imports.ts.out | 1 + cli/tests/testdata/fix_tsc_file_exists.out | 1 + cli/tests/testdata/fix_worker_dispatchevent.ts | 43 ++ cli/tests/testdata/fix_worker_dispatchevent.ts.out | 1 + cli/tests/testdata/fixture.json | 14 + .../fmt/expected_fmt_check_formatted_files.out | 1 + .../testdata/fmt/expected_fmt_check_ignore.out | 1 + .../testdata/fmt/expected_fmt_check_tests_dir.out | 2 + .../expected_fmt_check_verbose_formatted_files.out | 1 + .../fmt/expected_fmt_check_verbose_tests_dir.out | 2 + cli/tests/testdata/fmt/formatted1.js | 5 + cli/tests/testdata/fmt/formatted2.ts | 5 + cli/tests/testdata/fmt/formatted3.md | 17 + cli/tests/testdata/fmt/formatted4.jsonc | 4 + cli/tests/testdata/heapstats.js | 37 + cli/tests/testdata/heapstats.js.out | 2 + cli/tests/testdata/hello.txt | 1 + cli/tests/testdata/https_import.ts | 3 + cli/tests/testdata/https_import.ts.out | 1 + cli/tests/testdata/if_main.ts | 6 + cli/tests/testdata/if_main.ts.out | 1 + cli/tests/testdata/ignore_require.js | 2 + cli/tests/testdata/import_blob_url.ts | 13 + cli/tests/testdata/import_blob_url.ts.out | 3 + cli/tests/testdata/import_blob_url_error_stack.ts | 13 + .../testdata/import_blob_url_error_stack.ts.out | 6 + .../testdata/import_blob_url_import_relative.ts | 8 + .../import_blob_url_import_relative.ts.out | 4 + cli/tests/testdata/import_blob_url_imports.ts | 11 + cli/tests/testdata/import_blob_url_imports.ts.out | 1 + cli/tests/testdata/import_blob_url_jsx.ts | 16 + cli/tests/testdata/import_blob_url_jsx.ts.out | 1 + cli/tests/testdata/import_data_url.ts | 12 + cli/tests/testdata/import_data_url.ts.out | 3 + cli/tests/testdata/import_data_url_error_stack.ts | 3 + .../testdata/import_data_url_error_stack.ts.out | 6 + .../testdata/import_data_url_import_relative.ts | 4 + .../import_data_url_import_relative.ts.out | 4 + cli/tests/testdata/import_data_url_imports.ts | 4 + cli/tests/testdata/import_data_url_imports.ts.out | 1 + cli/tests/testdata/import_data_url_jsx.ts | 10 + cli/tests/testdata/import_data_url_jsx.ts.out | 1 + cli/tests/testdata/import_dynamic_data_url.ts | 14 + cli/tests/testdata/import_dynamic_data_url.ts.out | 3 + cli/tests/testdata/import_file_with_colon.ts | 1 + cli/tests/testdata/import_file_with_colon.ts.out | 1 + cli/tests/testdata/import_maps/import_map.json | 14 + .../testdata/import_maps/import_map_remote.json | 9 + cli/tests/testdata/import_maps/lodash/lodash.ts | 1 + .../testdata/import_maps/lodash/other_file.ts | 1 + cli/tests/testdata/import_maps/moment/moment.ts | 1 + .../testdata/import_maps/moment/other_file.ts | 1 + cli/tests/testdata/import_maps/scope/scoped.ts | 2 + cli/tests/testdata/import_maps/scoped_moment.ts | 1 + cli/tests/testdata/import_maps/test.ts | 6 + cli/tests/testdata/import_maps/test_remote.ts | 5 + cli/tests/testdata/import_maps/vue.ts | 1 + cli/tests/testdata/import_meta.ts | 3 + cli/tests/testdata/import_meta.ts.out | 2 + cli/tests/testdata/import_meta2.ts | 1 + .../info/data_null_error/data_null_error.out | 6 + cli/tests/testdata/info/data_null_error/mod.ts | 1 + cli/tests/testdata/info/data_null_error/types.d.ts | 1 + cli/tests/testdata/info/types_header.out | 8 + cli/tests/testdata/info_json.out | 7 + cli/tests/testdata/info_json_location.out | 8 + cli/tests/testdata/info_missing_module.out | 6 + cli/tests/testdata/info_recursive_imports_test.out | 12 + cli/tests/testdata/info_recursive_imports_test.ts | 5 + cli/tests/testdata/info_type_import.out | 5 + cli/tests/testdata/info_type_import.ts | 3 + cli/tests/testdata/inline_js_source_map.ts | 6 + cli/tests/testdata/inline_js_source_map_2.js | 4 + cli/tests/testdata/inline_js_source_map_2.js.out | 2 + cli/tests/testdata/inline_js_source_map_2.ts | 6 + .../inline_js_source_map_2_with_inline_contents.js | 4 + ...ine_js_source_map_2_with_inline_contents.js.out | 4 + ...nline_js_source_map_with_contents_from_graph.js | 4 + ...e_js_source_map_with_contents_from_graph.js.out | 4 + cli/tests/testdata/inspector1.js | 3 + cli/tests/testdata/inspector2.js | 4 + cli/tests/testdata/inspector3.js | 7 + cli/tests/testdata/inspector4.js | 5 + cli/tests/testdata/js_import_detect.ts | 3 + cli/tests/testdata/js_import_detect.ts.out | 1 + cli/tests/testdata/jsx_import_from_ts.App.jsx | 11 + cli/tests/testdata/jsx_import_from_ts.ts | 3 + cli/tests/testdata/jsx_import_from_ts.ts.out | 1 + cli/tests/testdata/lib_dom_asynciterable.ts | 23 + cli/tests/testdata/lib_dom_asynciterable.ts.out | 2 + cli/tests/testdata/lib_ref.ts | 16 + cli/tests/testdata/lib_ref.ts.out | 2 + cli/tests/testdata/lib_runtime_api.ts | 14 + cli/tests/testdata/lib_runtime_api.ts.out | 2 + cli/tests/testdata/lint/expected.out | 3 + cli/tests/testdata/lint/expected_from_stdin.out | 3 + .../testdata/lint/expected_from_stdin_json.out | 23 + cli/tests/testdata/lint/expected_glob.out | 3 + cli/tests/testdata/lint/expected_ignore.out | 3 + cli/tests/testdata/lint/expected_json.out | 64 ++ cli/tests/testdata/lint/expected_quiet.out | 14 + cli/tests/testdata/lint/expected_rules.out | 2 + cli/tests/testdata/lint/expected_verbose.out | 3 + cli/tests/testdata/lint/file1.js | 2 + cli/tests/testdata/lint/file2.ts | 6 + cli/tests/testdata/lint/ignored_file.ts | 3 + cli/tests/testdata/lint/malformed.js | 4 + cli/tests/testdata/listen_tls_alpn.ts | 12 + cli/tests/testdata/localhost_unsafe_ssl.ts.out | 3 + cli/tests/testdata/lock_check_err.json | 4 + cli/tests/testdata/lock_check_err.out | 3 + cli/tests/testdata/lock_check_err2.json | 10 + cli/tests/testdata/lock_check_err2.out | 3 + cli/tests/testdata/lock_check_err_with_bundle.json | 5 + cli/tests/testdata/lock_check_err_with_bundle.out | 4 + cli/tests/testdata/lock_check_ok.json | 4 + cli/tests/testdata/lock_check_ok2.json | 10 + cli/tests/testdata/lock_dynamic_imports.json | 6 + cli/tests/testdata/lock_dynamic_imports.out | 4 + cli/tests/testdata/lock_write_fetch.ts | 58 ++ cli/tests/testdata/lock_write_fetch.ts.out | 3 + cli/tests/testdata/lock_write_requires_lock.out | 3 + cli/tests/testdata/lsp/a.d.ts | 1 + cli/tests/testdata/lsp/b.d.ts | 1 + .../lsp/code_action_ignore_lint_params.json | 39 + .../lsp/code_action_ignore_lint_response.json | 62 ++ cli/tests/testdata/lsp/code_action_params.json | 39 + .../testdata/lsp/code_action_params_cache.json | 41 + .../testdata/lsp/code_action_params_deadlock.json | 38 + .../testdata/lsp/code_action_params_imports.json | 54 ++ .../testdata/lsp/code_action_params_refactor.json | 21 + .../testdata/lsp/code_action_resolve_params.json | 27 + .../lsp/code_action_resolve_params_imports.json | 26 + .../lsp/code_action_resolve_params_refactor.json | 20 + .../testdata/lsp/code_action_resolve_response.json | 91 +++ .../lsp/code_action_resolve_response_imports.json | 51 ++ .../lsp/code_action_resolve_response_refactor.json | 58 ++ cli/tests/testdata/lsp/code_action_response.json | 90 +++ .../testdata/lsp/code_action_response_cache.json | 36 + .../testdata/lsp/code_action_response_imports.json | 242 ++++++ .../lsp/code_action_response_no_disabled.json | 22 + .../lsp/code_action_response_refactor.json | 177 +++++ .../testdata/lsp/code_lens_resolve_response.json | 38 + .../lsp/code_lens_resolve_response_impl.json | 38 + cli/tests/testdata/lsp/code_lens_response.json | 34 + .../testdata/lsp/code_lens_response_changed.json | 50 ++ .../testdata/lsp/code_lens_response_impl.json | 98 +++ .../testdata/lsp/code_lens_response_test.json | 162 ++++ .../lsp/completion_request_params_optional.json | 13 + .../lsp/completion_request_response_empty.json | 38 + .../testdata/lsp/completion_resolve_params.json | 14 + .../lsp/completion_resolve_params_optional.json | 15 + .../lsp/completion_resolve_params_registry.json | 20 + .../testdata/lsp/completion_resolve_response.json | 11 + .../lsp/completion_resolve_response_registry.json | 20 + cli/tests/testdata/lsp/diagnostics_deno_deps.json | 25 + cli/tests/testdata/lsp/diagnostics_deno_types.json | 101 +++ .../testdata/lsp/did_open_params_deno_types.json | 8 + .../testdata/lsp/did_open_params_doc_symbol.json | 8 + .../testdata/lsp/did_open_params_import_hover.json | 8 + cli/tests/testdata/lsp/did_open_params_large.json | 8 + .../lsp/did_open_params_semantic_tokens.json | 8 + .../lsp/did_open_params_test_code_lens.json | 8 + .../testdata/lsp/document_symbol_response.json | 371 +++++++++ .../testdata/lsp/formatting_mbc_response.json | 54 ++ cli/tests/testdata/lsp/import-map.json | 5 + cli/tests/testdata/lsp/incoming_calls_params.json | 28 + .../testdata/lsp/incoming_calls_response.json | 42 + cli/tests/testdata/lsp/initialize_params.json | 65 ++ .../lsp/initialize_params_bad_config_option.json | 65 ++ .../lsp/initialize_params_ca_no_disabled.json | 64 ++ .../lsp/initialize_params_code_lens_test.json | 59 ++ .../initialize_params_code_lens_test_disabled.json | 64 ++ .../lsp/initialize_params_did_config_change.json | 65 ++ .../testdata/lsp/initialize_params_disabled.json | 63 ++ .../testdata/lsp/initialize_params_registry.json | 65 ++ .../testdata/lsp/initialize_params_unstable.json | 63 ++ cli/tests/testdata/lsp/lib.tsconfig.json | 5 + cli/tests/testdata/lsp/outgoing_calls_params.json | 28 + .../testdata/lsp/outgoing_calls_response.json | 42 + .../lsp/prepare_call_hierarchy_response.json | 28 + cli/tests/testdata/lsp/registries/a_latest.json | 4 + cli/tests/testdata/lsp/registries/a_v1.0.0.json | 4 + cli/tests/testdata/lsp/registries/a_v1.0.1.json | 4 + cli/tests/testdata/lsp/registries/a_v2.0.0.json | 4 + cli/tests/testdata/lsp/registries/a_versions.json | 5 + cli/tests/testdata/lsp/registries/b_latest.json | 4 + cli/tests/testdata/lsp/registries/b_v0.0.1.json | 4 + cli/tests/testdata/lsp/registries/b_v0.0.2.json | 4 + cli/tests/testdata/lsp/registries/b_v0.0.3.json | 4 + cli/tests/testdata/lsp/registries/b_versions.json | 5 + .../lsp/registries/deno-import-intellisense.json | 35 + cli/tests/testdata/lsp/registries/modules.json | 4 + cli/tests/testdata/lsp/rename_response.json | 38 + .../testdata/lsp/selection_range_response.json | 86 +++ cli/tests/testdata/lsp/types.tsconfig.json | 7 + cli/tests/testdata/main_module.ts | 3 + cli/tests/testdata/main_module.ts.out | 2 + cli/tests/testdata/main_module2.ts | 1 + cli/tests/testdata/module_graph/file_tests-a.mjs | 3 + .../testdata/module_graph/file_tests-b-mod.js | 1 + cli/tests/testdata/module_graph/file_tests-b.ts | 1 + .../testdata/module_graph/file_tests-c-mod.ts | 1 + .../module_graph/file_tests-checkwithconfig.ts | 5 + cli/tests/testdata/module_graph/file_tests-diag.ts | 4 + .../module_graph/file_tests-dynamicimport.ts | 5 + .../testdata/module_graph/file_tests-importjson.ts | 3 + .../module_graph/file_tests-importremap.ts | 3 + cli/tests/testdata/module_graph/file_tests-main.ts | 4 + .../testdata/module_graph/file_tests-some.json | 5 + cli/tests/testdata/module_graph/file_typesref.d.ts | 1 + cli/tests/testdata/module_graph/file_typesref.js | 3 + .../https_deno.land-std-http-server.ts | 5 + .../module_graph/https_deno.land-x-a-mod.ts | 1 + .../testdata/module_graph/https_deno.land-x-a.ts | 1 + .../module_graph/https_deno.land-x-import_map.ts | 4 + .../module_graph/https_deno.land-x-jquery.js | 3 + .../module_graph/https_deno.land-x-lib-a.ts | 1 + .../module_graph/https_deno.land-x-lib-b.js | 1 + .../module_graph/https_deno.land-x-lib-c.d.ts | 1 + .../module_graph/https_deno.land-x-lib-c.js | 3 + .../module_graph/https_deno.land-x-lib-mod.d.ts | 9 + .../module_graph/https_deno.land-x-lib-mod.js | 5 + .../testdata/module_graph/https_deno.land-x-mod.ts | 3 + .../module_graph/https_deno.land-x-transpile.tsx | 5 + .../module_graph/https_unpkg.com-lodash-index.js | 3 + cli/tests/testdata/module_graph/lockfile.json | 8 + cli/tests/testdata/module_graph/lockfile_fail.json | 8 + cli/tests/testdata/module_graph/tsconfig.json | 6 + cli/tests/testdata/module_graph/tsconfig_01.json | 13 + cli/tests/testdata/no_check_decorators.ts | 21 + cli/tests/testdata/no_check_decorators.ts.out | 3 + cli/tests/testdata/no_color.js | 1 + cli/tests/testdata/no_mem_cache.js | 33 + cli/tests/testdata/no_mem_cache.js.out | 2 + cli/tests/testdata/no_validate_asm.js | 20 + cli/tests/testdata/performance_stats.out | 16 + cli/tests/testdata/permission_test.ts | 33 + cli/tests/testdata/preserve_imports.tsconfig.json | 5 + cli/tests/testdata/proto_exploit.js | 5 + cli/tests/testdata/proto_exploit.js.out | 2 + cli/tests/testdata/raw_mode.ts | 18 + cli/tests/testdata/raw_mode_cbreak.ts | 17 + cli/tests/testdata/recursive_imports/A.ts | 7 + cli/tests/testdata/recursive_imports/B.ts | 7 + cli/tests/testdata/recursive_imports/C.ts | 8 + cli/tests/testdata/recursive_imports/common.ts | 2 + cli/tests/testdata/redirect_cache.out | 5 + cli/tests/testdata/reference_types.ts | 3 + cli/tests/testdata/reference_types.ts.out | 1 + cli/tests/testdata/reference_types_remote.ts | 3 + cli/tests/testdata/reference_types_remote.ts.out | 1 + cli/tests/testdata/resolve_dns.ts | 42 + cli/tests/testdata/resolve_dns.ts.out | 17 + cli/tests/testdata/runtime_decorators.ts | 42 + cli/tests/testdata/runtime_decorators.ts.out | 7 + cli/tests/testdata/seed_random.js | 11 + cli/tests/testdata/seed_random.js.out | 22 + cli/tests/testdata/single_compile_with_reload.ts | 18 + .../testdata/single_compile_with_reload.ts.out | 9 + .../testdata/single_compile_with_reload_dyn.ts | 11 + .../testdata/single_compile_with_reload_worker.ts | 3 + cli/tests/testdata/standalone_compiler_ops.ts | 12 + cli/tests/testdata/standalone_error.ts | 9 + cli/tests/testdata/standalone_import.ts | 2 + cli/tests/testdata/standalone_import_datauri.ts | 4 + cli/tests/testdata/standalone_runtime_flags.ts | 3 + cli/tests/testdata/std_lint.out | 3 + cli/tests/testdata/stdout_write_all.out | 1 + cli/tests/testdata/stdout_write_all.ts | 8 + cli/tests/testdata/subdir/amd_like.js | 3 + cli/tests/testdata/subdir/auto_print_hello.ts | 2 + cli/tests/testdata/subdir/circular1.ts | 7 + cli/tests/testdata/subdir/circular2.ts | 7 + cli/tests/testdata/subdir/comment.ts | 4 + cli/tests/testdata/subdir/config.json | 6 + cli/tests/testdata/subdir/emittable.d.ts | 1 + cli/tests/testdata/subdir/empty.ts | 0 cli/tests/testdata/subdir/evil_remote_import.js | 4 + cli/tests/testdata/subdir/foo_types.d.ts | 3 + cli/tests/testdata/subdir/form_urlencoded.txt | 1 + cli/tests/testdata/subdir/indirect_import_error.js | 1 + cli/tests/testdata/subdir/indirect_throws.js | 1 + cli/tests/testdata/subdir/json_1.json | 5 + cli/tests/testdata/subdir/json_2.json | 1 + cli/tests/testdata/subdir/main.ts | 3 + cli/tests/testdata/subdir/mismatch_ext.ts | 1 + cli/tests/testdata/subdir/mod1.ts | 17 + cli/tests/testdata/subdir/mod2.ts | 1 + cli/tests/testdata/subdir/mod3.js | 1 + cli/tests/testdata/subdir/mod4.js | 1 + cli/tests/testdata/subdir/mod5.mjs | 1 + cli/tests/testdata/subdir/mod6.js | 1 + cli/tests/testdata/subdir/more_decorators.ts | 18 + .../subdir/mt_application_ecmascript.j2.js | 1 + .../subdir/mt_application_ecmascript_jsx.j2.jsx | 5 + .../subdir/mt_application_x_javascript.j4.js | 1 + .../subdir/mt_application_x_javascript_jsx.j4.jsx | 5 + .../subdir/mt_application_x_typescript.t4.ts | 1 + .../subdir/mt_application_x_typescript_tsx.t4.tsx | 5 + cli/tests/testdata/subdir/mt_javascript.js | 1 + cli/tests/testdata/subdir/mt_javascript_jsx.jsx | 5 + cli/tests/testdata/subdir/mt_text_ecmascript.j3.js | 1 + .../testdata/subdir/mt_text_ecmascript_jsx.j3.jsx | 5 + cli/tests/testdata/subdir/mt_text_javascript.j1.js | 1 + .../testdata/subdir/mt_text_javascript_jsx.j1.jsx | 5 + cli/tests/testdata/subdir/mt_text_typescript.t1.ts | 1 + .../testdata/subdir/mt_text_typescript_tsx.t1.tsx | 5 + cli/tests/testdata/subdir/mt_video_mp2t.t3.ts | 1 + cli/tests/testdata/subdir/mt_video_mp2t_tsx.t3.tsx | 5 + cli/tests/testdata/subdir/mt_video_vdn.t2.ts | 1 + cli/tests/testdata/subdir/mt_video_vdn_tsx.t2.tsx | 5 + cli/tests/testdata/subdir/no_ext | 1 + cli/tests/testdata/subdir/no_js_ext | 3 + cli/tests/testdata/subdir/polyfill.ts | 10 + cli/tests/testdata/subdir/print_hello.ts | 3 + cli/tests/testdata/subdir/redirects/a.ts | 9 + cli/tests/testdata/subdir/redirects/b.ts | 5 + cli/tests/testdata/subdir/redirects/redirect1.js | 1 + cli/tests/testdata/subdir/redirects/redirect1.ts | 1 + cli/tests/testdata/subdir/redirects/redirect2.js | 1 + cli/tests/testdata/subdir/redirects/redirect3.js | 2 + cli/tests/testdata/subdir/redirects/redirect4.ts | 2 + cli/tests/testdata/subdir/single_module.ts | 2 + .../testdata/subdir/subdir2/dynamic_import.ts | 6 + cli/tests/testdata/subdir/subdir2/mod2.ts | 9 + cli/tests/testdata/subdir/test_worker_basic.js | 14 + cli/tests/testdata/subdir/throws.js | 6 + cli/tests/testdata/subdir/tla.ts | 1 + cli/tests/testdata/subdir/type_and_code.ts | 7 + cli/tests/testdata/subdir/type_reference.d.ts | 1 + cli/tests/testdata/subdir/type_reference.js | 3 + cli/tests/testdata/subdir/types.d.ts | 1 + cli/tests/testdata/subdir/unknown_ext.deno | 1 + cli/tests/testdata/swc_syntax_error.ts | 4 + cli/tests/testdata/swc_syntax_error.ts.out | 1 + cli/tests/testdata/symlink_to_subdir | 1 + cli/tests/testdata/test/allow_all.out | 18 + cli/tests/testdata/test/allow_all.ts | 35 + cli/tests/testdata/test/allow_none.out | 51 ++ cli/tests/testdata/test/allow_none.ts | 23 + cli/tests/testdata/test/clear_timeout.out | 8 + cli/tests/testdata/test/clear_timeout.ts | 5 + cli/tests/testdata/test/doc.out | 10 + cli/tests/testdata/test/doc.ts | 38 + cli/tests/testdata/test/doc_markdown.out | 7 + cli/tests/testdata/test/doc_markdown/doc.md | 25 + cli/tests/testdata/test/exit_sanitizer.out | 35 + cli/tests/testdata/test/exit_sanitizer.ts | 11 + cli/tests/testdata/test/fail.out | 81 ++ cli/tests/testdata/test/fail.ts | 30 + cli/tests/testdata/test/fail_fast.out | 18 + cli/tests/testdata/test/fail_fast.ts | 30 + cli/tests/testdata/test/fail_fast_with_val.out | 23 + cli/tests/testdata/test/fail_fast_with_val.ts | 30 + cli/tests/testdata/test/finally_timeout.out | 19 + cli/tests/testdata/test/finally_timeout.ts | 11 + cli/tests/testdata/test/ignore.out | 15 + cli/tests/testdata/test/ignore.ts | 9 + cli/tests/testdata/test/ignore_permissions.out | 6 + cli/tests/testdata/test/ignore_permissions.ts | 16 + cli/tests/testdata/test/meta.out | 7 + cli/tests/testdata/test/meta.ts | 2 + cli/tests/testdata/test/no_check.out | 8 + cli/tests/testdata/test/no_check.ts | 1 + cli/tests/testdata/test/no_color.ts | 17 + cli/tests/testdata/test/no_run.out | 5 + cli/tests/testdata/test/no_run.ts | 1 + cli/tests/testdata/test/only.out | 7 + cli/tests/testdata/test/only.ts | 15 + cli/tests/testdata/test/pass.out | 15 + cli/tests/testdata/test/pass.ts | 10 + cli/tests/testdata/test/quiet.out | 8 + cli/tests/testdata/test/quiet.ts | 15 + cli/tests/testdata/test/shuffle.out | 39 + cli/tests/testdata/test/shuffle/bar_test.ts | 3 + cli/tests/testdata/test/shuffle/baz_test.ts | 3 + cli/tests/testdata/test/shuffle/foo_test.ts | 3 + cli/tests/testdata/test/unhandled_rejection.out | 10 + cli/tests/testdata/test/unhandled_rejection.ts | 3 + cli/tests/testdata/test/unresolved_promise.out | 6 + cli/tests/testdata/test/unresolved_promise.ts | 11 + cli/tests/testdata/text_decoder_perf.js | 38 + cli/tests/testdata/text_encoder_into_perf.js | 34 + cli/tests/testdata/text_encoder_perf.js | 33 + cli/tests/testdata/tla/a.js | 3 + cli/tests/testdata/tla/b.js | 7 + cli/tests/testdata/tla/c.js | 3 + cli/tests/testdata/tla/d.js | 8 + cli/tests/testdata/tla/order.js | 1 + cli/tests/testdata/tla/parent.js | 9 + cli/tests/testdata/tla2/a.js | 5 + cli/tests/testdata/tla2/b.js | 5 + cli/tests/testdata/tla3/b.js | 7 + cli/tests/testdata/tla3/timeout_loop.js | 23 + cli/tests/testdata/tls.out | 1 + cli/tests/testdata/tls/README.md | 47 ++ cli/tests/testdata/tls/RootCA.crt | 19 + cli/tests/testdata/tls/RootCA.key | 28 + cli/tests/testdata/tls/RootCA.pem | 19 + cli/tests/testdata/tls/domains.txt | 6 + cli/tests/testdata/tls/localhost.crt | 21 + cli/tests/testdata/tls/localhost.key | 28 + cli/tests/testdata/tls_connecttls.js | 70 ++ cli/tests/testdata/tls_starttls.js | 68 ++ cli/tests/testdata/top_level_await.js | 3 + cli/tests/testdata/top_level_await.out | 3 + cli/tests/testdata/top_level_await.ts | 3 + cli/tests/testdata/top_level_await_circular.js | 8 + cli/tests/testdata/top_level_await_circular.out | 9 + cli/tests/testdata/top_level_await_loop.js | 18 + cli/tests/testdata/top_level_await_loop.out | 5 + cli/tests/testdata/top_level_await_nested.out | 5 + cli/tests/testdata/top_level_await_nested/a.js | 3 + cli/tests/testdata/top_level_await_nested/b.js | 1 + cli/tests/testdata/top_level_await_nested/main.js | 3 + cli/tests/testdata/top_level_await_order.js | 21 + cli/tests/testdata/top_level_await_order.out | 2 + cli/tests/testdata/top_level_await_unresolved.js | 1 + cli/tests/testdata/top_level_await_unresolved.out | 1 + cli/tests/testdata/top_level_for_await.js | 10 + cli/tests/testdata/top_level_for_await.out | 3 + cli/tests/testdata/top_level_for_await.ts | 10 + cli/tests/testdata/ts_decorators.ts | 14 + cli/tests/testdata/ts_decorators.ts.out | 2 + cli/tests/testdata/ts_decorators_bundle.out | 5 + cli/tests/testdata/ts_decorators_bundle.ts | 25 + cli/tests/testdata/ts_import_from_js.deps.js | 2 + cli/tests/testdata/ts_import_from_js.js | 3 + cli/tests/testdata/ts_import_from_js.js.out | 3 + cli/tests/testdata/ts_type_imports.ts | 5 + cli/tests/testdata/ts_type_imports.ts.out | 6 + cli/tests/testdata/ts_type_imports_foo.ts | 1 + cli/tests/testdata/ts_type_only_import.d.ts | 3 + cli/tests/testdata/ts_type_only_import.ts | 1 + cli/tests/testdata/ts_type_only_import.ts.out | 4 + cli/tests/testdata/ts_with_generic.ts | 3 + cli/tests/testdata/tsc/a.js | 2 + cli/tests/testdata/tsc/d.ts | 3 + cli/tests/testdata/tsc/node_modules/b.js | 2 + cli/tests/testdata/tsc/node_modules/c.js | 1 + cli/tests/testdata/tsc/test.js | 4 + cli/tests/testdata/tsc2/file_exportc.ts | 1 + cli/tests/testdata/tsc2/file_libref.ts | 8 + cli/tests/testdata/tsc2/file_main.ts | 1 + cli/tests/testdata/tsc2/file_reexports.ts | 3 + cli/tests/testdata/tsc2/https_deno.land-x-a.ts | 3 + cli/tests/testdata/tsc2/https_deno.land-x-b.ts | 1 + cli/tests/testdata/tsc2/https_deno.land-x-c.d.ts | 1 + cli/tests/testdata/tsc2/https_deno.land-x-c.js | 1 + cli/tests/testdata/tsc2/https_deno.land-x-mod.ts | 1 + cli/tests/testdata/tsconfig.decorators.json | 5 + cli/tests/testdata/tsx_imports.ts | 1 + cli/tests/testdata/tsx_imports.ts.out | 2 + cli/tests/testdata/type_definitions.ts | 12 + cli/tests/testdata/type_definitions.ts.out | 3 + cli/tests/testdata/type_definitions/bar.d.ts | 7 + cli/tests/testdata/type_definitions/bar.js | 5 + cli/tests/testdata/type_definitions/fizz.d.ts | 2 + cli/tests/testdata/type_definitions/fizz.js | 1 + cli/tests/testdata/type_definitions/foo.d.ts | 2 + cli/tests/testdata/type_definitions/foo.js | 1 + cli/tests/testdata/type_definitions/qat.ts | 1 + cli/tests/testdata/type_definitions_for_export.ts | 7 + .../testdata/type_definitions_for_export.ts.out | 5 + cli/tests/testdata/type_directives_01.ts | 3 + cli/tests/testdata/type_directives_01.ts.out | 3 + cli/tests/testdata/type_directives_02.ts | 3 + cli/tests/testdata/type_directives_02.ts.out | 3 + cli/tests/testdata/type_directives_js_main.js | 3 + cli/tests/testdata/type_directives_js_main.js.out | 3 + cli/tests/testdata/type_directives_redirect.ts | 1 + cli/tests/testdata/type_directives_redirect.ts.out | 5 + cli/tests/testdata/type_headers_deno_types.ts | 18 + cli/tests/testdata/type_headers_deno_types.ts.out | 5 + cli/tests/testdata/types.out | 4 + cli/tests/testdata/unbuffered_stderr.ts | 1 + cli/tests/testdata/unbuffered_stderr.ts.out | 2 + cli/tests/testdata/unbuffered_stdout.ts | 1 + cli/tests/testdata/unbuffered_stdout.ts.out | 1 + cli/tests/testdata/unstable.js | 1 + cli/tests/testdata/unstable.ts | 1 + cli/tests/testdata/unstable_disabled.out | 5 + cli/tests/testdata/unstable_disabled_js.out | 1 + cli/tests/testdata/unstable_enabled.out | 1 + cli/tests/testdata/unstable_enabled_js.out | 1 + cli/tests/testdata/unstable_worker.ts | 12 + cli/tests/testdata/unstable_worker.ts.out | 2 + .../testdata/unsupported_dynamic_import_scheme.out | 7 + cli/tests/testdata/v8_flags.js | 1 + cli/tests/testdata/v8_flags.js.out | 1 + cli/tests/testdata/v8_flags_unrecognized.out | 5 + cli/tests/testdata/v8_help.out | 4 + cli/tests/testdata/wasm.ts | 16 + cli/tests/testdata/wasm.ts.out | 1 + cli/tests/testdata/wasm_async.js | 27 + cli/tests/testdata/wasm_async.out | 1 + cli/tests/testdata/wasm_shared.out | 0 cli/tests/testdata/wasm_shared.ts | 6 + cli/tests/testdata/wasm_unreachable.js | 50 ++ cli/tests/testdata/wasm_unreachable.out | 3 + cli/tests/testdata/weakref.ts | 1 + cli/tests/testdata/weakref.ts.out | 1 + cli/tests/testdata/webgpu_computepass_shader.wgsl | 37 + cli/tests/testdata/webgpu_hellotriangle.out | Bin 0 -> 204800 bytes .../testdata/webgpu_hellotriangle_shader.wgsl | 10 + cli/tests/testdata/websocket_test.ts | 308 ++++++++ cli/tests/testdata/websocketstream_test.ts | 82 ++ cli/tests/testdata/worker_close_race.js | 14 + cli/tests/testdata/worker_close_race.js.out | 0 cli/tests/testdata/worker_event_handler_test.js | 5 + .../testdata/worker_event_handler_test.js.out | 11 + cli/tests/testdata/workers/bench_large_message.ts | 31 + cli/tests/testdata/workers/bench_round_robin.ts | 68 ++ cli/tests/testdata/workers/bench_startup.ts | 33 + cli/tests/testdata/workers/bench_worker.ts | 21 + cli/tests/testdata/workers/broadcast_channel.ts | 5 + cli/tests/testdata/workers/busy_worker.js | 8 + cli/tests/testdata/workers/close_race_worker.js | 6 + cli/tests/testdata/workers/deno_worker.ts | 7 + cli/tests/testdata/workers/dynamic_remote.ts | 2 + cli/tests/testdata/workers/error.ts | 5 + cli/tests/testdata/workers/event_worker.js | 7 + cli/tests/testdata/workers/event_worker_scope.js | 43 ++ cli/tests/testdata/workers/fetching_worker.js | 6 + cli/tests/testdata/workers/http_worker.js | 11 + .../testdata/workers/immediately_close_worker.js | 1 + cli/tests/testdata/workers/message_port.ts | 14 + cli/tests/testdata/workers/nested_worker.js | 18 + .../testdata/workers/no_permissions_worker.js | 17 + cli/tests/testdata/workers/non_deno_worker.js | 7 + cli/tests/testdata/workers/nonexistent_worker.out | 3 + cli/tests/testdata/workers/nonexistent_worker.ts | 5 + .../workers/parent_read_check_granular_worker.js | 41 + .../testdata/workers/parent_read_check_worker.js | 27 + .../testdata/workers/permissions_blob_local.ts | 6 + .../testdata/workers/permissions_blob_local.ts.out | 4 + .../testdata/workers/permissions_blob_remote.ts | 4 + .../workers/permissions_blob_remote.ts.out | 4 + .../testdata/workers/permissions_data_local.ts | 7 + .../testdata/workers/permissions_data_local.ts.out | 4 + .../testdata/workers/permissions_data_remote.ts | 5 + .../workers/permissions_data_remote.ts.out | 4 + .../testdata/workers/permissions_dynamic_remote.ts | 11 + .../workers/permissions_dynamic_remote.ts.out | 6 + .../testdata/workers/permissions_remote_remote.ts | 3 + .../workers/permissions_remote_remote.ts.out | 4 + cli/tests/testdata/workers/post_undefined.ts | 5 + cli/tests/testdata/workers/racy_worker.js | 25 + .../testdata/workers/read_check_granular_worker.js | 11 + cli/tests/testdata/workers/read_check_worker.js | 7 + cli/tests/testdata/workers/shared_array_buffer.ts | 9 + cli/tests/testdata/workers/sibling_worker.js | 4 + cli/tests/testdata/workers/static_remote.ts | 2 + cli/tests/testdata/workers/test.ts | 852 +++++++++++++++++++++ cli/tests/testdata/workers/test.ts.out | 3 + cli/tests/testdata/workers/test_worker.js | 19 + cli/tests/testdata/workers/test_worker.ts | 8 + cli/tests/testdata/workers/throwing_worker.js | 2 + cli/tests/testdata/workers/worker_crypto.js | 5 + cli/tests/testdata/workers/worker_error.ts | 5 + cli/tests/testdata/workers/worker_error.ts.out | 5 + .../testdata/workers/worker_event_handlers.js | 23 + cli/tests/testdata/workers/worker_globals.ts | 13 + cli/tests/testdata/workers/worker_large_message.js | 14 + cli/tests/testdata/workers/worker_location.ts | 6 + cli/tests/testdata/workers/worker_nested_error.ts | 5 + .../testdata/workers/worker_nested_error.ts.out | 5 + .../testdata/workers/worker_structured_cloning.ts | 15 + cli/tests/testdata/workers/worker_types.ts | 4 + cli/tests/testdata/workers/worker_unstable.ts | 5 + .../workers/worker_with_top_level_await.ts | 15 + cli/tests/testdata/x_deno_warning.js | 1 + cli/tests/text_decoder_perf.js | 38 - cli/tests/text_encoder_into_perf.js | 34 - cli/tests/text_encoder_perf.js | 33 - cli/tests/tla/a.js | 3 - cli/tests/tla/b.js | 7 - cli/tests/tla/c.js | 3 - cli/tests/tla/d.js | 8 - cli/tests/tla/order.js | 1 - cli/tests/tla/parent.js | 9 - cli/tests/tla2/a.js | 5 - cli/tests/tla2/b.js | 5 - cli/tests/tla3/b.js | 7 - cli/tests/tla3/timeout_loop.js | 23 - cli/tests/tls.out | 1 - cli/tests/tls/README.md | 47 -- cli/tests/tls/RootCA.crt | 19 - cli/tests/tls/RootCA.key | 28 - cli/tests/tls/RootCA.pem | 19 - cli/tests/tls/domains.txt | 6 - cli/tests/tls/localhost.crt | 21 - cli/tests/tls/localhost.key | 28 - cli/tests/tls_connecttls.js | 67 -- cli/tests/tls_starttls.js | 65 -- cli/tests/top_level_await.js | 3 - cli/tests/top_level_await.out | 3 - cli/tests/top_level_await.ts | 3 - cli/tests/top_level_await_circular.js | 8 - cli/tests/top_level_await_circular.out | 9 - cli/tests/top_level_await_loop.js | 18 - cli/tests/top_level_await_loop.out | 5 - cli/tests/top_level_await_nested.out | 5 - cli/tests/top_level_await_nested/a.js | 3 - cli/tests/top_level_await_nested/b.js | 1 - cli/tests/top_level_await_nested/main.js | 3 - cli/tests/top_level_await_order.js | 21 - cli/tests/top_level_await_order.out | 2 - cli/tests/top_level_await_unresolved.js | 1 - cli/tests/top_level_await_unresolved.out | 1 - cli/tests/top_level_for_await.js | 10 - cli/tests/top_level_for_await.out | 3 - cli/tests/top_level_for_await.ts | 10 - cli/tests/ts_decorators.ts | 14 - cli/tests/ts_decorators.ts.out | 2 - cli/tests/ts_decorators_bundle.out | 5 - cli/tests/ts_decorators_bundle.ts | 25 - cli/tests/ts_import_from_js.deps.js | 2 - cli/tests/ts_import_from_js.js | 3 - cli/tests/ts_import_from_js.js.out | 3 - cli/tests/ts_type_imports.ts | 5 - cli/tests/ts_type_imports.ts.out | 6 - cli/tests/ts_type_imports_foo.ts | 1 - cli/tests/ts_type_only_import.d.ts | 3 - cli/tests/ts_type_only_import.ts | 1 - cli/tests/ts_type_only_import.ts.out | 4 - cli/tests/ts_with_generic.ts | 3 - cli/tests/tsc/a.js | 2 - cli/tests/tsc/d.ts | 3 - cli/tests/tsc/node_modules/b.js | 2 - cli/tests/tsc/node_modules/c.js | 1 - cli/tests/tsc/test.js | 4 - cli/tests/tsc2/file_exportc.ts | 1 - cli/tests/tsc2/file_libref.ts | 8 - cli/tests/tsc2/file_main.ts | 1 - cli/tests/tsc2/file_reexports.ts | 3 - cli/tests/tsc2/https_deno.land-x-a.ts | 3 - cli/tests/tsc2/https_deno.land-x-b.ts | 1 - cli/tests/tsc2/https_deno.land-x-c.d.ts | 1 - cli/tests/tsc2/https_deno.land-x-c.js | 1 - cli/tests/tsc2/https_deno.land-x-mod.ts | 1 - cli/tests/tsconfig.decorators.json | 5 - cli/tests/tsx_imports.ts | 1 - cli/tests/tsx_imports.ts.out | 2 - cli/tests/type_definitions.ts | 12 - cli/tests/type_definitions.ts.out | 3 - cli/tests/type_definitions/bar.d.ts | 7 - cli/tests/type_definitions/bar.js | 5 - cli/tests/type_definitions/fizz.d.ts | 2 - cli/tests/type_definitions/fizz.js | 1 - cli/tests/type_definitions/foo.d.ts | 2 - cli/tests/type_definitions/foo.js | 1 - cli/tests/type_definitions/qat.ts | 1 - cli/tests/type_definitions_for_export.ts | 7 - cli/tests/type_definitions_for_export.ts.out | 5 - cli/tests/type_directives_01.ts | 3 - cli/tests/type_directives_01.ts.out | 3 - cli/tests/type_directives_02.ts | 3 - cli/tests/type_directives_02.ts.out | 3 - cli/tests/type_directives_js_main.js | 3 - cli/tests/type_directives_js_main.js.out | 3 - cli/tests/type_directives_redirect.ts | 1 - cli/tests/type_directives_redirect.ts.out | 5 - cli/tests/type_headers_deno_types.ts | 18 - cli/tests/type_headers_deno_types.ts.out | 5 - cli/tests/types.out | 4 - cli/tests/unbuffered_stderr.ts | 1 - cli/tests/unbuffered_stderr.ts.out | 2 - cli/tests/unbuffered_stdout.ts | 1 - cli/tests/unbuffered_stdout.ts.out | 1 - cli/tests/unit/README.md | 2 +- cli/tests/unit/body_test.ts | 2 +- cli/tests/unit/broadcast_channel_test.ts | 5 +- cli/tests/unit/fetch_test.ts | 48 +- cli/tests/unit/files_test.ts | 26 +- cli/tests/unit/http_test.ts | 6 +- cli/tests/unit/read_dir_test.ts | 12 +- cli/tests/unit/read_file_test.ts | 22 +- cli/tests/unit/read_text_file_test.ts | 14 +- cli/tests/unit/real_path_test.ts | 8 +- cli/tests/unit/resources_test.ts | 2 +- cli/tests/unit/stat_test.ts | 54 +- cli/tests/unit/tls_test.ts | 72 +- cli/tests/unit/tty_test.ts | 4 +- cli/tests/unit/wasm_test.ts | 2 +- cli/tests/unit/webgpu_test.ts | 9 +- cli/tests/unstable.js | 1 - cli/tests/unstable.ts | 1 - cli/tests/unstable_disabled.out | 5 - cli/tests/unstable_disabled_js.out | 1 - cli/tests/unstable_enabled.out | 1 - cli/tests/unstable_enabled_js.out | 1 - cli/tests/unstable_worker.ts | 12 - cli/tests/unstable_worker.ts.out | 2 - cli/tests/unsupported_dynamic_import_scheme.out | 7 - cli/tests/v8_flags.js | 1 - cli/tests/v8_flags.js.out | 1 - cli/tests/v8_flags_unrecognized.out | 5 - cli/tests/v8_help.out | 4 - cli/tests/wasm.ts | 16 - cli/tests/wasm.ts.out | 1 - cli/tests/wasm_async.js | 27 - cli/tests/wasm_async.out | 1 - cli/tests/wasm_shared.out | 0 cli/tests/wasm_shared.ts | 6 - cli/tests/wasm_unreachable.js | 50 -- cli/tests/wasm_unreachable.out | 3 - cli/tests/weakref.ts | 1 - cli/tests/weakref.ts.out | 1 - cli/tests/webgpu_computepass_shader.wgsl | 37 - cli/tests/webgpu_hellotriangle.out | Bin 204800 -> 0 bytes cli/tests/webgpu_hellotriangle_shader.wgsl | 10 - cli/tests/websocket_test.ts | 308 -------- cli/tests/websocketstream_test.ts | 82 -- cli/tests/worker_close_race.js | 14 - cli/tests/worker_close_race.js.out | 0 cli/tests/worker_event_handler_test.js | 5 - cli/tests/worker_event_handler_test.js.out | 11 - cli/tests/workers/bench_large_message.ts | 31 - cli/tests/workers/bench_round_robin.ts | 65 -- cli/tests/workers/bench_startup.ts | 33 - cli/tests/workers/bench_worker.ts | 21 - cli/tests/workers/broadcast_channel.ts | 5 - cli/tests/workers/busy_worker.js | 8 - cli/tests/workers/close_race_worker.js | 6 - cli/tests/workers/deno_worker.ts | 7 - cli/tests/workers/dynamic_remote.ts | 2 - cli/tests/workers/error.ts | 5 - cli/tests/workers/event_worker.js | 7 - cli/tests/workers/event_worker_scope.js | 43 -- cli/tests/workers/fetching_worker.js | 6 - cli/tests/workers/http_worker.js | 11 - cli/tests/workers/immediately_close_worker.js | 1 - cli/tests/workers/message_port.ts | 14 - cli/tests/workers/nested_worker.js | 18 - cli/tests/workers/no_permissions_worker.js | 17 - cli/tests/workers/non_deno_worker.js | 7 - cli/tests/workers/nonexistent_worker.out | 3 - cli/tests/workers/nonexistent_worker.ts | 5 - .../workers/parent_read_check_granular_worker.js | 41 - cli/tests/workers/parent_read_check_worker.js | 27 - cli/tests/workers/permissions_blob_local.ts | 6 - cli/tests/workers/permissions_blob_local.ts.out | 4 - cli/tests/workers/permissions_blob_remote.ts | 4 - cli/tests/workers/permissions_blob_remote.ts.out | 4 - cli/tests/workers/permissions_data_local.ts | 7 - cli/tests/workers/permissions_data_local.ts.out | 4 - cli/tests/workers/permissions_data_remote.ts | 5 - cli/tests/workers/permissions_data_remote.ts.out | 4 - cli/tests/workers/permissions_dynamic_remote.ts | 11 - .../workers/permissions_dynamic_remote.ts.out | 6 - cli/tests/workers/permissions_remote_remote.ts | 3 - cli/tests/workers/permissions_remote_remote.ts.out | 4 - cli/tests/workers/post_undefined.ts | 5 - cli/tests/workers/racy_worker.js | 25 - cli/tests/workers/read_check_granular_worker.js | 11 - cli/tests/workers/read_check_worker.js | 7 - cli/tests/workers/shared_array_buffer.ts | 9 - cli/tests/workers/sibling_worker.js | 4 - cli/tests/workers/static_remote.ts | 2 - cli/tests/workers/test.ts | 852 --------------------- cli/tests/workers/test.ts.out | 3 - cli/tests/workers/test_worker.js | 19 - cli/tests/workers/test_worker.ts | 8 - cli/tests/workers/throwing_worker.js | 2 - cli/tests/workers/worker_crypto.js | 5 - cli/tests/workers/worker_error.ts | 5 - cli/tests/workers/worker_error.ts.out | 5 - cli/tests/workers/worker_event_handlers.js | 23 - cli/tests/workers/worker_globals.ts | 13 - cli/tests/workers/worker_large_message.js | 14 - cli/tests/workers/worker_location.ts | 6 - cli/tests/workers/worker_nested_error.ts | 5 - cli/tests/workers/worker_nested_error.ts.out | 5 - cli/tests/workers/worker_structured_cloning.ts | 15 - cli/tests/workers/worker_types.ts | 4 - cli/tests/workers/worker_unstable.ts | 5 - cli/tests/workers/worker_with_top_level_await.ts | 15 - cli/tests/x_deno_warning.js | 1 - cli/tools/installer.rs | 91 ++- cli/tools/test_runner.rs | 7 +- cli/tsc.rs | 8 +- cli/tsc/99_main_compiler.js | 4 +- runtime/worker.rs | 10 +- test_util/src/lib.rs | 85 +- tools/lint.js | 14 +- 2001 files changed, 12414 insertions(+), 12424 deletions(-) delete mode 100644 cli/tests/001_hello.js delete mode 100644 cli/tests/001_hello.js.out delete mode 100644 cli/tests/002_hello.ts delete mode 100644 cli/tests/002_hello.ts.out delete mode 100644 cli/tests/003_relative_import.ts delete mode 100644 cli/tests/003_relative_import.ts.out delete mode 100644 cli/tests/004_set_timeout.ts delete mode 100644 cli/tests/004_set_timeout.ts.out delete mode 100644 cli/tests/005_more_imports.ts delete mode 100644 cli/tests/005_more_imports.ts.out delete mode 100644 cli/tests/006_url_imports.ts delete mode 100644 cli/tests/006_url_imports.ts.out delete mode 100644 cli/tests/012_async.ts delete mode 100644 cli/tests/012_async.ts.out delete mode 100644 cli/tests/013_dynamic_import.ts delete mode 100644 cli/tests/013_dynamic_import.ts.out delete mode 100644 cli/tests/014_duplicate_import.ts delete mode 100644 cli/tests/014_duplicate_import.ts.out delete mode 100644 cli/tests/015_duplicate_parallel_import.js delete mode 100644 cli/tests/015_duplicate_parallel_import.js.out delete mode 100644 cli/tests/016_double_await.ts delete mode 100644 cli/tests/016_double_await.ts.out delete mode 100644 cli/tests/017_import_redirect.ts delete mode 100644 cli/tests/017_import_redirect.ts.out delete mode 100644 cli/tests/017_import_redirect_info.out delete mode 100644 cli/tests/018_async_catch.ts delete mode 100644 cli/tests/018_async_catch.ts.out delete mode 100644 cli/tests/019_media_types.ts delete mode 100644 cli/tests/019_media_types.ts.out delete mode 100644 cli/tests/020_json_modules.ts delete mode 100644 cli/tests/020_json_modules.ts.out delete mode 100644 cli/tests/021_mjs_modules.ts delete mode 100644 cli/tests/021_mjs_modules.ts.out delete mode 100644 cli/tests/022_info_flag_script.out delete mode 100644 cli/tests/023_no_ext delete mode 100644 cli/tests/023_no_ext.out delete mode 100644 cli/tests/024_import_no_ext_with_headers.ts delete mode 100644 cli/tests/024_import_no_ext_with_headers.ts.out delete mode 100644 cli/tests/025_hrtime.ts delete mode 100644 cli/tests/025_hrtime.ts.out delete mode 100644 cli/tests/025_reload_js_type_error.js delete mode 100644 cli/tests/025_reload_js_type_error.js.out delete mode 100644 cli/tests/026_redirect_javascript.js delete mode 100644 cli/tests/026_redirect_javascript.js.out delete mode 100644 cli/tests/027_redirect_typescript.ts delete mode 100644 cli/tests/027_redirect_typescript.ts.out delete mode 100644 cli/tests/028_args.ts delete mode 100644 cli/tests/028_args.ts.out delete mode 100644 cli/tests/029_eval.out delete mode 100644 cli/tests/030_eval_ts.out delete mode 100644 cli/tests/031_info_ts_error.out delete mode 100644 cli/tests/031_info_ts_error.ts delete mode 100644 cli/tests/033_import_map.out delete mode 100644 cli/tests/033_import_map_remote.out delete mode 100644 cli/tests/034_onload.out delete mode 100644 cli/tests/034_onload/imported.ts delete mode 100644 cli/tests/034_onload/main.ts delete mode 100644 cli/tests/034_onload/nest_imported.ts delete mode 100644 cli/tests/035_cached_only_flag.out delete mode 100644 cli/tests/036_import_map_fetch.out delete mode 100644 cli/tests/037_fetch_multiple.out delete mode 100644 cli/tests/038_checkjs.js delete mode 100644 cli/tests/038_checkjs.js.out delete mode 100644 cli/tests/038_checkjs.tsconfig.json delete mode 100644 cli/tests/041_dyn_import_eval.out delete mode 100644 cli/tests/041_info_flag.out delete mode 100644 cli/tests/041_info_flag_location.out delete mode 100644 cli/tests/042_dyn_import_evalcontext.ts delete mode 100644 cli/tests/042_dyn_import_evalcontext.ts.out delete mode 100644 cli/tests/044_bad_resource.ts delete mode 100644 cli/tests/044_bad_resource.ts.out delete mode 100644 cli/tests/045_programmatic_proxy_client.ts delete mode 100644 cli/tests/045_proxy_client.ts delete mode 100644 cli/tests/045_proxy_test.ts delete mode 100644 cli/tests/045_proxy_test.ts.out delete mode 100644 cli/tests/046_jsx_test.tsx delete mode 100644 cli/tests/046_jsx_test.tsx.out delete mode 100644 cli/tests/047_jsx_test.jsx delete mode 100644 cli/tests/047_jsx_test.jsx.out delete mode 100644 cli/tests/048_media_types_jsx.ts delete mode 100644 cli/tests/048_media_types_jsx.ts.out delete mode 100644 cli/tests/049_info_flag_script_jsx.out delete mode 100644 cli/tests/052_no_remote_flag.out delete mode 100644 cli/tests/053_import_compression.out delete mode 100644 cli/tests/053_import_compression/brotli delete mode 100644 cli/tests/053_import_compression/gziped delete mode 100644 cli/tests/053_import_compression/main.ts delete mode 100644 cli/tests/054_info_local_imports.out delete mode 100644 cli/tests/055_info_file_json.out delete mode 100644 cli/tests/056_make_temp_file_write_perm.out delete mode 100644 cli/tests/056_make_temp_file_write_perm.ts delete mode 100644 cli/tests/058_tasks_microtasks_close.ts delete mode 100644 cli/tests/058_tasks_microtasks_close.ts.out delete mode 100644 cli/tests/059_fs_relative_path_perm.ts delete mode 100644 cli/tests/059_fs_relative_path_perm.ts.out delete mode 100644 cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts delete mode 100644 cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts.out delete mode 100644 cli/tests/061_permissions_request.ts delete mode 100644 cli/tests/061_permissions_request.ts.out delete mode 100644 cli/tests/062_permissions_request_global.ts delete mode 100644 cli/tests/062_permissions_request_global.ts.out delete mode 100644 cli/tests/063_permissions_revoke.ts delete mode 100644 cli/tests/063_permissions_revoke.ts.out delete mode 100644 cli/tests/064_permissions_revoke_global.ts delete mode 100644 cli/tests/064_permissions_revoke_global.ts.out delete mode 100644 cli/tests/065_import_map_info.out delete mode 100644 cli/tests/066_prompt.ts delete mode 100644 cli/tests/066_prompt.ts.out delete mode 100644 cli/tests/070_location.ts delete mode 100644 cli/tests/070_location.ts.out delete mode 100644 cli/tests/071_location_unset.ts delete mode 100644 cli/tests/071_location_unset.ts.out delete mode 100644 cli/tests/072_location_relative_fetch.ts delete mode 100644 cli/tests/072_location_relative_fetch.ts.out delete mode 100644 cli/tests/075_import_local_query_hash.ts delete mode 100644 cli/tests/075_import_local_query_hash.ts.out delete mode 100644 cli/tests/076_info_json_deps_order.out delete mode 100644 cli/tests/076_info_json_deps_order.ts delete mode 100644 cli/tests/077_fetch_empty.ts delete mode 100644 cli/tests/077_fetch_empty.ts.out delete mode 100644 cli/tests/078_unload_on_exit.ts delete mode 100644 cli/tests/078_unload_on_exit.ts.out delete mode 100644 cli/tests/079_location_authentication.ts delete mode 100644 cli/tests/079_location_authentication.ts.out delete mode 100644 cli/tests/080_deno_emit_permissions.ts delete mode 100644 cli/tests/080_deno_emit_permissions.ts.out delete mode 100644 cli/tests/081_location_relative_fetch_redirect.ts delete mode 100644 cli/tests/081_location_relative_fetch_redirect.ts.out delete mode 100644 cli/tests/082_prepare_stack_trace_throw.js delete mode 100644 cli/tests/082_prepare_stack_trace_throw.js.out delete mode 100644 cli/tests/083_legacy_external_source_map.ts delete mode 100644 cli/tests/084_worker_custom_inspect.ts delete mode 100644 cli/tests/084_worker_custom_inspect.ts.out delete mode 100644 cli/tests/084_worker_custom_inspect_worker.ts delete mode 100644 cli/tests/085_dynamic_import_async_error.ts delete mode 100644 cli/tests/085_dynamic_import_async_error.ts.out delete mode 100644 cli/tests/086_dynamic_import_already_rejected.ts delete mode 100644 cli/tests/086_dynamic_import_already_rejected.ts.out delete mode 100644 cli/tests/087_hello.ts delete mode 100644 cli/tests/087_no_check_imports_not_used_as_values.ts delete mode 100644 cli/tests/087_no_check_imports_not_used_as_values.ts.out delete mode 100644 cli/tests/088_dynamic_import_already_evaluating.ts delete mode 100644 cli/tests/088_dynamic_import_already_evaluating.ts.out delete mode 100644 cli/tests/088_dynamic_import_target.ts delete mode 100644 cli/tests/089_run_allow_list.ts delete mode 100644 cli/tests/089_run_allow_list.ts.out delete mode 100644 cli/tests/090_run_permissions_request.ts delete mode 100644 cli/tests/090_run_permissions_request.ts.out delete mode 100644 cli/tests/091_use_define_for_class_fields.ts delete mode 100644 cli/tests/091_use_define_for_class_fields.ts.out delete mode 100644 cli/tests/092_import_map_unmapped_bare_specifier.ts delete mode 100644 cli/tests/092_import_map_unmapped_bare_specifier.ts.out delete mode 100644 cli/tests/095_cache_with_bare_import.ts delete mode 100644 cli/tests/095_cache_with_bare_import.ts.out delete mode 100644 cli/tests/Component.tsx delete mode 100644 cli/tests/DenoWinRunner.cs delete mode 100644 cli/tests/DenoWinRunner.ps1 delete mode 100644 cli/tests/README.md delete mode 100644 cli/tests/async_error.ts delete mode 100644 cli/tests/async_error.ts.out delete mode 100644 cli/tests/badly_formatted.json delete mode 100644 cli/tests/badly_formatted.md delete mode 100644 cli/tests/badly_formatted.mjs delete mode 100644 cli/tests/badly_formatted_fixed.js delete mode 100644 cli/tests/badly_formatted_fixed.json delete mode 100644 cli/tests/badly_formatted_fixed.md delete mode 100644 cli/tests/blob_gc_finalization.js delete mode 100644 cli/tests/blob_gc_finalization.js.out delete mode 100644 cli/tests/bundle.test.out delete mode 100644 cli/tests/bundle/file_tests-fixture01.ts delete mode 100644 cli/tests/bundle/file_tests-fixture02.ts delete mode 100644 cli/tests/bundle/file_tests-fixture03.ts delete mode 100644 cli/tests/bundle/file_tests-fixture04.ts delete mode 100644 cli/tests/bundle/file_tests-fixture05.ts delete mode 100644 cli/tests/bundle/file_tests-fixture06.ts delete mode 100644 cli/tests/bundle/file_tests-fixture07.ts delete mode 100644 cli/tests/bundle/file_tests-fixture08.ts delete mode 100644 cli/tests/bundle/file_tests-fixture09.ts delete mode 100644 cli/tests/bundle/file_tests-fixture10.ts delete mode 100644 cli/tests/bundle/file_tests-fixture11.ts delete mode 100644 cli/tests/bundle/file_tests-fixture12.ts delete mode 100644 cli/tests/bundle/file_tests-fixture13.ts delete mode 100644 cli/tests/bundle/file_tests-fixture14.ts delete mode 100644 cli/tests/bundle/file_tests-fixture15.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-a.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-b.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-c.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-d.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-e.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-f.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-g.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-h.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-i.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-j.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-k.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-l.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-m.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-n.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-o.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-p.ts delete mode 100644 cli/tests/bundle/file_tests-subdir-q.ts delete mode 100644 cli/tests/bundle/fixture01.out delete mode 100644 cli/tests/bundle/fixture02.out delete mode 100644 cli/tests/bundle/fixture03.out delete mode 100644 cli/tests/bundle/fixture04.out delete mode 100644 cli/tests/bundle/fixture05.out delete mode 100644 cli/tests/bundle/fixture06.out delete mode 100644 cli/tests/bundle/fixture07.out delete mode 100644 cli/tests/bundle/fixture08.out delete mode 100644 cli/tests/bundle/fixture09.out delete mode 100644 cli/tests/bundle/fixture10.out delete mode 100644 cli/tests/bundle/fixture11.out delete mode 100644 cli/tests/bundle/fixture12.out delete mode 100644 cli/tests/bundle/fixture13.out delete mode 100644 cli/tests/bundle/fixture14.out delete mode 100644 cli/tests/bundle/fixture15.out delete mode 100644 cli/tests/bundle/https_deno.land-x-lib-a.ts delete mode 100644 cli/tests/bundle/https_deno.land-x-lib-b.js delete mode 100644 cli/tests/bundle/https_deno.land-x-lib-c.d.ts delete mode 100644 cli/tests/bundle/https_deno.land-x-lib-c.js delete mode 100644 cli/tests/bundle/https_deno.land-x-lib-mod.d.ts delete mode 100644 cli/tests/bundle/https_deno.land-x-lib-mod.js delete mode 100644 cli/tests/bundle_dynamic_import.ts delete mode 100644 cli/tests/bundle_im.json delete mode 100644 cli/tests/bundle_im.ts delete mode 100644 cli/tests/bundle_jsx.out delete mode 100644 cli/tests/cache_extensionless.out delete mode 100644 cli/tests/cache_random_extension.out delete mode 100644 cli/tests/cafile_info.ts delete mode 100644 cli/tests/cafile_info.ts.out delete mode 100644 cli/tests/cafile_ts_fetch.ts delete mode 100644 cli/tests/cafile_ts_fetch.ts.out delete mode 100644 cli/tests/cafile_ts_fetch_unsafe_ssl.ts.out delete mode 100644 cli/tests/cafile_url_imports.ts delete mode 100644 cli/tests/cafile_url_imports.ts.out delete mode 100644 cli/tests/cafile_url_imports_unsafe_ssl.ts.out delete mode 100644 cli/tests/cat.ts delete mode 100644 cli/tests/circular1.js delete mode 100644 cli/tests/circular1.js.out delete mode 100644 cli/tests/circular2.js delete mode 100644 cli/tests/cjs_imports.ts delete mode 100644 cli/tests/cjs_imports.ts.out delete mode 100644 cli/tests/commonjs.cjs delete mode 100644 cli/tests/compiler_api_test.ts delete mode 100644 cli/tests/complex_permissions_test.ts delete mode 100644 cli/tests/config.ts delete mode 100644 cli/tests/config.ts.out delete mode 100644 cli/tests/config.tsconfig.json delete mode 100644 cli/tests/config_types.ts delete mode 100644 cli/tests/config_types.ts.out delete mode 100644 cli/tests/config_types.tsconfig.json delete mode 100644 cli/tests/config_types_remote.tsconfig.json delete mode 100644 cli/tests/coverage/branch.ts delete mode 100644 cli/tests/coverage/branch_test.ts delete mode 100644 cli/tests/coverage/complex.ts delete mode 100644 cli/tests/coverage/complex_test.ts delete mode 100644 cli/tests/coverage/expected_branch.lcov delete mode 100644 cli/tests/coverage/expected_branch.out delete mode 100644 cli/tests/coverage/expected_complex.lcov delete mode 100644 cli/tests/coverage/expected_complex.out delete mode 100644 cli/tests/delayed_error.ts delete mode 100644 cli/tests/deno_doc.out delete mode 100644 cli/tests/deno_doc.ts delete mode 100644 cli/tests/deno_doc_builtin.out delete mode 100644 cli/tests/deno_dom_0.1.3-alpha2.wasm delete mode 100644 cli/tests/deno_land_unsafe_ssl.ts delete mode 100644 cli/tests/deno_land_unsafe_ssl.ts.out delete mode 100644 cli/tests/disallow_http_from_https.js delete mode 100644 cli/tests/disallow_http_from_https.ts delete mode 100644 cli/tests/disallow_http_from_https_js.out delete mode 100644 cli/tests/disallow_http_from_https_ts.out delete mode 100644 cli/tests/doc/import_map.json delete mode 100644 cli/tests/doc/invalid_url.out delete mode 100644 cli/tests/doc/module/fun.js delete mode 100644 cli/tests/doc/types_header.out delete mode 100644 cli/tests/doc/types_header.ts delete mode 100644 cli/tests/doc/types_hint.out delete mode 100644 cli/tests/doc/types_hint.ts delete mode 100644 cli/tests/doc/types_ref.js delete mode 100644 cli/tests/doc/types_ref.out delete mode 100644 cli/tests/doc/use_import_map.js delete mode 100644 cli/tests/doc/use_import_map.out delete mode 100644 cli/tests/dynamic_import/b.js delete mode 100644 cli/tests/dynamic_import/c.js delete mode 100644 cli/tests/dynamic_import/permissions_blob_local.ts delete mode 100644 cli/tests/dynamic_import/permissions_blob_local.ts.out delete mode 100644 cli/tests/dynamic_import/permissions_blob_remote.ts delete mode 100644 cli/tests/dynamic_import/permissions_blob_remote.ts.out delete mode 100644 cli/tests/dynamic_import/permissions_data_local.ts delete mode 100644 cli/tests/dynamic_import/permissions_data_local.ts.out delete mode 100644 cli/tests/dynamic_import/permissions_data_remote.ts delete mode 100644 cli/tests/dynamic_import/permissions_data_remote.ts.out delete mode 100644 cli/tests/dynamic_import/permissions_remote_remote.ts delete mode 100644 cli/tests/dynamic_import/permissions_remote_remote.ts.out delete mode 100644 cli/tests/dynamic_import/static_remote.ts delete mode 100644 cli/tests/dynamic_import_conditional.js delete mode 100644 cli/tests/dynamic_import_conditional.js.out delete mode 100644 cli/tests/echo.ts delete mode 100644 cli/tests/echo_server.ts delete mode 100644 cli/tests/encoding/utf-16be.ts delete mode 100644 cli/tests/encoding/utf-16le.ts delete mode 100644 cli/tests/encoding/utf-8.ts delete mode 100644 cli/tests/encoding/windows-1255 delete mode 100644 cli/tests/error_001.ts delete mode 100644 cli/tests/error_001.ts.out delete mode 100644 cli/tests/error_002.ts delete mode 100644 cli/tests/error_002.ts.out delete mode 100644 cli/tests/error_003_typescript.ts delete mode 100644 cli/tests/error_003_typescript.ts.out delete mode 100644 cli/tests/error_004_missing_module.ts delete mode 100644 cli/tests/error_004_missing_module.ts.out delete mode 100644 cli/tests/error_005_missing_dynamic_import.ts delete mode 100644 cli/tests/error_005_missing_dynamic_import.ts.out delete mode 100644 cli/tests/error_006_import_ext_failure.ts delete mode 100644 cli/tests/error_006_import_ext_failure.ts.out delete mode 100644 cli/tests/error_007_any.ts delete mode 100644 cli/tests/error_007_any.ts.out delete mode 100644 cli/tests/error_008_checkjs.js delete mode 100644 cli/tests/error_008_checkjs.js.out delete mode 100644 cli/tests/error_009_extensions_error.js delete mode 100644 cli/tests/error_009_extensions_error.js.out delete mode 100644 cli/tests/error_009_missing_js_module.disabled delete mode 100644 cli/tests/error_009_missing_js_module.js delete mode 100644 cli/tests/error_009_missing_js_module.js.out delete mode 100644 cli/tests/error_010_nonexistent_arg.disabled delete mode 100644 cli/tests/error_010_nonexistent_arg.out delete mode 100644 cli/tests/error_011_bad_module_specifier.ts delete mode 100644 cli/tests/error_011_bad_module_specifier.ts.out delete mode 100644 cli/tests/error_012_bad_dynamic_import_specifier.ts delete mode 100644 cli/tests/error_012_bad_dynamic_import_specifier.ts.out delete mode 100644 cli/tests/error_013_missing_script.out delete mode 100644 cli/tests/error_014_catch_dynamic_import_error.js delete mode 100644 cli/tests/error_014_catch_dynamic_import_error.js.out delete mode 100644 cli/tests/error_015_dynamic_import_permissions.js delete mode 100644 cli/tests/error_015_dynamic_import_permissions.out delete mode 100644 cli/tests/error_016_dynamic_import_permissions2.js delete mode 100644 cli/tests/error_016_dynamic_import_permissions2.out delete mode 100644 cli/tests/error_017_hide_long_source_ts.ts delete mode 100644 cli/tests/error_017_hide_long_source_ts.ts.out delete mode 100644 cli/tests/error_018_hide_long_source_js.js delete mode 100644 cli/tests/error_018_hide_long_source_js.js.out delete mode 100644 cli/tests/error_019_stack_function.ts delete mode 100644 cli/tests/error_019_stack_function.ts.out delete mode 100644 cli/tests/error_020_stack_constructor.ts delete mode 100644 cli/tests/error_020_stack_constructor.ts.out delete mode 100644 cli/tests/error_021_stack_method.ts delete mode 100644 cli/tests/error_021_stack_method.ts.out delete mode 100644 cli/tests/error_022_stack_custom_error.ts delete mode 100644 cli/tests/error_022_stack_custom_error.ts.out delete mode 100644 cli/tests/error_023_stack_async.ts delete mode 100644 cli/tests/error_023_stack_async.ts.out delete mode 100644 cli/tests/error_024_stack_promise_all.ts delete mode 100644 cli/tests/error_024_stack_promise_all.ts.out delete mode 100644 cli/tests/error_025_tab_indent delete mode 100644 cli/tests/error_025_tab_indent.out delete mode 100644 cli/tests/error_026_remote_import_error.ts delete mode 100644 cli/tests/error_026_remote_import_error.ts.out delete mode 100644 cli/tests/error_027_bundle_with_bare_import.ts delete mode 100644 cli/tests/error_027_bundle_with_bare_import.ts.out delete mode 100644 cli/tests/error_import_map_unable_to_load.out delete mode 100644 cli/tests/error_local_static_import_from_remote.js delete mode 100644 cli/tests/error_local_static_import_from_remote.js.out delete mode 100644 cli/tests/error_local_static_import_from_remote.ts delete mode 100644 cli/tests/error_local_static_import_from_remote.ts.out delete mode 100644 cli/tests/error_missing_module_named_import.ts delete mode 100644 cli/tests/error_missing_module_named_import.ts.out delete mode 100644 cli/tests/error_no_check.ts delete mode 100644 cli/tests/error_no_check.ts.out delete mode 100644 cli/tests/error_syntax.js delete mode 100644 cli/tests/error_syntax.js.out delete mode 100644 cli/tests/error_syntax_empty_trailing_line.mjs delete mode 100644 cli/tests/error_syntax_empty_trailing_line.mjs.out delete mode 100644 cli/tests/error_type_definitions.ts delete mode 100644 cli/tests/error_type_definitions.ts.out delete mode 100644 cli/tests/error_worker_permissions_local.ts delete mode 100644 cli/tests/error_worker_permissions_local.ts.out delete mode 100644 cli/tests/error_worker_permissions_remote.ts delete mode 100644 cli/tests/error_worker_permissions_remote.ts.out delete mode 100644 cli/tests/es_private_fields.js delete mode 100644 cli/tests/es_private_fields.js.out delete mode 100644 cli/tests/esm_imports_a.js delete mode 100644 cli/tests/esm_imports_b.js delete mode 100644 cli/tests/exec_path.ts delete mode 100644 cli/tests/exit_error42.ts delete mode 100644 cli/tests/exit_error42.ts.out delete mode 100644 cli/tests/export_type_def.ts delete mode 100644 cli/tests/fetch/hello.txt delete mode 100644 cli/tests/fetch/other.ts delete mode 100644 cli/tests/fetch/test.ts delete mode 100644 cli/tests/fetch_response_finalization.js delete mode 100644 cli/tests/fetch_response_finalization.js.out delete mode 100644 cli/tests/file_exists.ts delete mode 100644 cli/tests/finalization_registry.js delete mode 100644 cli/tests/finalization_registry.js.out delete mode 100644 cli/tests/fix_dynamic_import_errors.js delete mode 100644 cli/tests/fix_dynamic_import_errors.js.out delete mode 100644 cli/tests/fix_emittable_skipped.js delete mode 100644 cli/tests/fix_emittable_skipped.ts.out delete mode 100644 cli/tests/fix_exotic_specifiers.ts delete mode 100644 cli/tests/fix_exotic_specifiers.ts.out delete mode 100644 cli/tests/fix_js_import_js.ts delete mode 100644 cli/tests/fix_js_import_js.ts.out delete mode 100644 cli/tests/fix_js_imports.ts delete mode 100644 cli/tests/fix_js_imports.ts.out delete mode 100644 cli/tests/fix_tsc_file_exists.out delete mode 100644 cli/tests/fix_worker_dispatchevent.ts delete mode 100644 cli/tests/fix_worker_dispatchevent.ts.out delete mode 100644 cli/tests/fixture.json delete mode 100644 cli/tests/fmt/expected_fmt_check_formatted_files.out delete mode 100644 cli/tests/fmt/expected_fmt_check_ignore.out delete mode 100644 cli/tests/fmt/expected_fmt_check_tests_dir.out delete mode 100644 cli/tests/fmt/expected_fmt_check_verbose_formatted_files.out delete mode 100644 cli/tests/fmt/expected_fmt_check_verbose_tests_dir.out delete mode 100644 cli/tests/fmt/formatted1.js delete mode 100644 cli/tests/fmt/formatted2.ts delete mode 100644 cli/tests/fmt/formatted3.md delete mode 100644 cli/tests/fmt/formatted4.jsonc delete mode 100644 cli/tests/heapstats.js delete mode 100644 cli/tests/heapstats.js.out delete mode 100644 cli/tests/hello.txt delete mode 100644 cli/tests/https_import.ts delete mode 100644 cli/tests/https_import.ts.out delete mode 100644 cli/tests/if_main.ts delete mode 100644 cli/tests/if_main.ts.out delete mode 100644 cli/tests/ignore_require.js delete mode 100644 cli/tests/import_blob_url.ts delete mode 100644 cli/tests/import_blob_url.ts.out delete mode 100644 cli/tests/import_blob_url_error_stack.ts delete mode 100644 cli/tests/import_blob_url_error_stack.ts.out delete mode 100644 cli/tests/import_blob_url_import_relative.ts delete mode 100644 cli/tests/import_blob_url_import_relative.ts.out delete mode 100644 cli/tests/import_blob_url_imports.ts delete mode 100644 cli/tests/import_blob_url_imports.ts.out delete mode 100644 cli/tests/import_blob_url_jsx.ts delete mode 100644 cli/tests/import_blob_url_jsx.ts.out delete mode 100644 cli/tests/import_data_url.ts delete mode 100644 cli/tests/import_data_url.ts.out delete mode 100644 cli/tests/import_data_url_error_stack.ts delete mode 100644 cli/tests/import_data_url_error_stack.ts.out delete mode 100644 cli/tests/import_data_url_import_relative.ts delete mode 100644 cli/tests/import_data_url_import_relative.ts.out delete mode 100644 cli/tests/import_data_url_imports.ts delete mode 100644 cli/tests/import_data_url_imports.ts.out delete mode 100644 cli/tests/import_data_url_jsx.ts delete mode 100644 cli/tests/import_data_url_jsx.ts.out delete mode 100644 cli/tests/import_dynamic_data_url.ts delete mode 100644 cli/tests/import_dynamic_data_url.ts.out delete mode 100644 cli/tests/import_file_with_colon.ts delete mode 100644 cli/tests/import_file_with_colon.ts.out delete mode 100644 cli/tests/import_maps/import_map.json delete mode 100644 cli/tests/import_maps/import_map_remote.json delete mode 100644 cli/tests/import_maps/lodash/lodash.ts delete mode 100644 cli/tests/import_maps/lodash/other_file.ts delete mode 100644 cli/tests/import_maps/moment/moment.ts delete mode 100644 cli/tests/import_maps/moment/other_file.ts delete mode 100644 cli/tests/import_maps/scope/scoped.ts delete mode 100644 cli/tests/import_maps/scoped_moment.ts delete mode 100644 cli/tests/import_maps/test.ts delete mode 100644 cli/tests/import_maps/test_remote.ts delete mode 100644 cli/tests/import_maps/vue.ts delete mode 100644 cli/tests/import_meta.ts delete mode 100644 cli/tests/import_meta.ts.out delete mode 100644 cli/tests/import_meta2.ts delete mode 100644 cli/tests/info/data_null_error/data_null_error.out delete mode 100644 cli/tests/info/data_null_error/mod.ts delete mode 100644 cli/tests/info/data_null_error/types.d.ts delete mode 100644 cli/tests/info/types_header.out delete mode 100644 cli/tests/info_json.out delete mode 100644 cli/tests/info_json_location.out delete mode 100644 cli/tests/info_missing_module.out delete mode 100644 cli/tests/info_recursive_imports_test.out delete mode 100644 cli/tests/info_recursive_imports_test.ts delete mode 100644 cli/tests/info_type_import.out delete mode 100644 cli/tests/info_type_import.ts delete mode 100644 cli/tests/inline_js_source_map.ts delete mode 100644 cli/tests/inline_js_source_map_2.js delete mode 100644 cli/tests/inline_js_source_map_2.js.out delete mode 100644 cli/tests/inline_js_source_map_2.ts delete mode 100644 cli/tests/inline_js_source_map_2_with_inline_contents.js delete mode 100644 cli/tests/inline_js_source_map_2_with_inline_contents.js.out delete mode 100644 cli/tests/inline_js_source_map_with_contents_from_graph.js delete mode 100644 cli/tests/inline_js_source_map_with_contents_from_graph.js.out delete mode 100644 cli/tests/inspector1.js delete mode 100644 cli/tests/inspector2.js delete mode 100644 cli/tests/inspector3.js delete mode 100644 cli/tests/inspector4.js delete mode 100644 cli/tests/js_import_detect.ts delete mode 100644 cli/tests/js_import_detect.ts.out delete mode 100644 cli/tests/jsx_import_from_ts.App.jsx delete mode 100644 cli/tests/jsx_import_from_ts.ts delete mode 100644 cli/tests/jsx_import_from_ts.ts.out delete mode 100644 cli/tests/lib_dom_asynciterable.ts delete mode 100644 cli/tests/lib_dom_asynciterable.ts.out delete mode 100644 cli/tests/lib_ref.ts delete mode 100644 cli/tests/lib_ref.ts.out delete mode 100644 cli/tests/lib_runtime_api.ts delete mode 100644 cli/tests/lib_runtime_api.ts.out delete mode 100644 cli/tests/lint/expected.out delete mode 100644 cli/tests/lint/expected_from_stdin.out delete mode 100644 cli/tests/lint/expected_from_stdin_json.out delete mode 100644 cli/tests/lint/expected_glob.out delete mode 100644 cli/tests/lint/expected_ignore.out delete mode 100644 cli/tests/lint/expected_json.out delete mode 100644 cli/tests/lint/expected_quiet.out delete mode 100644 cli/tests/lint/expected_rules.out delete mode 100644 cli/tests/lint/expected_verbose.out delete mode 100644 cli/tests/lint/file1.js delete mode 100644 cli/tests/lint/file2.ts delete mode 100644 cli/tests/lint/ignored_file.ts delete mode 100644 cli/tests/lint/malformed.js delete mode 100644 cli/tests/listen_tls_alpn.ts delete mode 100644 cli/tests/localhost_unsafe_ssl.ts.out delete mode 100644 cli/tests/lock_check_err.json delete mode 100644 cli/tests/lock_check_err.out delete mode 100644 cli/tests/lock_check_err2.json delete mode 100644 cli/tests/lock_check_err2.out delete mode 100644 cli/tests/lock_check_err_with_bundle.json delete mode 100644 cli/tests/lock_check_err_with_bundle.out delete mode 100644 cli/tests/lock_check_ok.json delete mode 100644 cli/tests/lock_check_ok2.json delete mode 100644 cli/tests/lock_dynamic_imports.json delete mode 100644 cli/tests/lock_dynamic_imports.out delete mode 100644 cli/tests/lock_write_fetch.ts delete mode 100644 cli/tests/lock_write_fetch.ts.out delete mode 100644 cli/tests/lock_write_requires_lock.out delete mode 100644 cli/tests/lsp/a.d.ts delete mode 100644 cli/tests/lsp/b.d.ts delete mode 100644 cli/tests/lsp/code_action_ignore_lint_params.json delete mode 100644 cli/tests/lsp/code_action_ignore_lint_response.json delete mode 100644 cli/tests/lsp/code_action_params.json delete mode 100644 cli/tests/lsp/code_action_params_cache.json delete mode 100644 cli/tests/lsp/code_action_params_deadlock.json delete mode 100644 cli/tests/lsp/code_action_params_imports.json delete mode 100644 cli/tests/lsp/code_action_params_refactor.json delete mode 100644 cli/tests/lsp/code_action_resolve_params.json delete mode 100644 cli/tests/lsp/code_action_resolve_params_imports.json delete mode 100644 cli/tests/lsp/code_action_resolve_params_refactor.json delete mode 100644 cli/tests/lsp/code_action_resolve_response.json delete mode 100644 cli/tests/lsp/code_action_resolve_response_imports.json delete mode 100644 cli/tests/lsp/code_action_resolve_response_refactor.json delete mode 100644 cli/tests/lsp/code_action_response.json delete mode 100644 cli/tests/lsp/code_action_response_cache.json delete mode 100644 cli/tests/lsp/code_action_response_imports.json delete mode 100644 cli/tests/lsp/code_action_response_no_disabled.json delete mode 100644 cli/tests/lsp/code_action_response_refactor.json delete mode 100644 cli/tests/lsp/code_lens_resolve_response.json delete mode 100644 cli/tests/lsp/code_lens_resolve_response_impl.json delete mode 100644 cli/tests/lsp/code_lens_response.json delete mode 100644 cli/tests/lsp/code_lens_response_changed.json delete mode 100644 cli/tests/lsp/code_lens_response_impl.json delete mode 100644 cli/tests/lsp/code_lens_response_test.json delete mode 100644 cli/tests/lsp/completion_request_params_optional.json delete mode 100644 cli/tests/lsp/completion_request_response_empty.json delete mode 100644 cli/tests/lsp/completion_resolve_params.json delete mode 100644 cli/tests/lsp/completion_resolve_params_optional.json delete mode 100644 cli/tests/lsp/completion_resolve_params_registry.json delete mode 100644 cli/tests/lsp/completion_resolve_response.json delete mode 100644 cli/tests/lsp/completion_resolve_response_registry.json delete mode 100644 cli/tests/lsp/diagnostics_deno_deps.json delete mode 100644 cli/tests/lsp/diagnostics_deno_types.json delete mode 100644 cli/tests/lsp/did_open_params_deno_types.json delete mode 100644 cli/tests/lsp/did_open_params_doc_symbol.json delete mode 100644 cli/tests/lsp/did_open_params_import_hover.json delete mode 100644 cli/tests/lsp/did_open_params_large.json delete mode 100644 cli/tests/lsp/did_open_params_semantic_tokens.json delete mode 100644 cli/tests/lsp/did_open_params_test_code_lens.json delete mode 100644 cli/tests/lsp/document_symbol_response.json delete mode 100644 cli/tests/lsp/formatting_mbc_response.json delete mode 100644 cli/tests/lsp/import-map.json delete mode 100644 cli/tests/lsp/incoming_calls_params.json delete mode 100644 cli/tests/lsp/incoming_calls_response.json delete mode 100644 cli/tests/lsp/initialize_params.json delete mode 100644 cli/tests/lsp/initialize_params_bad_config_option.json delete mode 100644 cli/tests/lsp/initialize_params_ca_no_disabled.json delete mode 100644 cli/tests/lsp/initialize_params_code_lens_test.json delete mode 100644 cli/tests/lsp/initialize_params_code_lens_test_disabled.json delete mode 100644 cli/tests/lsp/initialize_params_did_config_change.json delete mode 100644 cli/tests/lsp/initialize_params_disabled.json delete mode 100644 cli/tests/lsp/initialize_params_registry.json delete mode 100644 cli/tests/lsp/initialize_params_unstable.json delete mode 100644 cli/tests/lsp/lib.tsconfig.json delete mode 100644 cli/tests/lsp/outgoing_calls_params.json delete mode 100644 cli/tests/lsp/outgoing_calls_response.json delete mode 100644 cli/tests/lsp/prepare_call_hierarchy_response.json delete mode 100644 cli/tests/lsp/registries/a_latest.json delete mode 100644 cli/tests/lsp/registries/a_v1.0.0.json delete mode 100644 cli/tests/lsp/registries/a_v1.0.1.json delete mode 100644 cli/tests/lsp/registries/a_v2.0.0.json delete mode 100644 cli/tests/lsp/registries/a_versions.json delete mode 100644 cli/tests/lsp/registries/b_latest.json delete mode 100644 cli/tests/lsp/registries/b_v0.0.1.json delete mode 100644 cli/tests/lsp/registries/b_v0.0.2.json delete mode 100644 cli/tests/lsp/registries/b_v0.0.3.json delete mode 100644 cli/tests/lsp/registries/b_versions.json delete mode 100644 cli/tests/lsp/registries/deno-import-intellisense.json delete mode 100644 cli/tests/lsp/registries/modules.json delete mode 100644 cli/tests/lsp/rename_response.json delete mode 100644 cli/tests/lsp/selection_range_response.json delete mode 100644 cli/tests/lsp/types.tsconfig.json delete mode 100644 cli/tests/main_module.ts delete mode 100644 cli/tests/main_module.ts.out delete mode 100644 cli/tests/main_module2.ts delete mode 100644 cli/tests/module_graph/file_tests-a.mjs delete mode 100644 cli/tests/module_graph/file_tests-b-mod.js delete mode 100644 cli/tests/module_graph/file_tests-b.ts delete mode 100644 cli/tests/module_graph/file_tests-c-mod.ts delete mode 100644 cli/tests/module_graph/file_tests-checkwithconfig.ts delete mode 100644 cli/tests/module_graph/file_tests-diag.ts delete mode 100644 cli/tests/module_graph/file_tests-dynamicimport.ts delete mode 100644 cli/tests/module_graph/file_tests-importjson.ts delete mode 100644 cli/tests/module_graph/file_tests-importremap.ts delete mode 100644 cli/tests/module_graph/file_tests-main.ts delete mode 100644 cli/tests/module_graph/file_tests-some.json delete mode 100644 cli/tests/module_graph/file_typesref.d.ts delete mode 100644 cli/tests/module_graph/file_typesref.js delete mode 100644 cli/tests/module_graph/https_deno.land-std-http-server.ts delete mode 100644 cli/tests/module_graph/https_deno.land-x-a-mod.ts delete mode 100644 cli/tests/module_graph/https_deno.land-x-a.ts delete mode 100644 cli/tests/module_graph/https_deno.land-x-import_map.ts delete mode 100644 cli/tests/module_graph/https_deno.land-x-jquery.js delete mode 100644 cli/tests/module_graph/https_deno.land-x-lib-a.ts delete mode 100644 cli/tests/module_graph/https_deno.land-x-lib-b.js delete mode 100644 cli/tests/module_graph/https_deno.land-x-lib-c.d.ts delete mode 100644 cli/tests/module_graph/https_deno.land-x-lib-c.js delete mode 100644 cli/tests/module_graph/https_deno.land-x-lib-mod.d.ts delete mode 100644 cli/tests/module_graph/https_deno.land-x-lib-mod.js delete mode 100644 cli/tests/module_graph/https_deno.land-x-mod.ts delete mode 100644 cli/tests/module_graph/https_deno.land-x-transpile.tsx delete mode 100644 cli/tests/module_graph/https_unpkg.com-lodash-index.js delete mode 100644 cli/tests/module_graph/lockfile.json delete mode 100644 cli/tests/module_graph/lockfile_fail.json delete mode 100644 cli/tests/module_graph/tsconfig.json delete mode 100644 cli/tests/module_graph/tsconfig_01.json delete mode 100644 cli/tests/no_check_decorators.ts delete mode 100644 cli/tests/no_check_decorators.ts.out delete mode 100644 cli/tests/no_color.js delete mode 100644 cli/tests/no_mem_cache.js delete mode 100644 cli/tests/no_mem_cache.js.out delete mode 100644 cli/tests/no_validate_asm.js delete mode 100644 cli/tests/performance_stats.out delete mode 100644 cli/tests/permission_test.ts delete mode 100644 cli/tests/preserve_imports.tsconfig.json delete mode 100644 cli/tests/proto_exploit.js delete mode 100644 cli/tests/proto_exploit.js.out delete mode 100644 cli/tests/raw_mode.ts delete mode 100644 cli/tests/raw_mode_cbreak.ts delete mode 100644 cli/tests/recursive_imports/A.ts delete mode 100644 cli/tests/recursive_imports/B.ts delete mode 100644 cli/tests/recursive_imports/C.ts delete mode 100644 cli/tests/recursive_imports/common.ts delete mode 100644 cli/tests/redirect_cache.out delete mode 100644 cli/tests/reference_types.ts delete mode 100644 cli/tests/reference_types.ts.out delete mode 100644 cli/tests/reference_types_remote.ts delete mode 100644 cli/tests/reference_types_remote.ts.out delete mode 100644 cli/tests/resolve_dns.ts delete mode 100644 cli/tests/resolve_dns.ts.out delete mode 100644 cli/tests/runtime_decorators.ts delete mode 100644 cli/tests/runtime_decorators.ts.out delete mode 100644 cli/tests/seed_random.js delete mode 100644 cli/tests/seed_random.js.out delete mode 100644 cli/tests/single_compile_with_reload.ts delete mode 100644 cli/tests/single_compile_with_reload.ts.out delete mode 100644 cli/tests/single_compile_with_reload_dyn.ts delete mode 100644 cli/tests/single_compile_with_reload_worker.ts delete mode 100644 cli/tests/standalone_compiler_ops.ts delete mode 100644 cli/tests/standalone_error.ts delete mode 100644 cli/tests/standalone_import.ts delete mode 100644 cli/tests/standalone_import_datauri.ts delete mode 100644 cli/tests/standalone_runtime_flags.ts delete mode 100644 cli/tests/std_lint.out delete mode 100644 cli/tests/stdout_write_all.out delete mode 100644 cli/tests/stdout_write_all.ts delete mode 100644 cli/tests/subdir/amd_like.js delete mode 100644 cli/tests/subdir/auto_print_hello.ts delete mode 100644 cli/tests/subdir/circular1.ts delete mode 100644 cli/tests/subdir/circular2.ts delete mode 100644 cli/tests/subdir/comment.ts delete mode 100644 cli/tests/subdir/config.json delete mode 100644 cli/tests/subdir/emittable.d.ts delete mode 100644 cli/tests/subdir/empty.ts delete mode 100644 cli/tests/subdir/evil_remote_import.js delete mode 100644 cli/tests/subdir/foo_types.d.ts delete mode 100644 cli/tests/subdir/form_urlencoded.txt delete mode 100644 cli/tests/subdir/indirect_import_error.js delete mode 100644 cli/tests/subdir/indirect_throws.js delete mode 100644 cli/tests/subdir/json_1.json delete mode 100644 cli/tests/subdir/json_2.json delete mode 100644 cli/tests/subdir/main.ts delete mode 100644 cli/tests/subdir/mismatch_ext.ts delete mode 100644 cli/tests/subdir/mod1.ts delete mode 100644 cli/tests/subdir/mod2.ts delete mode 100644 cli/tests/subdir/mod3.js delete mode 100644 cli/tests/subdir/mod4.js delete mode 100644 cli/tests/subdir/mod5.mjs delete mode 100644 cli/tests/subdir/mod6.js delete mode 100644 cli/tests/subdir/more_decorators.ts delete mode 100644 cli/tests/subdir/mt_application_ecmascript.j2.js delete mode 100644 cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx delete mode 100644 cli/tests/subdir/mt_application_x_javascript.j4.js delete mode 100644 cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx delete mode 100644 cli/tests/subdir/mt_application_x_typescript.t4.ts delete mode 100644 cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx delete mode 100644 cli/tests/subdir/mt_javascript.js delete mode 100644 cli/tests/subdir/mt_javascript_jsx.jsx delete mode 100644 cli/tests/subdir/mt_text_ecmascript.j3.js delete mode 100644 cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx delete mode 100644 cli/tests/subdir/mt_text_javascript.j1.js delete mode 100644 cli/tests/subdir/mt_text_javascript_jsx.j1.jsx delete mode 100644 cli/tests/subdir/mt_text_typescript.t1.ts delete mode 100644 cli/tests/subdir/mt_text_typescript_tsx.t1.tsx delete mode 100644 cli/tests/subdir/mt_video_mp2t.t3.ts delete mode 100644 cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx delete mode 100644 cli/tests/subdir/mt_video_vdn.t2.ts delete mode 100644 cli/tests/subdir/mt_video_vdn_tsx.t2.tsx delete mode 100644 cli/tests/subdir/no_ext delete mode 100644 cli/tests/subdir/no_js_ext delete mode 100644 cli/tests/subdir/polyfill.ts delete mode 100644 cli/tests/subdir/print_hello.ts delete mode 100644 cli/tests/subdir/redirects/a.ts delete mode 100644 cli/tests/subdir/redirects/b.ts delete mode 100644 cli/tests/subdir/redirects/redirect1.js delete mode 100644 cli/tests/subdir/redirects/redirect1.ts delete mode 100644 cli/tests/subdir/redirects/redirect2.js delete mode 100644 cli/tests/subdir/redirects/redirect3.js delete mode 100644 cli/tests/subdir/redirects/redirect4.ts delete mode 100644 cli/tests/subdir/single_module.ts delete mode 100644 cli/tests/subdir/subdir2/dynamic_import.ts delete mode 100644 cli/tests/subdir/subdir2/mod2.ts delete mode 100644 cli/tests/subdir/test_worker_basic.js delete mode 100644 cli/tests/subdir/throws.js delete mode 100644 cli/tests/subdir/tla.ts delete mode 100644 cli/tests/subdir/type_and_code.ts delete mode 100644 cli/tests/subdir/type_reference.d.ts delete mode 100644 cli/tests/subdir/type_reference.js delete mode 100644 cli/tests/subdir/types.d.ts delete mode 100644 cli/tests/subdir/unknown_ext.deno delete mode 100644 cli/tests/swc_syntax_error.ts delete mode 100644 cli/tests/swc_syntax_error.ts.out delete mode 120000 cli/tests/symlink_to_subdir delete mode 100644 cli/tests/test/allow_all.out delete mode 100644 cli/tests/test/allow_all.ts delete mode 100644 cli/tests/test/allow_none.out delete mode 100644 cli/tests/test/allow_none.ts delete mode 100644 cli/tests/test/clear_timeout.out delete mode 100644 cli/tests/test/clear_timeout.ts delete mode 100644 cli/tests/test/doc.out delete mode 100644 cli/tests/test/doc.ts delete mode 100644 cli/tests/test/doc_markdown.out delete mode 100644 cli/tests/test/doc_markdown/doc.md delete mode 100644 cli/tests/test/exit_sanitizer.out delete mode 100644 cli/tests/test/exit_sanitizer.ts delete mode 100644 cli/tests/test/fail.out delete mode 100644 cli/tests/test/fail.ts delete mode 100644 cli/tests/test/fail_fast.out delete mode 100644 cli/tests/test/fail_fast.ts delete mode 100644 cli/tests/test/fail_fast_with_val.out delete mode 100644 cli/tests/test/fail_fast_with_val.ts delete mode 100644 cli/tests/test/finally_timeout.out delete mode 100644 cli/tests/test/finally_timeout.ts delete mode 100644 cli/tests/test/ignore.out delete mode 100644 cli/tests/test/ignore.ts delete mode 100644 cli/tests/test/ignore_permissions.out delete mode 100644 cli/tests/test/ignore_permissions.ts delete mode 100644 cli/tests/test/meta.out delete mode 100644 cli/tests/test/meta.ts delete mode 100644 cli/tests/test/no_check.out delete mode 100644 cli/tests/test/no_check.ts delete mode 100644 cli/tests/test/no_color.ts delete mode 100644 cli/tests/test/no_run.out delete mode 100644 cli/tests/test/no_run.ts delete mode 100644 cli/tests/test/only.out delete mode 100644 cli/tests/test/only.ts delete mode 100644 cli/tests/test/pass.out delete mode 100644 cli/tests/test/pass.ts delete mode 100644 cli/tests/test/quiet.out delete mode 100644 cli/tests/test/quiet.ts delete mode 100644 cli/tests/test/shuffle.out delete mode 100644 cli/tests/test/shuffle/bar_test.ts delete mode 100644 cli/tests/test/shuffle/baz_test.ts delete mode 100644 cli/tests/test/shuffle/foo_test.ts delete mode 100644 cli/tests/test/unhandled_rejection.out delete mode 100644 cli/tests/test/unhandled_rejection.ts delete mode 100644 cli/tests/test/unresolved_promise.out delete mode 100644 cli/tests/test/unresolved_promise.ts create mode 100644 cli/tests/testdata/001_hello.js create mode 100644 cli/tests/testdata/001_hello.js.out create mode 100644 cli/tests/testdata/002_hello.ts create mode 100644 cli/tests/testdata/002_hello.ts.out create mode 100644 cli/tests/testdata/003_relative_import.ts create mode 100644 cli/tests/testdata/003_relative_import.ts.out create mode 100644 cli/tests/testdata/004_set_timeout.ts create mode 100644 cli/tests/testdata/004_set_timeout.ts.out create mode 100644 cli/tests/testdata/005_more_imports.ts create mode 100644 cli/tests/testdata/005_more_imports.ts.out create mode 100644 cli/tests/testdata/006_url_imports.ts create mode 100644 cli/tests/testdata/006_url_imports.ts.out create mode 100644 cli/tests/testdata/012_async.ts create mode 100644 cli/tests/testdata/012_async.ts.out create mode 100644 cli/tests/testdata/013_dynamic_import.ts create mode 100644 cli/tests/testdata/013_dynamic_import.ts.out create mode 100644 cli/tests/testdata/014_duplicate_import.ts create mode 100644 cli/tests/testdata/014_duplicate_import.ts.out create mode 100644 cli/tests/testdata/015_duplicate_parallel_import.js create mode 100644 cli/tests/testdata/015_duplicate_parallel_import.js.out create mode 100644 cli/tests/testdata/016_double_await.ts create mode 100644 cli/tests/testdata/016_double_await.ts.out create mode 100644 cli/tests/testdata/017_import_redirect.ts create mode 100644 cli/tests/testdata/017_import_redirect.ts.out create mode 100644 cli/tests/testdata/017_import_redirect_info.out create mode 100644 cli/tests/testdata/018_async_catch.ts create mode 100644 cli/tests/testdata/018_async_catch.ts.out create mode 100644 cli/tests/testdata/019_media_types.ts create mode 100644 cli/tests/testdata/019_media_types.ts.out create mode 100644 cli/tests/testdata/020_json_modules.ts create mode 100644 cli/tests/testdata/020_json_modules.ts.out create mode 100644 cli/tests/testdata/021_mjs_modules.ts create mode 100644 cli/tests/testdata/021_mjs_modules.ts.out create mode 100644 cli/tests/testdata/022_info_flag_script.out create mode 100644 cli/tests/testdata/023_no_ext create mode 100644 cli/tests/testdata/023_no_ext.out create mode 100644 cli/tests/testdata/024_import_no_ext_with_headers.ts create mode 100644 cli/tests/testdata/024_import_no_ext_with_headers.ts.out create mode 100644 cli/tests/testdata/025_hrtime.ts create mode 100644 cli/tests/testdata/025_hrtime.ts.out create mode 100644 cli/tests/testdata/025_reload_js_type_error.js create mode 100644 cli/tests/testdata/025_reload_js_type_error.js.out create mode 100644 cli/tests/testdata/026_redirect_javascript.js create mode 100644 cli/tests/testdata/026_redirect_javascript.js.out create mode 100644 cli/tests/testdata/027_redirect_typescript.ts create mode 100644 cli/tests/testdata/027_redirect_typescript.ts.out create mode 100644 cli/tests/testdata/028_args.ts create mode 100644 cli/tests/testdata/028_args.ts.out create mode 100644 cli/tests/testdata/029_eval.out create mode 100644 cli/tests/testdata/030_eval_ts.out create mode 100644 cli/tests/testdata/031_info_ts_error.out create mode 100644 cli/tests/testdata/031_info_ts_error.ts create mode 100644 cli/tests/testdata/033_import_map.out create mode 100644 cli/tests/testdata/033_import_map_remote.out create mode 100644 cli/tests/testdata/034_onload.out create mode 100644 cli/tests/testdata/034_onload/imported.ts create mode 100644 cli/tests/testdata/034_onload/main.ts create mode 100644 cli/tests/testdata/034_onload/nest_imported.ts create mode 100644 cli/tests/testdata/035_cached_only_flag.out create mode 100644 cli/tests/testdata/036_import_map_fetch.out create mode 100644 cli/tests/testdata/037_fetch_multiple.out create mode 100644 cli/tests/testdata/038_checkjs.js create mode 100644 cli/tests/testdata/038_checkjs.js.out create mode 100644 cli/tests/testdata/038_checkjs.tsconfig.json create mode 100644 cli/tests/testdata/041_dyn_import_eval.out create mode 100644 cli/tests/testdata/041_info_flag.out create mode 100644 cli/tests/testdata/041_info_flag_location.out create mode 100644 cli/tests/testdata/042_dyn_import_evalcontext.ts create mode 100644 cli/tests/testdata/042_dyn_import_evalcontext.ts.out create mode 100644 cli/tests/testdata/044_bad_resource.ts create mode 100644 cli/tests/testdata/044_bad_resource.ts.out create mode 100644 cli/tests/testdata/045_mod.ts create mode 100644 cli/tests/testdata/045_output.ts create mode 100644 cli/tests/testdata/045_programmatic_proxy_client.ts create mode 100644 cli/tests/testdata/045_proxy_client.ts create mode 100644 cli/tests/testdata/045_proxy_test.ts create mode 100644 cli/tests/testdata/045_proxy_test.ts.out create mode 100644 cli/tests/testdata/046_jsx_test.tsx create mode 100644 cli/tests/testdata/046_jsx_test.tsx.out create mode 100644 cli/tests/testdata/047_jsx_test.jsx create mode 100644 cli/tests/testdata/047_jsx_test.jsx.out create mode 100644 cli/tests/testdata/048_media_types_jsx.ts create mode 100644 cli/tests/testdata/048_media_types_jsx.ts.out create mode 100644 cli/tests/testdata/049_info_flag_script_jsx.out create mode 100644 cli/tests/testdata/052_no_remote_flag.out create mode 100644 cli/tests/testdata/053_import_compression.out create mode 100644 cli/tests/testdata/053_import_compression/brotli create mode 100644 cli/tests/testdata/053_import_compression/gziped create mode 100644 cli/tests/testdata/053_import_compression/main.ts create mode 100644 cli/tests/testdata/054_info_local_imports.out create mode 100644 cli/tests/testdata/055_info_file_json.out create mode 100644 cli/tests/testdata/056_make_temp_file_write_perm.out create mode 100644 cli/tests/testdata/056_make_temp_file_write_perm.ts create mode 100644 cli/tests/testdata/058_tasks_microtasks_close.ts create mode 100644 cli/tests/testdata/058_tasks_microtasks_close.ts.out create mode 100644 cli/tests/testdata/059_fs_relative_path_perm.ts create mode 100644 cli/tests/testdata/059_fs_relative_path_perm.ts.out create mode 100644 cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts create mode 100644 cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts.out create mode 100644 cli/tests/testdata/061_permissions_request.ts create mode 100644 cli/tests/testdata/061_permissions_request.ts.out create mode 100644 cli/tests/testdata/062_permissions_request_global.ts create mode 100644 cli/tests/testdata/062_permissions_request_global.ts.out create mode 100644 cli/tests/testdata/063_permissions_revoke.ts create mode 100644 cli/tests/testdata/063_permissions_revoke.ts.out create mode 100644 cli/tests/testdata/064_permissions_revoke_global.ts create mode 100644 cli/tests/testdata/064_permissions_revoke_global.ts.out create mode 100644 cli/tests/testdata/065_import_map_info.out create mode 100644 cli/tests/testdata/066_prompt.ts create mode 100644 cli/tests/testdata/066_prompt.ts.out create mode 100644 cli/tests/testdata/070_location.ts create mode 100644 cli/tests/testdata/070_location.ts.out create mode 100644 cli/tests/testdata/071_location_unset.ts create mode 100644 cli/tests/testdata/071_location_unset.ts.out create mode 100644 cli/tests/testdata/072_location_relative_fetch.ts create mode 100644 cli/tests/testdata/072_location_relative_fetch.ts.out create mode 100644 cli/tests/testdata/075_import_local_query_hash.ts create mode 100644 cli/tests/testdata/075_import_local_query_hash.ts.out create mode 100644 cli/tests/testdata/076_info_json_deps_order.out create mode 100644 cli/tests/testdata/076_info_json_deps_order.ts create mode 100644 cli/tests/testdata/077_fetch_empty.ts create mode 100644 cli/tests/testdata/077_fetch_empty.ts.out create mode 100644 cli/tests/testdata/078_unload_on_exit.ts create mode 100644 cli/tests/testdata/078_unload_on_exit.ts.out create mode 100644 cli/tests/testdata/079_location_authentication.ts create mode 100644 cli/tests/testdata/079_location_authentication.ts.out create mode 100644 cli/tests/testdata/080_deno_emit_permissions.ts create mode 100644 cli/tests/testdata/080_deno_emit_permissions.ts.out create mode 100644 cli/tests/testdata/081_location_relative_fetch_redirect.ts create mode 100644 cli/tests/testdata/081_location_relative_fetch_redirect.ts.out create mode 100644 cli/tests/testdata/082_prepare_stack_trace_throw.js create mode 100644 cli/tests/testdata/082_prepare_stack_trace_throw.js.out create mode 100644 cli/tests/testdata/083_legacy_external_source_map.ts create mode 100644 cli/tests/testdata/084_worker_custom_inspect.ts create mode 100644 cli/tests/testdata/084_worker_custom_inspect.ts.out create mode 100644 cli/tests/testdata/084_worker_custom_inspect_worker.ts create mode 100644 cli/tests/testdata/085_dynamic_import_async_error.ts create mode 100644 cli/tests/testdata/085_dynamic_import_async_error.ts.out create mode 100644 cli/tests/testdata/086_dynamic_import_already_rejected.ts create mode 100644 cli/tests/testdata/086_dynamic_import_already_rejected.ts.out create mode 100644 cli/tests/testdata/087_hello.ts create mode 100644 cli/tests/testdata/087_no_check_imports_not_used_as_values.ts create mode 100644 cli/tests/testdata/087_no_check_imports_not_used_as_values.ts.out create mode 100644 cli/tests/testdata/088_dynamic_import_already_evaluating.ts create mode 100644 cli/tests/testdata/088_dynamic_import_already_evaluating.ts.out create mode 100644 cli/tests/testdata/088_dynamic_import_target.ts create mode 100644 cli/tests/testdata/089_run_allow_list.ts create mode 100644 cli/tests/testdata/089_run_allow_list.ts.out create mode 100644 cli/tests/testdata/090_run_permissions_request.ts create mode 100644 cli/tests/testdata/090_run_permissions_request.ts.out create mode 100644 cli/tests/testdata/091_use_define_for_class_fields.ts create mode 100644 cli/tests/testdata/091_use_define_for_class_fields.ts.out create mode 100644 cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts create mode 100644 cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts.out create mode 100644 cli/tests/testdata/095_cache_with_bare_import.ts create mode 100644 cli/tests/testdata/095_cache_with_bare_import.ts.out create mode 100644 cli/tests/testdata/Component.tsx create mode 100644 cli/tests/testdata/DenoWinRunner.cs create mode 100644 cli/tests/testdata/DenoWinRunner.ps1 create mode 100644 cli/tests/testdata/async_error.ts create mode 100644 cli/tests/testdata/async_error.ts.out create mode 100644 cli/tests/testdata/badly_formatted.json create mode 100644 cli/tests/testdata/badly_formatted.md create mode 100644 cli/tests/testdata/badly_formatted.mjs create mode 100644 cli/tests/testdata/badly_formatted_fixed.js create mode 100644 cli/tests/testdata/badly_formatted_fixed.json create mode 100644 cli/tests/testdata/badly_formatted_fixed.md create mode 100644 cli/tests/testdata/blob_gc_finalization.js create mode 100644 cli/tests/testdata/blob_gc_finalization.js.out create mode 100644 cli/tests/testdata/bundle.test.out create mode 100644 cli/tests/testdata/bundle/file_tests-fixture01.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture02.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture03.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture04.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture05.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture06.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture07.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture08.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture09.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture10.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture11.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture12.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture13.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture14.ts create mode 100644 cli/tests/testdata/bundle/file_tests-fixture15.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-a.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-b.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-c.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-d.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-e.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-f.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-g.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-h.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-i.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-j.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-k.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-l.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-m.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-n.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-o.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-p.ts create mode 100644 cli/tests/testdata/bundle/file_tests-subdir-q.ts create mode 100644 cli/tests/testdata/bundle/fixture01.out create mode 100644 cli/tests/testdata/bundle/fixture02.out create mode 100644 cli/tests/testdata/bundle/fixture03.out create mode 100644 cli/tests/testdata/bundle/fixture04.out create mode 100644 cli/tests/testdata/bundle/fixture05.out create mode 100644 cli/tests/testdata/bundle/fixture06.out create mode 100644 cli/tests/testdata/bundle/fixture07.out create mode 100644 cli/tests/testdata/bundle/fixture08.out create mode 100644 cli/tests/testdata/bundle/fixture09.out create mode 100644 cli/tests/testdata/bundle/fixture10.out create mode 100644 cli/tests/testdata/bundle/fixture11.out create mode 100644 cli/tests/testdata/bundle/fixture12.out create mode 100644 cli/tests/testdata/bundle/fixture13.out create mode 100644 cli/tests/testdata/bundle/fixture14.out create mode 100644 cli/tests/testdata/bundle/fixture15.out create mode 100644 cli/tests/testdata/bundle/https_deno.land-x-lib-a.ts create mode 100644 cli/tests/testdata/bundle/https_deno.land-x-lib-b.js create mode 100644 cli/tests/testdata/bundle/https_deno.land-x-lib-c.d.ts create mode 100644 cli/tests/testdata/bundle/https_deno.land-x-lib-c.js create mode 100644 cli/tests/testdata/bundle/https_deno.land-x-lib-mod.d.ts create mode 100644 cli/tests/testdata/bundle/https_deno.land-x-lib-mod.js create mode 100644 cli/tests/testdata/bundle_dynamic_import.ts create mode 100644 cli/tests/testdata/bundle_im.json create mode 100644 cli/tests/testdata/bundle_im.ts create mode 100644 cli/tests/testdata/bundle_jsx.out create mode 100644 cli/tests/testdata/cache_extensionless.out create mode 100644 cli/tests/testdata/cache_random_extension.out create mode 100644 cli/tests/testdata/cafile_info.ts create mode 100644 cli/tests/testdata/cafile_info.ts.out create mode 100644 cli/tests/testdata/cafile_ts_fetch.ts create mode 100644 cli/tests/testdata/cafile_ts_fetch.ts.out create mode 100644 cli/tests/testdata/cafile_ts_fetch_unsafe_ssl.ts.out create mode 100644 cli/tests/testdata/cafile_url_imports.ts create mode 100644 cli/tests/testdata/cafile_url_imports.ts.out create mode 100644 cli/tests/testdata/cafile_url_imports_unsafe_ssl.ts.out create mode 100644 cli/tests/testdata/cat.ts create mode 100644 cli/tests/testdata/circular1.js create mode 100644 cli/tests/testdata/circular1.js.out create mode 100644 cli/tests/testdata/circular2.js create mode 100644 cli/tests/testdata/cjs_imports.ts create mode 100644 cli/tests/testdata/cjs_imports.ts.out create mode 100644 cli/tests/testdata/commonjs.cjs create mode 100644 cli/tests/testdata/compiler_api_test.ts create mode 100644 cli/tests/testdata/complex_permissions_test.ts create mode 100644 cli/tests/testdata/config.ts create mode 100644 cli/tests/testdata/config.ts.out create mode 100644 cli/tests/testdata/config.tsconfig.json create mode 100644 cli/tests/testdata/config_types.ts create mode 100644 cli/tests/testdata/config_types.ts.out create mode 100644 cli/tests/testdata/config_types.tsconfig.json create mode 100644 cli/tests/testdata/config_types_remote.tsconfig.json create mode 100644 cli/tests/testdata/coverage/branch.ts create mode 100644 cli/tests/testdata/coverage/branch_test.ts create mode 100644 cli/tests/testdata/coverage/complex.ts create mode 100644 cli/tests/testdata/coverage/complex_test.ts create mode 100644 cli/tests/testdata/coverage/expected_branch.lcov create mode 100644 cli/tests/testdata/coverage/expected_branch.out create mode 100644 cli/tests/testdata/coverage/expected_complex.lcov create mode 100644 cli/tests/testdata/coverage/expected_complex.out create mode 100644 cli/tests/testdata/delayed_error.ts create mode 100644 cli/tests/testdata/deno_doc.out create mode 100644 cli/tests/testdata/deno_doc.ts create mode 100644 cli/tests/testdata/deno_doc_builtin.out create mode 100644 cli/tests/testdata/deno_dom_0.1.3-alpha2.wasm create mode 100644 cli/tests/testdata/deno_land_unsafe_ssl.ts create mode 100644 cli/tests/testdata/deno_land_unsafe_ssl.ts.out create mode 100644 cli/tests/testdata/disallow_http_from_https.js create mode 100644 cli/tests/testdata/disallow_http_from_https.ts create mode 100644 cli/tests/testdata/disallow_http_from_https_js.out create mode 100644 cli/tests/testdata/disallow_http_from_https_ts.out create mode 100644 cli/tests/testdata/doc/import_map.json create mode 100644 cli/tests/testdata/doc/invalid_url.out create mode 100644 cli/tests/testdata/doc/module/fun.js create mode 100644 cli/tests/testdata/doc/types_header.out create mode 100644 cli/tests/testdata/doc/types_header.ts create mode 100644 cli/tests/testdata/doc/types_hint.out create mode 100644 cli/tests/testdata/doc/types_hint.ts create mode 100644 cli/tests/testdata/doc/types_ref.js create mode 100644 cli/tests/testdata/doc/types_ref.out create mode 100644 cli/tests/testdata/doc/use_import_map.js create mode 100644 cli/tests/testdata/doc/use_import_map.out create mode 100644 cli/tests/testdata/dynamic_import/b.js create mode 100644 cli/tests/testdata/dynamic_import/c.js create mode 100644 cli/tests/testdata/dynamic_import/permissions_blob_local.ts create mode 100644 cli/tests/testdata/dynamic_import/permissions_blob_local.ts.out create mode 100644 cli/tests/testdata/dynamic_import/permissions_blob_remote.ts create mode 100644 cli/tests/testdata/dynamic_import/permissions_blob_remote.ts.out create mode 100644 cli/tests/testdata/dynamic_import/permissions_data_local.ts create mode 100644 cli/tests/testdata/dynamic_import/permissions_data_local.ts.out create mode 100644 cli/tests/testdata/dynamic_import/permissions_data_remote.ts create mode 100644 cli/tests/testdata/dynamic_import/permissions_data_remote.ts.out create mode 100644 cli/tests/testdata/dynamic_import/permissions_remote_remote.ts create mode 100644 cli/tests/testdata/dynamic_import/permissions_remote_remote.ts.out create mode 100644 cli/tests/testdata/dynamic_import/static_remote.ts create mode 100644 cli/tests/testdata/dynamic_import_conditional.js create mode 100644 cli/tests/testdata/dynamic_import_conditional.js.out create mode 100644 cli/tests/testdata/echo.ts create mode 100644 cli/tests/testdata/echo_server.ts create mode 100644 cli/tests/testdata/encoding/utf-16be.ts create mode 100644 cli/tests/testdata/encoding/utf-16le.ts create mode 100644 cli/tests/testdata/encoding/utf-8.ts create mode 100644 cli/tests/testdata/encoding/windows-1255 create mode 100644 cli/tests/testdata/error_001.ts create mode 100644 cli/tests/testdata/error_001.ts.out create mode 100644 cli/tests/testdata/error_002.ts create mode 100644 cli/tests/testdata/error_002.ts.out create mode 100644 cli/tests/testdata/error_003_typescript.ts create mode 100644 cli/tests/testdata/error_003_typescript.ts.out create mode 100644 cli/tests/testdata/error_004_missing_module.ts create mode 100644 cli/tests/testdata/error_004_missing_module.ts.out create mode 100644 cli/tests/testdata/error_005_missing_dynamic_import.ts create mode 100644 cli/tests/testdata/error_005_missing_dynamic_import.ts.out create mode 100644 cli/tests/testdata/error_006_import_ext_failure.ts create mode 100644 cli/tests/testdata/error_006_import_ext_failure.ts.out create mode 100644 cli/tests/testdata/error_007_any.ts create mode 100644 cli/tests/testdata/error_007_any.ts.out create mode 100644 cli/tests/testdata/error_008_checkjs.js create mode 100644 cli/tests/testdata/error_008_checkjs.js.out create mode 100644 cli/tests/testdata/error_009_extensions_error.js create mode 100644 cli/tests/testdata/error_009_extensions_error.js.out create mode 100644 cli/tests/testdata/error_009_missing_js_module.disabled create mode 100644 cli/tests/testdata/error_009_missing_js_module.js create mode 100644 cli/tests/testdata/error_009_missing_js_module.js.out create mode 100644 cli/tests/testdata/error_010_nonexistent_arg.disabled create mode 100644 cli/tests/testdata/error_010_nonexistent_arg.out create mode 100644 cli/tests/testdata/error_011_bad_module_specifier.ts create mode 100644 cli/tests/testdata/error_011_bad_module_specifier.ts.out create mode 100644 cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts create mode 100644 cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts.out create mode 100644 cli/tests/testdata/error_013_missing_script.out create mode 100644 cli/tests/testdata/error_014_catch_dynamic_import_error.js create mode 100644 cli/tests/testdata/error_014_catch_dynamic_import_error.js.out create mode 100644 cli/tests/testdata/error_015_dynamic_import_permissions.js create mode 100644 cli/tests/testdata/error_015_dynamic_import_permissions.out create mode 100644 cli/tests/testdata/error_016_dynamic_import_permissions2.js create mode 100644 cli/tests/testdata/error_016_dynamic_import_permissions2.out create mode 100644 cli/tests/testdata/error_017_hide_long_source_ts.ts create mode 100644 cli/tests/testdata/error_017_hide_long_source_ts.ts.out create mode 100644 cli/tests/testdata/error_018_hide_long_source_js.js create mode 100644 cli/tests/testdata/error_018_hide_long_source_js.js.out create mode 100644 cli/tests/testdata/error_019_stack_function.ts create mode 100644 cli/tests/testdata/error_019_stack_function.ts.out create mode 100644 cli/tests/testdata/error_020_stack_constructor.ts create mode 100644 cli/tests/testdata/error_020_stack_constructor.ts.out create mode 100644 cli/tests/testdata/error_021_stack_method.ts create mode 100644 cli/tests/testdata/error_021_stack_method.ts.out create mode 100644 cli/tests/testdata/error_022_stack_custom_error.ts create mode 100644 cli/tests/testdata/error_022_stack_custom_error.ts.out create mode 100644 cli/tests/testdata/error_023_stack_async.ts create mode 100644 cli/tests/testdata/error_023_stack_async.ts.out create mode 100644 cli/tests/testdata/error_024_stack_promise_all.ts create mode 100644 cli/tests/testdata/error_024_stack_promise_all.ts.out create mode 100644 cli/tests/testdata/error_025_tab_indent create mode 100644 cli/tests/testdata/error_025_tab_indent.out create mode 100644 cli/tests/testdata/error_026_remote_import_error.ts create mode 100644 cli/tests/testdata/error_026_remote_import_error.ts.out create mode 100644 cli/tests/testdata/error_027_bundle_with_bare_import.ts create mode 100644 cli/tests/testdata/error_027_bundle_with_bare_import.ts.out create mode 100644 cli/tests/testdata/error_import_map_unable_to_load.out create mode 100644 cli/tests/testdata/error_local_static_import_from_remote.js create mode 100644 cli/tests/testdata/error_local_static_import_from_remote.js.out create mode 100644 cli/tests/testdata/error_local_static_import_from_remote.ts create mode 100644 cli/tests/testdata/error_local_static_import_from_remote.ts.out create mode 100644 cli/tests/testdata/error_missing_module_named_import.ts create mode 100644 cli/tests/testdata/error_missing_module_named_import.ts.out create mode 100644 cli/tests/testdata/error_no_check.ts create mode 100644 cli/tests/testdata/error_no_check.ts.out create mode 100644 cli/tests/testdata/error_syntax.js create mode 100644 cli/tests/testdata/error_syntax.js.out create mode 100644 cli/tests/testdata/error_syntax_empty_trailing_line.mjs create mode 100644 cli/tests/testdata/error_syntax_empty_trailing_line.mjs.out create mode 100644 cli/tests/testdata/error_type_definitions.ts create mode 100644 cli/tests/testdata/error_type_definitions.ts.out create mode 100644 cli/tests/testdata/error_worker_permissions_local.ts create mode 100644 cli/tests/testdata/error_worker_permissions_local.ts.out create mode 100644 cli/tests/testdata/error_worker_permissions_remote.ts create mode 100644 cli/tests/testdata/error_worker_permissions_remote.ts.out create mode 100644 cli/tests/testdata/es_private_fields.js create mode 100644 cli/tests/testdata/es_private_fields.js.out create mode 100644 cli/tests/testdata/esm_imports_a.js create mode 100644 cli/tests/testdata/esm_imports_b.js create mode 100644 cli/tests/testdata/exec_path.ts create mode 100644 cli/tests/testdata/exit_error42.ts create mode 100644 cli/tests/testdata/exit_error42.ts.out create mode 100644 cli/tests/testdata/export_type_def.ts create mode 100644 cli/tests/testdata/fetch/hello.txt create mode 100644 cli/tests/testdata/fetch/other.ts create mode 100644 cli/tests/testdata/fetch/test.ts create mode 100644 cli/tests/testdata/fetch_response_finalization.js create mode 100644 cli/tests/testdata/fetch_response_finalization.js.out create mode 100644 cli/tests/testdata/file_exists.ts create mode 100644 cli/tests/testdata/finalization_registry.js create mode 100644 cli/tests/testdata/finalization_registry.js.out create mode 100644 cli/tests/testdata/fix_dynamic_import_errors.js create mode 100644 cli/tests/testdata/fix_dynamic_import_errors.js.out create mode 100644 cli/tests/testdata/fix_emittable_skipped.js create mode 100644 cli/tests/testdata/fix_emittable_skipped.ts.out create mode 100644 cli/tests/testdata/fix_exotic_specifiers.ts create mode 100644 cli/tests/testdata/fix_exotic_specifiers.ts.out create mode 100644 cli/tests/testdata/fix_js_import_js.ts create mode 100644 cli/tests/testdata/fix_js_import_js.ts.out create mode 100644 cli/tests/testdata/fix_js_imports.ts create mode 100644 cli/tests/testdata/fix_js_imports.ts.out create mode 100644 cli/tests/testdata/fix_tsc_file_exists.out create mode 100644 cli/tests/testdata/fix_worker_dispatchevent.ts create mode 100644 cli/tests/testdata/fix_worker_dispatchevent.ts.out create mode 100644 cli/tests/testdata/fixture.json create mode 100644 cli/tests/testdata/fmt/expected_fmt_check_formatted_files.out create mode 100644 cli/tests/testdata/fmt/expected_fmt_check_ignore.out create mode 100644 cli/tests/testdata/fmt/expected_fmt_check_tests_dir.out create mode 100644 cli/tests/testdata/fmt/expected_fmt_check_verbose_formatted_files.out create mode 100644 cli/tests/testdata/fmt/expected_fmt_check_verbose_tests_dir.out create mode 100644 cli/tests/testdata/fmt/formatted1.js create mode 100644 cli/tests/testdata/fmt/formatted2.ts create mode 100644 cli/tests/testdata/fmt/formatted3.md create mode 100644 cli/tests/testdata/fmt/formatted4.jsonc create mode 100644 cli/tests/testdata/heapstats.js create mode 100644 cli/tests/testdata/heapstats.js.out create mode 100644 cli/tests/testdata/hello.txt create mode 100644 cli/tests/testdata/https_import.ts create mode 100644 cli/tests/testdata/https_import.ts.out create mode 100644 cli/tests/testdata/if_main.ts create mode 100644 cli/tests/testdata/if_main.ts.out create mode 100644 cli/tests/testdata/ignore_require.js create mode 100644 cli/tests/testdata/import_blob_url.ts create mode 100644 cli/tests/testdata/import_blob_url.ts.out create mode 100644 cli/tests/testdata/import_blob_url_error_stack.ts create mode 100644 cli/tests/testdata/import_blob_url_error_stack.ts.out create mode 100644 cli/tests/testdata/import_blob_url_import_relative.ts create mode 100644 cli/tests/testdata/import_blob_url_import_relative.ts.out create mode 100644 cli/tests/testdata/import_blob_url_imports.ts create mode 100644 cli/tests/testdata/import_blob_url_imports.ts.out create mode 100644 cli/tests/testdata/import_blob_url_jsx.ts create mode 100644 cli/tests/testdata/import_blob_url_jsx.ts.out create mode 100644 cli/tests/testdata/import_data_url.ts create mode 100644 cli/tests/testdata/import_data_url.ts.out create mode 100644 cli/tests/testdata/import_data_url_error_stack.ts create mode 100644 cli/tests/testdata/import_data_url_error_stack.ts.out create mode 100644 cli/tests/testdata/import_data_url_import_relative.ts create mode 100644 cli/tests/testdata/import_data_url_import_relative.ts.out create mode 100644 cli/tests/testdata/import_data_url_imports.ts create mode 100644 cli/tests/testdata/import_data_url_imports.ts.out create mode 100644 cli/tests/testdata/import_data_url_jsx.ts create mode 100644 cli/tests/testdata/import_data_url_jsx.ts.out create mode 100644 cli/tests/testdata/import_dynamic_data_url.ts create mode 100644 cli/tests/testdata/import_dynamic_data_url.ts.out create mode 100644 cli/tests/testdata/import_file_with_colon.ts create mode 100644 cli/tests/testdata/import_file_with_colon.ts.out create mode 100644 cli/tests/testdata/import_maps/import_map.json create mode 100644 cli/tests/testdata/import_maps/import_map_remote.json create mode 100644 cli/tests/testdata/import_maps/lodash/lodash.ts create mode 100644 cli/tests/testdata/import_maps/lodash/other_file.ts create mode 100644 cli/tests/testdata/import_maps/moment/moment.ts create mode 100644 cli/tests/testdata/import_maps/moment/other_file.ts create mode 100644 cli/tests/testdata/import_maps/scope/scoped.ts create mode 100644 cli/tests/testdata/import_maps/scoped_moment.ts create mode 100644 cli/tests/testdata/import_maps/test.ts create mode 100644 cli/tests/testdata/import_maps/test_remote.ts create mode 100644 cli/tests/testdata/import_maps/vue.ts create mode 100644 cli/tests/testdata/import_meta.ts create mode 100644 cli/tests/testdata/import_meta.ts.out create mode 100644 cli/tests/testdata/import_meta2.ts create mode 100644 cli/tests/testdata/info/data_null_error/data_null_error.out create mode 100644 cli/tests/testdata/info/data_null_error/mod.ts create mode 100644 cli/tests/testdata/info/data_null_error/types.d.ts create mode 100644 cli/tests/testdata/info/types_header.out create mode 100644 cli/tests/testdata/info_json.out create mode 100644 cli/tests/testdata/info_json_location.out create mode 100644 cli/tests/testdata/info_missing_module.out create mode 100644 cli/tests/testdata/info_recursive_imports_test.out create mode 100644 cli/tests/testdata/info_recursive_imports_test.ts create mode 100644 cli/tests/testdata/info_type_import.out create mode 100644 cli/tests/testdata/info_type_import.ts create mode 100644 cli/tests/testdata/inline_js_source_map.ts create mode 100644 cli/tests/testdata/inline_js_source_map_2.js create mode 100644 cli/tests/testdata/inline_js_source_map_2.js.out create mode 100644 cli/tests/testdata/inline_js_source_map_2.ts create mode 100644 cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js create mode 100644 cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out create mode 100644 cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js create mode 100644 cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js.out create mode 100644 cli/tests/testdata/inspector1.js create mode 100644 cli/tests/testdata/inspector2.js create mode 100644 cli/tests/testdata/inspector3.js create mode 100644 cli/tests/testdata/inspector4.js create mode 100644 cli/tests/testdata/js_import_detect.ts create mode 100644 cli/tests/testdata/js_import_detect.ts.out create mode 100644 cli/tests/testdata/jsx_import_from_ts.App.jsx create mode 100644 cli/tests/testdata/jsx_import_from_ts.ts create mode 100644 cli/tests/testdata/jsx_import_from_ts.ts.out create mode 100644 cli/tests/testdata/lib_dom_asynciterable.ts create mode 100644 cli/tests/testdata/lib_dom_asynciterable.ts.out create mode 100644 cli/tests/testdata/lib_ref.ts create mode 100644 cli/tests/testdata/lib_ref.ts.out create mode 100644 cli/tests/testdata/lib_runtime_api.ts create mode 100644 cli/tests/testdata/lib_runtime_api.ts.out create mode 100644 cli/tests/testdata/lint/expected.out create mode 100644 cli/tests/testdata/lint/expected_from_stdin.out create mode 100644 cli/tests/testdata/lint/expected_from_stdin_json.out create mode 100644 cli/tests/testdata/lint/expected_glob.out create mode 100644 cli/tests/testdata/lint/expected_ignore.out create mode 100644 cli/tests/testdata/lint/expected_json.out create mode 100644 cli/tests/testdata/lint/expected_quiet.out create mode 100644 cli/tests/testdata/lint/expected_rules.out create mode 100644 cli/tests/testdata/lint/expected_verbose.out create mode 100644 cli/tests/testdata/lint/file1.js create mode 100644 cli/tests/testdata/lint/file2.ts create mode 100644 cli/tests/testdata/lint/ignored_file.ts create mode 100644 cli/tests/testdata/lint/malformed.js create mode 100644 cli/tests/testdata/listen_tls_alpn.ts create mode 100644 cli/tests/testdata/localhost_unsafe_ssl.ts.out create mode 100644 cli/tests/testdata/lock_check_err.json create mode 100644 cli/tests/testdata/lock_check_err.out create mode 100644 cli/tests/testdata/lock_check_err2.json create mode 100644 cli/tests/testdata/lock_check_err2.out create mode 100644 cli/tests/testdata/lock_check_err_with_bundle.json create mode 100644 cli/tests/testdata/lock_check_err_with_bundle.out create mode 100644 cli/tests/testdata/lock_check_ok.json create mode 100644 cli/tests/testdata/lock_check_ok2.json create mode 100644 cli/tests/testdata/lock_dynamic_imports.json create mode 100644 cli/tests/testdata/lock_dynamic_imports.out create mode 100644 cli/tests/testdata/lock_write_fetch.ts create mode 100644 cli/tests/testdata/lock_write_fetch.ts.out create mode 100644 cli/tests/testdata/lock_write_requires_lock.out create mode 100644 cli/tests/testdata/lsp/a.d.ts create mode 100644 cli/tests/testdata/lsp/b.d.ts create mode 100644 cli/tests/testdata/lsp/code_action_ignore_lint_params.json create mode 100644 cli/tests/testdata/lsp/code_action_ignore_lint_response.json create mode 100644 cli/tests/testdata/lsp/code_action_params.json create mode 100644 cli/tests/testdata/lsp/code_action_params_cache.json create mode 100644 cli/tests/testdata/lsp/code_action_params_deadlock.json create mode 100644 cli/tests/testdata/lsp/code_action_params_imports.json create mode 100644 cli/tests/testdata/lsp/code_action_params_refactor.json create mode 100644 cli/tests/testdata/lsp/code_action_resolve_params.json create mode 100644 cli/tests/testdata/lsp/code_action_resolve_params_imports.json create mode 100644 cli/tests/testdata/lsp/code_action_resolve_params_refactor.json create mode 100644 cli/tests/testdata/lsp/code_action_resolve_response.json create mode 100644 cli/tests/testdata/lsp/code_action_resolve_response_imports.json create mode 100644 cli/tests/testdata/lsp/code_action_resolve_response_refactor.json create mode 100644 cli/tests/testdata/lsp/code_action_response.json create mode 100644 cli/tests/testdata/lsp/code_action_response_cache.json create mode 100644 cli/tests/testdata/lsp/code_action_response_imports.json create mode 100644 cli/tests/testdata/lsp/code_action_response_no_disabled.json create mode 100644 cli/tests/testdata/lsp/code_action_response_refactor.json create mode 100644 cli/tests/testdata/lsp/code_lens_resolve_response.json create mode 100644 cli/tests/testdata/lsp/code_lens_resolve_response_impl.json create mode 100644 cli/tests/testdata/lsp/code_lens_response.json create mode 100644 cli/tests/testdata/lsp/code_lens_response_changed.json create mode 100644 cli/tests/testdata/lsp/code_lens_response_impl.json create mode 100644 cli/tests/testdata/lsp/code_lens_response_test.json create mode 100644 cli/tests/testdata/lsp/completion_request_params_optional.json create mode 100644 cli/tests/testdata/lsp/completion_request_response_empty.json create mode 100644 cli/tests/testdata/lsp/completion_resolve_params.json create mode 100644 cli/tests/testdata/lsp/completion_resolve_params_optional.json create mode 100644 cli/tests/testdata/lsp/completion_resolve_params_registry.json create mode 100644 cli/tests/testdata/lsp/completion_resolve_response.json create mode 100644 cli/tests/testdata/lsp/completion_resolve_response_registry.json create mode 100644 cli/tests/testdata/lsp/diagnostics_deno_deps.json create mode 100644 cli/tests/testdata/lsp/diagnostics_deno_types.json create mode 100644 cli/tests/testdata/lsp/did_open_params_deno_types.json create mode 100644 cli/tests/testdata/lsp/did_open_params_doc_symbol.json create mode 100644 cli/tests/testdata/lsp/did_open_params_import_hover.json create mode 100644 cli/tests/testdata/lsp/did_open_params_large.json create mode 100644 cli/tests/testdata/lsp/did_open_params_semantic_tokens.json create mode 100644 cli/tests/testdata/lsp/did_open_params_test_code_lens.json create mode 100644 cli/tests/testdata/lsp/document_symbol_response.json create mode 100644 cli/tests/testdata/lsp/formatting_mbc_response.json create mode 100644 cli/tests/testdata/lsp/import-map.json create mode 100644 cli/tests/testdata/lsp/incoming_calls_params.json create mode 100644 cli/tests/testdata/lsp/incoming_calls_response.json create mode 100644 cli/tests/testdata/lsp/initialize_params.json create mode 100644 cli/tests/testdata/lsp/initialize_params_bad_config_option.json create mode 100644 cli/tests/testdata/lsp/initialize_params_ca_no_disabled.json create mode 100644 cli/tests/testdata/lsp/initialize_params_code_lens_test.json create mode 100644 cli/tests/testdata/lsp/initialize_params_code_lens_test_disabled.json create mode 100644 cli/tests/testdata/lsp/initialize_params_did_config_change.json create mode 100644 cli/tests/testdata/lsp/initialize_params_disabled.json create mode 100644 cli/tests/testdata/lsp/initialize_params_registry.json create mode 100644 cli/tests/testdata/lsp/initialize_params_unstable.json create mode 100644 cli/tests/testdata/lsp/lib.tsconfig.json create mode 100644 cli/tests/testdata/lsp/outgoing_calls_params.json create mode 100644 cli/tests/testdata/lsp/outgoing_calls_response.json create mode 100644 cli/tests/testdata/lsp/prepare_call_hierarchy_response.json create mode 100644 cli/tests/testdata/lsp/registries/a_latest.json create mode 100644 cli/tests/testdata/lsp/registries/a_v1.0.0.json create mode 100644 cli/tests/testdata/lsp/registries/a_v1.0.1.json create mode 100644 cli/tests/testdata/lsp/registries/a_v2.0.0.json create mode 100644 cli/tests/testdata/lsp/registries/a_versions.json create mode 100644 cli/tests/testdata/lsp/registries/b_latest.json create mode 100644 cli/tests/testdata/lsp/registries/b_v0.0.1.json create mode 100644 cli/tests/testdata/lsp/registries/b_v0.0.2.json create mode 100644 cli/tests/testdata/lsp/registries/b_v0.0.3.json create mode 100644 cli/tests/testdata/lsp/registries/b_versions.json create mode 100644 cli/tests/testdata/lsp/registries/deno-import-intellisense.json create mode 100644 cli/tests/testdata/lsp/registries/modules.json create mode 100644 cli/tests/testdata/lsp/rename_response.json create mode 100644 cli/tests/testdata/lsp/selection_range_response.json create mode 100644 cli/tests/testdata/lsp/types.tsconfig.json create mode 100644 cli/tests/testdata/main_module.ts create mode 100644 cli/tests/testdata/main_module.ts.out create mode 100644 cli/tests/testdata/main_module2.ts create mode 100644 cli/tests/testdata/module_graph/file_tests-a.mjs create mode 100644 cli/tests/testdata/module_graph/file_tests-b-mod.js create mode 100644 cli/tests/testdata/module_graph/file_tests-b.ts create mode 100644 cli/tests/testdata/module_graph/file_tests-c-mod.ts create mode 100644 cli/tests/testdata/module_graph/file_tests-checkwithconfig.ts create mode 100644 cli/tests/testdata/module_graph/file_tests-diag.ts create mode 100644 cli/tests/testdata/module_graph/file_tests-dynamicimport.ts create mode 100644 cli/tests/testdata/module_graph/file_tests-importjson.ts create mode 100644 cli/tests/testdata/module_graph/file_tests-importremap.ts create mode 100644 cli/tests/testdata/module_graph/file_tests-main.ts create mode 100644 cli/tests/testdata/module_graph/file_tests-some.json create mode 100644 cli/tests/testdata/module_graph/file_typesref.d.ts create mode 100644 cli/tests/testdata/module_graph/file_typesref.js create mode 100644 cli/tests/testdata/module_graph/https_deno.land-std-http-server.ts create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-a-mod.ts create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-a.ts create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-import_map.ts create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-jquery.js create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-lib-a.ts create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-lib-b.js create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-lib-c.d.ts create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-lib-c.js create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-lib-mod.d.ts create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-lib-mod.js create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-mod.ts create mode 100644 cli/tests/testdata/module_graph/https_deno.land-x-transpile.tsx create mode 100644 cli/tests/testdata/module_graph/https_unpkg.com-lodash-index.js create mode 100644 cli/tests/testdata/module_graph/lockfile.json create mode 100644 cli/tests/testdata/module_graph/lockfile_fail.json create mode 100644 cli/tests/testdata/module_graph/tsconfig.json create mode 100644 cli/tests/testdata/module_graph/tsconfig_01.json create mode 100644 cli/tests/testdata/no_check_decorators.ts create mode 100644 cli/tests/testdata/no_check_decorators.ts.out create mode 100644 cli/tests/testdata/no_color.js create mode 100644 cli/tests/testdata/no_mem_cache.js create mode 100644 cli/tests/testdata/no_mem_cache.js.out create mode 100644 cli/tests/testdata/no_validate_asm.js create mode 100644 cli/tests/testdata/performance_stats.out create mode 100644 cli/tests/testdata/permission_test.ts create mode 100644 cli/tests/testdata/preserve_imports.tsconfig.json create mode 100644 cli/tests/testdata/proto_exploit.js create mode 100644 cli/tests/testdata/proto_exploit.js.out create mode 100644 cli/tests/testdata/raw_mode.ts create mode 100644 cli/tests/testdata/raw_mode_cbreak.ts create mode 100644 cli/tests/testdata/recursive_imports/A.ts create mode 100644 cli/tests/testdata/recursive_imports/B.ts create mode 100644 cli/tests/testdata/recursive_imports/C.ts create mode 100644 cli/tests/testdata/recursive_imports/common.ts create mode 100644 cli/tests/testdata/redirect_cache.out create mode 100644 cli/tests/testdata/reference_types.ts create mode 100644 cli/tests/testdata/reference_types.ts.out create mode 100644 cli/tests/testdata/reference_types_remote.ts create mode 100644 cli/tests/testdata/reference_types_remote.ts.out create mode 100644 cli/tests/testdata/resolve_dns.ts create mode 100644 cli/tests/testdata/resolve_dns.ts.out create mode 100644 cli/tests/testdata/runtime_decorators.ts create mode 100644 cli/tests/testdata/runtime_decorators.ts.out create mode 100644 cli/tests/testdata/seed_random.js create mode 100644 cli/tests/testdata/seed_random.js.out create mode 100644 cli/tests/testdata/single_compile_with_reload.ts create mode 100644 cli/tests/testdata/single_compile_with_reload.ts.out create mode 100644 cli/tests/testdata/single_compile_with_reload_dyn.ts create mode 100644 cli/tests/testdata/single_compile_with_reload_worker.ts create mode 100644 cli/tests/testdata/standalone_compiler_ops.ts create mode 100644 cli/tests/testdata/standalone_error.ts create mode 100644 cli/tests/testdata/standalone_import.ts create mode 100644 cli/tests/testdata/standalone_import_datauri.ts create mode 100644 cli/tests/testdata/standalone_runtime_flags.ts create mode 100644 cli/tests/testdata/std_lint.out create mode 100644 cli/tests/testdata/stdout_write_all.out create mode 100644 cli/tests/testdata/stdout_write_all.ts create mode 100644 cli/tests/testdata/subdir/amd_like.js create mode 100644 cli/tests/testdata/subdir/auto_print_hello.ts create mode 100644 cli/tests/testdata/subdir/circular1.ts create mode 100644 cli/tests/testdata/subdir/circular2.ts create mode 100644 cli/tests/testdata/subdir/comment.ts create mode 100644 cli/tests/testdata/subdir/config.json create mode 100644 cli/tests/testdata/subdir/emittable.d.ts create mode 100644 cli/tests/testdata/subdir/empty.ts create mode 100644 cli/tests/testdata/subdir/evil_remote_import.js create mode 100644 cli/tests/testdata/subdir/foo_types.d.ts create mode 100644 cli/tests/testdata/subdir/form_urlencoded.txt create mode 100644 cli/tests/testdata/subdir/indirect_import_error.js create mode 100644 cli/tests/testdata/subdir/indirect_throws.js create mode 100644 cli/tests/testdata/subdir/json_1.json create mode 100644 cli/tests/testdata/subdir/json_2.json create mode 100644 cli/tests/testdata/subdir/main.ts create mode 100644 cli/tests/testdata/subdir/mismatch_ext.ts create mode 100644 cli/tests/testdata/subdir/mod1.ts create mode 100644 cli/tests/testdata/subdir/mod2.ts create mode 100644 cli/tests/testdata/subdir/mod3.js create mode 100644 cli/tests/testdata/subdir/mod4.js create mode 100644 cli/tests/testdata/subdir/mod5.mjs create mode 100644 cli/tests/testdata/subdir/mod6.js create mode 100644 cli/tests/testdata/subdir/more_decorators.ts create mode 100644 cli/tests/testdata/subdir/mt_application_ecmascript.j2.js create mode 100644 cli/tests/testdata/subdir/mt_application_ecmascript_jsx.j2.jsx create mode 100644 cli/tests/testdata/subdir/mt_application_x_javascript.j4.js create mode 100644 cli/tests/testdata/subdir/mt_application_x_javascript_jsx.j4.jsx create mode 100644 cli/tests/testdata/subdir/mt_application_x_typescript.t4.ts create mode 100644 cli/tests/testdata/subdir/mt_application_x_typescript_tsx.t4.tsx create mode 100644 cli/tests/testdata/subdir/mt_javascript.js create mode 100644 cli/tests/testdata/subdir/mt_javascript_jsx.jsx create mode 100644 cli/tests/testdata/subdir/mt_text_ecmascript.j3.js create mode 100644 cli/tests/testdata/subdir/mt_text_ecmascript_jsx.j3.jsx create mode 100644 cli/tests/testdata/subdir/mt_text_javascript.j1.js create mode 100644 cli/tests/testdata/subdir/mt_text_javascript_jsx.j1.jsx create mode 100644 cli/tests/testdata/subdir/mt_text_typescript.t1.ts create mode 100644 cli/tests/testdata/subdir/mt_text_typescript_tsx.t1.tsx create mode 100644 cli/tests/testdata/subdir/mt_video_mp2t.t3.ts create mode 100644 cli/tests/testdata/subdir/mt_video_mp2t_tsx.t3.tsx create mode 100644 cli/tests/testdata/subdir/mt_video_vdn.t2.ts create mode 100644 cli/tests/testdata/subdir/mt_video_vdn_tsx.t2.tsx create mode 100644 cli/tests/testdata/subdir/no_ext create mode 100644 cli/tests/testdata/subdir/no_js_ext create mode 100644 cli/tests/testdata/subdir/polyfill.ts create mode 100644 cli/tests/testdata/subdir/print_hello.ts create mode 100644 cli/tests/testdata/subdir/redirects/a.ts create mode 100644 cli/tests/testdata/subdir/redirects/b.ts create mode 100644 cli/tests/testdata/subdir/redirects/redirect1.js create mode 100644 cli/tests/testdata/subdir/redirects/redirect1.ts create mode 100644 cli/tests/testdata/subdir/redirects/redirect2.js create mode 100644 cli/tests/testdata/subdir/redirects/redirect3.js create mode 100644 cli/tests/testdata/subdir/redirects/redirect4.ts create mode 100644 cli/tests/testdata/subdir/single_module.ts create mode 100644 cli/tests/testdata/subdir/subdir2/dynamic_import.ts create mode 100644 cli/tests/testdata/subdir/subdir2/mod2.ts create mode 100644 cli/tests/testdata/subdir/test_worker_basic.js create mode 100644 cli/tests/testdata/subdir/throws.js create mode 100644 cli/tests/testdata/subdir/tla.ts create mode 100644 cli/tests/testdata/subdir/type_and_code.ts create mode 100644 cli/tests/testdata/subdir/type_reference.d.ts create mode 100644 cli/tests/testdata/subdir/type_reference.js create mode 100644 cli/tests/testdata/subdir/types.d.ts create mode 100644 cli/tests/testdata/subdir/unknown_ext.deno create mode 100644 cli/tests/testdata/swc_syntax_error.ts create mode 100644 cli/tests/testdata/swc_syntax_error.ts.out create mode 120000 cli/tests/testdata/symlink_to_subdir create mode 100644 cli/tests/testdata/test/allow_all.out create mode 100644 cli/tests/testdata/test/allow_all.ts create mode 100644 cli/tests/testdata/test/allow_none.out create mode 100644 cli/tests/testdata/test/allow_none.ts create mode 100644 cli/tests/testdata/test/clear_timeout.out create mode 100644 cli/tests/testdata/test/clear_timeout.ts create mode 100644 cli/tests/testdata/test/doc.out create mode 100644 cli/tests/testdata/test/doc.ts create mode 100644 cli/tests/testdata/test/doc_markdown.out create mode 100644 cli/tests/testdata/test/doc_markdown/doc.md create mode 100644 cli/tests/testdata/test/exit_sanitizer.out create mode 100644 cli/tests/testdata/test/exit_sanitizer.ts create mode 100644 cli/tests/testdata/test/fail.out create mode 100644 cli/tests/testdata/test/fail.ts create mode 100644 cli/tests/testdata/test/fail_fast.out create mode 100644 cli/tests/testdata/test/fail_fast.ts create mode 100644 cli/tests/testdata/test/fail_fast_with_val.out create mode 100644 cli/tests/testdata/test/fail_fast_with_val.ts create mode 100644 cli/tests/testdata/test/finally_timeout.out create mode 100644 cli/tests/testdata/test/finally_timeout.ts create mode 100644 cli/tests/testdata/test/ignore.out create mode 100644 cli/tests/testdata/test/ignore.ts create mode 100644 cli/tests/testdata/test/ignore_permissions.out create mode 100644 cli/tests/testdata/test/ignore_permissions.ts create mode 100644 cli/tests/testdata/test/meta.out create mode 100644 cli/tests/testdata/test/meta.ts create mode 100644 cli/tests/testdata/test/no_check.out create mode 100644 cli/tests/testdata/test/no_check.ts create mode 100644 cli/tests/testdata/test/no_color.ts create mode 100644 cli/tests/testdata/test/no_run.out create mode 100644 cli/tests/testdata/test/no_run.ts create mode 100644 cli/tests/testdata/test/only.out create mode 100644 cli/tests/testdata/test/only.ts create mode 100644 cli/tests/testdata/test/pass.out create mode 100644 cli/tests/testdata/test/pass.ts create mode 100644 cli/tests/testdata/test/quiet.out create mode 100644 cli/tests/testdata/test/quiet.ts create mode 100644 cli/tests/testdata/test/shuffle.out create mode 100644 cli/tests/testdata/test/shuffle/bar_test.ts create mode 100644 cli/tests/testdata/test/shuffle/baz_test.ts create mode 100644 cli/tests/testdata/test/shuffle/foo_test.ts create mode 100644 cli/tests/testdata/test/unhandled_rejection.out create mode 100644 cli/tests/testdata/test/unhandled_rejection.ts create mode 100644 cli/tests/testdata/test/unresolved_promise.out create mode 100644 cli/tests/testdata/test/unresolved_promise.ts create mode 100644 cli/tests/testdata/text_decoder_perf.js create mode 100644 cli/tests/testdata/text_encoder_into_perf.js create mode 100644 cli/tests/testdata/text_encoder_perf.js create mode 100644 cli/tests/testdata/tla/a.js create mode 100644 cli/tests/testdata/tla/b.js create mode 100644 cli/tests/testdata/tla/c.js create mode 100644 cli/tests/testdata/tla/d.js create mode 100644 cli/tests/testdata/tla/order.js create mode 100644 cli/tests/testdata/tla/parent.js create mode 100644 cli/tests/testdata/tla2/a.js create mode 100644 cli/tests/testdata/tla2/b.js create mode 100644 cli/tests/testdata/tla3/b.js create mode 100644 cli/tests/testdata/tla3/timeout_loop.js create mode 100644 cli/tests/testdata/tls.out create mode 100644 cli/tests/testdata/tls/README.md create mode 100644 cli/tests/testdata/tls/RootCA.crt create mode 100644 cli/tests/testdata/tls/RootCA.key create mode 100644 cli/tests/testdata/tls/RootCA.pem create mode 100644 cli/tests/testdata/tls/domains.txt create mode 100644 cli/tests/testdata/tls/localhost.crt create mode 100644 cli/tests/testdata/tls/localhost.key create mode 100644 cli/tests/testdata/tls_connecttls.js create mode 100644 cli/tests/testdata/tls_starttls.js create mode 100644 cli/tests/testdata/top_level_await.js create mode 100644 cli/tests/testdata/top_level_await.out create mode 100644 cli/tests/testdata/top_level_await.ts create mode 100644 cli/tests/testdata/top_level_await_circular.js create mode 100644 cli/tests/testdata/top_level_await_circular.out create mode 100644 cli/tests/testdata/top_level_await_loop.js create mode 100644 cli/tests/testdata/top_level_await_loop.out create mode 100644 cli/tests/testdata/top_level_await_nested.out create mode 100644 cli/tests/testdata/top_level_await_nested/a.js create mode 100644 cli/tests/testdata/top_level_await_nested/b.js create mode 100644 cli/tests/testdata/top_level_await_nested/main.js create mode 100644 cli/tests/testdata/top_level_await_order.js create mode 100644 cli/tests/testdata/top_level_await_order.out create mode 100644 cli/tests/testdata/top_level_await_unresolved.js create mode 100644 cli/tests/testdata/top_level_await_unresolved.out create mode 100644 cli/tests/testdata/top_level_for_await.js create mode 100644 cli/tests/testdata/top_level_for_await.out create mode 100644 cli/tests/testdata/top_level_for_await.ts create mode 100644 cli/tests/testdata/ts_decorators.ts create mode 100644 cli/tests/testdata/ts_decorators.ts.out create mode 100644 cli/tests/testdata/ts_decorators_bundle.out create mode 100644 cli/tests/testdata/ts_decorators_bundle.ts create mode 100644 cli/tests/testdata/ts_import_from_js.deps.js create mode 100644 cli/tests/testdata/ts_import_from_js.js create mode 100644 cli/tests/testdata/ts_import_from_js.js.out create mode 100644 cli/tests/testdata/ts_type_imports.ts create mode 100644 cli/tests/testdata/ts_type_imports.ts.out create mode 100644 cli/tests/testdata/ts_type_imports_foo.ts create mode 100644 cli/tests/testdata/ts_type_only_import.d.ts create mode 100644 cli/tests/testdata/ts_type_only_import.ts create mode 100644 cli/tests/testdata/ts_type_only_import.ts.out create mode 100644 cli/tests/testdata/ts_with_generic.ts create mode 100644 cli/tests/testdata/tsc/a.js create mode 100644 cli/tests/testdata/tsc/d.ts create mode 100644 cli/tests/testdata/tsc/node_modules/b.js create mode 100644 cli/tests/testdata/tsc/node_modules/c.js create mode 100644 cli/tests/testdata/tsc/test.js create mode 100644 cli/tests/testdata/tsc2/file_exportc.ts create mode 100644 cli/tests/testdata/tsc2/file_libref.ts create mode 100644 cli/tests/testdata/tsc2/file_main.ts create mode 100644 cli/tests/testdata/tsc2/file_reexports.ts create mode 100644 cli/tests/testdata/tsc2/https_deno.land-x-a.ts create mode 100644 cli/tests/testdata/tsc2/https_deno.land-x-b.ts create mode 100644 cli/tests/testdata/tsc2/https_deno.land-x-c.d.ts create mode 100644 cli/tests/testdata/tsc2/https_deno.land-x-c.js create mode 100644 cli/tests/testdata/tsc2/https_deno.land-x-mod.ts create mode 100644 cli/tests/testdata/tsconfig.decorators.json create mode 100644 cli/tests/testdata/tsx_imports.ts create mode 100644 cli/tests/testdata/tsx_imports.ts.out create mode 100644 cli/tests/testdata/type_definitions.ts create mode 100644 cli/tests/testdata/type_definitions.ts.out create mode 100644 cli/tests/testdata/type_definitions/bar.d.ts create mode 100644 cli/tests/testdata/type_definitions/bar.js create mode 100644 cli/tests/testdata/type_definitions/fizz.d.ts create mode 100644 cli/tests/testdata/type_definitions/fizz.js create mode 100644 cli/tests/testdata/type_definitions/foo.d.ts create mode 100644 cli/tests/testdata/type_definitions/foo.js create mode 100644 cli/tests/testdata/type_definitions/qat.ts create mode 100644 cli/tests/testdata/type_definitions_for_export.ts create mode 100644 cli/tests/testdata/type_definitions_for_export.ts.out create mode 100644 cli/tests/testdata/type_directives_01.ts create mode 100644 cli/tests/testdata/type_directives_01.ts.out create mode 100644 cli/tests/testdata/type_directives_02.ts create mode 100644 cli/tests/testdata/type_directives_02.ts.out create mode 100644 cli/tests/testdata/type_directives_js_main.js create mode 100644 cli/tests/testdata/type_directives_js_main.js.out create mode 100644 cli/tests/testdata/type_directives_redirect.ts create mode 100644 cli/tests/testdata/type_directives_redirect.ts.out create mode 100644 cli/tests/testdata/type_headers_deno_types.ts create mode 100644 cli/tests/testdata/type_headers_deno_types.ts.out create mode 100644 cli/tests/testdata/types.out create mode 100644 cli/tests/testdata/unbuffered_stderr.ts create mode 100644 cli/tests/testdata/unbuffered_stderr.ts.out create mode 100644 cli/tests/testdata/unbuffered_stdout.ts create mode 100644 cli/tests/testdata/unbuffered_stdout.ts.out create mode 100644 cli/tests/testdata/unstable.js create mode 100644 cli/tests/testdata/unstable.ts create mode 100644 cli/tests/testdata/unstable_disabled.out create mode 100644 cli/tests/testdata/unstable_disabled_js.out create mode 100644 cli/tests/testdata/unstable_enabled.out create mode 100644 cli/tests/testdata/unstable_enabled_js.out create mode 100644 cli/tests/testdata/unstable_worker.ts create mode 100644 cli/tests/testdata/unstable_worker.ts.out create mode 100644 cli/tests/testdata/unsupported_dynamic_import_scheme.out create mode 100644 cli/tests/testdata/v8_flags.js create mode 100644 cli/tests/testdata/v8_flags.js.out create mode 100644 cli/tests/testdata/v8_flags_unrecognized.out create mode 100644 cli/tests/testdata/v8_help.out create mode 100644 cli/tests/testdata/wasm.ts create mode 100644 cli/tests/testdata/wasm.ts.out create mode 100644 cli/tests/testdata/wasm_async.js create mode 100644 cli/tests/testdata/wasm_async.out create mode 100644 cli/tests/testdata/wasm_shared.out create mode 100644 cli/tests/testdata/wasm_shared.ts create mode 100644 cli/tests/testdata/wasm_unreachable.js create mode 100644 cli/tests/testdata/wasm_unreachable.out create mode 100644 cli/tests/testdata/weakref.ts create mode 100644 cli/tests/testdata/weakref.ts.out create mode 100644 cli/tests/testdata/webgpu_computepass_shader.wgsl create mode 100644 cli/tests/testdata/webgpu_hellotriangle.out create mode 100644 cli/tests/testdata/webgpu_hellotriangle_shader.wgsl create mode 100644 cli/tests/testdata/websocket_test.ts create mode 100644 cli/tests/testdata/websocketstream_test.ts create mode 100644 cli/tests/testdata/worker_close_race.js create mode 100644 cli/tests/testdata/worker_close_race.js.out create mode 100644 cli/tests/testdata/worker_event_handler_test.js create mode 100644 cli/tests/testdata/worker_event_handler_test.js.out create mode 100644 cli/tests/testdata/workers/bench_large_message.ts create mode 100644 cli/tests/testdata/workers/bench_round_robin.ts create mode 100644 cli/tests/testdata/workers/bench_startup.ts create mode 100644 cli/tests/testdata/workers/bench_worker.ts create mode 100644 cli/tests/testdata/workers/broadcast_channel.ts create mode 100644 cli/tests/testdata/workers/busy_worker.js create mode 100644 cli/tests/testdata/workers/close_race_worker.js create mode 100644 cli/tests/testdata/workers/deno_worker.ts create mode 100644 cli/tests/testdata/workers/dynamic_remote.ts create mode 100644 cli/tests/testdata/workers/error.ts create mode 100644 cli/tests/testdata/workers/event_worker.js create mode 100644 cli/tests/testdata/workers/event_worker_scope.js create mode 100644 cli/tests/testdata/workers/fetching_worker.js create mode 100644 cli/tests/testdata/workers/http_worker.js create mode 100644 cli/tests/testdata/workers/immediately_close_worker.js create mode 100644 cli/tests/testdata/workers/message_port.ts create mode 100644 cli/tests/testdata/workers/nested_worker.js create mode 100644 cli/tests/testdata/workers/no_permissions_worker.js create mode 100644 cli/tests/testdata/workers/non_deno_worker.js create mode 100644 cli/tests/testdata/workers/nonexistent_worker.out create mode 100644 cli/tests/testdata/workers/nonexistent_worker.ts create mode 100644 cli/tests/testdata/workers/parent_read_check_granular_worker.js create mode 100644 cli/tests/testdata/workers/parent_read_check_worker.js create mode 100644 cli/tests/testdata/workers/permissions_blob_local.ts create mode 100644 cli/tests/testdata/workers/permissions_blob_local.ts.out create mode 100644 cli/tests/testdata/workers/permissions_blob_remote.ts create mode 100644 cli/tests/testdata/workers/permissions_blob_remote.ts.out create mode 100644 cli/tests/testdata/workers/permissions_data_local.ts create mode 100644 cli/tests/testdata/workers/permissions_data_local.ts.out create mode 100644 cli/tests/testdata/workers/permissions_data_remote.ts create mode 100644 cli/tests/testdata/workers/permissions_data_remote.ts.out create mode 100644 cli/tests/testdata/workers/permissions_dynamic_remote.ts create mode 100644 cli/tests/testdata/workers/permissions_dynamic_remote.ts.out create mode 100644 cli/tests/testdata/workers/permissions_remote_remote.ts create mode 100644 cli/tests/testdata/workers/permissions_remote_remote.ts.out create mode 100644 cli/tests/testdata/workers/post_undefined.ts create mode 100644 cli/tests/testdata/workers/racy_worker.js create mode 100644 cli/tests/testdata/workers/read_check_granular_worker.js create mode 100644 cli/tests/testdata/workers/read_check_worker.js create mode 100644 cli/tests/testdata/workers/shared_array_buffer.ts create mode 100644 cli/tests/testdata/workers/sibling_worker.js create mode 100644 cli/tests/testdata/workers/static_remote.ts create mode 100644 cli/tests/testdata/workers/test.ts create mode 100644 cli/tests/testdata/workers/test.ts.out create mode 100644 cli/tests/testdata/workers/test_worker.js create mode 100644 cli/tests/testdata/workers/test_worker.ts create mode 100644 cli/tests/testdata/workers/throwing_worker.js create mode 100644 cli/tests/testdata/workers/worker_crypto.js create mode 100644 cli/tests/testdata/workers/worker_error.ts create mode 100644 cli/tests/testdata/workers/worker_error.ts.out create mode 100644 cli/tests/testdata/workers/worker_event_handlers.js create mode 100644 cli/tests/testdata/workers/worker_globals.ts create mode 100644 cli/tests/testdata/workers/worker_large_message.js create mode 100644 cli/tests/testdata/workers/worker_location.ts create mode 100644 cli/tests/testdata/workers/worker_nested_error.ts create mode 100644 cli/tests/testdata/workers/worker_nested_error.ts.out create mode 100644 cli/tests/testdata/workers/worker_structured_cloning.ts create mode 100644 cli/tests/testdata/workers/worker_types.ts create mode 100644 cli/tests/testdata/workers/worker_unstable.ts create mode 100644 cli/tests/testdata/workers/worker_with_top_level_await.ts create mode 100644 cli/tests/testdata/x_deno_warning.js delete mode 100644 cli/tests/text_decoder_perf.js delete mode 100644 cli/tests/text_encoder_into_perf.js delete mode 100644 cli/tests/text_encoder_perf.js delete mode 100644 cli/tests/tla/a.js delete mode 100644 cli/tests/tla/b.js delete mode 100644 cli/tests/tla/c.js delete mode 100644 cli/tests/tla/d.js delete mode 100644 cli/tests/tla/order.js delete mode 100644 cli/tests/tla/parent.js delete mode 100644 cli/tests/tla2/a.js delete mode 100644 cli/tests/tla2/b.js delete mode 100644 cli/tests/tla3/b.js delete mode 100644 cli/tests/tla3/timeout_loop.js delete mode 100644 cli/tests/tls.out delete mode 100644 cli/tests/tls/README.md delete mode 100644 cli/tests/tls/RootCA.crt delete mode 100644 cli/tests/tls/RootCA.key delete mode 100644 cli/tests/tls/RootCA.pem delete mode 100644 cli/tests/tls/domains.txt delete mode 100644 cli/tests/tls/localhost.crt delete mode 100644 cli/tests/tls/localhost.key delete mode 100644 cli/tests/tls_connecttls.js delete mode 100644 cli/tests/tls_starttls.js delete mode 100644 cli/tests/top_level_await.js delete mode 100644 cli/tests/top_level_await.out delete mode 100644 cli/tests/top_level_await.ts delete mode 100644 cli/tests/top_level_await_circular.js delete mode 100644 cli/tests/top_level_await_circular.out delete mode 100644 cli/tests/top_level_await_loop.js delete mode 100644 cli/tests/top_level_await_loop.out delete mode 100644 cli/tests/top_level_await_nested.out delete mode 100644 cli/tests/top_level_await_nested/a.js delete mode 100644 cli/tests/top_level_await_nested/b.js delete mode 100644 cli/tests/top_level_await_nested/main.js delete mode 100644 cli/tests/top_level_await_order.js delete mode 100644 cli/tests/top_level_await_order.out delete mode 100644 cli/tests/top_level_await_unresolved.js delete mode 100644 cli/tests/top_level_await_unresolved.out delete mode 100644 cli/tests/top_level_for_await.js delete mode 100644 cli/tests/top_level_for_await.out delete mode 100644 cli/tests/top_level_for_await.ts delete mode 100644 cli/tests/ts_decorators.ts delete mode 100644 cli/tests/ts_decorators.ts.out delete mode 100644 cli/tests/ts_decorators_bundle.out delete mode 100644 cli/tests/ts_decorators_bundle.ts delete mode 100644 cli/tests/ts_import_from_js.deps.js delete mode 100644 cli/tests/ts_import_from_js.js delete mode 100644 cli/tests/ts_import_from_js.js.out delete mode 100644 cli/tests/ts_type_imports.ts delete mode 100644 cli/tests/ts_type_imports.ts.out delete mode 100644 cli/tests/ts_type_imports_foo.ts delete mode 100644 cli/tests/ts_type_only_import.d.ts delete mode 100644 cli/tests/ts_type_only_import.ts delete mode 100644 cli/tests/ts_type_only_import.ts.out delete mode 100644 cli/tests/ts_with_generic.ts delete mode 100644 cli/tests/tsc/a.js delete mode 100644 cli/tests/tsc/d.ts delete mode 100644 cli/tests/tsc/node_modules/b.js delete mode 100644 cli/tests/tsc/node_modules/c.js delete mode 100644 cli/tests/tsc/test.js delete mode 100644 cli/tests/tsc2/file_exportc.ts delete mode 100644 cli/tests/tsc2/file_libref.ts delete mode 100644 cli/tests/tsc2/file_main.ts delete mode 100644 cli/tests/tsc2/file_reexports.ts delete mode 100644 cli/tests/tsc2/https_deno.land-x-a.ts delete mode 100644 cli/tests/tsc2/https_deno.land-x-b.ts delete mode 100644 cli/tests/tsc2/https_deno.land-x-c.d.ts delete mode 100644 cli/tests/tsc2/https_deno.land-x-c.js delete mode 100644 cli/tests/tsc2/https_deno.land-x-mod.ts delete mode 100644 cli/tests/tsconfig.decorators.json delete mode 100644 cli/tests/tsx_imports.ts delete mode 100644 cli/tests/tsx_imports.ts.out delete mode 100644 cli/tests/type_definitions.ts delete mode 100644 cli/tests/type_definitions.ts.out delete mode 100644 cli/tests/type_definitions/bar.d.ts delete mode 100644 cli/tests/type_definitions/bar.js delete mode 100644 cli/tests/type_definitions/fizz.d.ts delete mode 100644 cli/tests/type_definitions/fizz.js delete mode 100644 cli/tests/type_definitions/foo.d.ts delete mode 100644 cli/tests/type_definitions/foo.js delete mode 100644 cli/tests/type_definitions/qat.ts delete mode 100644 cli/tests/type_definitions_for_export.ts delete mode 100644 cli/tests/type_definitions_for_export.ts.out delete mode 100644 cli/tests/type_directives_01.ts delete mode 100644 cli/tests/type_directives_01.ts.out delete mode 100644 cli/tests/type_directives_02.ts delete mode 100644 cli/tests/type_directives_02.ts.out delete mode 100644 cli/tests/type_directives_js_main.js delete mode 100644 cli/tests/type_directives_js_main.js.out delete mode 100644 cli/tests/type_directives_redirect.ts delete mode 100644 cli/tests/type_directives_redirect.ts.out delete mode 100644 cli/tests/type_headers_deno_types.ts delete mode 100644 cli/tests/type_headers_deno_types.ts.out delete mode 100644 cli/tests/types.out delete mode 100644 cli/tests/unbuffered_stderr.ts delete mode 100644 cli/tests/unbuffered_stderr.ts.out delete mode 100644 cli/tests/unbuffered_stdout.ts delete mode 100644 cli/tests/unbuffered_stdout.ts.out delete mode 100644 cli/tests/unstable.js delete mode 100644 cli/tests/unstable.ts delete mode 100644 cli/tests/unstable_disabled.out delete mode 100644 cli/tests/unstable_disabled_js.out delete mode 100644 cli/tests/unstable_enabled.out delete mode 100644 cli/tests/unstable_enabled_js.out delete mode 100644 cli/tests/unstable_worker.ts delete mode 100644 cli/tests/unstable_worker.ts.out delete mode 100644 cli/tests/unsupported_dynamic_import_scheme.out delete mode 100644 cli/tests/v8_flags.js delete mode 100644 cli/tests/v8_flags.js.out delete mode 100644 cli/tests/v8_flags_unrecognized.out delete mode 100644 cli/tests/v8_help.out delete mode 100644 cli/tests/wasm.ts delete mode 100644 cli/tests/wasm.ts.out delete mode 100644 cli/tests/wasm_async.js delete mode 100644 cli/tests/wasm_async.out delete mode 100644 cli/tests/wasm_shared.out delete mode 100644 cli/tests/wasm_shared.ts delete mode 100644 cli/tests/wasm_unreachable.js delete mode 100644 cli/tests/wasm_unreachable.out delete mode 100644 cli/tests/weakref.ts delete mode 100644 cli/tests/weakref.ts.out delete mode 100644 cli/tests/webgpu_computepass_shader.wgsl delete mode 100644 cli/tests/webgpu_hellotriangle.out delete mode 100644 cli/tests/webgpu_hellotriangle_shader.wgsl delete mode 100644 cli/tests/websocket_test.ts delete mode 100644 cli/tests/websocketstream_test.ts delete mode 100644 cli/tests/worker_close_race.js delete mode 100644 cli/tests/worker_close_race.js.out delete mode 100644 cli/tests/worker_event_handler_test.js delete mode 100644 cli/tests/worker_event_handler_test.js.out delete mode 100644 cli/tests/workers/bench_large_message.ts delete mode 100644 cli/tests/workers/bench_round_robin.ts delete mode 100644 cli/tests/workers/bench_startup.ts delete mode 100644 cli/tests/workers/bench_worker.ts delete mode 100644 cli/tests/workers/broadcast_channel.ts delete mode 100644 cli/tests/workers/busy_worker.js delete mode 100644 cli/tests/workers/close_race_worker.js delete mode 100644 cli/tests/workers/deno_worker.ts delete mode 100644 cli/tests/workers/dynamic_remote.ts delete mode 100644 cli/tests/workers/error.ts delete mode 100644 cli/tests/workers/event_worker.js delete mode 100644 cli/tests/workers/event_worker_scope.js delete mode 100644 cli/tests/workers/fetching_worker.js delete mode 100644 cli/tests/workers/http_worker.js delete mode 100644 cli/tests/workers/immediately_close_worker.js delete mode 100644 cli/tests/workers/message_port.ts delete mode 100644 cli/tests/workers/nested_worker.js delete mode 100644 cli/tests/workers/no_permissions_worker.js delete mode 100644 cli/tests/workers/non_deno_worker.js delete mode 100644 cli/tests/workers/nonexistent_worker.out delete mode 100644 cli/tests/workers/nonexistent_worker.ts delete mode 100644 cli/tests/workers/parent_read_check_granular_worker.js delete mode 100644 cli/tests/workers/parent_read_check_worker.js delete mode 100644 cli/tests/workers/permissions_blob_local.ts delete mode 100644 cli/tests/workers/permissions_blob_local.ts.out delete mode 100644 cli/tests/workers/permissions_blob_remote.ts delete mode 100644 cli/tests/workers/permissions_blob_remote.ts.out delete mode 100644 cli/tests/workers/permissions_data_local.ts delete mode 100644 cli/tests/workers/permissions_data_local.ts.out delete mode 100644 cli/tests/workers/permissions_data_remote.ts delete mode 100644 cli/tests/workers/permissions_data_remote.ts.out delete mode 100644 cli/tests/workers/permissions_dynamic_remote.ts delete mode 100644 cli/tests/workers/permissions_dynamic_remote.ts.out delete mode 100644 cli/tests/workers/permissions_remote_remote.ts delete mode 100644 cli/tests/workers/permissions_remote_remote.ts.out delete mode 100644 cli/tests/workers/post_undefined.ts delete mode 100644 cli/tests/workers/racy_worker.js delete mode 100644 cli/tests/workers/read_check_granular_worker.js delete mode 100644 cli/tests/workers/read_check_worker.js delete mode 100644 cli/tests/workers/shared_array_buffer.ts delete mode 100644 cli/tests/workers/sibling_worker.js delete mode 100644 cli/tests/workers/static_remote.ts delete mode 100644 cli/tests/workers/test.ts delete mode 100644 cli/tests/workers/test.ts.out delete mode 100644 cli/tests/workers/test_worker.js delete mode 100644 cli/tests/workers/test_worker.ts delete mode 100644 cli/tests/workers/throwing_worker.js delete mode 100644 cli/tests/workers/worker_crypto.js delete mode 100644 cli/tests/workers/worker_error.ts delete mode 100644 cli/tests/workers/worker_error.ts.out delete mode 100644 cli/tests/workers/worker_event_handlers.js delete mode 100644 cli/tests/workers/worker_globals.ts delete mode 100644 cli/tests/workers/worker_large_message.js delete mode 100644 cli/tests/workers/worker_location.ts delete mode 100644 cli/tests/workers/worker_nested_error.ts delete mode 100644 cli/tests/workers/worker_nested_error.ts.out delete mode 100644 cli/tests/workers/worker_structured_cloning.ts delete mode 100644 cli/tests/workers/worker_types.ts delete mode 100644 cli/tests/workers/worker_unstable.ts delete mode 100644 cli/tests/workers/worker_with_top_level_await.ts delete mode 100644 cli/tests/x_deno_warning.js diff --git a/.dprint.json b/.dprint.json index aaf191b77..91c827fc1 100644 --- a/.dprint.json +++ b/.dprint.json @@ -21,10 +21,10 @@ "cli/dts/lib.scripthost.d.ts", "cli/dts/lib.webworker*.d.ts", "cli/dts/typescript.d.ts", - "cli/tests/encoding", - "cli/tests/inline_js_source_map*", - "cli/tests/badly_formatted.md", - "cli/tests/badly_formatted.json", + "cli/tests/testdata/encoding", + "cli/tests/testdata/inline_js_source_map*", + "cli/tests/testdata/badly_formatted.md", + "cli/tests/testdata/badly_formatted.json", "cli/tsc/*typescript.js", "test_util/std", "test_util/wpt", diff --git a/.gitattributes b/.gitattributes index 00d74b784..08ef3b672 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,11 +2,11 @@ * text=auto eol=lf *.png -text -/cli/tests/encoding/* -text +/cli/tests/testdata/encoding/* -text # Tell git which symlinks point to files, and which ones point to directories. # This is relevant for Windows only, and requires git >= 2.19.2 to work. -/cli/tests/symlink_to_subdir symlink=dir +/cli/tests/testdata/symlink_to_subdir symlink=dir # Tell github these are vendored files. # Doesn't include them in the language statistics. diff --git a/cli/bench/main.rs b/cli/bench/main.rs index e6d735397..06e2d59bb 100644 --- a/cli/bench/main.rs +++ b/cli/bench/main.rs @@ -36,29 +36,46 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option)] = &[ // invalidating that cache. ( "cold_hello", - &["run", "--reload", "cli/tests/002_hello.ts"], + &["run", "--reload", "cli/tests/testdata/002_hello.ts"], None, ), ( "cold_relative_import", - &["run", "--reload", "cli/tests/003_relative_import.ts"], + &[ + "run", + "--reload", + "cli/tests/testdata/003_relative_import.ts", + ], None, ), - ("hello", &["run", "cli/tests/002_hello.ts"], None), + ("hello", &["run", "cli/tests/testdata/002_hello.ts"], None), ( "relative_import", - &["run", "cli/tests/003_relative_import.ts"], + &["run", "cli/tests/testdata/003_relative_import.ts"], None, ), - ("error_001", &["run", "cli/tests/error_001.ts"], Some(1)), + ( + "error_001", + &["run", "cli/tests/testdata/error_001.ts"], + Some(1), + ), ( "no_check_hello", - &["run", "--reload", "--no-check", "cli/tests/002_hello.ts"], + &[ + "run", + "--reload", + "--no-check", + "cli/tests/testdata/002_hello.ts", + ], None, ), ( "workers_startup", - &["run", "--allow-read", "cli/tests/workers/bench_startup.ts"], + &[ + "run", + "--allow-read", + "cli/tests/testdata/workers/bench_startup.ts", + ], None, ), ( @@ -66,7 +83,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option)] = &[ &[ "run", "--allow-read", - "cli/tests/workers/bench_round_robin.ts", + "cli/tests/testdata/workers/bench_round_robin.ts", ], None, ), @@ -75,23 +92,23 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option)] = &[ &[ "run", "--allow-read", - "cli/tests/workers/bench_large_message.ts", + "cli/tests/testdata/workers/bench_large_message.ts", ], None, ), ( "text_decoder", - &["run", "cli/tests/text_decoder_perf.js"], + &["run", "cli/tests/testdata/text_decoder_perf.js"], None, ), ( "text_encoder", - &["run", "cli/tests/text_encoder_perf.js"], + &["run", "cli/tests/testdata/text_encoder_perf.js"], None, ), ( "text_encoder_into", - &["run", "cli/tests/text_encoder_into_perf.js"], + &["run", "cli/tests/testdata/text_encoder_into_perf.js"], None, ), ( diff --git a/cli/bench/throughput.rs b/cli/bench/throughput.rs index de18089bb..0420889ef 100644 --- a/cli/bench/throughput.rs +++ b/cli/bench/throughput.rs @@ -14,7 +14,7 @@ const CLIENT_ADDR: &str = "127.0.0.1 4544"; pub(crate) fn cat(deno_exe: &Path, megs: usize) -> f64 { let size = megs * MB; let shell_cmd = format!( - "{} run --allow-read cli/tests/cat.ts /dev/zero | head -c {}", + "{} run --allow-read cli/tests/testdata/cat.ts /dev/zero | head -c {}", deno_exe.to_str().unwrap(), size ); @@ -47,12 +47,8 @@ pub(crate) fn tcp(deno_exe: &Path, megs: usize) -> Result { // Run deno echo server in the background. let mut echo_server = Command::new(deno_exe.to_str().unwrap()) - .args(&[ - "run", - "--allow-net", - "cli/tests/echo_server.ts", - SERVER_ADDR, - ]) + .args(&["run", "--allow-net", "echo_server.ts", SERVER_ADDR]) + .current_dir(test_util::testdata_path()) .spawn()?; std::thread::sleep(Duration::from_secs(5)); // wait for deno to wake up. TODO racy. diff --git a/cli/config_file.rs b/cli/config_file.rs index 5ea92447b..e366be77c 100644 --- a/cli/config_file.rs +++ b/cli/config_file.rs @@ -279,12 +279,12 @@ pub struct ConfigFile { } impl ConfigFile { - pub fn read(path_str: &str) -> Result { - let path = Path::new(path_str); + pub fn read(path_ref: impl AsRef) -> Result { + let path = Path::new(path_ref.as_ref()); let config_file = if path.is_absolute() { path.to_path_buf() } else { - std::env::current_dir()?.join(path_str) + std::env::current_dir()?.join(path_ref) }; let config_path = canonicalize_path(&config_file).map_err(|_| { @@ -349,16 +349,15 @@ mod tests { #[test] fn read_config_file_relative() { - let config_file = ConfigFile::read("tests/module_graph/tsconfig.json") - .expect("Failed to load config file"); + let config_file = + ConfigFile::read("tests/testdata/module_graph/tsconfig.json") + .expect("Failed to load config file"); assert!(config_file.json.compiler_options.is_some()); } #[test] fn read_config_file_absolute() { - let path = std::env::current_dir() - .unwrap() - .join("tests/module_graph/tsconfig.json"); + let path = test_util::testdata_path().join("module_graph/tsconfig.json"); let config_file = ConfigFile::read(path.to_str().unwrap()) .expect("Failed to load config file"); assert!(config_file.json.compiler_options.is_some()); diff --git a/cli/file_fetcher.rs b/cli/file_fetcher.rs index 7029b9620..41c645c3a 100644 --- a/cli/file_fetcher.rs +++ b/cli/file_fetcher.rs @@ -663,8 +663,7 @@ mod tests { charset: &str, expected: &str, ) { - let url_str = - format!("http://127.0.0.1:4545/cli/tests/encoding/{}", fixture); + let url_str = format!("http://127.0.0.1:4545/encoding/{}", fixture); let specifier = resolve_url(&url_str).unwrap(); let (file, headers) = test_fetch_remote(&specifier).await; assert_eq!(file.source, expected); @@ -676,8 +675,7 @@ mod tests { } async fn test_fetch_local_encoded(charset: &str, expected: String) { - let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join(format!("tests/encoding/{}.ts", charset)); + let p = test_util::testdata_path().join(format!("encoding/{}.ts", charset)); let specifier = resolve_url_or_path(p.to_str().unwrap()).unwrap(); let (file, _) = test_fetch(&specifier).await; assert_eq!(file.source, expected); @@ -910,10 +908,9 @@ mod tests { async fn test_get_source() { let _http_server_guard = test_util::http_server(); let (file_fetcher, _) = setup(CacheSetting::Use, None); - let specifier = resolve_url( - "http://localhost:4548/cli/tests/subdir/redirects/redirect1.js", - ) - .unwrap(); + let specifier = + resolve_url("http://localhost:4548/subdir/redirects/redirect1.js") + .unwrap(); let result = file_fetcher .fetch(&specifier, &mut Permissions::allow_all()) @@ -926,10 +923,8 @@ mod tests { assert_eq!(file.source, "export const redirect = 1;\n"); assert_eq!( file.specifier, - resolve_url( - "http://localhost:4545/cli/tests/subdir/redirects/redirect1.js" - ) - .unwrap() + resolve_url("http://localhost:4545/subdir/redirects/redirect1.js") + .unwrap() ); } @@ -999,8 +994,7 @@ mod tests { let (file_fetcher_01, _) = setup(CacheSetting::Use, Some(temp_dir.clone())); let (file_fetcher_02, _) = setup(CacheSetting::Use, Some(temp_dir.clone())); let specifier = - resolve_url_or_path("http://localhost:4545/cli/tests/subdir/mod2.ts") - .unwrap(); + resolve_url_or_path("http://localhost:4545/subdir/mod2.ts").unwrap(); let result = file_fetcher .fetch(&specifier, &mut Permissions::allow_all()) @@ -1098,8 +1092,7 @@ mod tests { ) .expect("could not create file fetcher"); let specifier = - resolve_url("http://localhost:4545/cli/tests/subdir/mismatch_ext.ts") - .unwrap(); + resolve_url("http://localhost:4545/subdir/mismatch_ext.ts").unwrap(); let cache_filename = file_fetcher_01 .http_cache .get_cache_filename(&specifier) @@ -1148,18 +1141,16 @@ mod tests { async fn test_fetch_redirected() { let _http_server_guard = test_util::http_server(); let (file_fetcher, _) = setup(CacheSetting::Use, None); - let specifier = resolve_url( - "http://localhost:4546/cli/tests/subdir/redirects/redirect1.js", - ) - .unwrap(); + let specifier = + resolve_url("http://localhost:4546/subdir/redirects/redirect1.js") + .unwrap(); let cached_filename = file_fetcher .http_cache .get_cache_filename(&specifier) .unwrap(); - let redirected_specifier = resolve_url( - "http://localhost:4545/cli/tests/subdir/redirects/redirect1.js", - ) - .unwrap(); + let redirected_specifier = + resolve_url("http://localhost:4545/subdir/redirects/redirect1.js") + .unwrap(); let redirected_cached_filename = file_fetcher .http_cache .get_cache_filename(&redirected_specifier) @@ -1183,7 +1174,7 @@ mod tests { .expect("could not get file"); assert_eq!( headers.get("location").unwrap(), - "http://localhost:4545/cli/tests/subdir/redirects/redirect1.js" + "http://localhost:4545/subdir/redirects/redirect1.js" ); assert_eq!( @@ -1201,26 +1192,23 @@ mod tests { async fn test_fetch_multiple_redirects() { let _http_server_guard = test_util::http_server(); let (file_fetcher, _) = setup(CacheSetting::Use, None); - let specifier = resolve_url( - "http://localhost:4548/cli/tests/subdir/redirects/redirect1.js", - ) - .unwrap(); + let specifier = + resolve_url("http://localhost:4548/subdir/redirects/redirect1.js") + .unwrap(); let cached_filename = file_fetcher .http_cache .get_cache_filename(&specifier) .unwrap(); - let redirected_01_specifier = resolve_url( - "http://localhost:4546/cli/tests/subdir/redirects/redirect1.js", - ) - .unwrap(); + let redirected_01_specifier = + resolve_url("http://localhost:4546/subdir/redirects/redirect1.js") + .unwrap(); let redirected_01_cached_filename = file_fetcher .http_cache .get_cache_filename(&redirected_01_specifier) .unwrap(); - let redirected_02_specifier = resolve_url( - "http://localhost:4545/cli/tests/subdir/redirects/redirect1.js", - ) - .unwrap(); + let redirected_02_specifier = + resolve_url("http://localhost:4545/subdir/redirects/redirect1.js") + .unwrap(); let redirected_02_cached_filename = file_fetcher .http_cache .get_cache_filename(&redirected_02_specifier) @@ -1244,7 +1232,7 @@ mod tests { .expect("could not get file"); assert_eq!( headers.get("location").unwrap(), - "http://localhost:4546/cli/tests/subdir/redirects/redirect1.js" + "http://localhost:4546/subdir/redirects/redirect1.js" ); assert_eq!( @@ -1258,7 +1246,7 @@ mod tests { .expect("could not get file"); assert_eq!( headers.get("location").unwrap(), - "http://localhost:4545/cli/tests/subdir/redirects/redirect1.js" + "http://localhost:4545/subdir/redirects/redirect1.js" ); assert_eq!( @@ -1289,11 +1277,9 @@ mod tests { ) .expect("could not create file fetcher"); let specifier = - resolve_url("http://localhost:4548/cli/tests/subdir/mismatch_ext.ts") - .unwrap(); + resolve_url("http://localhost:4548/subdir/mismatch_ext.ts").unwrap(); let redirected_specifier = - resolve_url("http://localhost:4546/cli/tests/subdir/mismatch_ext.ts") - .unwrap(); + resolve_url("http://localhost:4546/subdir/mismatch_ext.ts").unwrap(); let redirected_cache_filename = file_fetcher_01 .http_cache .get_cache_filename(&redirected_specifier) @@ -1342,10 +1328,9 @@ mod tests { async fn test_fetcher_limits_redirects() { let _http_server_guard = test_util::http_server(); let (file_fetcher, _) = setup(CacheSetting::Use, None); - let specifier = resolve_url( - "http://localhost:4548/cli/tests/subdir/redirects/redirect1.js", - ) - .unwrap(); + let specifier = + resolve_url("http://localhost:4548/subdir/redirects/redirect1.js") + .unwrap(); let result = file_fetcher .fetch_remote(&specifier, &mut Permissions::allow_all(), 2) @@ -1369,17 +1354,16 @@ mod tests { let _http_server_guard = test_util::http_server(); let (file_fetcher, _) = setup(CacheSetting::Use, None); let specifier = resolve_url( - "http://localhost:4550/REDIRECT/cli/tests/subdir/redirects/redirect1.js", + "http://localhost:4550/REDIRECT/subdir/redirects/redirect1.js", ) .unwrap(); let cached_filename = file_fetcher .http_cache .get_cache_filename(&specifier) .unwrap(); - let redirected_specifier = resolve_url( - "http://localhost:4550/cli/tests/subdir/redirects/redirect1.js", - ) - .unwrap(); + let redirected_specifier = + resolve_url("http://localhost:4550/subdir/redirects/redirect1.js") + .unwrap(); let redirected_cached_filename = file_fetcher .http_cache .get_cache_filename(&redirected_specifier) @@ -1403,7 +1387,7 @@ mod tests { .expect("could not get file"); assert_eq!( headers.get("location").unwrap(), - "/cli/tests/subdir/redirects/redirect1.js" + "/subdir/redirects/redirect1.js" ); assert_eq!( @@ -1431,8 +1415,7 @@ mod tests { None, ) .expect("could not create file fetcher"); - let specifier = - resolve_url("http://localhost:4545/cli/tests/002_hello.ts").unwrap(); + let specifier = resolve_url("http://localhost:4545/002_hello.ts").unwrap(); let result = file_fetcher .fetch(&specifier, &mut Permissions::allow_all()) @@ -1440,7 +1423,7 @@ mod tests { assert!(result.is_err()); let err = result.unwrap_err(); assert_eq!(get_custom_error_class(&err), Some("NoRemote")); - assert_eq!(err.to_string(), "A remote specifier was requested: \"http://localhost:4545/cli/tests/002_hello.ts\", but --no-remote is specified."); + assert_eq!(err.to_string(), "A remote specifier was requested: \"http://localhost:4545/002_hello.ts\", but --no-remote is specified."); } #[tokio::test] @@ -1468,8 +1451,7 @@ mod tests { None, ) .expect("could not create file fetcher"); - let specifier = - resolve_url("http://localhost:4545/cli/tests/002_hello.ts").unwrap(); + let specifier = resolve_url("http://localhost:4545/002_hello.ts").unwrap(); let result = file_fetcher_01 .fetch(&specifier, &mut Permissions::allow_all()) @@ -1477,7 +1459,7 @@ mod tests { assert!(result.is_err()); let err = result.unwrap_err(); assert_eq!(get_custom_error_class(&err), Some("NotFound")); - assert_eq!(err.to_string(), "Specifier not found in cache: \"http://localhost:4545/cli/tests/002_hello.ts\", --cached-only is specified."); + assert_eq!(err.to_string(), "Specifier not found in cache: \"http://localhost:4545/002_hello.ts\", --cached-only is specified."); let result = file_fetcher_02 .fetch(&specifier, &mut Permissions::allow_all()) diff --git a/cli/fs_util.rs b/cli/fs_util.rs index 4fcae38f4..6103a0833 100644 --- a/cli/fs_util.rs +++ b/cli/fs_util.rs @@ -234,8 +234,8 @@ mod tests { assert!(!is_supported_ext(Path::new("tests/subdir/redirects"))); assert!(!is_supported_ext(Path::new("README.md"))); assert!(is_supported_ext(Path::new("lib/typescript.d.ts"))); - assert!(is_supported_ext(Path::new("cli/tests/001_hello.js"))); - assert!(is_supported_ext(Path::new("cli/tests/002_hello.ts"))); + assert!(is_supported_ext(Path::new("testdata/001_hello.js"))); + assert!(is_supported_ext(Path::new("testdata/002_hello.ts"))); assert!(is_supported_ext(Path::new("foo.jsx"))); assert!(is_supported_ext(Path::new("foo.tsx"))); assert!(is_supported_ext(Path::new("foo.TS"))); @@ -252,8 +252,8 @@ mod tests { assert!(is_supported_ext_fmt(Path::new("README.md"))); assert!(is_supported_ext_fmt(Path::new("readme.MD"))); assert!(is_supported_ext_fmt(Path::new("lib/typescript.d.ts"))); - assert!(is_supported_ext_fmt(Path::new("cli/tests/001_hello.js"))); - assert!(is_supported_ext_fmt(Path::new("cli/tests/002_hello.ts"))); + assert!(is_supported_ext_fmt(Path::new("testdata/001_hello.js"))); + assert!(is_supported_ext_fmt(Path::new("testdata/002_hello.ts"))); assert!(is_supported_ext_fmt(Path::new("foo.jsx"))); assert!(is_supported_ext_fmt(Path::new("foo.tsx"))); assert!(is_supported_ext_fmt(Path::new("foo.TS"))); diff --git a/cli/http_util.rs b/cli/http_util.rs index 89ba4fb93..46ec73cc7 100644 --- a/cli/http_util.rs +++ b/cli/http_util.rs @@ -152,8 +152,7 @@ mod tests { async fn test_fetch_string() { let _http_server_guard = test_util::http_server(); // Relies on external http server. See target/debug/test_server - let url = - Url::parse("http://127.0.0.1:4545/cli/tests/fixture.json").unwrap(); + let url = Url::parse("http://127.0.0.1:4545/fixture.json").unwrap(); let client = create_test_client(None); let result = fetch_once(FetchOnceArgs { client, @@ -176,10 +175,8 @@ mod tests { async fn test_fetch_gzip() { let _http_server_guard = test_util::http_server(); // Relies on external http server. See target/debug/test_server - let url = Url::parse( - "http://127.0.0.1:4545/cli/tests/053_import_compression/gziped", - ) - .unwrap(); + let url = Url::parse("http://127.0.0.1:4545/053_import_compression/gziped") + .unwrap(); let client = create_test_client(None); let result = fetch_once(FetchOnceArgs { client, @@ -239,10 +236,8 @@ mod tests { async fn test_fetch_brotli() { let _http_server_guard = test_util::http_server(); // Relies on external http server. See target/debug/test_server - let url = Url::parse( - "http://127.0.0.1:4545/cli/tests/053_import_compression/brotli", - ) - .unwrap(); + let url = Url::parse("http://127.0.0.1:4545/053_import_compression/brotli") + .unwrap(); let client = create_test_client(None); let result = fetch_once(FetchOnceArgs { client, @@ -269,11 +264,9 @@ mod tests { async fn test_fetch_once_with_redirect() { let _http_server_guard = test_util::http_server(); // Relies on external http server. See target/debug/test_server - let url = - Url::parse("http://127.0.0.1:4546/cli/tests/fixture.json").unwrap(); + let url = Url::parse("http://127.0.0.1:4546/fixture.json").unwrap(); // Dns resolver substitutes `127.0.0.1` with `localhost` - let target_url = - Url::parse("http://localhost:4545/cli/tests/fixture.json").unwrap(); + let target_url = Url::parse("http://localhost:4545/fixture.json").unwrap(); let client = create_test_client(None); let result = fetch_once(FetchOnceArgs { client, @@ -331,16 +324,15 @@ mod tests { async fn test_fetch_with_cafile_string() { let _http_server_guard = test_util::http_server(); // Relies on external http server. See target/debug/test_server - let url = - Url::parse("https://localhost:5545/cli/tests/fixture.json").unwrap(); + let url = Url::parse("https://localhost:5545/fixture.json").unwrap(); let client = create_http_client( version::get_user_agent(), None, Some( read( - test_util::root_path() - .join("cli/tests/tls/RootCA.pem") + test_util::testdata_path() + .join("tls/RootCA.pem") .to_str() .unwrap(), ) @@ -431,17 +423,16 @@ mod tests { async fn test_fetch_with_cafile_gzip() { let _http_server_guard = test_util::http_server(); // Relies on external http server. See target/debug/test_server - let url = Url::parse( - "https://localhost:5545/cli/tests/053_import_compression/gziped", - ) - .unwrap(); + let url = + Url::parse("https://localhost:5545/053_import_compression/gziped") + .unwrap(); let client = create_http_client( version::get_user_agent(), None, Some( read( - test_util::root_path() - .join("cli/tests/tls/RootCA.pem") + test_util::testdata_path() + .join("tls/RootCA.pem") .to_str() .unwrap(), ) @@ -480,8 +471,8 @@ mod tests { None, Some( read( - test_util::root_path() - .join("cli/tests/tls/RootCA.pem") + test_util::testdata_path() + .join("tls/RootCA.pem") .to_str() .unwrap(), ) @@ -525,17 +516,16 @@ mod tests { async fn test_fetch_with_cafile_brotli() { let _http_server_guard = test_util::http_server(); // Relies on external http server. See target/debug/test_server - let url = Url::parse( - "https://localhost:5545/cli/tests/053_import_compression/brotli", - ) - .unwrap(); + let url = + Url::parse("https://localhost:5545/053_import_compression/brotli") + .unwrap(); let client = create_http_client( version::get_user_agent(), None, Some( read( - test_util::root_path() - .join("cli/tests/tls/RootCA.pem") + test_util::testdata_path() + .join("tls/RootCA.pem") .to_str() .unwrap(), ) diff --git a/cli/lsp/sources.rs b/cli/lsp/sources.rs index 8be1420d4..a3f0ae750 100644 --- a/cli/lsp/sources.rs +++ b/cli/lsp/sources.rs @@ -575,7 +575,6 @@ mod tests { use deno_core::resolve_path; use deno_core::resolve_url; use deno_core::serde_json::json; - use std::env; use tempfile::TempDir; fn setup() -> (Sources, PathBuf) { @@ -588,8 +587,7 @@ mod tests { #[test] fn test_sources_get_script_version() { let (sources, _) = setup(); - let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let tests = c.join("tests"); + let tests = test_util::testdata_path(); let specifier = resolve_path(&tests.join("001_hello.js").to_string_lossy()).unwrap(); let actual = sources.get_script_version(&specifier); @@ -599,8 +597,7 @@ mod tests { #[test] fn test_sources_get_text() { let (sources, _) = setup(); - let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let tests = c.join("tests"); + let tests = test_util::testdata_path(); let specifier = resolve_path(&tests.join("001_hello.js").to_string_lossy()).unwrap(); let actual = sources.get_source(&specifier); diff --git a/cli/module_graph.rs b/cli/module_graph.rs index 26c20f21d..44939e68f 100644 --- a/cli/module_graph.rs +++ b/cli/module_graph.rs @@ -2069,7 +2069,6 @@ pub mod tests { use crate::specifier_handler::MemoryHandler; use deno_core::futures::future; use deno_core::parking_lot::Mutex; - use std::env; use std::fs; use std::path::PathBuf; @@ -2190,8 +2189,7 @@ pub mod tests { async fn setup( specifier: ModuleSpecifier, ) -> (Graph, Arc>) { - let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let fixtures = c.join("tests/module_graph"); + let fixtures = test_util::testdata_path().join("module_graph"); let handler = Arc::new(Mutex::new(MockSpecifierHandler { fixtures, ..MockSpecifierHandler::default() @@ -2314,8 +2312,7 @@ pub mod tests { ("file:///tests/fixture14.ts", "fixture14.out"), ("file:///tests/fixture15.ts", "fixture15.out"), ]; - let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let fixtures = c.join("tests/bundle"); + let fixtures = test_util::testdata_path().join("bundle"); for (specifier, expected_str) in tests { let specifier = resolve_url_or_path(specifier).unwrap(); @@ -2474,8 +2471,10 @@ pub mod tests { let specifier = resolve_url_or_path("file:///tests/checkwithconfig.ts") .expect("could not resolve module"); let (graph, handler) = setup(specifier.clone()).await; - let config_file = - ConfigFile::read("tests/module_graph/tsconfig_01.json").unwrap(); + let config_file = ConfigFile::read( + test_util::testdata_path().join("module_graph/tsconfig_01.json"), + ) + .unwrap(); let result_info = graph .check(CheckOptions { debug: false, @@ -2496,8 +2495,10 @@ pub mod tests { // let's do it all over again to ensure that the versions are determinstic let (graph, handler) = setup(specifier).await; - let config_file = - ConfigFile::read("tests/module_graph/tsconfig_01.json").unwrap(); + let config_file = ConfigFile::read( + test_util::testdata_path().join("module_graph/tsconfig_01.json"), + ) + .unwrap(); let result_info = graph .check(CheckOptions { debug: false, @@ -2651,8 +2652,7 @@ pub mod tests { async fn test_graph_import_json() { let specifier = resolve_url_or_path("file:///tests/importjson.ts") .expect("could not resolve module"); - let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let fixtures = c.join("tests/module_graph"); + let fixtures = test_util::testdata_path().join("module_graph"); let handler = Arc::new(Mutex::new(MockSpecifierHandler { fixtures, ..MockSpecifierHandler::default() @@ -2726,8 +2726,10 @@ pub mod tests { let specifier = resolve_url_or_path("https://deno.land/x/transpile.tsx") .expect("could not resolve module"); let (mut graph, handler) = setup(specifier).await; - let config_file = - ConfigFile::read("tests/module_graph/tsconfig.json").unwrap(); + let config_file = ConfigFile::read( + test_util::testdata_path().join("module_graph/tsconfig.json"), + ) + .unwrap(); let result_info = graph .transpile(TranspileOptions { debug: false, @@ -2756,8 +2758,7 @@ pub mod tests { #[tokio::test] async fn test_graph_import_map_remote_to_local() { - let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let fixtures = c.join("tests/module_graph"); + let fixtures = test_util::testdata_path().join("module_graph"); let maybe_import_map = Some( ImportMap::from_json( "file:///tests/importmap.json", @@ -2783,8 +2784,7 @@ pub mod tests { #[tokio::test] async fn test_graph_with_lockfile() { - let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let fixtures = c.join("tests/module_graph"); + let fixtures = test_util::testdata_path().join("module_graph"); let lockfile_path = fixtures.join("lockfile.json"); let lockfile = Lockfile::new(lockfile_path, false).expect("could not load lockfile"); diff --git a/cli/specifier_handler.rs b/cli/specifier_handler.rs index ddc3adc7e..cd785f015 100644 --- a/cli/specifier_handler.rs +++ b/cli/specifier_handler.rs @@ -572,7 +572,6 @@ pub mod tests { use crate::http_cache::HttpCache; use deno_core::resolve_url_or_path; use deno_runtime::deno_web::BlobStore; - use std::env; use tempfile::TempDir; macro_rules! map ( @@ -618,8 +617,7 @@ pub mod tests { let _http_server_guard = test_util::http_server(); let (_, mut file_fetcher) = setup(); let specifier = - resolve_url_or_path("http://localhost:4545/cli/tests/subdir/mod2.ts") - .unwrap(); + resolve_url_or_path("http://localhost:4545/subdir/mod2.ts").unwrap(); let cached_module: CachedModule = file_fetcher .fetch(specifier.clone(), None, false) .await @@ -639,8 +637,7 @@ pub mod tests { let _http_server_guard = test_util::http_server(); let (_, mut file_fetcher) = setup(); let specifier = - resolve_url_or_path("http://localhost:4545/cli/tests/subdir/mod2.ts") - .unwrap(); + resolve_url_or_path("http://localhost:4545/subdir/mod2.ts").unwrap(); let cached_module: CachedModule = file_fetcher .fetch(specifier.clone(), None, false) .await @@ -665,14 +662,16 @@ pub mod tests { let _http_server_guard = test_util::http_server(); let (_, mut file_fetcher) = setup(); let specifier = - resolve_url_or_path("http://localhost:4545/cli/tests/subdir/mod2.ts") - .unwrap(); + resolve_url_or_path("http://localhost:4545/subdir/mod2.ts").unwrap(); let cached_module: CachedModule = file_fetcher.fetch(specifier, None, false).await.unwrap(); assert!(cached_module.is_remote); - let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); let specifier = resolve_url_or_path( - c.join("tests/subdir/mod1.ts").as_os_str().to_str().unwrap(), + test_util::testdata_path() + .join("subdir/mod1.ts") + .as_os_str() + .to_str() + .unwrap(), ) .unwrap(); let cached_module: CachedModule = diff --git a/cli/tests/001_hello.js b/cli/tests/001_hello.js deleted file mode 100644 index accefceba..000000000 --- a/cli/tests/001_hello.js +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello World"); diff --git a/cli/tests/001_hello.js.out b/cli/tests/001_hello.js.out deleted file mode 100644 index 557db03de..000000000 --- a/cli/tests/001_hello.js.out +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/cli/tests/002_hello.ts b/cli/tests/002_hello.ts deleted file mode 100644 index accefceba..000000000 --- a/cli/tests/002_hello.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello World"); diff --git a/cli/tests/002_hello.ts.out b/cli/tests/002_hello.ts.out deleted file mode 100644 index 557db03de..000000000 --- a/cli/tests/002_hello.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/cli/tests/003_relative_import.ts b/cli/tests/003_relative_import.ts deleted file mode 100644 index 01d5d7faa..000000000 --- a/cli/tests/003_relative_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello } from "./subdir/print_hello.ts"; - -printHello(); diff --git a/cli/tests/003_relative_import.ts.out b/cli/tests/003_relative_import.ts.out deleted file mode 100644 index 699b756ed..000000000 --- a/cli/tests/003_relative_import.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -Hello diff --git a/cli/tests/004_set_timeout.ts b/cli/tests/004_set_timeout.ts deleted file mode 100644 index 214b25086..000000000 --- a/cli/tests/004_set_timeout.ts +++ /dev/null @@ -1,11 +0,0 @@ -setTimeout(() => { - console.log("World"); -}, 10); - -console.log("Hello"); - -const id = setTimeout(() => { - console.log("Not printed"); -}, 10000); - -clearTimeout(id); diff --git a/cli/tests/004_set_timeout.ts.out b/cli/tests/004_set_timeout.ts.out deleted file mode 100644 index f9264f7fb..000000000 --- a/cli/tests/004_set_timeout.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Hello -World diff --git a/cli/tests/005_more_imports.ts b/cli/tests/005_more_imports.ts deleted file mode 100644 index 0266bf46c..000000000 --- a/cli/tests/005_more_imports.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { printHello3, returnsFoo2, returnsHi } from "./subdir/mod1.ts"; - -printHello3(); - -if (returnsHi() !== "Hi") { - throw Error("Unexpected"); -} - -if (returnsFoo2() !== "Foo") { - throw Error("Unexpected"); -} diff --git a/cli/tests/005_more_imports.ts.out b/cli/tests/005_more_imports.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/005_more_imports.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/006_url_imports.ts b/cli/tests/006_url_imports.ts deleted file mode 100644 index 109cb603e..000000000 --- a/cli/tests/006_url_imports.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello } from "http://localhost:4545/cli/tests/subdir/mod2.ts"; -printHello(); -console.log("success"); diff --git a/cli/tests/006_url_imports.ts.out b/cli/tests/006_url_imports.ts.out deleted file mode 100644 index 989ce33e9..000000000 --- a/cli/tests/006_url_imports.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Hello -success diff --git a/cli/tests/012_async.ts b/cli/tests/012_async.ts deleted file mode 100644 index 536197b68..000000000 --- a/cli/tests/012_async.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Check that we can use the async keyword. -async function main() { - await new Promise((resolve) => { - console.log("2"); - setTimeout(resolve, 100); - }); - console.log("3"); -} - -console.log("1"); -main(); diff --git a/cli/tests/012_async.ts.out b/cli/tests/012_async.ts.out deleted file mode 100644 index 01e79c32a..000000000 --- a/cli/tests/012_async.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -1 -2 -3 diff --git a/cli/tests/013_dynamic_import.ts b/cli/tests/013_dynamic_import.ts deleted file mode 100644 index d4dc55152..000000000 --- a/cli/tests/013_dynamic_import.ts +++ /dev/null @@ -1,15 +0,0 @@ -(async () => { - const { returnsHi, returnsFoo2, printHello3 } = await import( - "./subdir/mod1.ts" - ); - - printHello3(); - - if (returnsHi() !== "Hi") { - throw Error("Unexpected"); - } - - if (returnsFoo2() !== "Foo") { - throw Error("Unexpected"); - } -})(); diff --git a/cli/tests/013_dynamic_import.ts.out b/cli/tests/013_dynamic_import.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/013_dynamic_import.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/014_duplicate_import.ts b/cli/tests/014_duplicate_import.ts deleted file mode 100644 index 88f934526..000000000 --- a/cli/tests/014_duplicate_import.ts +++ /dev/null @@ -1,9 +0,0 @@ -// with all the imports of the same module, the module should only be -// instantiated once -import "./subdir/auto_print_hello.ts"; - -import "./subdir/auto_print_hello.ts"; - -(async () => { - await import("./subdir/auto_print_hello.ts"); -})(); diff --git a/cli/tests/014_duplicate_import.ts.out b/cli/tests/014_duplicate_import.ts.out deleted file mode 100644 index 4effa19f4..000000000 --- a/cli/tests/014_duplicate_import.ts.out +++ /dev/null @@ -1 +0,0 @@ -hello! diff --git a/cli/tests/015_duplicate_parallel_import.js b/cli/tests/015_duplicate_parallel_import.js deleted file mode 100644 index 172eeaf53..000000000 --- a/cli/tests/015_duplicate_parallel_import.js +++ /dev/null @@ -1,20 +0,0 @@ -// Importing the same module in parallel, the module should only be -// instantiated once. - -const promises = new Array(100) - .fill(null) - .map(() => import("./subdir/mod1.ts")); - -Promise.all(promises).then((imports) => { - const mod = imports.reduce((first, cur) => { - if (typeof first !== "object") { - throw new Error("Expected an object."); - } - if (first !== cur) { - throw new Error("More than one instance of the same module."); - } - return first; - }); - - mod.printHello3(); -}); diff --git a/cli/tests/015_duplicate_parallel_import.js.out b/cli/tests/015_duplicate_parallel_import.js.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/015_duplicate_parallel_import.js.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/016_double_await.ts b/cli/tests/016_double_await.ts deleted file mode 100644 index 457a53ff3..000000000 --- a/cli/tests/016_double_await.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This is to test if Deno would die at 2nd await -// See https://github.com/denoland/deno/issues/919 -(async () => { - const currDirInfo = await Deno.stat("."); - const parentDirInfo = await Deno.stat(".."); - console.log(currDirInfo.isDirectory); - console.log(parentDirInfo.isFile); -})(); diff --git a/cli/tests/016_double_await.ts.out b/cli/tests/016_double_await.ts.out deleted file mode 100644 index da29283aa..000000000 --- a/cli/tests/016_double_await.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -true -false diff --git a/cli/tests/017_import_redirect.ts b/cli/tests/017_import_redirect.ts deleted file mode 100644 index 1265dd4ed..000000000 --- a/cli/tests/017_import_redirect.ts +++ /dev/null @@ -1,4 +0,0 @@ -// http -> https redirect would happen: -import { printHello } from "http://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts"; - -printHello(); diff --git a/cli/tests/017_import_redirect.ts.out b/cli/tests/017_import_redirect.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/017_import_redirect.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/017_import_redirect_info.out b/cli/tests/017_import_redirect_info.out deleted file mode 100644 index 662b237a4..000000000 --- a/cli/tests/017_import_redirect_info.out +++ /dev/null @@ -1,6 +0,0 @@ -local: [WILDCARD]017_import_redirect.ts -type: TypeScript -dependencies: 1 unique (total 278B) - -file:///[WILDCARD]cli/tests/017_import_redirect.ts ([WILDCARD]) -└── https://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts ([WILDCARD]) diff --git a/cli/tests/018_async_catch.ts b/cli/tests/018_async_catch.ts deleted file mode 100644 index ac43a52e8..000000000 --- a/cli/tests/018_async_catch.ts +++ /dev/null @@ -1,14 +0,0 @@ -function fn(): Promise { - throw new Error("message"); -} -async function call() { - try { - console.log("before await fn()"); - await fn(); - console.log("after await fn()"); - } catch (_error) { - console.log("catch"); - } - console.log("after try-catch"); -} -call().catch(() => console.log("outer catch")); diff --git a/cli/tests/018_async_catch.ts.out b/cli/tests/018_async_catch.ts.out deleted file mode 100644 index 4fc219973..000000000 --- a/cli/tests/018_async_catch.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -before await fn() -catch -after try-catch diff --git a/cli/tests/019_media_types.ts b/cli/tests/019_media_types.ts deleted file mode 100644 index 523639be4..000000000 --- a/cli/tests/019_media_types.ts +++ /dev/null @@ -1,24 +0,0 @@ -// When run against the test HTTP server, it will serve different media types -// based on the URL containing `.t#.` strings, which exercises the different -// mapping of media types end to end. - -import { loaded as loadedTs1 } from "http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts"; -import { loaded as loadedTs2 } from "http://localhost:4545/cli/tests/subdir/mt_video_vdn.t2.ts"; -import { loaded as loadedTs3 } from "http://localhost:4545/cli/tests/subdir/mt_video_mp2t.t3.ts"; -import { loaded as loadedTs4 } from "http://localhost:4545/cli/tests/subdir/mt_application_x_typescript.t4.ts"; -import { loaded as loadedJs1 } from "http://localhost:4545/cli/tests/subdir/mt_text_javascript.j1.js"; -import { loaded as loadedJs2 } from "http://localhost:4545/cli/tests/subdir/mt_application_ecmascript.j2.js"; -import { loaded as loadedJs3 } from "http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js"; -import { loaded as loadedJs4 } from "http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js"; - -console.log( - "success", - loadedTs1, - loadedTs2, - loadedTs3, - loadedTs4, - loadedJs1, - loadedJs2, - loadedJs3, - loadedJs4, -); diff --git a/cli/tests/019_media_types.ts.out b/cli/tests/019_media_types.ts.out deleted file mode 100644 index b3e94678c..000000000 --- a/cli/tests/019_media_types.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]success true true true true true true true true diff --git a/cli/tests/020_json_modules.ts b/cli/tests/020_json_modules.ts deleted file mode 100644 index fdc85c440..000000000 --- a/cli/tests/020_json_modules.ts +++ /dev/null @@ -1,2 +0,0 @@ -import config from "./subdir/config.json"; -console.log(JSON.stringify(config)); diff --git a/cli/tests/020_json_modules.ts.out b/cli/tests/020_json_modules.ts.out deleted file mode 100644 index a89bd2ad6..000000000 --- a/cli/tests/020_json_modules.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD] -error: An unsupported media type was attempted to be imported as a module. - Specifier: [WILDCARD]cli/tests/subdir/config.json - MediaType: Json -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/021_mjs_modules.ts b/cli/tests/021_mjs_modules.ts deleted file mode 100644 index 6052b9081..000000000 --- a/cli/tests/021_mjs_modules.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { isMod5 } from "./subdir/mod5.mjs"; -console.log(isMod5); diff --git a/cli/tests/021_mjs_modules.ts.out b/cli/tests/021_mjs_modules.ts.out deleted file mode 100644 index 27ba77dda..000000000 --- a/cli/tests/021_mjs_modules.ts.out +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/cli/tests/022_info_flag_script.out b/cli/tests/022_info_flag_script.out deleted file mode 100644 index 878b0fa08..000000000 --- a/cli/tests/022_info_flag_script.out +++ /dev/null @@ -1,14 +0,0 @@ -[WILDCARD] -local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD] -type: TypeScript -dependencies: 8 unique (total [WILDCARD]) - -http://127.0.0.1:4545/cli/tests/019_media_types.ts ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_application_ecmascript.j2.js ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_application_x_typescript.t4.ts ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_text_javascript.j1.js ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_video_mp2t.t3.ts ([WILDCARD]) -└── http://localhost:4545/cli/tests/subdir/mt_video_vdn.t2.ts ([WILDCARD]) diff --git a/cli/tests/023_no_ext b/cli/tests/023_no_ext deleted file mode 100644 index 0dcfb6209..000000000 --- a/cli/tests/023_no_ext +++ /dev/null @@ -1,2 +0,0 @@ -import * as mod4 from "./subdir/mod4.js"; -console.log(mod4.isMod4); diff --git a/cli/tests/023_no_ext.out b/cli/tests/023_no_ext.out deleted file mode 100644 index 27ba77dda..000000000 --- a/cli/tests/023_no_ext.out +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/cli/tests/024_import_no_ext_with_headers.ts b/cli/tests/024_import_no_ext_with_headers.ts deleted file mode 100644 index c8621d0e6..000000000 --- a/cli/tests/024_import_no_ext_with_headers.ts +++ /dev/null @@ -1 +0,0 @@ -import "./023_no_ext_with_headers"; diff --git a/cli/tests/024_import_no_ext_with_headers.ts.out b/cli/tests/024_import_no_ext_with_headers.ts.out deleted file mode 100644 index e427984d4..000000000 --- a/cli/tests/024_import_no_ext_with_headers.ts.out +++ /dev/null @@ -1 +0,0 @@ -HELLO diff --git a/cli/tests/025_hrtime.ts b/cli/tests/025_hrtime.ts deleted file mode 100644 index b69d61488..000000000 --- a/cli/tests/025_hrtime.ts +++ /dev/null @@ -1,5 +0,0 @@ -window.onload = async () => { - console.log(performance.now() % 2 !== 0); - await Deno.permissions.revoke({ name: "hrtime" }); - console.log(performance.now() % 2 === 0); -}; diff --git a/cli/tests/025_hrtime.ts.out b/cli/tests/025_hrtime.ts.out deleted file mode 100644 index bb101b641..000000000 --- a/cli/tests/025_hrtime.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -true -true diff --git a/cli/tests/025_reload_js_type_error.js b/cli/tests/025_reload_js_type_error.js deleted file mode 100644 index 3b7c23cc9..000000000 --- a/cli/tests/025_reload_js_type_error.js +++ /dev/null @@ -1,6 +0,0 @@ -// deno-lint-ignore-file -// There was a bug where if this was executed with --reload it would throw a -// type error. -window.test = null; -test = console; -test.log("hello"); diff --git a/cli/tests/025_reload_js_type_error.js.out b/cli/tests/025_reload_js_type_error.js.out deleted file mode 100644 index ce0136250..000000000 --- a/cli/tests/025_reload_js_type_error.js.out +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/cli/tests/026_redirect_javascript.js b/cli/tests/026_redirect_javascript.js deleted file mode 100644 index 226a6b622..000000000 --- a/cli/tests/026_redirect_javascript.js +++ /dev/null @@ -1,2 +0,0 @@ -import { value } from "http://localhost:4547/redirects/redirect3.js"; -console.log(value); diff --git a/cli/tests/026_redirect_javascript.js.out b/cli/tests/026_redirect_javascript.js.out deleted file mode 100644 index 290864299..000000000 --- a/cli/tests/026_redirect_javascript.js.out +++ /dev/null @@ -1 +0,0 @@ -3 imports 1 diff --git a/cli/tests/027_redirect_typescript.ts b/cli/tests/027_redirect_typescript.ts deleted file mode 100644 index 584341975..000000000 --- a/cli/tests/027_redirect_typescript.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { value } from "http://localhost:4547/redirects/redirect4.ts"; -console.log(value); diff --git a/cli/tests/027_redirect_typescript.ts.out b/cli/tests/027_redirect_typescript.ts.out deleted file mode 100644 index 480d4e8ca..000000000 --- a/cli/tests/027_redirect_typescript.ts.out +++ /dev/null @@ -1 +0,0 @@ -4 imports 1 diff --git a/cli/tests/028_args.ts b/cli/tests/028_args.ts deleted file mode 100644 index ec41d52f9..000000000 --- a/cli/tests/028_args.ts +++ /dev/null @@ -1,3 +0,0 @@ -Deno.args.forEach((arg) => { - console.log(arg); -}); diff --git a/cli/tests/028_args.ts.out b/cli/tests/028_args.ts.out deleted file mode 100644 index 0f1b5c59e..000000000 --- a/cli/tests/028_args.ts.out +++ /dev/null @@ -1,6 +0,0 @@ ---arg1 -val1 ---arg2=val2 --- -arg3 -arg4 diff --git a/cli/tests/029_eval.out b/cli/tests/029_eval.out deleted file mode 100644 index ce0136250..000000000 --- a/cli/tests/029_eval.out +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/cli/tests/030_eval_ts.out b/cli/tests/030_eval_ts.out deleted file mode 100644 index 190a18037..000000000 --- a/cli/tests/030_eval_ts.out +++ /dev/null @@ -1 +0,0 @@ -123 diff --git a/cli/tests/031_info_ts_error.out b/cli/tests/031_info_ts_error.out deleted file mode 100644 index 2dc7bb4e8..000000000 --- a/cli/tests/031_info_ts_error.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD] -local: [WILDCARD]031_info_ts_error.ts -type: TypeScript -dependencies: 0 unique (total [WILDCARD]) -[WILDCARD]031_info_ts_error.ts ([WILDCARD]) diff --git a/cli/tests/031_info_ts_error.ts b/cli/tests/031_info_ts_error.ts deleted file mode 100644 index 9b7492dbe..000000000 --- a/cli/tests/031_info_ts_error.ts +++ /dev/null @@ -1 +0,0 @@ -const _foo: string = 1; diff --git a/cli/tests/033_import_map.out b/cli/tests/033_import_map.out deleted file mode 100644 index e9b9160e9..000000000 --- a/cli/tests/033_import_map.out +++ /dev/null @@ -1,7 +0,0 @@ -Hello from remapped moment! -Hello from remapped moment dir! -Hello from remapped lodash! -Hello from remapped lodash dir! -Hello from remapped Vue! -Hello from scoped moment! -Hello from scoped! diff --git a/cli/tests/033_import_map_remote.out b/cli/tests/033_import_map_remote.out deleted file mode 100644 index 804fa0d57..000000000 --- a/cli/tests/033_import_map_remote.out +++ /dev/null @@ -1,5 +0,0 @@ -Hello from remapped moment! -Hello from remapped moment dir! -Hello from remapped lodash! -Hello from remapped lodash dir! -Hello from remapped Vue! diff --git a/cli/tests/034_onload.out b/cli/tests/034_onload.out deleted file mode 100644 index 9b1f454c9..000000000 --- a/cli/tests/034_onload.out +++ /dev/null @@ -1,11 +0,0 @@ -log from nest_imported script -log from imported script -log from main -got load event in event handler (nest_imported) -got load event in event handler (imported) -got load event in event handler (main) -got load event in onload function -got unload event in event handler (nest_imported) -got unload event in event handler (imported) -got unload event in event handler (main) -got unload event in onunload function diff --git a/cli/tests/034_onload/imported.ts b/cli/tests/034_onload/imported.ts deleted file mode 100644 index 3c7a0aae2..000000000 --- a/cli/tests/034_onload/imported.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { assert } from "../../../test_util/std/testing/asserts.ts"; -import "./nest_imported.ts"; - -const handler = (e: Event) => { - assert(!e.cancelable); - console.log(`got ${e.type} event in event handler (imported)`); -}; - -window.addEventListener("load", handler); -window.addEventListener("unload", handler); -console.log("log from imported script"); diff --git a/cli/tests/034_onload/main.ts b/cli/tests/034_onload/main.ts deleted file mode 100644 index 7696ec122..000000000 --- a/cli/tests/034_onload/main.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { assert } from "../../../test_util/std/testing/asserts.ts"; -import "./imported.ts"; - -assert(window.hasOwnProperty("onload")); -assert(window.onload === null); - -const eventHandler = (e: Event) => { - assert(!e.cancelable); - console.log(`got ${e.type} event in event handler (main)`); -}; - -window.addEventListener("load", eventHandler); - -window.addEventListener("unload", eventHandler); - -window.onload = (e: Event) => { - assert(!e.cancelable); - console.log(`got ${e.type} event in onload function`); -}; - -window.onunload = (e: Event) => { - assert(!e.cancelable); - console.log(`got ${e.type} event in onunload function`); -}; - -console.log("log from main"); diff --git a/cli/tests/034_onload/nest_imported.ts b/cli/tests/034_onload/nest_imported.ts deleted file mode 100644 index 8ca668de9..000000000 --- a/cli/tests/034_onload/nest_imported.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { assert } from "../../../test_util/std/testing/asserts.ts"; - -const handler = (e: Event) => { - assert(!e.cancelable); - console.log(`got ${e.type} event in event handler (nest_imported)`); -}; - -window.addEventListener("load", handler); -window.addEventListener("unload", handler); -console.log("log from nest_imported script"); diff --git a/cli/tests/035_cached_only_flag.out b/cli/tests/035_cached_only_flag.out deleted file mode 100644 index 0c4992799..000000000 --- a/cli/tests/035_cached_only_flag.out +++ /dev/null @@ -1 +0,0 @@ -error: Specifier not found in cache: "http://127.0.0.1:4545/cli/tests/019_media_types.ts", --cached-only is specified. diff --git a/cli/tests/036_import_map_fetch.out b/cli/tests/036_import_map_fetch.out deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/037_fetch_multiple.out b/cli/tests/037_fetch_multiple.out deleted file mode 100644 index 2497cfa76..000000000 --- a/cli/tests/037_fetch_multiple.out +++ /dev/null @@ -1,5 +0,0 @@ -Download http://localhost:4545/cli/tests/subdir/mod2.ts -Download http://localhost:4545/cli/tests/subdir/print_hello.ts -Check [WILDCARD]/fetch/test.ts -Download http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts -Check [WILDCARD]/fetch/other.ts diff --git a/cli/tests/038_checkjs.js b/cli/tests/038_checkjs.js deleted file mode 100644 index f0856d94c..000000000 --- a/cli/tests/038_checkjs.js +++ /dev/null @@ -1,5 +0,0 @@ -// console.log intentionally misspelled to trigger a type error -consol.log("hello world!"); - -// the following error should be ignored and not output to the console -const foo = new Foo(); diff --git a/cli/tests/038_checkjs.js.out b/cli/tests/038_checkjs.js.out deleted file mode 100644 index bd3fc3548..000000000 --- a/cli/tests/038_checkjs.js.out +++ /dev/null @@ -1,22 +0,0 @@ -[WILDCARD] -error: TS2552 [ERROR]: Cannot find name 'consol'. Did you mean 'console'? -consol.log("hello world!"); -~~~~~~ - at [WILDCARD]tests/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]tests/038_checkjs.js:5:17 - - 'foo' is declared here. - const foo = new Foo(); - ~~~ - at [WILDCARD]tests/038_checkjs.js:5:7 - -Found 2 errors. diff --git a/cli/tests/038_checkjs.tsconfig.json b/cli/tests/038_checkjs.tsconfig.json deleted file mode 100644 index 46d96db9e..000000000 --- a/cli/tests/038_checkjs.tsconfig.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "checkJs": true - } -} diff --git a/cli/tests/041_dyn_import_eval.out b/cli/tests/041_dyn_import_eval.out deleted file mode 100644 index 12a45b8da..000000000 --- a/cli/tests/041_dyn_import_eval.out +++ /dev/null @@ -1 +0,0 @@ -Module { isMod4: true } diff --git a/cli/tests/041_info_flag.out b/cli/tests/041_info_flag.out deleted file mode 100644 index ded795339..000000000 --- a/cli/tests/041_info_flag.out +++ /dev/null @@ -1,5 +0,0 @@ -DENO_DIR location: "[WILDCARD]" -Remote modules cache: "[WILDCARD]deps" -Emitted modules cache: "[WILDCARD]gen" -Language server registries cache: "[WILDCARD]registries" -Origin storage: "[WILDCARD]location_data" diff --git a/cli/tests/041_info_flag_location.out b/cli/tests/041_info_flag_location.out deleted file mode 100644 index 207065012..000000000 --- a/cli/tests/041_info_flag_location.out +++ /dev/null @@ -1,6 +0,0 @@ -DENO_DIR location: "[WILDCARD]" -Remote modules cache: "[WILDCARD]deps" -Emitted modules cache: "[WILDCARD]gen" -Language server registries cache: "[WILDCARD]registries" -Origin storage: "[WILDCARD]location_data[WILDCARD]" -Local Storage: "[WILDCARD]location_data[WILDCARD]local_storage" diff --git a/cli/tests/042_dyn_import_evalcontext.ts b/cli/tests/042_dyn_import_evalcontext.ts deleted file mode 100644 index ccda3a972..000000000 --- a/cli/tests/042_dyn_import_evalcontext.ts +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-expect-error "Deno.core" is not a public interface -Deno.core.evalContext( - "(async () => console.log(await import('./subdir/mod4.js')))()", -); diff --git a/cli/tests/042_dyn_import_evalcontext.ts.out b/cli/tests/042_dyn_import_evalcontext.ts.out deleted file mode 100644 index 12a45b8da..000000000 --- a/cli/tests/042_dyn_import_evalcontext.ts.out +++ /dev/null @@ -1 +0,0 @@ -Module { isMod4: true } diff --git a/cli/tests/044_bad_resource.ts b/cli/tests/044_bad_resource.ts deleted file mode 100644 index 05e1354dc..000000000 --- a/cli/tests/044_bad_resource.ts +++ /dev/null @@ -1,3 +0,0 @@ -const file = await Deno.open("044_bad_resource.ts", { read: true }); -file.close(); -await file.seek(10, 0); diff --git a/cli/tests/044_bad_resource.ts.out b/cli/tests/044_bad_resource.ts.out deleted file mode 100644 index 33c95fc44..000000000 --- a/cli/tests/044_bad_resource.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Uncaught (in promise) BadResource: Bad resource ID -[WILDCARD] diff --git a/cli/tests/045_programmatic_proxy_client.ts b/cli/tests/045_programmatic_proxy_client.ts deleted file mode 100644 index 50884407d..000000000 --- a/cli/tests/045_programmatic_proxy_client.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018-2021 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/test_util/std/examples/colors.ts", - { client }, -); -console.log(`Response http: ${await res.text()}`); - -client.close(); diff --git a/cli/tests/045_proxy_client.ts b/cli/tests/045_proxy_client.ts deleted file mode 100644 index 316f0bf85..000000000 --- a/cli/tests/045_proxy_client.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -const res = await fetch( - "http://localhost:4545/test_util/std/examples/colors.ts", -); -console.log(`Response http: ${await res.text()}`); diff --git a/cli/tests/045_proxy_test.ts b/cli/tests/045_proxy_test.ts deleted file mode 100644 index db6f00876..000000000 --- a/cli/tests/045_proxy_test.ts +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { serve, ServerRequest } from "../../test_util/std/http/server.ts"; -import { assertEquals } from "../../test_util/std/testing/asserts.ts"; - -const addr = Deno.args[1] || "127.0.0.1:4555"; - -async function proxyServer() { - const server = serve(addr); - - console.log(`Proxy server listening on http://${addr}/`); - for await (const req of server) { - proxyRequest(req); - } -} - -async function proxyRequest(req: ServerRequest) { - console.log(`Proxy request to: ${req.url}`); - const proxyAuthorization = req.headers.get("proxy-authorization"); - if (proxyAuthorization) { - console.log(`proxy-authorization: ${proxyAuthorization}`); - req.headers.delete("proxy-authorization"); - } - const resp = await fetch(req.url, { - method: req.method, - headers: req.headers, - }); - req.respond({ - status: resp.status, - body: new Uint8Array(await resp.arrayBuffer()), - headers: resp.headers, - }); -} - -async function testFetch() { - const c = Deno.run({ - cmd: [ - Deno.execPath(), - "run", - "--quiet", - "--reload", - "--allow-net", - "045_proxy_client.ts", - ], - stdout: "piped", - env: { - HTTP_PROXY: `http://${addr}`, - }, - }); - - const status = await c.status(); - assertEquals(status.code, 0); - c.close(); -} - -async function testModuleDownload() { - const http = Deno.run({ - cmd: [ - Deno.execPath(), - "cache", - "--reload", - "--quiet", - "http://localhost:4545/test_util/std/examples/colors.ts", - ], - stdout: "piped", - env: { - HTTP_PROXY: `http://${addr}`, - }, - }); - - const httpStatus = await http.status(); - assertEquals(httpStatus.code, 0); - http.close(); -} - -async function testFetchNoProxy() { - const c = Deno.run({ - cmd: [ - Deno.execPath(), - "run", - "--quiet", - "--reload", - "--allow-net", - "045_proxy_client.ts", - ], - stdout: "piped", - env: { - HTTP_PROXY: "http://not.exising.proxy.server", - NO_PROXY: "localhost", - }, - }); - - const status = await c.status(); - assertEquals(status.code, 0); - c.close(); -} - -async function testModuleDownloadNoProxy() { - const http = Deno.run({ - cmd: [ - Deno.execPath(), - "cache", - "--reload", - "--quiet", - "http://localhost:4545/test_util/std/examples/colors.ts", - ], - stdout: "piped", - env: { - HTTP_PROXY: "http://not.exising.proxy.server", - NO_PROXY: "localhost", - }, - }); - - const httpStatus = await http.status(); - assertEquals(httpStatus.code, 0); - http.close(); -} - -async function testFetchProgrammaticProxy() { - const c = Deno.run({ - cmd: [ - Deno.execPath(), - "run", - "--quiet", - "--reload", - "--allow-net=localhost:4545,localhost:4555", - "--unstable", - "045_programmatic_proxy_client.ts", - ], - stdout: "piped", - }); - const status = await c.status(); - assertEquals(status.code, 0); - c.close(); -} - -proxyServer(); -await testFetch(); -await testModuleDownload(); -await testFetchNoProxy(); -await testModuleDownloadNoProxy(); -await testFetchProgrammaticProxy(); -Deno.exit(0); diff --git a/cli/tests/045_proxy_test.ts.out b/cli/tests/045_proxy_test.ts.out deleted file mode 100644 index 4957c9307..000000000 --- a/cli/tests/045_proxy_test.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -Proxy server listening on [WILDCARD] -Proxy request to: http://localhost:4545/test_util/std/examples/colors.ts -Proxy request to: http://localhost:4545/test_util/std/examples/colors.ts -Proxy request to: http://localhost:4545/test_util/std/fmt/colors.ts -Proxy request to: http://localhost:4545/test_util/std/examples/colors.ts -proxy-authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= diff --git a/cli/tests/046_jsx_test.tsx b/cli/tests/046_jsx_test.tsx deleted file mode 100644 index a96e90baf..000000000 --- a/cli/tests/046_jsx_test.tsx +++ /dev/null @@ -1,12 +0,0 @@ -declare namespace JSX { - interface IntrinsicElements { - [elemName: string]: any; - } -} -const React = { - createElement(factory: any, props: any, ...children: any[]) { - return { factory, props, children }; - }, -}; -const View = () =>
land
; -console.log(); diff --git a/cli/tests/046_jsx_test.tsx.out b/cli/tests/046_jsx_test.tsx.out deleted file mode 100644 index 85cfe824b..000000000 --- a/cli/tests/046_jsx_test.tsx.out +++ /dev/null @@ -1 +0,0 @@ -{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/047_jsx_test.jsx b/cli/tests/047_jsx_test.jsx deleted file mode 100644 index 4c2314072..000000000 --- a/cli/tests/047_jsx_test.jsx +++ /dev/null @@ -1,7 +0,0 @@ -const React = { - createElement(factory, props, ...children) { - return { factory, props, children }; - }, -}; -const View = () =>
land
; -console.log(); diff --git a/cli/tests/047_jsx_test.jsx.out b/cli/tests/047_jsx_test.jsx.out deleted file mode 100644 index 85cfe824b..000000000 --- a/cli/tests/047_jsx_test.jsx.out +++ /dev/null @@ -1 +0,0 @@ -{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/048_media_types_jsx.ts b/cli/tests/048_media_types_jsx.ts deleted file mode 100644 index 044963000..000000000 --- a/cli/tests/048_media_types_jsx.ts +++ /dev/null @@ -1,32 +0,0 @@ -// When run against the test HTTP server, it will serve different media types -// based on the URL containing `.t#.` strings, which exercises the different -// mapping of media types end to end. -import { loaded as loadedTsx1 } from "http://localhost:4545/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx"; -import { loaded as loadedTsx2 } from "http://localhost:4545/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx"; -import { loaded as loadedTsx3 } from "http://localhost:4545/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx"; -import { loaded as loadedTsx4 } from "http://localhost:4545/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx"; -import { loaded as loadedJsx1 } from "http://localhost:4545/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx"; -import { loaded as loadedJsx2 } from "http://localhost:4545/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx"; -import { loaded as loadedJsx3 } from "http://localhost:4545/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx"; -import { loaded as loadedJsx4 } from "http://localhost:4545/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx"; - -declare global { - namespace JSX { - interface IntrinsicElements { - // deno-lint-ignore no-explicit-any - [elemName: string]: any; - } - } -} - -console.log( - "success", - loadedTsx1, - loadedTsx2, - loadedTsx3, - loadedTsx4, - loadedJsx1, - loadedJsx2, - loadedJsx3, - loadedJsx4, -); diff --git a/cli/tests/048_media_types_jsx.ts.out b/cli/tests/048_media_types_jsx.ts.out deleted file mode 100644 index 266cc5741..000000000 --- a/cli/tests/048_media_types_jsx.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -success true true true true true true true true diff --git a/cli/tests/049_info_flag_script_jsx.out b/cli/tests/049_info_flag_script_jsx.out deleted file mode 100644 index 0ad6608d4..000000000 --- a/cli/tests/049_info_flag_script_jsx.out +++ /dev/null @@ -1,14 +0,0 @@ -[WILDCARD] -local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD] -type: TypeScript -dependencies: 8 unique (total [WILDCARD]) - -http://127.0.0.1:4545/cli/tests/048_media_types_jsx.ts ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx ([WILDCARD]) -├── http://localhost:4545/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx ([WILDCARD]) -└── http://localhost:4545/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx ([WILDCARD]) diff --git a/cli/tests/052_no_remote_flag.out b/cli/tests/052_no_remote_flag.out deleted file mode 100644 index 9fefc4b92..000000000 --- a/cli/tests/052_no_remote_flag.out +++ /dev/null @@ -1 +0,0 @@ -error: A remote specifier was requested: "http://127.0.0.1:4545/cli/tests/019_media_types.ts", but --no-remote is specified. diff --git a/cli/tests/053_import_compression.out b/cli/tests/053_import_compression.out deleted file mode 100644 index 371994979..000000000 --- a/cli/tests/053_import_compression.out +++ /dev/null @@ -1,4 +0,0 @@ -gzip -brotli -console.log('gzip') -console.log('brotli'); diff --git a/cli/tests/053_import_compression/brotli b/cli/tests/053_import_compression/brotli deleted file mode 100644 index 65f679d57..000000000 --- a/cli/tests/053_import_compression/brotli +++ /dev/null @@ -1,2 +0,0 @@ -‹ -€console.log('brotli'); \ No newline at end of file diff --git a/cli/tests/053_import_compression/gziped b/cli/tests/053_import_compression/gziped deleted file mode 100644 index 9f9a7bc69..000000000 Binary files a/cli/tests/053_import_compression/gziped and /dev/null differ diff --git a/cli/tests/053_import_compression/main.ts b/cli/tests/053_import_compression/main.ts deleted file mode 100644 index 5b2199483..000000000 --- a/cli/tests/053_import_compression/main.ts +++ /dev/null @@ -1,13 +0,0 @@ -import "http://127.0.0.1:4545/cli/tests/053_import_compression/gziped"; -import "http://127.0.0.1:4545/cli/tests/053_import_compression/brotli"; - -console.log( - await fetch( - "http://127.0.0.1:4545/cli/tests/053_import_compression/gziped", - ).then((res) => res.text()), -); -console.log( - await fetch( - "http://127.0.0.1:4545/cli/tests/053_import_compression/brotli", - ).then((res) => res.text()), -); diff --git a/cli/tests/054_info_local_imports.out b/cli/tests/054_info_local_imports.out deleted file mode 100644 index cde5ff3ab..000000000 --- a/cli/tests/054_info_local_imports.out +++ /dev/null @@ -1,8 +0,0 @@ -local: [WILDCARD]005_more_imports.ts -type: TypeScript -dependencies: 3 unique (total [WILDCARD]) - -file://[WILDCARD]/005_more_imports.ts ([WILDCARD]) -└─┬ file://[WILDCARD]/subdir/mod1.ts ([WILDCARD]) - └─┬ file://[WILDCARD]/subdir/subdir2/mod2.ts ([WILDCARD]) - └── file://[WILDCARD]/subdir/print_hello.ts ([WILDCARD]) diff --git a/cli/tests/055_info_file_json.out b/cli/tests/055_info_file_json.out deleted file mode 100644 index 070668922..000000000 --- a/cli/tests/055_info_file_json.out +++ /dev/null @@ -1,53 +0,0 @@ -{ - "root": "file://[WILDCARD]/cli/tests/005_more_imports.ts", - "modules": [ - { - "specifier": "file://[WILDCARD]/cli/tests/005_more_imports.ts", - "dependencies": [ - { - "specifier": "./subdir/mod1.ts", - "code": "file://[WILDCARD]/cli/tests/subdir/mod1.ts" - } - ], - "size": 211, - "mediaType": "TypeScript", - "local": "[WILDCARD]005_more_imports.ts", - [WILDCARD] - }, - { - "specifier": "file://[WILDCARD]/cli/tests/subdir/mod1.ts", - "dependencies": [ - { - "specifier": "./subdir2/mod2.ts", - "code": "file://[WILDCARD]/cli/tests/subdir/subdir2/mod2.ts" - } - ], - "size": 308, - "mediaType": "TypeScript", - "local": "[WILDCARD]mod1.ts", - [WILDCARD] - }, - { - "specifier": "file://[WILDCARD]/cli/tests/subdir/print_hello.ts", - "dependencies": [], - "size": 57, - "mediaType": "TypeScript", - "local": "[WILDCARD]print_hello.ts", - [WILDCARD] - }, - { - "specifier": "file://[WILDCARD]/cli/tests/subdir/subdir2/mod2.ts", - "dependencies": [ - { - "specifier": "../print_hello.ts", - "code": "file://[WILDCARD]/cli/tests/subdir/print_hello.ts" - } - ], - "size": 157, - "mediaType": "TypeScript", - "local": "[WILDCARD]mod2.ts", - [WILDCARD] - } - ], - "size": 733 -} diff --git a/cli/tests/056_make_temp_file_write_perm.out b/cli/tests/056_make_temp_file_write_perm.out deleted file mode 100644 index c56aae43f..000000000 --- a/cli/tests/056_make_temp_file_write_perm.out +++ /dev/null @@ -1 +0,0 @@ -good [WILDCARD]subdir[WILDCARD] diff --git a/cli/tests/056_make_temp_file_write_perm.ts b/cli/tests/056_make_temp_file_write_perm.ts deleted file mode 100644 index c0deda8a2..000000000 --- a/cli/tests/056_make_temp_file_write_perm.ts +++ /dev/null @@ -1,9 +0,0 @@ -const path = await Deno.makeTempFile({ dir: `subdir` }); -try { - if (!path.match(/^subdir[/\\][^/\\]+/)) { - throw Error("bad " + path); - } - console.log("good", path); -} finally { - await Deno.remove(path); -} diff --git a/cli/tests/058_tasks_microtasks_close.ts b/cli/tests/058_tasks_microtasks_close.ts deleted file mode 100644 index 11de55a38..000000000 --- a/cli/tests/058_tasks_microtasks_close.ts +++ /dev/null @@ -1,18 +0,0 @@ -console.log("sync 1"); -setTimeout(() => { - console.log("setTimeout 1"); - Promise.resolve().then(() => { - console.log("Promise resolve in setTimeout 1"); - }); -}); -Promise.resolve().then(() => { - console.log("promise 1"); -}); -window.close(); -console.log("sync 2"); -setTimeout(() => { - console.log("setTimeout 2"); -}); -setTimeout(() => { - console.log("setTimeout 3"); -}, 100); diff --git a/cli/tests/058_tasks_microtasks_close.ts.out b/cli/tests/058_tasks_microtasks_close.ts.out deleted file mode 100644 index 218273cab..000000000 --- a/cli/tests/058_tasks_microtasks_close.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -sync 1 -sync 2 -promise 1 -setTimeout 1 -Promise resolve in setTimeout 1 -setTimeout 2 diff --git a/cli/tests/059_fs_relative_path_perm.ts b/cli/tests/059_fs_relative_path_perm.ts deleted file mode 100644 index 26630fe1c..000000000 --- a/cli/tests/059_fs_relative_path_perm.ts +++ /dev/null @@ -1,2 +0,0 @@ -// The permission error message shouldn't include the CWD. -Deno.readFileSync("non-existent"); diff --git a/cli/tests/059_fs_relative_path_perm.ts.out b/cli/tests/059_fs_relative_path_perm.ts.out deleted file mode 100644 index b55412137..000000000 --- a/cli/tests/059_fs_relative_path_perm.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]error: Uncaught PermissionDenied: Requires read access to "non-existent", run again with the --allow-read flag -Deno.readFileSync("non-existent"); - ^ - at [WILDCARD] diff --git a/cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts b/cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts deleted file mode 100644 index 854c1b464..000000000 --- a/cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts +++ /dev/null @@ -1,6 +0,0 @@ -// deno-lint-ignore-file -export namespace NS { - export function test(name: string, fn: Function): void; - export function test(options: object): void; - export function test(name: string | object, fn?: Function): void {} -} diff --git a/cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts.out b/cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts.out deleted file mode 100644 index b7b4076f9..000000000 --- a/cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts.out +++ /dev/null @@ -1,12 +0,0 @@ -Defined in [WILDCARD]/cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts:3:2 - -function test(name: string, fn: Function): void - -Defined in [WILDCARD]/cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts:4:2 - -function test(options: object): void - -Defined in [WILDCARD]cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts:5:2 - -function test(name: string | object, fn?: Function): void - diff --git a/cli/tests/061_permissions_request.ts b/cli/tests/061_permissions_request.ts deleted file mode 100644 index c31e7ac42..000000000 --- a/cli/tests/061_permissions_request.ts +++ /dev/null @@ -1,9 +0,0 @@ -const status1 = - (await Deno.permissions.request({ name: "read", path: "foo" })).state; -const status2 = - (await Deno.permissions.query({ name: "read", path: "bar" })).state; -const status3 = - (await Deno.permissions.request({ name: "read", path: "bar" })).state; -console.log(status1); -console.log(status2); -console.log(status3); diff --git a/cli/tests/061_permissions_request.ts.out b/cli/tests/061_permissions_request.ts.out deleted file mode 100644 index 362425876..000000000 --- a/cli/tests/061_permissions_request.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]granted -prompt -denied diff --git a/cli/tests/062_permissions_request_global.ts b/cli/tests/062_permissions_request_global.ts deleted file mode 100644 index e431bc31b..000000000 --- a/cli/tests/062_permissions_request_global.ts +++ /dev/null @@ -1,6 +0,0 @@ -const status1 = await Deno.permissions.request({ name: "read" }); -console.log(status1); -const status2 = await Deno.permissions.query({ name: "read", path: "foo" }); -console.log(status2); -const status3 = await Deno.permissions.query({ name: "read", path: "bar" }); -console.log(status3); diff --git a/cli/tests/062_permissions_request_global.ts.out b/cli/tests/062_permissions_request_global.ts.out deleted file mode 100644 index 57b5aa7d8..000000000 --- a/cli/tests/062_permissions_request_global.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]PermissionStatus { state: "granted", onchange: null } -PermissionStatus { state: "granted", onchange: null } -PermissionStatus { state: "granted", onchange: null } diff --git a/cli/tests/063_permissions_revoke.ts b/cli/tests/063_permissions_revoke.ts deleted file mode 100644 index a81eee7cb..000000000 --- a/cli/tests/063_permissions_revoke.ts +++ /dev/null @@ -1,6 +0,0 @@ -const status1 = await Deno.permissions.revoke({ name: "read", path: "foo" }); -console.log(status1); -const status2 = await Deno.permissions.query({ name: "read", path: "bar" }); -console.log(status2); -const status3 = await Deno.permissions.revoke({ name: "read", path: "bar" }); -console.log(status3); diff --git a/cli/tests/063_permissions_revoke.ts.out b/cli/tests/063_permissions_revoke.ts.out deleted file mode 100644 index bbd64c557..000000000 --- a/cli/tests/063_permissions_revoke.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]PermissionStatus { state: "prompt", onchange: null } -PermissionStatus { state: "granted", onchange: null } -PermissionStatus { state: "prompt", onchange: null } diff --git a/cli/tests/064_permissions_revoke_global.ts b/cli/tests/064_permissions_revoke_global.ts deleted file mode 100644 index a9b1fcd40..000000000 --- a/cli/tests/064_permissions_revoke_global.ts +++ /dev/null @@ -1,6 +0,0 @@ -const status1 = await Deno.permissions.revoke({ name: "read" }); -console.log(status1); -const status2 = await Deno.permissions.query({ name: "read", path: "foo" }); -console.log(status2); -const status3 = await Deno.permissions.query({ name: "read", path: "bar" }); -console.log(status3); diff --git a/cli/tests/064_permissions_revoke_global.ts.out b/cli/tests/064_permissions_revoke_global.ts.out deleted file mode 100644 index f7e389a76..000000000 --- a/cli/tests/064_permissions_revoke_global.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]PermissionStatus { state: "prompt", onchange: null } -PermissionStatus { state: "prompt", onchange: null } -PermissionStatus { state: "prompt", onchange: null } diff --git a/cli/tests/065_import_map_info.out b/cli/tests/065_import_map_info.out deleted file mode 100644 index 8771d0594..000000000 --- a/cli/tests/065_import_map_info.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD] -local: [WILDCARD]test.ts -type: TypeScript -dependencies: 7 unique (total [WILDCARD]) -[WILDCARD] diff --git a/cli/tests/066_prompt.ts b/cli/tests/066_prompt.ts deleted file mode 100644 index e3daa7ac0..000000000 --- a/cli/tests/066_prompt.ts +++ /dev/null @@ -1,21 +0,0 @@ -const name0 = prompt("What is your name?", "Jane Doe"); // Answer John Doe -console.log(`Your name is ${name0}.`); -const name1 = prompt("What is your name?", "Jane Doe"); // Answer with default -console.log(`Your name is ${name1}.`); -const input = prompt(); // Answer foo -console.log(`Your input is ${input}.`); -const answer0 = confirm("Question 0"); // Answer y -console.log(`Your answer is ${answer0}`); -const answer1 = confirm("Question 1"); // Answer n -console.log(`Your answer is ${answer1}`); -const answer2 = confirm("Question 2"); // Answer with yes (returns false) -console.log(`Your answer is ${answer2}`); -const answer3 = confirm(); // Answer with default -console.log(`Your answer is ${answer3}`); -const windows = prompt("What is Windows EOL?"); -console.log(`Your answer is ${JSON.stringify(windows)}`); -alert("Hi"); -alert(); -console.log("The end of test"); -const eof = prompt("What is EOF?"); -console.log(`Your answer is ${JSON.stringify(eof)}`); diff --git a/cli/tests/066_prompt.ts.out b/cli/tests/066_prompt.ts.out deleted file mode 100644 index 7defc51e5..000000000 --- a/cli/tests/066_prompt.ts.out +++ /dev/null @@ -1,10 +0,0 @@ -[WILDCARD]What is your name? [Jane Doe] Your name is John Doe. -What is your name? [Jane Doe] Your name is Jane Doe. -Prompt Your input is foo. -Question 0 [y/N] Your answer is true -Question 1 [y/N] Your answer is false -Question 2 [y/N] Your answer is false -Confirm [y/N] Your answer is false -What is Windows EOL? Your answer is "windows" -Hi [Enter] Alert [Enter] The end of test -What is EOF? Your answer is null diff --git a/cli/tests/070_location.ts b/cli/tests/070_location.ts deleted file mode 100644 index 61256dcbc..000000000 --- a/cli/tests/070_location.ts +++ /dev/null @@ -1,8 +0,0 @@ -console.log(Location); -console.log(Location.prototype); -console.log(location); -try { - location.hostname = "bar"; -} catch (error) { - console.log(error.toString()); -} diff --git a/cli/tests/070_location.ts.out b/cli/tests/070_location.ts.out deleted file mode 100644 index e05561e58..000000000 --- a/cli/tests/070_location.ts.out +++ /dev/null @@ -1,15 +0,0 @@ -[WILDCARD][Function: Location] -Location {} -Location { - hash: "#bat", - host: "foo", - hostname: "foo", - href: "https://foo/bar?baz#bat", - origin: "https://foo", - pathname: "/bar", - port: "", - protocol: "https:", - search: "?baz" -} -NotSupportedError: Cannot set "location.hostname". -[WILDCARD] diff --git a/cli/tests/071_location_unset.ts b/cli/tests/071_location_unset.ts deleted file mode 100644 index bb60df8c4..000000000 --- a/cli/tests/071_location_unset.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log(Location); -console.log(Location.prototype); -console.log(location); diff --git a/cli/tests/071_location_unset.ts.out b/cli/tests/071_location_unset.ts.out deleted file mode 100644 index 43308f3bd..000000000 --- a/cli/tests/071_location_unset.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD][Function: Location] -Location {} -error: Uncaught ReferenceError: Access to "location", run again with --location . -[WILDCARD] diff --git a/cli/tests/072_location_relative_fetch.ts b/cli/tests/072_location_relative_fetch.ts deleted file mode 100644 index d4764bf7f..000000000 --- a/cli/tests/072_location_relative_fetch.ts +++ /dev/null @@ -1,2 +0,0 @@ -const response = await fetch("fetch/hello.txt"); -console.log(await response.text()); diff --git a/cli/tests/072_location_relative_fetch.ts.out b/cli/tests/072_location_relative_fetch.ts.out deleted file mode 100644 index 8151f6f88..000000000 --- a/cli/tests/072_location_relative_fetch.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]Hello, world! - diff --git a/cli/tests/075_import_local_query_hash.ts b/cli/tests/075_import_local_query_hash.ts deleted file mode 100644 index 99c7ceab4..000000000 --- a/cli/tests/075_import_local_query_hash.ts +++ /dev/null @@ -1,2 +0,0 @@ -import "./001_hello.js?a=b#c"; -import "./002_hello.ts?a=b#c"; diff --git a/cli/tests/075_import_local_query_hash.ts.out b/cli/tests/075_import_local_query_hash.ts.out deleted file mode 100644 index 340777742..000000000 --- a/cli/tests/075_import_local_query_hash.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]Hello World -Hello World diff --git a/cli/tests/076_info_json_deps_order.out b/cli/tests/076_info_json_deps_order.out deleted file mode 100644 index f8b26057d..000000000 --- a/cli/tests/076_info_json_deps_order.out +++ /dev/null @@ -1,78 +0,0 @@ -{ - "root": "file://[WILDCARD]/cli/tests/076_info_json_deps_order.ts", - "modules": [ - { - "specifier": "file://[WILDCARD]/cli/tests/076_info_json_deps_order.ts", - "dependencies": [ - { - "specifier": "./recursive_imports/A.ts", - "code": "file://[WILDCARD]/cli/tests/recursive_imports/A.ts" - } - ], - "size": 81, - "mediaType": "TypeScript", - "local": "[WILDCARD]076_info_json_deps_order.ts", - "checksum": "5dd40fe33e5924cca513489ce568e86c9b9fe318a87975403c8923629018680d" - }, - { - "specifier": "file://[WILDCARD]/cli/tests/recursive_imports/A.ts", - "dependencies": [ - { - "specifier": "./B.ts", - "code": "file://[WILDCARD]/cli/tests/recursive_imports/B.ts" - }, - { - "specifier": "./common.ts", - "code": "file://[WILDCARD]/cli/tests/recursive_imports/common.ts" - } - ], - "size": 108, - "mediaType": "TypeScript", - "local": "[WILDCARD]A.ts", - "checksum": "3b45a105d892584298490cb73372b2cac57118e1e42a677a1d5cacea704d8d3a" - }, - { - "specifier": "file://[WILDCARD]/cli/tests/recursive_imports/B.ts", - "dependencies": [ - { - "specifier": "./C.ts", - "code": "file://[WILDCARD]/cli/tests/recursive_imports/C.ts" - }, - { - "specifier": "./common.ts", - "code": "file://[WILDCARD]/cli/tests/recursive_imports/common.ts" - } - ], - "size": 108, - "mediaType": "TypeScript", - "local": "[WILDCARD]B.ts", - "checksum": "b12b0437ef9a91c4a4b1f66e8e4339f986b60bd8134031ccb296ce49df15b54e" - }, - { - "specifier": "file://[WILDCARD]/cli/tests/recursive_imports/C.ts", - "dependencies": [ - { - "specifier": "./A.ts", - "code": "file://[WILDCARD]/cli/tests/recursive_imports/A.ts" - }, - { - "specifier": "./common.ts", - "code": "file://[WILDCARD]/cli/tests/recursive_imports/common.ts" - } - ], - "size": 126, - "mediaType": "TypeScript", - "local": "[WILDCARD]C.ts", - "checksum": "605875a410741bfaeeade28cbccf45f219ad99d987ea695e35eda75d2c53a658" - }, - { - "specifier": "file://[WILDCARD]/cli/tests/recursive_imports/common.ts", - "dependencies": [], - "size": 28, - "mediaType": "TypeScript", - "local": "[WILDCARD]common.ts", - "checksum": "c70025f0b936c02980c3be1fbd78f6f36b6241927c44ea67580821a6e664d8b3" - } - ], - "size": 451 -} diff --git a/cli/tests/076_info_json_deps_order.ts b/cli/tests/076_info_json_deps_order.ts deleted file mode 100644 index b1ae75e68..000000000 --- a/cli/tests/076_info_json_deps_order.ts +++ /dev/null @@ -1,2 +0,0 @@ -// deno-lint-ignore no-unused-vars -import { A } from "./recursive_imports/A.ts"; diff --git a/cli/tests/077_fetch_empty.ts b/cli/tests/077_fetch_empty.ts deleted file mode 100644 index b10a9094e..000000000 --- a/cli/tests/077_fetch_empty.ts +++ /dev/null @@ -1 +0,0 @@ -await fetch(""); diff --git a/cli/tests/077_fetch_empty.ts.out b/cli/tests/077_fetch_empty.ts.out deleted file mode 100644 index e546cfcec..000000000 --- a/cli/tests/077_fetch_empty.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Uncaught TypeError: Invalid URL -[WILDCARD] diff --git a/cli/tests/078_unload_on_exit.ts b/cli/tests/078_unload_on_exit.ts deleted file mode 100644 index 43d33eb25..000000000 --- a/cli/tests/078_unload_on_exit.ts +++ /dev/null @@ -1,9 +0,0 @@ -window.onunload = () => { - console.log("onunload is called"); - // This second exit call doesn't trigger unload event, - // and therefore actually stops the process. - Deno.exit(1); - console.log("This doesn't show up in console"); -}; -// This exit call triggers the above unload event handler. -Deno.exit(0); diff --git a/cli/tests/078_unload_on_exit.ts.out b/cli/tests/078_unload_on_exit.ts.out deleted file mode 100644 index e213f9632..000000000 --- a/cli/tests/078_unload_on_exit.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]onunload is called diff --git a/cli/tests/079_location_authentication.ts b/cli/tests/079_location_authentication.ts deleted file mode 100644 index 4989312ac..000000000 --- a/cli/tests/079_location_authentication.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(location.href); diff --git a/cli/tests/079_location_authentication.ts.out b/cli/tests/079_location_authentication.ts.out deleted file mode 100644 index bb2458497..000000000 --- a/cli/tests/079_location_authentication.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -https://baz/qux -[WILDCARD] diff --git a/cli/tests/080_deno_emit_permissions.ts b/cli/tests/080_deno_emit_permissions.ts deleted file mode 100644 index dc550cffb..000000000 --- a/cli/tests/080_deno_emit_permissions.ts +++ /dev/null @@ -1 +0,0 @@ -await Deno.emit(new URL("001_hello.js", import.meta.url).href); diff --git a/cli/tests/080_deno_emit_permissions.ts.out b/cli/tests/080_deno_emit_permissions.ts.out deleted file mode 100644 index 4eb4fd1c1..000000000 --- a/cli/tests/080_deno_emit_permissions.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Uncaught (in promise) PermissionDenied: Requires read access to "[WILDCARD]001_hello.js", run again with the --allow-read flag -[WILDCARD] diff --git a/cli/tests/081_location_relative_fetch_redirect.ts b/cli/tests/081_location_relative_fetch_redirect.ts deleted file mode 100644 index 742ef0afb..000000000 --- a/cli/tests/081_location_relative_fetch_redirect.ts +++ /dev/null @@ -1,2 +0,0 @@ -const response = await fetch("/"); -console.log(response.url); diff --git a/cli/tests/081_location_relative_fetch_redirect.ts.out b/cli/tests/081_location_relative_fetch_redirect.ts.out deleted file mode 100644 index f62b93195..000000000 --- a/cli/tests/081_location_relative_fetch_redirect.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]http://localhost:4545/ diff --git a/cli/tests/082_prepare_stack_trace_throw.js b/cli/tests/082_prepare_stack_trace_throw.js deleted file mode 100644 index 8137bfdc8..000000000 --- a/cli/tests/082_prepare_stack_trace_throw.js +++ /dev/null @@ -1,6 +0,0 @@ -Error.prepareStackTrace = () => { - console.trace(); - throw new Error("foo"); -}; - -new Error("bar").stack; diff --git a/cli/tests/082_prepare_stack_trace_throw.js.out b/cli/tests/082_prepare_stack_trace_throw.js.out deleted file mode 100644 index 751b7c971..000000000 --- a/cli/tests/082_prepare_stack_trace_throw.js.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Uncaught Error: foo -[WILDCARD] diff --git a/cli/tests/083_legacy_external_source_map.ts b/cli/tests/083_legacy_external_source_map.ts deleted file mode 100644 index 73d267b87..000000000 --- a/cli/tests/083_legacy_external_source_map.ts +++ /dev/null @@ -1,2 +0,0 @@ -// - -throw new Error("foo"); diff --git a/cli/tests/084_worker_custom_inspect.ts b/cli/tests/084_worker_custom_inspect.ts deleted file mode 100644 index 2e7b86a4e..000000000 --- a/cli/tests/084_worker_custom_inspect.ts +++ /dev/null @@ -1,4 +0,0 @@ -new Worker( - new URL("084_worker_custom_inspect_worker.ts", import.meta.url).href, - { type: "module" }, -); diff --git a/cli/tests/084_worker_custom_inspect.ts.out b/cli/tests/084_worker_custom_inspect.ts.out deleted file mode 100644 index b34300c40..000000000 --- a/cli/tests/084_worker_custom_inspect.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]ReadableStream { locked: false } -[WILDCARD] diff --git a/cli/tests/084_worker_custom_inspect_worker.ts b/cli/tests/084_worker_custom_inspect_worker.ts deleted file mode 100644 index 5be82724e..000000000 --- a/cli/tests/084_worker_custom_inspect_worker.ts +++ /dev/null @@ -1,2 +0,0 @@ -console.log(new ReadableStream()); -close(); diff --git a/cli/tests/085_dynamic_import_async_error.ts b/cli/tests/085_dynamic_import_async_error.ts deleted file mode 100644 index aa5ff7277..000000000 --- a/cli/tests/085_dynamic_import_async_error.ts +++ /dev/null @@ -1,5 +0,0 @@ -try { - await import("./delayed_error.ts"); -} catch (error) { - console.log(`Caught: ${error.stack}`); -} diff --git a/cli/tests/085_dynamic_import_async_error.ts.out b/cli/tests/085_dynamic_import_async_error.ts.out deleted file mode 100644 index 974c2e426..000000000 --- a/cli/tests/085_dynamic_import_async_error.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]Caught: Error: foo - at [WILDCARD]/delayed_error.ts:[WILDCARD] diff --git a/cli/tests/086_dynamic_import_already_rejected.ts b/cli/tests/086_dynamic_import_already_rejected.ts deleted file mode 100644 index 359db670c..000000000 --- a/cli/tests/086_dynamic_import_already_rejected.ts +++ /dev/null @@ -1,11 +0,0 @@ -try { - await import("./error_001.ts"); -} catch (error) { - console.log(`Caught: ${error.stack}`); -} - -try { - await import("./error_001.ts"); -} catch (error) { - console.log(`Caught: ${error.stack}`); -} diff --git a/cli/tests/086_dynamic_import_already_rejected.ts.out b/cli/tests/086_dynamic_import_already_rejected.ts.out deleted file mode 100644 index c3eb66f9e..000000000 --- a/cli/tests/086_dynamic_import_already_rejected.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]Caught: Error: bad - at [WILDCARD]/error_001.ts:[WILDCARD] -Caught: Error: bad - at [WILDCARD]/error_001.ts:[WILDCARD] diff --git a/cli/tests/087_hello.ts b/cli/tests/087_hello.ts deleted file mode 100644 index 1a9d8f114..000000000 --- a/cli/tests/087_hello.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type SomeType = unknown; -console.log("Hello, world!"); diff --git a/cli/tests/087_no_check_imports_not_used_as_values.ts b/cli/tests/087_no_check_imports_not_used_as_values.ts deleted file mode 100644 index 64a13f9b1..000000000 --- a/cli/tests/087_no_check_imports_not_used_as_values.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { SomeType } from "./087_hello.ts"; - -const string: SomeType = "Hi!"; -console.log(string); diff --git a/cli/tests/087_no_check_imports_not_used_as_values.ts.out b/cli/tests/087_no_check_imports_not_used_as_values.ts.out deleted file mode 100644 index f744c4183..000000000 --- a/cli/tests/087_no_check_imports_not_used_as_values.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]Hello, world! -Hi! diff --git a/cli/tests/088_dynamic_import_already_evaluating.ts b/cli/tests/088_dynamic_import_already_evaluating.ts deleted file mode 100644 index 272163a5d..000000000 --- a/cli/tests/088_dynamic_import_already_evaluating.ts +++ /dev/null @@ -1,2 +0,0 @@ -import("./088_dynamic_import_target.ts").then(() => console.log(3)); -import("./088_dynamic_import_target.ts").then(() => console.log(3)); diff --git a/cli/tests/088_dynamic_import_already_evaluating.ts.out b/cli/tests/088_dynamic_import_already_evaluating.ts.out deleted file mode 100644 index a36dd11e7..000000000 --- a/cli/tests/088_dynamic_import_already_evaluating.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]1 -2 -3 -3 diff --git a/cli/tests/088_dynamic_import_target.ts b/cli/tests/088_dynamic_import_target.ts deleted file mode 100644 index 226f1851a..000000000 --- a/cli/tests/088_dynamic_import_target.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await new Promise((r) => setTimeout(r, 100)); -console.log(2); diff --git a/cli/tests/089_run_allow_list.ts b/cli/tests/089_run_allow_list.ts deleted file mode 100644 index defb3196f..000000000 --- a/cli/tests/089_run_allow_list.ts +++ /dev/null @@ -1,13 +0,0 @@ -try { - Deno.run({ - cmd: ["ls"], - }); -} catch (e) { - console.log(e); -} - -const proc = Deno.run({ - cmd: ["curl", "--help"], - stdout: "null", -}); -console.log((await proc.status()).success); diff --git a/cli/tests/089_run_allow_list.ts.out b/cli/tests/089_run_allow_list.ts.out deleted file mode 100644 index 68a4a2ac5..000000000 --- a/cli/tests/089_run_allow_list.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]PermissionDenied: Requires run access to "ls", run again with the --allow-run flag -[WILDCARD] -true diff --git a/cli/tests/090_run_permissions_request.ts b/cli/tests/090_run_permissions_request.ts deleted file mode 100644 index 044bc6e8e..000000000 --- a/cli/tests/090_run_permissions_request.ts +++ /dev/null @@ -1,9 +0,0 @@ -const status1 = - (await Deno.permissions.request({ name: "run", command: "ls" })).state; -const status2 = - (await Deno.permissions.query({ name: "run", command: "cat" })).state; -const status3 = - (await Deno.permissions.request({ name: "run", command: "cat" })).state; -console.log(status1); -console.log(status2); -console.log(status3); diff --git a/cli/tests/090_run_permissions_request.ts.out b/cli/tests/090_run_permissions_request.ts.out deleted file mode 100644 index 362425876..000000000 --- a/cli/tests/090_run_permissions_request.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]granted -prompt -denied diff --git a/cli/tests/091_use_define_for_class_fields.ts b/cli/tests/091_use_define_for_class_fields.ts deleted file mode 100644 index 46be3ac0b..000000000 --- a/cli/tests/091_use_define_for_class_fields.ts +++ /dev/null @@ -1,4 +0,0 @@ -class _A { - b = this.a; - constructor(public a: unknown) {} -} diff --git a/cli/tests/091_use_define_for_class_fields.ts.out b/cli/tests/091_use_define_for_class_fields.ts.out deleted file mode 100644 index 08f94a967..000000000 --- a/cli/tests/091_use_define_for_class_fields.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]error: TS2729 [ERROR]: Property 'a' is used before its initialization. - b = this.a; - ^ -[WILDCARD] diff --git a/cli/tests/092_import_map_unmapped_bare_specifier.ts b/cli/tests/092_import_map_unmapped_bare_specifier.ts deleted file mode 100644 index 87684430d..000000000 --- a/cli/tests/092_import_map_unmapped_bare_specifier.ts +++ /dev/null @@ -1 +0,0 @@ -await import("unmapped"); diff --git a/cli/tests/092_import_map_unmapped_bare_specifier.ts.out b/cli/tests/092_import_map_unmapped_bare_specifier.ts.out deleted file mode 100644 index 1a55e352b..000000000 --- a/cli/tests/092_import_map_unmapped_bare_specifier.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]error: Uncaught (in promise) TypeError: Relative import path "unmapped" not prefixed with / or ./ or ../ and not in import map from "[WILDCARD]" -await import("unmapped"); -^ - at [WILDCARD] diff --git a/cli/tests/095_cache_with_bare_import.ts b/cli/tests/095_cache_with_bare_import.ts deleted file mode 100644 index c0748305d..000000000 --- a/cli/tests/095_cache_with_bare_import.ts +++ /dev/null @@ -1 +0,0 @@ -import "foo"; diff --git a/cli/tests/095_cache_with_bare_import.ts.out b/cli/tests/095_cache_with_bare_import.ts.out deleted file mode 100644 index f424f4c3e..000000000 --- a/cli/tests/095_cache_with_bare_import.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ from "file:///[WILDCARD]/095_cache_with_bare_import.ts" diff --git a/cli/tests/Component.tsx b/cli/tests/Component.tsx deleted file mode 100644 index 81dfd6957..000000000 --- a/cli/tests/Component.tsx +++ /dev/null @@ -1 +0,0 @@ -import "./046_jsx_test.tsx"; diff --git a/cli/tests/DenoWinRunner.cs b/cli/tests/DenoWinRunner.cs deleted file mode 100644 index 2f9e9f89f..000000000 --- a/cli/tests/DenoWinRunner.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Threading.Tasks; - -[Flags] -public enum DenoConstraints : int -{ - None = 0, - NoStdin = 1, - NoStdout = 2, - NoStderr = 4 -} - -public class DenoWinRunner -{ - private const int STD_INPUT_HANDLE = -10; - private const int STD_OUTPUT_HANDLE = -11; - private const int STD_ERROR_HANDLE = -12; - - private const int FILE_NOT_FOUND = 2; - private const int WAIT_TIMEOUT = 258; - - [DllImport("kernel32.dll")] - private static extern void SetStdHandle(int nStdHandle, IntPtr handle); - - /// - /// Runs Deno.exe under the specified constraints - /// - /// Path to the Deno.exe file. Can be absolute or relative - /// Path to the script file Deno should run. - /// The constraints to apply to the Deno process - /// How long to wait for the Deno process to exit - /// The deno.exe exit code, or an exit code provided by the test runner - public static int RunDenoScript(string pathToDenoExe, string pathToTestScript, DenoConstraints constraints, uint timeoutMilliseconds = 1000) - { - try - { - if (!File.Exists(pathToDenoExe)) - { - Console.Error.WriteLine("Cannot find Deno.exe at " + pathToDenoExe); - return FILE_NOT_FOUND; - } - - if (!File.Exists(pathToTestScript)) - { - Console.Error.WriteLine("Cannot find test script at " + pathToTestScript); - return FILE_NOT_FOUND; - } - - ProcessStartInfo startInfo = new ProcessStartInfo(pathToDenoExe) - { - ErrorDialog = false, - UseShellExecute = false, - Arguments = @"run -A " + pathToTestScript, - RedirectStandardInput = !constraints.HasFlag(DenoConstraints.NoStdin), - RedirectStandardOutput = !constraints.HasFlag(DenoConstraints.NoStdout), - RedirectStandardError = !constraints.HasFlag(DenoConstraints.NoStderr) - }; - - startInfo.Environment.Add("RUST_BACKTRACE", "1"); - - if (constraints.HasFlag(DenoConstraints.NoStdin)) - { - SetStdHandle(STD_INPUT_HANDLE, (IntPtr)null); - } - - if (constraints.HasFlag(DenoConstraints.NoStdout)) - { - SetStdHandle(STD_OUTPUT_HANDLE, (IntPtr)null); - } - - if (constraints.HasFlag(DenoConstraints.NoStderr)) - { - SetStdHandle(STD_ERROR_HANDLE, (IntPtr)null); - } - - Process process = new Process { StartInfo = startInfo }; - process.Start(); - - Task stdErrTask = startInfo.RedirectStandardError ? - process.StandardError.ReadToEndAsync() : Task.FromResult(null); - Task stdOutTask = startInfo.RedirectStandardOutput ? - process.StandardOutput.ReadToEndAsync() : Task.FromResult(null); - - if (!process.WaitForExit((int)timeoutMilliseconds)) - { - Console.Error.WriteLine("Timed out waiting for Deno process to exit"); - try - { - process.Kill(); - } - catch - { - // Kill might fail, either because the process already exited or due to some other error - Console.Error.WriteLine("Failure killing the Deno process - possible Zombie Deno.exe process"); - } - return WAIT_TIMEOUT; - } - - // If the Deno process wrote to STDERR - append it to our STDERR - if (!constraints.HasFlag(DenoConstraints.NoStderr)) - { - string error = stdErrTask.Result; - if (!string.IsNullOrWhiteSpace(error)) - { - Console.Error.WriteLine(error); - } - } - - return process.ExitCode; - - } - catch (Win32Exception ex) - { - Console.Error.WriteLine("Win32Exception: code = " + ex.ErrorCode + ", message: " + ex.Message); - return ex.NativeErrorCode; - } - catch (Exception ex) - { - Console.Error.WriteLine("Exception: message: " + ex.Message); - return -1; - } - } -} diff --git a/cli/tests/DenoWinRunner.ps1 b/cli/tests/DenoWinRunner.ps1 deleted file mode 100644 index 203b5d36c..000000000 --- a/cli/tests/DenoWinRunner.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -$Source = [IO.File]::ReadAllText("$PSScriptRoot\DenoWinRunner.cs") -$denoExePath = $args[0] -$scriptPath = $args[1] -$constraints = $args[2] -$timeout = 5000; -Add-Type -TypeDefinition $Source -Language CSharp -Write-Output("Running Deno script: " + $args[1]) -$code = [DenoWinRunner]::RunDenoScript($denoExePath, $scriptPath, $constraints, $timeout) -Write-Output("Deno.exe or the test wrapper has exited with code: $code") -exit $code diff --git a/cli/tests/README.md b/cli/tests/README.md deleted file mode 100644 index 831d2750f..000000000 --- a/cli/tests/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Integration Tests - -This path contains integration tests. See integration_tests.rs for the index. diff --git a/cli/tests/async_error.ts b/cli/tests/async_error.ts deleted file mode 100644 index b55c73aeb..000000000 --- a/cli/tests/async_error.ts +++ /dev/null @@ -1,9 +0,0 @@ -console.log("hello"); -// deno-lint-ignore require-await -const foo = async (): Promise => { - console.log("before error"); - throw Error("error"); -}; - -foo(); -console.log("world"); diff --git a/cli/tests/async_error.ts.out b/cli/tests/async_error.ts.out deleted file mode 100644 index 77406352c..000000000 --- a/cli/tests/async_error.ts.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD]hello -before error -world -error: Uncaught (in promise) Error: error - throw Error("error"); - ^ - at foo ([WILDCARD]tests/async_error.ts:5:9) - at [WILDCARD]tests/async_error.ts:8:1 diff --git a/cli/tests/badly_formatted.json b/cli/tests/badly_formatted.json deleted file mode 100644 index f2bacf73d..000000000 --- a/cli/tests/badly_formatted.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - - - "key1": "value1", - "key2": true, - "key3": ["value2", "value3", false], - "keys": { - "more": "values" - } - - -} \ No newline at end of file diff --git a/cli/tests/badly_formatted.md b/cli/tests/badly_formatted.md deleted file mode 100644 index 26afe483b..000000000 --- a/cli/tests/badly_formatted.md +++ /dev/null @@ -1,46 +0,0 @@ -# Hello Markdown - -```js -console.log("Hello World" - -) -``` - -```javascript -console.log("Hello World2" - -) -``` - -```ts - -function hello(name: string ) { - console.log(name); -}; - -hello( "alice"); -``` - -```typescript -function foo(): number { - return 2; -} -``` - -```jsonc - -{ - // Comment in JSON - "key": "value", - "key2": - "value2", -} - -``` - -```json -{ - "numbers": - ["1", "2"] -} -``` \ No newline at end of file diff --git a/cli/tests/badly_formatted.mjs b/cli/tests/badly_formatted.mjs deleted file mode 100644 index bc515a330..000000000 --- a/cli/tests/badly_formatted.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Deliberately using .mjs to avoid triggering dprint -console.log("Hello World" - -) diff --git a/cli/tests/badly_formatted_fixed.js b/cli/tests/badly_formatted_fixed.js deleted file mode 100644 index e9062ba85..000000000 --- a/cli/tests/badly_formatted_fixed.js +++ /dev/null @@ -1,2 +0,0 @@ -// Deliberately using .mjs to avoid triggering dprint -console.log("Hello World"); diff --git a/cli/tests/badly_formatted_fixed.json b/cli/tests/badly_formatted_fixed.json deleted file mode 100644 index 0d697a2c6..000000000 --- a/cli/tests/badly_formatted_fixed.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "key1": "value1", - "key2": true, - "key3": ["value2", "value3", false], - "keys": { - "more": "values" - } -} diff --git a/cli/tests/badly_formatted_fixed.md b/cli/tests/badly_formatted_fixed.md deleted file mode 100644 index 8ba74cac3..000000000 --- a/cli/tests/badly_formatted_fixed.md +++ /dev/null @@ -1,37 +0,0 @@ -# Hello Markdown - -```js -console.log("Hello World"); -``` - -```javascript -console.log("Hello World2"); -``` - -```ts -function hello(name: string) { - console.log(name); -} - -hello("alice"); -``` - -```typescript -function foo(): number { - return 2; -} -``` - -```jsonc -{ - // Comment in JSON - "key": "value", - "key2": "value2" -} -``` - -```json -{ - "numbers": ["1", "2"] -} -``` diff --git a/cli/tests/blob_gc_finalization.js b/cli/tests/blob_gc_finalization.js deleted file mode 100644 index 34c878513..000000000 --- a/cli/tests/blob_gc_finalization.js +++ /dev/null @@ -1,11 +0,0 @@ -// This test creates 1024 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 < 1024; i++) { - // Create a 128MB byte array, and then a blob from it. - const buf = new Uint8Array(128 * 1024 * 1024); - new Blob([buf]); - // It is very important that there is a yield here, otherwise the finalizer - // for the blob is not called and the memory is not freed. - await new Promise((resolve) => setTimeout(resolve, 0)); -} -console.log("GCed all blobs"); diff --git a/cli/tests/blob_gc_finalization.js.out b/cli/tests/blob_gc_finalization.js.out deleted file mode 100644 index dcc4500f8..000000000 --- a/cli/tests/blob_gc_finalization.js.out +++ /dev/null @@ -1 +0,0 @@ -GCed all blobs diff --git a/cli/tests/bundle.test.out b/cli/tests/bundle.test.out deleted file mode 100644 index 030c09295..000000000 --- a/cli/tests/bundle.test.out +++ /dev/null @@ -1,27 +0,0 @@ -[WILDCARD] -function printHello() { - console.log("Hello"); -} -function returnsFoo() { - return "Foo"; -} -function printHello2() { - printHello(); -} -function returnsHi1() { - return "Hi"; -} -function returnsFoo21() { - return returnsFoo(); -} -function printHello31() { - printHello2(); -} -function throwsError1() { - throw Error("exception from mod1"); -} -export { returnsHi1 as returnsHi }; -export { returnsFoo21 as returnsFoo2 }; -export { printHello31 as printHello3 }; -export { throwsError1 as throwsError }; - diff --git a/cli/tests/bundle/file_tests-fixture01.ts b/cli/tests/bundle/file_tests-fixture01.ts deleted file mode 100644 index 3598d0298..000000000 --- a/cli/tests/bundle/file_tests-fixture01.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as a from "./subdir/a.ts"; - -console.log(a); diff --git a/cli/tests/bundle/file_tests-fixture02.ts b/cli/tests/bundle/file_tests-fixture02.ts deleted file mode 100644 index 0cd291329..000000000 --- a/cli/tests/bundle/file_tests-fixture02.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as b from "./subdir/b.ts"; - -console.log(b.b); // "b" -console.log(b.c); // { c: "c", default: class C } diff --git a/cli/tests/bundle/file_tests-fixture03.ts b/cli/tests/bundle/file_tests-fixture03.ts deleted file mode 100644 index 78365ce13..000000000 --- a/cli/tests/bundle/file_tests-fixture03.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { d } from "./subdir/d.ts"; - -console.log(d); diff --git a/cli/tests/bundle/file_tests-fixture04.ts b/cli/tests/bundle/file_tests-fixture04.ts deleted file mode 100644 index 590f4fef9..000000000 --- a/cli/tests/bundle/file_tests-fixture04.ts +++ /dev/null @@ -1,3 +0,0 @@ -const a = await import("./subdir/a.ts"); - -console.log(a); diff --git a/cli/tests/bundle/file_tests-fixture05.ts b/cli/tests/bundle/file_tests-fixture05.ts deleted file mode 100644 index 19541ce59..000000000 --- a/cli/tests/bundle/file_tests-fixture05.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { a } from "./subdir/e.ts"; - -console.log(a); diff --git a/cli/tests/bundle/file_tests-fixture06.ts b/cli/tests/bundle/file_tests-fixture06.ts deleted file mode 100644 index 3d94332df..000000000 --- a/cli/tests/bundle/file_tests-fixture06.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { isMain, modUrl } from "./subdir/f.ts"; - -console.log(isMain, modUrl); -console.log(import.meta.main, import.meta.url); diff --git a/cli/tests/bundle/file_tests-fixture07.ts b/cli/tests/bundle/file_tests-fixture07.ts deleted file mode 100644 index 0475a6c53..000000000 --- a/cli/tests/bundle/file_tests-fixture07.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { G } from "./subdir/g.ts"; -import { H } from "./subdir/h.ts"; - -console.log(new G(true), new H(true)); diff --git a/cli/tests/bundle/file_tests-fixture08.ts b/cli/tests/bundle/file_tests-fixture08.ts deleted file mode 100644 index 6af5d172e..000000000 --- a/cli/tests/bundle/file_tests-fixture08.ts +++ /dev/null @@ -1 +0,0 @@ -export * as a from "./subdir/a.ts"; diff --git a/cli/tests/bundle/file_tests-fixture09.ts b/cli/tests/bundle/file_tests-fixture09.ts deleted file mode 100644 index 30ba983ee..000000000 --- a/cli/tests/bundle/file_tests-fixture09.ts +++ /dev/null @@ -1 +0,0 @@ -export { a } from "./subdir/k.ts"; diff --git a/cli/tests/bundle/file_tests-fixture10.ts b/cli/tests/bundle/file_tests-fixture10.ts deleted file mode 100644 index bec555da8..000000000 --- a/cli/tests/bundle/file_tests-fixture10.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { a as defaultA } from "./subdir/l.ts"; - -const o: { a?: string } = {}; - -const { a = defaultA } = o; - -console.log(a); diff --git a/cli/tests/bundle/file_tests-fixture11.ts b/cli/tests/bundle/file_tests-fixture11.ts deleted file mode 100644 index 1c361438f..000000000 --- a/cli/tests/bundle/file_tests-fixture11.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { a as defaultA, O } from "./subdir/m.ts"; -export { O } from "./subdir/m.ts"; - -interface AOptions { - a?(); - c?: O; -} - -class A { - #a: () => void; - #c?: O; - constructor(o: AOptions = {}) { - const { - a = defaultA, - c, - } = o; - this.#a = a; - this.#c = c; - } - - a() { - this.#a(); - } - - c() { - console.log(this.#c); - } -} - -const a = new A(); -a.a(); -a.c(); diff --git a/cli/tests/bundle/file_tests-fixture12.ts b/cli/tests/bundle/file_tests-fixture12.ts deleted file mode 100644 index 32b9566bd..000000000 --- a/cli/tests/bundle/file_tests-fixture12.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { a } from "./subdir/p.ts"; - -function b() { - a(); -} - -b(); diff --git a/cli/tests/bundle/file_tests-fixture13.ts b/cli/tests/bundle/file_tests-fixture13.ts deleted file mode 100644 index 7dc13534c..000000000 --- a/cli/tests/bundle/file_tests-fixture13.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { D, d } from "./subdir/q.ts"; - -class A { - private s: D = d(); - - a() { - this.s.resolve(); - } -} - -new A(); diff --git a/cli/tests/bundle/file_tests-fixture14.ts b/cli/tests/bundle/file_tests-fixture14.ts deleted file mode 100644 index aa8eef1b8..000000000 --- a/cli/tests/bundle/file_tests-fixture14.ts +++ /dev/null @@ -1,4 +0,0 @@ -// @deno-types="https://deno.land/x/lib/mod.d.ts" -import * as lib from "https://deno.land/x/lib/mod.js"; - -console.log(lib); diff --git a/cli/tests/bundle/file_tests-fixture15.ts b/cli/tests/bundle/file_tests-fixture15.ts deleted file mode 100644 index c1dd3bc89..000000000 --- a/cli/tests/bundle/file_tests-fixture15.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function getIndex(c: string): number { - return "\x00\r\n\x85\u2028\u2029".indexOf(c); -} diff --git a/cli/tests/bundle/file_tests-subdir-a.ts b/cli/tests/bundle/file_tests-subdir-a.ts deleted file mode 100644 index 9233cce2f..000000000 --- a/cli/tests/bundle/file_tests-subdir-a.ts +++ /dev/null @@ -1 +0,0 @@ -export const a = "a"; diff --git a/cli/tests/bundle/file_tests-subdir-b.ts b/cli/tests/bundle/file_tests-subdir-b.ts deleted file mode 100644 index 1cf751c22..000000000 --- a/cli/tests/bundle/file_tests-subdir-b.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * as c from "./c.ts"; - -export const b = "b"; diff --git a/cli/tests/bundle/file_tests-subdir-c.ts b/cli/tests/bundle/file_tests-subdir-c.ts deleted file mode 100644 index 7cc01f993..000000000 --- a/cli/tests/bundle/file_tests-subdir-c.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const c = "c"; -export default class C {} diff --git a/cli/tests/bundle/file_tests-subdir-d.ts b/cli/tests/bundle/file_tests-subdir-d.ts deleted file mode 100644 index 9f1ba7f67..000000000 --- a/cli/tests/bundle/file_tests-subdir-d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { a } from "./a.ts"; - -export const d = { a }; diff --git a/cli/tests/bundle/file_tests-subdir-e.ts b/cli/tests/bundle/file_tests-subdir-e.ts deleted file mode 100644 index 55e8e0e18..000000000 --- a/cli/tests/bundle/file_tests-subdir-e.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./a.ts"; diff --git a/cli/tests/bundle/file_tests-subdir-f.ts b/cli/tests/bundle/file_tests-subdir-f.ts deleted file mode 100644 index 8bc8d9bf4..000000000 --- a/cli/tests/bundle/file_tests-subdir-f.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const isMain = import.meta.main; -export const modUrl = import.meta.url; diff --git a/cli/tests/bundle/file_tests-subdir-g.ts b/cli/tests/bundle/file_tests-subdir-g.ts deleted file mode 100644 index 3eb4cd3cc..000000000 --- a/cli/tests/bundle/file_tests-subdir-g.ts +++ /dev/null @@ -1,12 +0,0 @@ -const g: number[] = []; - -export class G { - #g!: number[]; - constructor(shared: boolean) { - if (shared) { - this.#g = g; - } else { - this.#g = []; - } - } -} diff --git a/cli/tests/bundle/file_tests-subdir-h.ts b/cli/tests/bundle/file_tests-subdir-h.ts deleted file mode 100644 index 9c86dd5c5..000000000 --- a/cli/tests/bundle/file_tests-subdir-h.ts +++ /dev/null @@ -1,12 +0,0 @@ -const g: number[] = []; - -export class H { - #g!: number[]; - constructor(shared: boolean) { - if (shared) { - this.#g = g; - } else { - this.#g = []; - } - } -} diff --git a/cli/tests/bundle/file_tests-subdir-i.ts b/cli/tests/bundle/file_tests-subdir-i.ts deleted file mode 100644 index 4ad9ce449..000000000 --- a/cli/tests/bundle/file_tests-subdir-i.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function a(...d: string[]): string { - return d.join(" "); -} diff --git a/cli/tests/bundle/file_tests-subdir-j.ts b/cli/tests/bundle/file_tests-subdir-j.ts deleted file mode 100644 index ac7bce0ea..000000000 --- a/cli/tests/bundle/file_tests-subdir-j.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function a(...d: string[]): string { - return d.join("/"); -} diff --git a/cli/tests/bundle/file_tests-subdir-k.ts b/cli/tests/bundle/file_tests-subdir-k.ts deleted file mode 100644 index 1b8a533f1..000000000 --- a/cli/tests/bundle/file_tests-subdir-k.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as _i from "./i.ts"; -import * as _j from "./j.ts"; - -const k = globalThis.value ? _i : _j; - -export const i = _i; -export const j = _j; - -export const { - a, -} = k; diff --git a/cli/tests/bundle/file_tests-subdir-l.ts b/cli/tests/bundle/file_tests-subdir-l.ts deleted file mode 100644 index d767e6ad0..000000000 --- a/cli/tests/bundle/file_tests-subdir-l.ts +++ /dev/null @@ -1 +0,0 @@ -export { a } from "./a.ts"; diff --git a/cli/tests/bundle/file_tests-subdir-m.ts b/cli/tests/bundle/file_tests-subdir-m.ts deleted file mode 100644 index 21e86d07c..000000000 --- a/cli/tests/bundle/file_tests-subdir-m.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { a } from "./n.ts"; -export { O } from "./o.ts"; diff --git a/cli/tests/bundle/file_tests-subdir-n.ts b/cli/tests/bundle/file_tests-subdir-n.ts deleted file mode 100644 index ac3c37005..000000000 --- a/cli/tests/bundle/file_tests-subdir-n.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function a() { - console.log("a"); -} diff --git a/cli/tests/bundle/file_tests-subdir-o.ts b/cli/tests/bundle/file_tests-subdir-o.ts deleted file mode 100644 index ab9753fea..000000000 --- a/cli/tests/bundle/file_tests-subdir-o.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum O { - A, - B, - C, -} diff --git a/cli/tests/bundle/file_tests-subdir-p.ts b/cli/tests/bundle/file_tests-subdir-p.ts deleted file mode 100644 index 19b486f71..000000000 --- a/cli/tests/bundle/file_tests-subdir-p.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./i.ts"; diff --git a/cli/tests/bundle/file_tests-subdir-q.ts b/cli/tests/bundle/file_tests-subdir-q.ts deleted file mode 100644 index eebe0a38b..000000000 --- a/cli/tests/bundle/file_tests-subdir-q.ts +++ /dev/null @@ -1,13 +0,0 @@ -// deno-lint-ignore-file -export interface D { - resolve: any; - reject: any; -} - -export function d(): D { - let methods; - const promise = new Promise((resolve, reject) => { - methods = { resolve, reject }; - }); - return Object.assign(promise, methods); -} diff --git a/cli/tests/bundle/fixture01.out b/cli/tests/bundle/fixture01.out deleted file mode 100644 index a825140b7..000000000 --- a/cli/tests/bundle/fixture01.out +++ /dev/null @@ -1,7 +0,0 @@ -const a = "a"; -const mod = function() { - return { - a: a - }; -}(); -console.log(mod); diff --git a/cli/tests/bundle/fixture02.out b/cli/tests/bundle/fixture02.out deleted file mode 100644 index 5c502e2f0..000000000 --- a/cli/tests/bundle/fixture02.out +++ /dev/null @@ -1,12 +0,0 @@ -const c = "c"; -class C { -} -const mod = function() { - return { - default: C, - c: c - }; -}(); -const b = "b"; -console.log(b); -console.log(mod); diff --git a/cli/tests/bundle/fixture03.out b/cli/tests/bundle/fixture03.out deleted file mode 100644 index 524e77abb..000000000 --- a/cli/tests/bundle/fixture03.out +++ /dev/null @@ -1,5 +0,0 @@ -const a = "a"; -const d = { - a -}; -console.log(d); diff --git a/cli/tests/bundle/fixture04.out b/cli/tests/bundle/fixture04.out deleted file mode 100644 index 37869205b..000000000 --- a/cli/tests/bundle/fixture04.out +++ /dev/null @@ -1,2 +0,0 @@ -const a = await import("./subdir/a.ts"); -console.log(a); diff --git a/cli/tests/bundle/fixture05.out b/cli/tests/bundle/fixture05.out deleted file mode 100644 index 1289cca5f..000000000 --- a/cli/tests/bundle/fixture05.out +++ /dev/null @@ -1,2 +0,0 @@ -const a = "a"; -console.log(a); diff --git a/cli/tests/bundle/fixture06.out b/cli/tests/bundle/fixture06.out deleted file mode 100644 index 47288d5e4..000000000 --- a/cli/tests/bundle/fixture06.out +++ /dev/null @@ -1,12 +0,0 @@ -const importMeta = { - url: "file:///tests/subdir/f.ts", - main: false -}; -const isMain = importMeta.main; -const modUrl = importMeta.url; -const importMeta1 = { - url: "file:///tests/fixture06.ts", - main: import.meta.main -}; -console.log(isMain, modUrl); -console.log(importMeta1.main, importMeta1.url); diff --git a/cli/tests/bundle/fixture07.out b/cli/tests/bundle/fixture07.out deleted file mode 100644 index 39e6a11e8..000000000 --- a/cli/tests/bundle/fixture07.out +++ /dev/null @@ -1,23 +0,0 @@ -const g = []; -class G { - #g; - constructor(shared){ - if (shared) { - this.#g = g; - } else { - this.#g = []; - } - } -} -const g1 = []; -class H { - #g; - constructor(shared1){ - if (shared1) { - this.#g = g1; - } else { - this.#g = []; - } - } -} -console.log(new G(true), new H(true)); diff --git a/cli/tests/bundle/fixture08.out b/cli/tests/bundle/fixture08.out deleted file mode 100644 index bfe40aa37..000000000 --- a/cli/tests/bundle/fixture08.out +++ /dev/null @@ -1,7 +0,0 @@ -const a1 = "a"; -const mod = function() { - return { - a: a1 - }; -}(); -export { mod as a }; diff --git a/cli/tests/bundle/fixture09.out b/cli/tests/bundle/fixture09.out deleted file mode 100644 index e06cc92de..000000000 --- a/cli/tests/bundle/fixture09.out +++ /dev/null @@ -1,19 +0,0 @@ -function a3(...d) { - return d.join(" "); -} -const mod = function() { - return { - a: a3 - }; -}(); -function a1(...d) { - return d.join("/"); -} -const mod1 = function() { - return { - a: a1 - }; -}(); -const k = globalThis.value ? mod : mod1; -const { a: a2 , } = k; -export { a2 as a }; diff --git a/cli/tests/bundle/fixture10.out b/cli/tests/bundle/fixture10.out deleted file mode 100644 index 5491e5e7f..000000000 --- a/cli/tests/bundle/fixture10.out +++ /dev/null @@ -1,5 +0,0 @@ -const a = "a"; -const o = { -}; -const { a: a1 = a } = o; -console.log(a1); diff --git a/cli/tests/bundle/fixture11.out b/cli/tests/bundle/fixture11.out deleted file mode 100644 index d143e8723..000000000 --- a/cli/tests/bundle/fixture11.out +++ /dev/null @@ -1,30 +0,0 @@ -function a() { - console.log("a"); -} -var O1; -(function(O1) { - O1[O1["A"] = 0] = "A"; - O1[O1["B"] = 1] = "B"; - O1[O1["C"] = 2] = "C"; -})(O1 || (O1 = { -})); -export { O1 as O }; -class A { - #a; - #c; - constructor(o = { - }){ - const { a: a1 = a , c , } = o; - this.#a = a1; - this.#c = c; - } - a() { - this.#a(); - } - c() { - console.log(this.#c); - } -} -const a2 = new A(); -a2.a(); -a2.c(); diff --git a/cli/tests/bundle/fixture12.out b/cli/tests/bundle/fixture12.out deleted file mode 100644 index 64e2d6cdb..000000000 --- a/cli/tests/bundle/fixture12.out +++ /dev/null @@ -1,7 +0,0 @@ -function a(...d) { - return d.join(" "); -} -function b() { - a(); -} -b(); diff --git a/cli/tests/bundle/fixture13.out b/cli/tests/bundle/fixture13.out deleted file mode 100644 index 1c7a8c991..000000000 --- a/cli/tests/bundle/fixture13.out +++ /dev/null @@ -1,17 +0,0 @@ -function d() { - let methods; - const promise = new Promise((resolve, reject)=>{ - methods = { - resolve, - reject - }; - }); - return Object.assign(promise, methods); -} -class A { - s = d(); - a() { - this.s.resolve(); - } -} -new A(); diff --git a/cli/tests/bundle/fixture14.out b/cli/tests/bundle/fixture14.out deleted file mode 100644 index 392bb6478..000000000 --- a/cli/tests/bundle/fixture14.out +++ /dev/null @@ -1,2 +0,0 @@ -const mod = []; -console.log(mod); diff --git a/cli/tests/bundle/fixture15.out b/cli/tests/bundle/fixture15.out deleted file mode 100644 index dc72fdeff..000000000 --- a/cli/tests/bundle/fixture15.out +++ /dev/null @@ -1,4 +0,0 @@ -function getIndex1(c) { - return "\x00\r\n\x85\u2028\u2029".indexOf(c); -} -export { getIndex1 as getIndex }; diff --git a/cli/tests/bundle/https_deno.land-x-lib-a.ts b/cli/tests/bundle/https_deno.land-x-lib-a.ts deleted file mode 100644 index a0a6f8e94..000000000 --- a/cli/tests/bundle/https_deno.land-x-lib-a.ts +++ /dev/null @@ -1 +0,0 @@ -export const a: string[] = []; diff --git a/cli/tests/bundle/https_deno.land-x-lib-b.js b/cli/tests/bundle/https_deno.land-x-lib-b.js deleted file mode 100644 index 13cacdd8b..000000000 --- a/cli/tests/bundle/https_deno.land-x-lib-b.js +++ /dev/null @@ -1 +0,0 @@ -export const b = []; diff --git a/cli/tests/bundle/https_deno.land-x-lib-c.d.ts b/cli/tests/bundle/https_deno.land-x-lib-c.d.ts deleted file mode 100644 index fac988e49..000000000 --- a/cli/tests/bundle/https_deno.land-x-lib-c.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const c: string[]; diff --git a/cli/tests/bundle/https_deno.land-x-lib-c.js b/cli/tests/bundle/https_deno.land-x-lib-c.js deleted file mode 100644 index 620ca0b66..000000000 --- a/cli/tests/bundle/https_deno.land-x-lib-c.js +++ /dev/null @@ -1,3 +0,0 @@ -/// - -export const c = []; diff --git a/cli/tests/bundle/https_deno.land-x-lib-mod.d.ts b/cli/tests/bundle/https_deno.land-x-lib-mod.d.ts deleted file mode 100644 index 76ed81df0..000000000 --- a/cli/tests/bundle/https_deno.land-x-lib-mod.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * as a from "./a.ts"; -export * as b from "./b.js"; -export * as c from "./c.js"; - -export interface A { - a: string; -} - -export const mod: A[]; diff --git a/cli/tests/bundle/https_deno.land-x-lib-mod.js b/cli/tests/bundle/https_deno.land-x-lib-mod.js deleted file mode 100644 index 505162094..000000000 --- a/cli/tests/bundle/https_deno.land-x-lib-mod.js +++ /dev/null @@ -1,5 +0,0 @@ -export * as a from "./a.ts"; -export * as b from "./b.js"; -export * as c from "./c.js"; - -export const mod = []; diff --git a/cli/tests/bundle_dynamic_import.ts b/cli/tests/bundle_dynamic_import.ts deleted file mode 100644 index 754831632..000000000 --- a/cli/tests/bundle_dynamic_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -const mod1 = await import("http://localhost:4545/cli/tests/subdir/mod1.ts"); - -mod1.printHello3(); diff --git a/cli/tests/bundle_im.json b/cli/tests/bundle_im.json deleted file mode 100644 index 8ebc00c5b..000000000 --- a/cli/tests/bundle_im.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "imports": { - "mod2": "./subdir/subdir2/mod2.ts" - } -} diff --git a/cli/tests/bundle_im.ts b/cli/tests/bundle_im.ts deleted file mode 100644 index 74834de20..000000000 --- a/cli/tests/bundle_im.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { printHello2, returnsFoo } from "mod2"; - -export function returnsHi(): string { - return "Hi"; -} - -export function returnsFoo2(): string { - return returnsFoo(); -} - -export function printHello3() { - printHello2(); -} - -export function throwsError() { - throw Error("exception from mod1"); -} diff --git a/cli/tests/bundle_jsx.out b/cli/tests/bundle_jsx.out deleted file mode 100644 index 44c9e4555..000000000 --- a/cli/tests/bundle_jsx.out +++ /dev/null @@ -1,10 +0,0 @@ -[WILDCARD] -const React = { - createElement () { - } -}; -function app() { - return React.createElement("div", null, React.createElement("h2", null, "asdf")); -} -console.log(app); - diff --git a/cli/tests/cache_extensionless.out b/cli/tests/cache_extensionless.out deleted file mode 100644 index 6e3569689..000000000 --- a/cli/tests/cache_extensionless.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -Check http://localhost:4545/cli/tests/subdir/no_js_ext diff --git a/cli/tests/cache_random_extension.out b/cli/tests/cache_random_extension.out deleted file mode 100644 index c508fbc60..000000000 --- a/cli/tests/cache_random_extension.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -Check http://localhost:4545/cli/tests/subdir/no_js_ext@1.0.0 diff --git a/cli/tests/cafile_info.ts b/cli/tests/cafile_info.ts deleted file mode 100644 index cd92a42f6..000000000 --- a/cli/tests/cafile_info.ts +++ /dev/null @@ -1,24 +0,0 @@ -// When run against the test HTTP server, it will serve different media types -// based on the URL containing `.t#.` strings, which exercises the different -// mapping of media types end to end. - -import { loaded as loadedTs1 } from "https://localhost:5545/cli/tests/subdir/mt_text_typescript.t1.ts"; -import { loaded as loadedTs2 } from "https://localhost:5545/cli/tests/subdir/mt_video_vdn.t2.ts"; -import { loaded as loadedTs3 } from "https://localhost:5545/cli/tests/subdir/mt_video_mp2t.t3.ts"; -import { loaded as loadedTs4 } from "https://localhost:5545/cli/tests/subdir/mt_application_x_typescript.t4.ts"; -import { loaded as loadedJs1 } from "https://localhost:5545/cli/tests/subdir/mt_text_javascript.j1.js"; -import { loaded as loadedJs2 } from "https://localhost:5545/cli/tests/subdir/mt_application_ecmascript.j2.js"; -import { loaded as loadedJs3 } from "https://localhost:5545/cli/tests/subdir/mt_text_ecmascript.j3.js"; -import { loaded as loadedJs4 } from "https://localhost:5545/cli/tests/subdir/mt_application_x_javascript.j4.js"; - -console.log( - "success", - loadedTs1, - loadedTs2, - loadedTs3, - loadedTs4, - loadedJs1, - loadedJs2, - loadedJs3, - loadedJs4, -); diff --git a/cli/tests/cafile_info.ts.out b/cli/tests/cafile_info.ts.out deleted file mode 100644 index 35575f8d6..000000000 --- a/cli/tests/cafile_info.ts.out +++ /dev/null @@ -1,13 +0,0 @@ -local: [WILDCARD]https[WILDCARD]localhost_PORT5545[WILDCARD] -type: TypeScript -dependencies: 8 unique (total [WILDCARD]) - -https://localhost:5545/cli/tests/cafile_info.ts ([WILDCARD]) -├── https://localhost:5545/cli/tests/subdir/mt_application_ecmascript.j2.js ([WILDCARD]) -├── https://localhost:5545/cli/tests/subdir/mt_application_x_javascript.j4.js ([WILDCARD]) -├── https://localhost:5545/cli/tests/subdir/mt_application_x_typescript.t4.ts ([WILDCARD]) -├── https://localhost:5545/cli/tests/subdir/mt_text_ecmascript.j3.js ([WILDCARD]) -├── https://localhost:5545/cli/tests/subdir/mt_text_javascript.j1.js ([WILDCARD]) -├── https://localhost:5545/cli/tests/subdir/mt_text_typescript.t1.ts ([WILDCARD]) -├── https://localhost:5545/cli/tests/subdir/mt_video_mp2t.t3.ts ([WILDCARD]) -└── https://localhost:5545/cli/tests/subdir/mt_video_vdn.t2.ts ([WILDCARD]) diff --git a/cli/tests/cafile_ts_fetch.ts b/cli/tests/cafile_ts_fetch.ts deleted file mode 100644 index 14f39ef97..000000000 --- a/cli/tests/cafile_ts_fetch.ts +++ /dev/null @@ -1,3 +0,0 @@ -fetch("https://localhost:5545/cli/tests/cafile_ts_fetch.ts.out") - .then((r) => r.text()) - .then((t) => console.log(t.trimEnd())); diff --git a/cli/tests/cafile_ts_fetch.ts.out b/cli/tests/cafile_ts_fetch.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/cafile_ts_fetch.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/cafile_ts_fetch_unsafe_ssl.ts.out b/cli/tests/cafile_ts_fetch_unsafe_ssl.ts.out deleted file mode 100644 index 1dc61c837..000000000 --- a/cli/tests/cafile_ts_fetch_unsafe_ssl.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -DANGER: TLS certificate validation is disabled for all hostnames -Hello diff --git a/cli/tests/cafile_url_imports.ts b/cli/tests/cafile_url_imports.ts deleted file mode 100644 index f781f32f5..000000000 --- a/cli/tests/cafile_url_imports.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello } from "https://localhost:5545/cli/tests/subdir/mod2.ts"; -printHello(); -console.log("success"); diff --git a/cli/tests/cafile_url_imports.ts.out b/cli/tests/cafile_url_imports.ts.out deleted file mode 100644 index 989ce33e9..000000000 --- a/cli/tests/cafile_url_imports.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Hello -success diff --git a/cli/tests/cafile_url_imports_unsafe_ssl.ts.out b/cli/tests/cafile_url_imports_unsafe_ssl.ts.out deleted file mode 100644 index daebcd766..000000000 --- a/cli/tests/cafile_url_imports_unsafe_ssl.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -DANGER: TLS certificate validation is disabled for: localhost -Hello -success diff --git a/cli/tests/cat.ts b/cli/tests/cat.ts deleted file mode 100644 index 14ceec553..000000000 --- a/cli/tests/cat.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { copy } from "../../test_util/std/io/util.ts"; -async function main() { - for (let i = 1; i < Deno.args.length; i++) { - const filename = Deno.args[i]; - const file = await Deno.open(filename); - await copy(file, Deno.stdout); - } -} - -main(); diff --git a/cli/tests/circular1.js b/cli/tests/circular1.js deleted file mode 100644 index 8b2cc4960..000000000 --- a/cli/tests/circular1.js +++ /dev/null @@ -1,2 +0,0 @@ -import "./circular2.js"; -console.log("circular1"); diff --git a/cli/tests/circular1.js.out b/cli/tests/circular1.js.out deleted file mode 100644 index 21f7fd585..000000000 --- a/cli/tests/circular1.js.out +++ /dev/null @@ -1,2 +0,0 @@ -circular2 -circular1 diff --git a/cli/tests/circular2.js b/cli/tests/circular2.js deleted file mode 100644 index 62127e04d..000000000 --- a/cli/tests/circular2.js +++ /dev/null @@ -1,2 +0,0 @@ -import "./circular1.js"; -console.log("circular2"); diff --git a/cli/tests/cjs_imports.ts b/cli/tests/cjs_imports.ts deleted file mode 100644 index d8b77c22e..000000000 --- a/cli/tests/cjs_imports.ts +++ /dev/null @@ -1 +0,0 @@ -import "./commonjs.cjs"; diff --git a/cli/tests/cjs_imports.ts.out b/cli/tests/cjs_imports.ts.out deleted file mode 100644 index 557db03de..000000000 --- a/cli/tests/cjs_imports.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/cli/tests/commonjs.cjs b/cli/tests/commonjs.cjs deleted file mode 100644 index 7df7d571e..000000000 --- a/cli/tests/commonjs.cjs +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello World"); \ No newline at end of file diff --git a/cli/tests/compiler_api_test.ts b/cli/tests/compiler_api_test.ts deleted file mode 100644 index 2e0a8820c..000000000 --- a/cli/tests/compiler_api_test.ts +++ /dev/null @@ -1,504 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { - assert, - assertEquals, - assertStringIncludes, - assertThrowsAsync, -} from "../../test_util/std/testing/asserts.ts"; - -Deno.test({ - name: "Deno.emit() - sources provided", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "/foo.ts", - { - sources: { - "/foo.ts": `import * as bar from "./bar.ts";\n\nconsole.log(bar);\n`, - "/bar.ts": `export const bar = "bar";\n`, - }, - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 12); - const keys = Object.keys(files).sort(); - assert(keys[0].endsWith("/bar.ts.js")); - assert(keys[1].endsWith("/bar.ts.js.map")); - assert(keys[2].endsWith("/foo.ts.js")); - assert(keys[3].endsWith("/foo.ts.js.map")); - }, -}); - -Deno.test({ - name: "Deno.emit() - no sources provided", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "./subdir/mod1.ts", - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 12); - const keys = Object.keys(files).sort(); - assertEquals(keys.length, 6); - assert(keys[0].endsWith("cli/tests/subdir/mod1.ts.js")); - assert(keys[1].endsWith("cli/tests/subdir/mod1.ts.js.map")); - }, -}); - -Deno.test({ - name: "Deno.emit() - compiler options effects emit", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "/foo.ts", - { - compilerOptions: { - module: "amd", - sourceMap: false, - }, - sources: { "/foo.ts": `export const foo = "foo";` }, - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 12); - const keys = Object.keys(files); - assertEquals(keys.length, 1); - const key = keys[0]; - assert(key.endsWith("/foo.ts.js")); - assert(files[key].startsWith("define(")); - }, -}); - -Deno.test({ - name: "Deno.emit() - pass lib in compiler options", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "file:///foo.ts", - { - compilerOptions: { - lib: ["dom", "es2018", "deno.ns"], - }, - sources: { - "file:///foo.ts": `console.log(document.getElementById("foo")); - console.log(Deno.args);`, - }, - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 12); - const keys = Object.keys(files).sort(); - assertEquals(keys, ["file:///foo.ts.js", "file:///foo.ts.js.map"]); - }, -}); - -Deno.test({ - name: "Deno.emit() - type references can be loaded", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "file:///a.ts", - { - sources: { - "file:///a.ts": `/// - const b = new B(); - console.log(b.b);`, - "file:///b.d.ts": `declare class B { - b: string; - }`, - }, - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 12); - const keys = Object.keys(files).sort(); - assertEquals(keys, ["file:///a.ts.js", "file:///a.ts.js.map"]); - }, -}); - -Deno.test({ - name: "Deno.emit() - compilerOptions.types", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "file:///a.ts", - { - compilerOptions: { - types: ["file:///b.d.ts"], - }, - sources: { - "file:///a.ts": `const b = new B(); - console.log(b.b);`, - "file:///b.d.ts": `declare class B { - b: string; - }`, - }, - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 12); - const keys = Object.keys(files).sort(); - assertEquals(keys, ["file:///a.ts.js", "file:///a.ts.js.map"]); - }, -}); - -Deno.test({ - name: "Deno.emit() - import maps", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "file:///a.ts", - { - importMap: { - imports: { - "b": "./b.ts", - }, - }, - importMapPath: "file:///import-map.json", - sources: { - "file:///a.ts": `import * as b from "b" - console.log(b);`, - "file:///b.ts": `export const b = "b";`, - }, - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 12); - const keys = Object.keys(files).sort(); - assertEquals( - keys, - [ - "file:///a.ts.js", - "file:///a.ts.js.map", - "file:///b.ts.js", - "file:///b.ts.js.map", - ], - ); - }, -}); - -Deno.test({ - name: "Deno.emit() - no check", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "/foo.ts", - { - check: false, - sources: { - "/foo.ts": `export enum Foo { Foo, Bar, Baz };\n`, - }, - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 3); - const keys = Object.keys(files).sort(); - assert(keys[0].endsWith("/foo.ts.js")); - assert(keys[1].endsWith("/foo.ts.js.map")); - assert(files[keys[0]].startsWith("export var Foo;")); - }, -}); - -Deno.test({ - name: "Deno.emit() - no check - config effects emit", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "/foo.ts", - { - check: false, - compilerOptions: { removeComments: true }, - sources: { - "/foo.ts": - `/** This is JSDoc */\nexport enum Foo { Foo, Bar, Baz };\n`, - }, - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 3); - const keys = Object.keys(files).sort(); - assert(keys[0].endsWith("/foo.ts.js")); - assert(keys[1].endsWith("/foo.ts.js.map")); - assert(!files[keys[0]].includes("This is JSDoc")); - }, -}); - -Deno.test({ - name: "Deno.emit() - bundle as module script - with sources", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "/foo.ts", - { - bundle: "module", - sources: { - "/foo.ts": `export * from "./bar.ts";\n`, - "/bar.ts": `export const bar = "bar";\n`, - }, - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 12); - assertEquals( - Object.keys(files).sort(), - ["deno:///bundle.js", "deno:///bundle.js.map"].sort(), - ); - assert(files["deno:///bundle.js"].includes(`const bar1 = "bar"`)); - }, -}); - -Deno.test({ - name: "Deno.emit() - bundle as module script - no sources", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "./subdir/mod1.ts", - { - bundle: "module", - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 12); - assertEquals( - Object.keys(files).sort(), - ["deno:///bundle.js", "deno:///bundle.js.map"].sort(), - ); - assert(files["deno:///bundle.js"].length); - }, -}); - -Deno.test({ - name: "Deno.emit() - bundle as module script - include js modules", - async fn() { - const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( - "/foo.js", - { - bundle: "module", - sources: { - "/foo.js": `export * from "./bar.js";\n`, - "/bar.js": `export const bar = "bar";\n`, - }, - }, - ); - assertEquals(diagnostics.length, 0); - assert(!ignoredOptions); - assertEquals(stats.length, 12); - assertEquals( - Object.keys(files).sort(), - ["deno:///bundle.js.map", "deno:///bundle.js"].sort(), - ); - assert(files["deno:///bundle.js"].includes(`const bar1 = "bar"`)); - }, -}); - -Deno.test({ - name: "Deno.emit() - generates diagnostics", - async fn() { - const { diagnostics, files } = await Deno.emit( - "/foo.ts", - { - sources: { - "/foo.ts": `document.getElementById("foo");`, - }, - }, - ); - assertEquals(diagnostics.length, 1); - const keys = Object.keys(files).sort(); - assert(keys[0].endsWith("/foo.ts.js")); - assert(keys[1].endsWith("/foo.ts.js.map")); - }, -}); - -// See https://github.com/denoland/deno/issues/6908 -Deno.test({ - name: "Deno.emit() - invalid syntax does not panic", - async fn() { - await assertThrowsAsync(async () => { - await Deno.emit("/main.js", { - sources: { - "/main.js": ` - export class Foo { - constructor() { - console.log("foo"); - } - export get() { - console.log("bar"); - } - }`, - }, - }); - }); - }, -}); - -Deno.test({ - name: 'Deno.emit() - allows setting of "importsNotUsedAsValues"', - async fn() { - const { diagnostics } = await Deno.emit("/a.ts", { - sources: { - "/a.ts": `import { B } from "./b.ts"; - const b: B = { b: "b" };`, - "/b.ts": `export interface B { - b:string; - };`, - }, - compilerOptions: { - importsNotUsedAsValues: "error", - }, - }); - assert(diagnostics); - assertEquals(diagnostics.length, 1); - assert(diagnostics[0].messageText); - assert(diagnostics[0].messageText.includes("This import is never used")); - }, -}); - -Deno.test({ - name: "Deno.emit() - Unknown media type does not panic", - async fn() { - await assertThrowsAsync(async () => { - await Deno.emit("https://example.com/foo", { - sources: { - "https://example.com/foo": `let foo: string = "foo";`, - }, - }); - }); - }, -}); - -Deno.test({ - name: "Deno.emit() - non-normalized specifier and source can compile", - async fn() { - const specifier = "https://example.com/foo//bar.ts"; - const { files } = await Deno.emit(specifier, { - sources: { - [specifier]: `export let foo: string = "foo";`, - }, - }); - assertEquals(files[`${specifier}.js`], 'export let foo = "foo";\n'); - assert(typeof files[`${specifier}.js.map`] === "string"); - }, -}); - -Deno.test({ - name: `Deno.emit() - bundle as classic script iife`, - async fn() { - const { diagnostics, files } = await Deno.emit("/a.ts", { - bundle: "classic", - sources: { - "/a.ts": `import { b } from "./b.ts"; - console.log(b);`, - "/b.ts": `export const b = "b";`, - }, - }); - assert(diagnostics); - assertEquals(diagnostics.length, 0); - assertEquals(Object.keys(files).length, 2); - assert(files["deno:///bundle.js"].startsWith("(function() {\n")); - assert(files["deno:///bundle.js"].endsWith("})();\n")); - assert(files["deno:///bundle.js.map"]); - }, -}); - -Deno.test({ - name: `Deno.emit() - throws descriptive error when unable to load import map`, - async fn() { - await assertThrowsAsync( - async () => { - await Deno.emit("/a.ts", { - bundle: "classic", - sources: { - "/a.ts": `console.log("hello");`, - }, - importMapPath: "file:///import_map_does_not_exist.json", - }); - }, - Error, - "Unable to load 'file:///import_map_does_not_exist.json' import map", - ); - }, -}); - -Deno.test({ - name: `Deno.emit() - support source maps with bundle option`, - async fn() { - { - const { diagnostics, files } = await Deno.emit("/a.ts", { - bundle: "classic", - sources: { - "/a.ts": `import { b } from "./b.ts"; - console.log(b);`, - "/b.ts": `export const b = "b";`, - }, - compilerOptions: { - inlineSourceMap: true, - sourceMap: false, - }, - }); - assert(diagnostics); - assertEquals(diagnostics.length, 0); - assertEquals(Object.keys(files).length, 1); - assertStringIncludes(files["deno:///bundle.js"], "sourceMappingURL"); - } - - const { diagnostics, files } = await Deno.emit("/a.ts", { - bundle: "classic", - sources: { - "/a.ts": `import { b } from "./b.ts"; - console.log(b);`, - "/b.ts": `export const b = "b";`, - }, - }); - assert(diagnostics); - assertEquals(diagnostics.length, 0); - assertEquals(Object.keys(files).length, 2); - assert(files["deno:///bundle.js"]); - assert(files["deno:///bundle.js.map"]); - }, -}); - -Deno.test({ - name: `Deno.emit() - graph errors as diagnostics`, - ignore: Deno.build.os === "windows", - async fn() { - const { diagnostics } = await Deno.emit("/a.ts", { - sources: { - "/a.ts": `import { b } from "./b.ts"; - console.log(b);`, - }, - }); - assert(diagnostics); - assertEquals(diagnostics, [ - { - category: 1, - code: 2305, - start: { line: 0, character: 9 }, - end: { line: 0, character: 10 }, - messageText: - `Module '"deno:///missing_dependency.d.ts"' has no exported member 'b'.`, - messageChain: null, - source: null, - sourceLine: 'import { b } from "./b.ts";', - fileName: "file:///a.ts", - relatedInformation: null, - }, - { - category: 1, - code: 900001, - start: null, - end: null, - messageText: "Unable to find specifier in sources: file:///b.ts", - messageChain: null, - source: null, - sourceLine: null, - fileName: "file:///b.ts", - relatedInformation: null, - }, - ]); - assert( - Deno.formatDiagnostics(diagnostics).includes( - "Unable to find specifier in sources: file:///b.ts", - ), - ); - }, -}); diff --git a/cli/tests/complex_permissions_test.ts b/cli/tests/complex_permissions_test.ts deleted file mode 100644 index bae157246..000000000 --- a/cli/tests/complex_permissions_test.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -const name = Deno.args[0]; -// deno-lint-ignore no-explicit-any -const test: { [key: string]: (...args: any[]) => void | Promise } = { - read(files: string[]) { - files.forEach((file) => Deno.readFileSync(file)); - }, - write(files: string[]) { - files.forEach((file) => - Deno.writeFileSync(file, new Uint8Array(0), { append: true }) - ); - }, - netFetch(urls: string[]) { - urls.forEach((url) => fetch(url)); - }, - netListen(endpoints: string[]) { - endpoints.forEach((endpoint) => { - const index = endpoint.lastIndexOf(":"); - const [hostname, port] = [ - endpoint.substr(0, index), - endpoint.substr(index + 1), - ]; - const listener = Deno.listen({ - transport: "tcp", - hostname, - port: parseInt(port, 10), - }); - listener.close(); - }); - }, - async netConnect(endpoints: string[]) { - for (const endpoint of endpoints) { - const index = endpoint.lastIndexOf(":"); - const [hostname, port] = [ - endpoint.substr(0, index), - endpoint.substr(index + 1), - ]; - const listener = await Deno.connect({ - transport: "tcp", - hostname, - port: parseInt(port, 10), - }); - listener.close(); - } - }, -}; - -if (!test[name]) { - console.log("Unknown test:", name); - Deno.exit(1); -} - -test[name](Deno.args.slice(1)); diff --git a/cli/tests/config.ts b/cli/tests/config.ts deleted file mode 100644 index cd7a1b33f..000000000 --- a/cli/tests/config.ts +++ /dev/null @@ -1,18 +0,0 @@ -// deno-lint-ignore-file - -function b() { - return function ( - _target: any, - _propertyKey: string, - _descriptor: PropertyDescriptor, - ) { - console.log("b"); - }; -} - -class A { - @b() - a() { - console.log("a"); - } -} diff --git a/cli/tests/config.ts.out b/cli/tests/config.ts.out deleted file mode 100644 index 99b4a7ea4..000000000 --- a/cli/tests/config.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -[WILDCARD]Unsupported compiler options in "[WILDCARD]config.tsconfig.json". - The following options were ignored: - module, target -error: TS1219 [ERROR]: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. - a() { - ^ - at file:///[WILDCARD]cli/tests/config.ts:[WILDCARD] diff --git a/cli/tests/config.tsconfig.json b/cli/tests/config.tsconfig.json deleted file mode 100644 index dcabb50a4..000000000 --- a/cli/tests/config.tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "experimentalDecorators": false, - "module": "amd", - "target": "es5" - } -} diff --git a/cli/tests/config_types.ts b/cli/tests/config_types.ts deleted file mode 100644 index f1a8d6583..000000000 --- a/cli/tests/config_types.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(globalThis.a); diff --git a/cli/tests/config_types.ts.out b/cli/tests/config_types.ts.out deleted file mode 100644 index 417b7b537..000000000 --- a/cli/tests/config_types.ts.out +++ /dev/null @@ -1 +0,0 @@ -undefined diff --git a/cli/tests/config_types.tsconfig.json b/cli/tests/config_types.tsconfig.json deleted file mode 100644 index 3810d4534..000000000 --- a/cli/tests/config_types.tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "types": [ - "./subdir/types.d.ts" - ] - } -} diff --git a/cli/tests/config_types_remote.tsconfig.json b/cli/tests/config_types_remote.tsconfig.json deleted file mode 100644 index 745bb7b20..000000000 --- a/cli/tests/config_types_remote.tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "types": [ - "http://localhost:4545/cli/tests/subdir/types.d.ts" - ] - } -} diff --git a/cli/tests/coverage/branch.ts b/cli/tests/coverage/branch.ts deleted file mode 100644 index 352167109..000000000 --- a/cli/tests/coverage/branch.ts +++ /dev/null @@ -1,15 +0,0 @@ -export function branch(condition: boolean): boolean { - if (condition) { - return true; - } else { - return false; - } -} - -export function unused(condition: boolean): boolean { - if (condition) { - return false; - } else { - return true; - } -} diff --git a/cli/tests/coverage/branch_test.ts b/cli/tests/coverage/branch_test.ts deleted file mode 100644 index 2a44c8071..000000000 --- a/cli/tests/coverage/branch_test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { branch } from "./branch.ts"; - -Deno.test("branch", function () { - branch(true); -}); diff --git a/cli/tests/coverage/complex.ts b/cli/tests/coverage/complex.ts deleted file mode 100644 index 47d4ffa79..000000000 --- a/cli/tests/coverage/complex.ts +++ /dev/null @@ -1,71 +0,0 @@ -// This entire interface should be completely ignored by the coverage tool. -export interface Complex { - // These comments should be ignored. - foo: string; - - // But this is a stub, so this isn't really documentation. - bar: string; - - // Really all these are doing is padding the line count. - baz: string; -} - -// Lets add some wide characters to ensure that the absolute byte offsets are -// being matched properly. -// -// íŒ¨ë”©ì— ëŒ€í•œ ë” ë§Žì€ ë¬¸ìž. -function dependency( - foo: string, - bar: string, - baz: string, -): Complex { - return { - foo, - bar, - baz, - }; -} - -// Again just more wide characters for padding. -// -// 良ã„対策ã®ãŸã‚ã«ã„ãã¤ã‹ã®ãƒ¦ãƒ‹ã‚³ãƒ¼ãƒ‰æ–‡å­—を投ã’る。 -export function complex( - foo: string, - bar: string, - baz: string, -): Complex { - return dependency( - foo, - bar, - baz, - ); -} - -// And yet again for good measure. -// 更多用於填充的字元。 -export function unused( - foo: string, - bar: string, - baz: string, -): Complex { - return complex( - foo, - bar, - baz, - ); -} - -// Using a non-ascii name again to ensure that the byte offsets match up -// correctly. -export const Ï€ = Math.PI; - -// And same applies for this one, this one is unused and will show up in -// lacking coverage. -export function Æ’(): number { - return ( - 0 - ); -} - -// This arrow function should also show up as uncovered. -console.log("%s", () => 1); diff --git a/cli/tests/coverage/complex_test.ts b/cli/tests/coverage/complex_test.ts deleted file mode 100644 index fda948bc3..000000000 --- a/cli/tests/coverage/complex_test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { complex } from "./complex.ts"; - -Deno.test("complex", function () { - complex("foo", "bar", "baz"); -}); diff --git a/cli/tests/coverage/expected_branch.lcov b/cli/tests/coverage/expected_branch.lcov deleted file mode 100644 index 07e29cca5..000000000 --- a/cli/tests/coverage/expected_branch.lcov +++ /dev/null @@ -1,27 +0,0 @@ -SF:[WILDCARD]branch.ts -FN:2,branch -FN:10,unused -FNDA:1,branch -FNDA:0,unused -FNF:2 -FNH:1 -BRDA:4,1,0,0 -BRF:1 -BRH:0 -DA:1,1 -DA:2,2 -DA:3,2 -DA:4,0 -DA:5,0 -DA:6,0 -DA:7,1 -DA:9,0 -DA:10,0 -DA:11,0 -DA:12,0 -DA:13,0 -DA:14,0 -DA:15,0 -LH:4 -LF:14 -end_of_record diff --git a/cli/tests/coverage/expected_branch.out b/cli/tests/coverage/expected_branch.out deleted file mode 100644 index 630ea93b2..000000000 --- a/cli/tests/coverage/expected_branch.out +++ /dev/null @@ -1,12 +0,0 @@ -cover [WILDCARD]/coverage/branch.ts ... 28.571% (4/14) - 4 | } else { - 5 | return false; - 6 | } ------|----- - 9 | export function unused(condition: boolean): boolean { - 10 | if (condition) { - 11 | return false; - 12 | } else { - 13 | return true; - 14 | } - 15 | } diff --git a/cli/tests/coverage/expected_complex.lcov b/cli/tests/coverage/expected_complex.lcov deleted file mode 100644 index 962ebee96..000000000 --- a/cli/tests/coverage/expected_complex.lcov +++ /dev/null @@ -1,53 +0,0 @@ -SF:[WILDCARD]complex.ts -FN:22,dependency -FN:37,complex -FN:51,unused -FN:65,Æ’ -FNDA:1,dependency -FNDA:1,complex -FNDA:0,unused -FNDA:0,Æ’ -FNF:4 -FNH:2 -BRF:0 -BRH:0 -DA:17,2 -DA:18,2 -DA:19,2 -DA:20,2 -DA:22,2 -DA:23,2 -DA:24,2 -DA:25,2 -DA:26,2 -DA:27,1 -DA:32,1 -DA:33,1 -DA:34,1 -DA:35,1 -DA:37,2 -DA:38,2 -DA:39,2 -DA:40,2 -DA:41,2 -DA:42,1 -DA:46,0 -DA:47,0 -DA:48,0 -DA:49,0 -DA:51,0 -DA:52,0 -DA:53,0 -DA:54,0 -DA:55,0 -DA:56,0 -DA:60,1 -DA:64,0 -DA:65,0 -DA:66,0 -DA:67,0 -DA:68,1 -DA:71,0 -LH:22 -LF:37 -end_of_record diff --git a/cli/tests/coverage/expected_complex.out b/cli/tests/coverage/expected_complex.out deleted file mode 100644 index e9f9a453f..000000000 --- a/cli/tests/coverage/expected_complex.out +++ /dev/null @@ -1,19 +0,0 @@ -cover [WILDCARD]/coverage/complex.ts ... 59.459% (22/37) - 46 | export function unused( - 47 | foo: string, - 48 | bar: string, - 49 | baz: string, ------|----- - 51 | return complex( - 52 | foo, - 53 | bar, - 54 | baz, - 55 | ); - 56 | } ------|----- - 64 | export function Æ’(): number { - 65 | return ( - 66 | 0 - 67 | ); ------|----- - 71 | console.log("%s", () => 1); diff --git a/cli/tests/delayed_error.ts b/cli/tests/delayed_error.ts deleted file mode 100644 index 76057e627..000000000 --- a/cli/tests/delayed_error.ts +++ /dev/null @@ -1,2 +0,0 @@ -await new Promise((r) => setTimeout(r, 100)); -throw new Error("foo"); diff --git a/cli/tests/deno_doc.out b/cli/tests/deno_doc.out deleted file mode 100644 index 86a77a9cc..000000000 --- a/cli/tests/deno_doc.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -function foo[WILDCARD] \ No newline at end of file diff --git a/cli/tests/deno_doc.ts b/cli/tests/deno_doc.ts deleted file mode 100644 index fb3c50957..000000000 --- a/cli/tests/deno_doc.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** Some JSDoc */ -export function foo() { -} diff --git a/cli/tests/deno_doc_builtin.out b/cli/tests/deno_doc_builtin.out deleted file mode 100644 index b4a90d6bc..000000000 --- a/cli/tests/deno_doc_builtin.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -namespace Deno -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/deno_dom_0.1.3-alpha2.wasm b/cli/tests/deno_dom_0.1.3-alpha2.wasm deleted file mode 100644 index 6dd9d0e91..000000000 Binary files a/cli/tests/deno_dom_0.1.3-alpha2.wasm and /dev/null differ diff --git a/cli/tests/deno_land_unsafe_ssl.ts b/cli/tests/deno_land_unsafe_ssl.ts deleted file mode 100644 index f5e8dcc80..000000000 --- a/cli/tests/deno_land_unsafe_ssl.ts +++ /dev/null @@ -1,2 +0,0 @@ -const r = await fetch("https://google.com"); -console.log(r.status); diff --git a/cli/tests/deno_land_unsafe_ssl.ts.out b/cli/tests/deno_land_unsafe_ssl.ts.out deleted file mode 100644 index cbf52b076..000000000 --- a/cli/tests/deno_land_unsafe_ssl.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -DANGER: TLS certificate validation is disabled for: deno.land -200 diff --git a/cli/tests/disallow_http_from_https.js b/cli/tests/disallow_http_from_https.js deleted file mode 100644 index fd30a023d..000000000 --- a/cli/tests/disallow_http_from_https.js +++ /dev/null @@ -1,2 +0,0 @@ -// Trying to import "http://", while this file is accessed by "https://" -import "http://localhost:4545/cli/tests/001_hello.js"; diff --git a/cli/tests/disallow_http_from_https.ts b/cli/tests/disallow_http_from_https.ts deleted file mode 100644 index fd30a023d..000000000 --- a/cli/tests/disallow_http_from_https.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Trying to import "http://", while this file is accessed by "https://" -import "http://localhost:4545/cli/tests/001_hello.js"; diff --git a/cli/tests/disallow_http_from_https_js.out b/cli/tests/disallow_http_from_https_js.out deleted file mode 100644 index 405859e4d..000000000 --- a/cli/tests/disallow_http_from_https_js.out +++ /dev/null @@ -1,3 +0,0 @@ -error: Modules imported via https are not allowed to import http modules. - Importing: http://localhost:4545/cli/tests/001_hello.js - at https://localhost:5545/cli/tests/disallow_http_from_https.js:2:0 diff --git a/cli/tests/disallow_http_from_https_ts.out b/cli/tests/disallow_http_from_https_ts.out deleted file mode 100644 index b63ba0c67..000000000 --- a/cli/tests/disallow_http_from_https_ts.out +++ /dev/null @@ -1,3 +0,0 @@ -error: Modules imported via https are not allowed to import http modules. - Importing: http://localhost:4545/cli/tests/001_hello.js - at https://localhost:5545/cli/tests/disallow_http_from_https.ts:2:0 diff --git a/cli/tests/doc/import_map.json b/cli/tests/doc/import_map.json deleted file mode 100644 index 244a30296..000000000 --- a/cli/tests/doc/import_map.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "imports": { - "rex/": "./module/" - } -} diff --git a/cli/tests/doc/invalid_url.out b/cli/tests/doc/invalid_url.out deleted file mode 100644 index 8be787e90..000000000 --- a/cli/tests/doc/invalid_url.out +++ /dev/null @@ -1,4 +0,0 @@ -error: invalid URL: invalid domain character - -Caused by: - invalid domain character diff --git a/cli/tests/doc/module/fun.js b/cli/tests/doc/module/fun.js deleted file mode 100644 index 28901d945..000000000 --- a/cli/tests/doc/module/fun.js +++ /dev/null @@ -1,2 +0,0 @@ -/** This is some documentation */ -export function fun(_a, _b) {} diff --git a/cli/tests/doc/types_header.out b/cli/tests/doc/types_header.out deleted file mode 100644 index ccff1a373..000000000 --- a/cli/tests/doc/types_header.out +++ /dev/null @@ -1,6 +0,0 @@ -Download http://127.0.0.1:4545/xTypeScriptTypes.js -Download http://127.0.0.1:4545/xTypeScriptTypes.d.ts -Defined in http://127.0.0.1:4545/xTypeScriptTypes.d.ts:1:0 - -const foo: "foo" - diff --git a/cli/tests/doc/types_header.ts b/cli/tests/doc/types_header.ts deleted file mode 100644 index b64c8d000..000000000 --- a/cli/tests/doc/types_header.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "http://127.0.0.1:4545/xTypeScriptTypes.js"; diff --git a/cli/tests/doc/types_hint.out b/cli/tests/doc/types_hint.out deleted file mode 100644 index 7eb05faed..000000000 --- a/cli/tests/doc/types_hint.out +++ /dev/null @@ -1,5 +0,0 @@ -Defined in [WILDCARD]/type_definitions/foo.d.ts:2:0 - -const foo: string - An exported value. - diff --git a/cli/tests/doc/types_hint.ts b/cli/tests/doc/types_hint.ts deleted file mode 100644 index bacea46db..000000000 --- a/cli/tests/doc/types_hint.ts +++ /dev/null @@ -1,2 +0,0 @@ -// @deno-types="../type_definitions/foo.d.ts" -export * from "../type_definitions/foo.js"; diff --git a/cli/tests/doc/types_ref.js b/cli/tests/doc/types_ref.js deleted file mode 100644 index 03d8b5570..000000000 --- a/cli/tests/doc/types_ref.js +++ /dev/null @@ -1,2 +0,0 @@ -/// -export const foo = "foo"; diff --git a/cli/tests/doc/types_ref.out b/cli/tests/doc/types_ref.out deleted file mode 100644 index 7eb05faed..000000000 --- a/cli/tests/doc/types_ref.out +++ /dev/null @@ -1,5 +0,0 @@ -Defined in [WILDCARD]/type_definitions/foo.d.ts:2:0 - -const foo: string - An exported value. - diff --git a/cli/tests/doc/use_import_map.js b/cli/tests/doc/use_import_map.js deleted file mode 100644 index 672a7a7bd..000000000 --- a/cli/tests/doc/use_import_map.js +++ /dev/null @@ -1 +0,0 @@ -export { fun } from "rex/fun.js"; diff --git a/cli/tests/doc/use_import_map.out b/cli/tests/doc/use_import_map.out deleted file mode 100644 index 0b27ccf18..000000000 --- a/cli/tests/doc/use_import_map.out +++ /dev/null @@ -1,5 +0,0 @@ -Defined in [WILDCARD]/doc/module/fun.js:2:0 - -function fun(_a, _b) - This is some documentation - diff --git a/cli/tests/dynamic_import/b.js b/cli/tests/dynamic_import/b.js deleted file mode 100644 index 6ea50d360..000000000 --- a/cli/tests/dynamic_import/b.js +++ /dev/null @@ -1,2 +0,0 @@ -import "./bad.mjs"; -export default () => "error"; diff --git a/cli/tests/dynamic_import/c.js b/cli/tests/dynamic_import/c.js deleted file mode 100644 index 20546455e..000000000 --- a/cli/tests/dynamic_import/c.js +++ /dev/null @@ -1,2 +0,0 @@ -await import("./bad2.mjs"); -export default () => "error"; diff --git a/cli/tests/dynamic_import/permissions_blob_local.ts b/cli/tests/dynamic_import/permissions_blob_local.ts deleted file mode 100644 index 9ef4158ce..000000000 --- a/cli/tests/dynamic_import/permissions_blob_local.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "file:///${ - Deno.build.os == "windows" ? "C:/" : "" -}local_file.ts";`; -const blob = new Blob([code]); -await import(URL.createObjectURL(blob)); diff --git a/cli/tests/dynamic_import/permissions_blob_local.ts.out b/cli/tests/dynamic_import/permissions_blob_local.ts.out deleted file mode 100644 index 5a2da0536..000000000 --- a/cli/tests/dynamic_import/permissions_blob_local.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag - at blob:null/[WILDCARD]:1:0 -await import(URL.createObjectURL(blob)); -^ - at async file:///[WILDCARD]/cli/tests/dynamic_import/permissions_blob_local.ts:6:1 diff --git a/cli/tests/dynamic_import/permissions_blob_remote.ts b/cli/tests/dynamic_import/permissions_blob_remote.ts deleted file mode 100644 index 1e2c8c21a..000000000 --- a/cli/tests/dynamic_import/permissions_blob_remote.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "https://example.com/some/file.ts";`; -const blob = new Blob([code]); -await import(URL.createObjectURL(blob)); diff --git a/cli/tests/dynamic_import/permissions_blob_remote.ts.out b/cli/tests/dynamic_import/permissions_blob_remote.ts.out deleted file mode 100644 index 7992e0855..000000000 --- a/cli/tests/dynamic_import/permissions_blob_remote.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag - at blob:null/[WILDCARD]:1:0 -await import(URL.createObjectURL(blob)); -^ - at async file:///[WILDCARD]/cli/tests/dynamic_import/permissions_blob_remote.ts:4:1 diff --git a/cli/tests/dynamic_import/permissions_data_local.ts b/cli/tests/dynamic_import/permissions_data_local.ts deleted file mode 100644 index be4fc1c34..000000000 --- a/cli/tests/dynamic_import/permissions_data_local.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "file:///${ - Deno.build.os == "windows" ? "C:/" : "" -}local_file.ts";`; -await import(`data:application/javascript;base64,${btoa(code)}`); diff --git a/cli/tests/dynamic_import/permissions_data_local.ts.out b/cli/tests/dynamic_import/permissions_data_local.ts.out deleted file mode 100644 index 39686740a..000000000 --- a/cli/tests/dynamic_import/permissions_data_local.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag - at data:application/javascript;base64,[WILDCARD]:1:0 -await import(`data:application/javascript;base64,${btoa(code)}`); -^ - at async file:///[WILDCARD]/cli/tests/dynamic_import/permissions_data_local.ts:5:1 diff --git a/cli/tests/dynamic_import/permissions_data_remote.ts b/cli/tests/dynamic_import/permissions_data_remote.ts deleted file mode 100644 index b0a9540c3..000000000 --- a/cli/tests/dynamic_import/permissions_data_remote.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "https://example.com/some/file.ts";`; -await import(`data:application/javascript;base64,${btoa(code)}`); diff --git a/cli/tests/dynamic_import/permissions_data_remote.ts.out b/cli/tests/dynamic_import/permissions_data_remote.ts.out deleted file mode 100644 index 6bb137091..000000000 --- a/cli/tests/dynamic_import/permissions_data_remote.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag - at data:application/javascript;base64,aW1wb3J0ICJodHRwczovL2V4YW1wbGUuY29tL3NvbWUvZmlsZS50cyI7:1:0 -await import(`data:application/javascript;base64,${btoa(code)}`); -^ - at async file:///[WILDCARD]/cli/tests/dynamic_import/permissions_data_remote.ts:3:1 diff --git a/cli/tests/dynamic_import/permissions_remote_remote.ts b/cli/tests/dynamic_import/permissions_remote_remote.ts deleted file mode 100644 index 99de3f46f..000000000 --- a/cli/tests/dynamic_import/permissions_remote_remote.ts +++ /dev/null @@ -1,3 +0,0 @@ -await import( - "http://localhost:4545/cli/tests/dynamic_import/static_remote.ts" -); diff --git a/cli/tests/dynamic_import/permissions_remote_remote.ts.out b/cli/tests/dynamic_import/permissions_remote_remote.ts.out deleted file mode 100644 index ae8113899..000000000 --- a/cli/tests/dynamic_import/permissions_remote_remote.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag - at http://localhost:4545/cli/tests/dynamic_import/static_remote.ts:2:0 -await import( -^ - at async file:///[WILDCARD]/cli/tests/dynamic_import/permissions_remote_remote.ts:1:1 diff --git a/cli/tests/dynamic_import/static_remote.ts b/cli/tests/dynamic_import/static_remote.ts deleted file mode 100644 index 2d6e820fd..000000000 --- a/cli/tests/dynamic_import/static_remote.ts +++ /dev/null @@ -1,2 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -import "https://example.com/some/file.ts"; diff --git a/cli/tests/dynamic_import_conditional.js b/cli/tests/dynamic_import_conditional.js deleted file mode 100644 index 1b4193e3e..000000000 --- a/cli/tests/dynamic_import_conditional.js +++ /dev/null @@ -1,3 +0,0 @@ -const Worker = globalThis.Worker ?? (await import("worker_threads")).Worker; - -console.log(!!Worker); diff --git a/cli/tests/dynamic_import_conditional.js.out b/cli/tests/dynamic_import_conditional.js.out deleted file mode 100644 index 27ba77dda..000000000 --- a/cli/tests/dynamic_import_conditional.js.out +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/cli/tests/echo.ts b/cli/tests/echo.ts deleted file mode 100644 index 84a645433..000000000 --- a/cli/tests/echo.ts +++ /dev/null @@ -1,6 +0,0 @@ -function echo(args: string[]) { - const msg = args.join(", "); - Deno.stdout.write(new TextEncoder().encode(msg)); -} - -echo(Deno.args); diff --git a/cli/tests/echo_server.ts b/cli/tests/echo_server.ts deleted file mode 100644 index 84284bea1..000000000 --- a/cli/tests/echo_server.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { copy } from "../../test_util/std/io/util.ts"; -const addr = Deno.args[0] || "0.0.0.0:4544"; -const [hostname, port] = addr.split(":"); -const listener = Deno.listen({ hostname, port: Number(port) }); -console.log("listening on", addr); -listener.accept().then( - async (conn) => { - console.log("received bytes:", await copy(conn, conn)); - conn.close(); - listener.close(); - }, -); diff --git a/cli/tests/encoding/utf-16be.ts b/cli/tests/encoding/utf-16be.ts deleted file mode 100644 index 3d0144d7c..000000000 Binary files a/cli/tests/encoding/utf-16be.ts and /dev/null differ diff --git a/cli/tests/encoding/utf-16le.ts b/cli/tests/encoding/utf-16le.ts deleted file mode 100644 index 6f0e415f2..000000000 Binary files a/cli/tests/encoding/utf-16le.ts and /dev/null differ diff --git a/cli/tests/encoding/utf-8.ts b/cli/tests/encoding/utf-8.ts deleted file mode 100644 index bf889aeb7..000000000 --- a/cli/tests/encoding/utf-8.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello World"); diff --git a/cli/tests/encoding/windows-1255 b/cli/tests/encoding/windows-1255 deleted file mode 100644 index ec5cad7fd..000000000 --- a/cli/tests/encoding/windows-1255 +++ /dev/null @@ -1 +0,0 @@ -console.log("ùìåí òåìí"); diff --git a/cli/tests/error_001.ts b/cli/tests/error_001.ts deleted file mode 100644 index b01068bc0..000000000 --- a/cli/tests/error_001.ts +++ /dev/null @@ -1,9 +0,0 @@ -function foo(): never { - throw Error("bad"); -} - -function bar() { - foo(); -} - -bar(); diff --git a/cli/tests/error_001.ts.out b/cli/tests/error_001.ts.out deleted file mode 100644 index d4103349a..000000000 --- a/cli/tests/error_001.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught Error: bad - throw Error("bad"); - ^ - at foo ([WILDCARD]tests/error_001.ts:2:9) - at bar ([WILDCARD]tests/error_001.ts:6:3) - at [WILDCARD]tests/error_001.ts:9:1 diff --git a/cli/tests/error_002.ts b/cli/tests/error_002.ts deleted file mode 100644 index 6aa0fcc3b..000000000 --- a/cli/tests/error_002.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { throwsError } from "./subdir/mod1.ts"; - -function foo() { - throwsError(); -} - -foo(); diff --git a/cli/tests/error_002.ts.out b/cli/tests/error_002.ts.out deleted file mode 100644 index 2aae770f8..000000000 --- a/cli/tests/error_002.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught Error: exception from mod1 - throw Error("exception from mod1"); - ^ - at throwsError ([WILDCARD]tests/subdir/mod1.ts:16:9) - at foo ([WILDCARD]tests/error_002.ts:4:3) - at [WILDCARD]tests/error_002.ts:7:1 diff --git a/cli/tests/error_003_typescript.ts b/cli/tests/error_003_typescript.ts deleted file mode 100644 index e1f882123..000000000 --- a/cli/tests/error_003_typescript.ts +++ /dev/null @@ -1,20 +0,0 @@ -// deno-lint-ignore-file -let x = { - a: { - b: { - c() { - return { d: "hello" }; - }, - }, - }, -}; -let y = { - a: { - b: { - c() { - return { d: 1234 }; - }, - }, - }, -}; -x = y; diff --git a/cli/tests/error_003_typescript.ts.out b/cli/tests/error_003_typescript.ts.out deleted file mode 100644 index 49cd274f4..000000000 --- a/cli/tests/error_003_typescript.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -[WILDCARD] -error: TS2322 [ERROR]: Type '{ a: { b: { c(): { d: number; }; }; }; }' is not assignable to type '{ a: { b: { c(): { d: string; }; }; }; }'. - The types of 'a.b.c().d' are incompatible between these types. - Type 'number' is not assignable to type 'string'. -x = y; -^ - at [WILDCARD]/tests/error_003_typescript.ts:20:1 diff --git a/cli/tests/error_004_missing_module.ts b/cli/tests/error_004_missing_module.ts deleted file mode 100644 index 82b281181..000000000 --- a/cli/tests/error_004_missing_module.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as badModule from "./bad-module.ts"; - -console.log(badModule); diff --git a/cli/tests/error_004_missing_module.ts.out b/cli/tests/error_004_missing_module.ts.out deleted file mode 100644 index 474fdf8ed..000000000 --- a/cli/tests/error_004_missing_module.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Cannot resolve module "file:///[WILDCARD]cli/tests/bad-module.ts" from "file:///[WILDCARD]cli/tests/error_004_missing_module.ts". - at file:///[WILDCARD]cli/tests/error_004_missing_module.ts:1:0 diff --git a/cli/tests/error_005_missing_dynamic_import.ts b/cli/tests/error_005_missing_dynamic_import.ts deleted file mode 100644 index 8ea8ff94e..000000000 --- a/cli/tests/error_005_missing_dynamic_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -(async () => { - const _badModule = await import("./bad-module.ts"); -})(); diff --git a/cli/tests/error_005_missing_dynamic_import.ts.out b/cli/tests/error_005_missing_dynamic_import.ts.out deleted file mode 100644 index da680e195..000000000 --- a/cli/tests/error_005_missing_dynamic_import.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in promise) TypeError: Cannot resolve module "[WILDCARD]/cli/tests/bad-module.ts". - const _badModule = await import("./bad-module.ts"); - ^ - at async file://[WILDCARD]/error_005_missing_dynamic_import.ts:2:22 diff --git a/cli/tests/error_006_import_ext_failure.ts b/cli/tests/error_006_import_ext_failure.ts deleted file mode 100644 index 3c32303a3..000000000 --- a/cli/tests/error_006_import_ext_failure.ts +++ /dev/null @@ -1 +0,0 @@ -import "./non-existent"; diff --git a/cli/tests/error_006_import_ext_failure.ts.out b/cli/tests/error_006_import_ext_failure.ts.out deleted file mode 100644 index 601e527cf..000000000 --- a/cli/tests/error_006_import_ext_failure.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Cannot resolve module "[WILDCARD]/non-existent" from "[WILDCARD]/error_006_import_ext_failure.ts". - at file:///[WILDCARD]cli/tests/error_006_import_ext_failure.ts:1:0 diff --git a/cli/tests/error_007_any.ts b/cli/tests/error_007_any.ts deleted file mode 100644 index 778886fcb..000000000 --- a/cli/tests/error_007_any.ts +++ /dev/null @@ -1 +0,0 @@ -throw {}; diff --git a/cli/tests/error_007_any.ts.out b/cli/tests/error_007_any.ts.out deleted file mode 100644 index 45dbffd04..000000000 --- a/cli/tests/error_007_any.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]error: Uncaught # diff --git a/cli/tests/error_008_checkjs.js b/cli/tests/error_008_checkjs.js deleted file mode 100644 index f0856d94c..000000000 --- a/cli/tests/error_008_checkjs.js +++ /dev/null @@ -1,5 +0,0 @@ -// console.log intentionally misspelled to trigger a type error -consol.log("hello world!"); - -// the following error should be ignored and not output to the console -const foo = new Foo(); diff --git a/cli/tests/error_008_checkjs.js.out b/cli/tests/error_008_checkjs.js.out deleted file mode 100644 index 2d93ffd01..000000000 --- a/cli/tests/error_008_checkjs.js.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]error: Uncaught ReferenceError: consol is not defined -consol.log("hello world!"); -^ - at [WILDCARD]tests/error_008_checkjs.js:2:1 diff --git a/cli/tests/error_009_extensions_error.js b/cli/tests/error_009_extensions_error.js deleted file mode 100644 index 01b97ea38..000000000 --- a/cli/tests/error_009_extensions_error.js +++ /dev/null @@ -1,2 +0,0 @@ -// Missing arg. -new Event(); diff --git a/cli/tests/error_009_extensions_error.js.out b/cli/tests/error_009_extensions_error.js.out deleted file mode 100644 index 8510980f6..000000000 --- a/cli/tests/error_009_extensions_error.js.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught TypeError: Failed to construct 'Event': 1 argument required, but only 0 present. -new Event(); -^ - at [WILDCARD] - at new Event (deno:ext/web/[WILDCARD]) - at [WILDCARD] diff --git a/cli/tests/error_009_missing_js_module.disabled b/cli/tests/error_009_missing_js_module.disabled deleted file mode 100644 index 3156fc94b..000000000 --- a/cli/tests/error_009_missing_js_module.disabled +++ /dev/null @@ -1,4 +0,0 @@ -args: tests/error_009_missing_js_module.js -check_stderr: true -exit_code: 1 -output: tests/error_009_missing_js_module.js.out diff --git a/cli/tests/error_009_missing_js_module.js b/cli/tests/error_009_missing_js_module.js deleted file mode 100644 index e6ca88934..000000000 --- a/cli/tests/error_009_missing_js_module.js +++ /dev/null @@ -1 +0,0 @@ -import "./bad-module.js"; diff --git a/cli/tests/error_009_missing_js_module.js.out b/cli/tests/error_009_missing_js_module.js.out deleted file mode 100644 index edb08da1c..000000000 --- a/cli/tests/error_009_missing_js_module.js.out +++ /dev/null @@ -1 +0,0 @@ -Cannot resolve module "./bad-module.js" from "[WILDCARD]error_009_missing_js_module.js" diff --git a/cli/tests/error_010_nonexistent_arg.disabled b/cli/tests/error_010_nonexistent_arg.disabled deleted file mode 100644 index 9d183107c..000000000 --- a/cli/tests/error_010_nonexistent_arg.disabled +++ /dev/null @@ -1,4 +0,0 @@ -args: not-a-valid-filename.ts -output: tests/error_010_nonexistent_arg.out -exit_code: 1 -check_stderr: true diff --git a/cli/tests/error_010_nonexistent_arg.out b/cli/tests/error_010_nonexistent_arg.out deleted file mode 100644 index ef4f7b041..000000000 --- a/cli/tests/error_010_nonexistent_arg.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]Cannot resolve module "file:[WILDCARD]not-a-valid-filename.ts" from "." diff --git a/cli/tests/error_011_bad_module_specifier.ts b/cli/tests/error_011_bad_module_specifier.ts deleted file mode 100644 index 1c57e37a5..000000000 --- a/cli/tests/error_011_bad_module_specifier.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as badModule from "bad-module.ts"; - -console.log(badModule); diff --git a/cli/tests/error_011_bad_module_specifier.ts.out b/cli/tests/error_011_bad_module_specifier.ts.out deleted file mode 100644 index 713072191..000000000 --- a/cli/tests/error_011_bad_module_specifier.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]error: Relative import path "bad-module.ts" not prefixed with / or ./ or ../ from "[WILDCARD]/error_011_bad_module_specifier.ts" diff --git a/cli/tests/error_012_bad_dynamic_import_specifier.ts b/cli/tests/error_012_bad_dynamic_import_specifier.ts deleted file mode 100644 index 5f39f407c..000000000 --- a/cli/tests/error_012_bad_dynamic_import_specifier.ts +++ /dev/null @@ -1,3 +0,0 @@ -(async () => { - const _badModule = await import("bad-module.ts"); -})(); diff --git a/cli/tests/error_012_bad_dynamic_import_specifier.ts.out b/cli/tests/error_012_bad_dynamic_import_specifier.ts.out deleted file mode 100644 index 0d0b168a4..000000000 --- a/cli/tests/error_012_bad_dynamic_import_specifier.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -Check [WILDCARD]error_012_bad_dynamic_import_specifier.ts -error: Uncaught (in promise) TypeError: Relative import path "bad-module.ts" not prefixed with / or ./ or ../ from "[WILDCARD]/error_012_bad_dynamic_import_specifier.ts" - const _badModule = await import("bad-module.ts"); - ^ - at async file:///[WILDCARD]/error_012_bad_dynamic_import_specifier.ts:2:22 diff --git a/cli/tests/error_013_missing_script.out b/cli/tests/error_013_missing_script.out deleted file mode 100644 index d1c257bdb..000000000 --- a/cli/tests/error_013_missing_script.out +++ /dev/null @@ -1 +0,0 @@ -error: Cannot resolve module "[WILDCARD]missing_file_name". diff --git a/cli/tests/error_014_catch_dynamic_import_error.js b/cli/tests/error_014_catch_dynamic_import_error.js deleted file mode 100644 index 483be7b1a..000000000 --- a/cli/tests/error_014_catch_dynamic_import_error.js +++ /dev/null @@ -1,31 +0,0 @@ -(async () => { - try { - await import("does not exist"); - } catch (err) { - console.log("Caught direct dynamic import error."); - console.log(err); - } - - try { - await import("./subdir/indirect_import_error.js"); - } catch (err) { - console.log("Caught indirect direct dynamic import error."); - console.log(err); - } - - try { - await import("./subdir/throws.js"); - } catch (err) { - console.log("Caught error thrown by dynamically imported module."); - console.log(err); - } - - try { - await import("./subdir/indirect_throws.js"); - } catch (err) { - console.log( - "Caught error thrown indirectly by dynamically imported module.", - ); - console.log(err); - } -})(); diff --git a/cli/tests/error_014_catch_dynamic_import_error.js.out b/cli/tests/error_014_catch_dynamic_import_error.js.out deleted file mode 100644 index 60de400db..000000000 --- a/cli/tests/error_014_catch_dynamic_import_error.js.out +++ /dev/null @@ -1,12 +0,0 @@ -Caught direct dynamic import error. -TypeError: Relative import path "does not exist" not prefixed with / or ./ or ../ from "[WILDCARD]/error_014_catch_dynamic_import_error.js" - at async file:///[WILDCARD]/error_014_catch_dynamic_import_error.js:3:5 -Caught indirect direct dynamic import error. -TypeError: Relative import path "does not exist either" not prefixed with / or ./ or ../ from "[WILDCARD]/indirect_import_error.js" - at async file:///[WILDCARD]/error_014_catch_dynamic_import_error.js:10:5 -Caught error thrown by dynamically imported module. -Error: An error - at file:///[WILDCARD]tests/subdir/throws.js:6:7 -Caught error thrown indirectly by dynamically imported module. -Error: An error - at file:///[WILDCARD]tests/subdir/throws.js:6:7 diff --git a/cli/tests/error_015_dynamic_import_permissions.js b/cli/tests/error_015_dynamic_import_permissions.js deleted file mode 100644 index 197339c5e..000000000 --- a/cli/tests/error_015_dynamic_import_permissions.js +++ /dev/null @@ -1,3 +0,0 @@ -(async () => { - await import("http://localhost:4545/cli/tests/subdir/mod4.js"); -})(); diff --git a/cli/tests/error_015_dynamic_import_permissions.out b/cli/tests/error_015_dynamic_import_permissions.out deleted file mode 100644 index de6585dcd..000000000 --- a/cli/tests/error_015_dynamic_import_permissions.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires net access to "localhost:4545", run again with the --allow-net flag - await import("http://localhost:4545/cli/tests/subdir/mod4.js"); - ^ - at async file:///[WILDCARD]/error_015_dynamic_import_permissions.js:2:3 diff --git a/cli/tests/error_016_dynamic_import_permissions2.js b/cli/tests/error_016_dynamic_import_permissions2.js deleted file mode 100644 index 34e1a43d2..000000000 --- a/cli/tests/error_016_dynamic_import_permissions2.js +++ /dev/null @@ -1,5 +0,0 @@ -// If this is executed with --allow-net but not --allow-read the following -// import should cause a permission denied error. -(async () => { - await import("http://localhost:4545/cli/tests/subdir/evil_remote_import.js"); -})(); diff --git a/cli/tests/error_016_dynamic_import_permissions2.out b/cli/tests/error_016_dynamic_import_permissions2.out deleted file mode 100644 index f54b4a7fe..000000000 --- a/cli/tests/error_016_dynamic_import_permissions2.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. - Importing: file:///c:/etc/passwd - at http://localhost:4545/cli/tests/subdir/evil_remote_import.js:3:0 diff --git a/cli/tests/error_017_hide_long_source_ts.ts b/cli/tests/error_017_hide_long_source_ts.ts deleted file mode 100644 index d61cb1277..000000000 --- a/cli/tests/error_017_hide_long_source_ts.ts +++ /dev/null @@ -1,3 +0,0 @@ -// deno-fmt-ignore-file -const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; -LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; diff --git a/cli/tests/error_017_hide_long_source_ts.ts.out b/cli/tests/error_017_hide_long_source_ts.ts.out deleted file mode 100644 index 52c2f7cc2..000000000 --- a/cli/tests/error_017_hide_long_source_ts.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -error: TS2532 [ERROR]: Object is possibly 'undefined'. - at [WILDCARD]tests/error_017_hide_long_source_ts.ts:3:1 diff --git a/cli/tests/error_018_hide_long_source_js.js b/cli/tests/error_018_hide_long_source_js.js deleted file mode 100644 index d61cb1277..000000000 --- a/cli/tests/error_018_hide_long_source_js.js +++ /dev/null @@ -1,3 +0,0 @@ -// deno-fmt-ignore-file -const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; -LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; diff --git a/cli/tests/error_018_hide_long_source_js.js.out b/cli/tests/error_018_hide_long_source_js.js.out deleted file mode 100644 index c83778dc0..000000000 --- a/cli/tests/error_018_hide_long_source_js.js.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Uncaught TypeError: Cannot read properties of undefined (reading 'a') - at file:///[WILDCARD]cli/tests/error_018_hide_long_source_js.js:3:206 diff --git a/cli/tests/error_019_stack_function.ts b/cli/tests/error_019_stack_function.ts deleted file mode 100644 index c5eeae8f4..000000000 --- a/cli/tests/error_019_stack_function.ts +++ /dev/null @@ -1,10 +0,0 @@ -function foo(): never { - throw new Error("function"); -} - -try { - foo(); -} catch (error) { - console.log(error.stack); - throw error; -} diff --git a/cli/tests/error_019_stack_function.ts.out b/cli/tests/error_019_stack_function.ts.out deleted file mode 100644 index 66e37bce9..000000000 --- a/cli/tests/error_019_stack_function.ts.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD]Error: function - at foo ([WILDCARD]tests/error_019_stack_function.ts:[WILDCARD]) - at [WILDCARD]tests/error_019_stack_function.ts:[WILDCARD] -error: Uncaught Error: function - throw new Error("function"); - ^ - at foo ([WILDCARD]tests/error_019_stack_function.ts:[WILDCARD]) - at [WILDCARD]tests/error_019_stack_function.ts:[WILDCARD] diff --git a/cli/tests/error_020_stack_constructor.ts b/cli/tests/error_020_stack_constructor.ts deleted file mode 100644 index 49988280b..000000000 --- a/cli/tests/error_020_stack_constructor.ts +++ /dev/null @@ -1,12 +0,0 @@ -class A { - constructor() { - throw new Error("constructor"); - } -} - -try { - new A(); -} catch (error) { - console.log(error.stack); - throw error; -} diff --git a/cli/tests/error_020_stack_constructor.ts.out b/cli/tests/error_020_stack_constructor.ts.out deleted file mode 100644 index 96a243e74..000000000 --- a/cli/tests/error_020_stack_constructor.ts.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD]Error: constructor - at new A ([WILDCARD]tests/error_020_stack_constructor.ts:[WILDCARD]) - at [WILDCARD]tests/error_020_stack_constructor.ts:[WILDCARD] -error: Uncaught Error: constructor - throw new Error("constructor"); - ^ - at new A ([WILDCARD]tests/error_020_stack_constructor.ts:[WILDCARD]) - at [WILDCARD]tests/error_020_stack_constructor.ts:[WILDCARD] diff --git a/cli/tests/error_021_stack_method.ts b/cli/tests/error_021_stack_method.ts deleted file mode 100644 index a52d00deb..000000000 --- a/cli/tests/error_021_stack_method.ts +++ /dev/null @@ -1,12 +0,0 @@ -class A { - m(): never { - throw new Error("method"); - } -} - -try { - new A().m(); -} catch (error) { - console.log(error.stack); - throw error; -} diff --git a/cli/tests/error_021_stack_method.ts.out b/cli/tests/error_021_stack_method.ts.out deleted file mode 100644 index 1f9a24aed..000000000 --- a/cli/tests/error_021_stack_method.ts.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD]Error: method - at A.m ([WILDCARD]tests/error_021_stack_method.ts:[WILDCARD]) - at [WILDCARD]tests/error_021_stack_method.ts:[WILDCARD] -error: Uncaught Error: method - throw new Error("method"); - ^ - at A.m ([WILDCARD]tests/error_021_stack_method.ts:[WILDCARD]) - at [WILDCARD]tests/error_021_stack_method.ts:[WILDCARD] diff --git a/cli/tests/error_022_stack_custom_error.ts b/cli/tests/error_022_stack_custom_error.ts deleted file mode 100644 index b95743503..000000000 --- a/cli/tests/error_022_stack_custom_error.ts +++ /dev/null @@ -1,14 +0,0 @@ -class CustomError extends Error { - constructor() { - super(); - this.name = "CustomError"; - } - - get message(): string { - return "custom error"; - } -} - -const error = new CustomError(); -console.log(error.stack); -throw error; diff --git a/cli/tests/error_022_stack_custom_error.ts.out b/cli/tests/error_022_stack_custom_error.ts.out deleted file mode 100644 index d95783d06..000000000 --- a/cli/tests/error_022_stack_custom_error.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]CustomError: custom error - at [WILDCARD]tests/error_022_stack_custom_error.ts:[WILDCARD] -error: Uncaught CustomError: custom error -const error = new CustomError(); - ^ - at [WILDCARD]tests/error_022_stack_custom_error.ts:[WILDCARD] diff --git a/cli/tests/error_023_stack_async.ts b/cli/tests/error_023_stack_async.ts deleted file mode 100644 index 99e676e26..000000000 --- a/cli/tests/error_023_stack_async.ts +++ /dev/null @@ -1,12 +0,0 @@ -const p = (async () => { - await Promise.resolve().then((): never => { - throw new Error("async"); - }); -})(); - -try { - await p; -} catch (error) { - console.log(error.stack); - throw error; -} diff --git a/cli/tests/error_023_stack_async.ts.out b/cli/tests/error_023_stack_async.ts.out deleted file mode 100644 index 2f4ffd2f3..000000000 --- a/cli/tests/error_023_stack_async.ts.out +++ /dev/null @@ -1,10 +0,0 @@ -[WILDCARD]Error: async - at [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD] - at async [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD] - at async [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD] -error: Uncaught Error: async - throw new Error("async"); - ^ - at [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD] - at async [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD] - at async [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD] diff --git a/cli/tests/error_024_stack_promise_all.ts b/cli/tests/error_024_stack_promise_all.ts deleted file mode 100644 index ddaf0dbaa..000000000 --- a/cli/tests/error_024_stack_promise_all.ts +++ /dev/null @@ -1,14 +0,0 @@ -const p = Promise.all([ - Promise.resolve(), - (async (): Promise => { - await Promise.resolve(); - throw new Error("Promise.all()"); - })(), -]); - -try { - await p; -} catch (error) { - console.log(error.stack); - throw error; -} diff --git a/cli/tests/error_024_stack_promise_all.ts.out b/cli/tests/error_024_stack_promise_all.ts.out deleted file mode 100644 index 31e15c372..000000000 --- a/cli/tests/error_024_stack_promise_all.ts.out +++ /dev/null @@ -1,10 +0,0 @@ -[WILDCARD]Error: Promise.all() - at [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD] - at async Promise.all (index 1) - at async [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD] -error: Uncaught Error: Promise.all() - throw new Error("Promise.all()"); - ^ - at [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD] - at async Promise.all (index 1) - at async [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD] diff --git a/cli/tests/error_025_tab_indent b/cli/tests/error_025_tab_indent deleted file mode 100644 index 35a25bcea..000000000 --- a/cli/tests/error_025_tab_indent +++ /dev/null @@ -1,9 +0,0 @@ -function foo() { - throw Error("bad"); -} - -function bar() { - foo(); -} - -bar(); diff --git a/cli/tests/error_025_tab_indent.out b/cli/tests/error_025_tab_indent.out deleted file mode 100644 index 7b339c48f..000000000 --- a/cli/tests/error_025_tab_indent.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught Error: bad - throw Error("bad"); - ^ - at foo ([WILDCARD]tests/error_025_tab_indent:2:8) - at bar ([WILDCARD]tests/error_025_tab_indent:6:2) - at [WILDCARD]tests/error_025_tab_indent:9:1 diff --git a/cli/tests/error_026_remote_import_error.ts b/cli/tests/error_026_remote_import_error.ts deleted file mode 100644 index 1ab600cfa..000000000 --- a/cli/tests/error_026_remote_import_error.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/cli/tests/error_001.ts"; diff --git a/cli/tests/error_026_remote_import_error.ts.out b/cli/tests/error_026_remote_import_error.ts.out deleted file mode 100644 index e2d6545ef..000000000 --- a/cli/tests/error_026_remote_import_error.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -[WILDCARD]error: Uncaught Error: bad - throw Error("bad"); - ^ - at foo (http://localhost:4545/cli/tests/error_001.ts:2:9) - at bar (http://localhost:4545/cli/tests/error_001.ts:6:3) - at http://localhost:4545/cli/tests/error_001.ts:9:1 -[WILDCARD] diff --git a/cli/tests/error_027_bundle_with_bare_import.ts b/cli/tests/error_027_bundle_with_bare_import.ts deleted file mode 100644 index c0748305d..000000000 --- a/cli/tests/error_027_bundle_with_bare_import.ts +++ /dev/null @@ -1 +0,0 @@ -import "foo"; diff --git a/cli/tests/error_027_bundle_with_bare_import.ts.out b/cli/tests/error_027_bundle_with_bare_import.ts.out deleted file mode 100644 index 3aa4a42a2..000000000 --- a/cli/tests/error_027_bundle_with_bare_import.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ from "file:///[WILDCARD]/error_027_bundle_with_bare_import.ts" diff --git a/cli/tests/error_import_map_unable_to_load.out b/cli/tests/error_import_map_unable_to_load.out deleted file mode 100644 index 50760e438..000000000 --- a/cli/tests/error_import_map_unable_to_load.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Unable to load '[WILDCARD]' import map - -Caused by: - [WILDCARD] \ No newline at end of file diff --git a/cli/tests/error_local_static_import_from_remote.js b/cli/tests/error_local_static_import_from_remote.js deleted file mode 100644 index eb7fd23ba..000000000 --- a/cli/tests/error_local_static_import_from_remote.js +++ /dev/null @@ -1 +0,0 @@ -import "file:///some/dir/file.js"; diff --git a/cli/tests/error_local_static_import_from_remote.js.out b/cli/tests/error_local_static_import_from_remote.js.out deleted file mode 100644 index 071ca36d4..000000000 --- a/cli/tests/error_local_static_import_from_remote.js.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. - Importing: file:///some/dir/file.js - at http://localhost:4545/cli/tests/error_local_static_import_from_remote.js:1:0 diff --git a/cli/tests/error_local_static_import_from_remote.ts b/cli/tests/error_local_static_import_from_remote.ts deleted file mode 100644 index a831db0c4..000000000 --- a/cli/tests/error_local_static_import_from_remote.ts +++ /dev/null @@ -1 +0,0 @@ -import "file:///some/dir/file.ts"; diff --git a/cli/tests/error_local_static_import_from_remote.ts.out b/cli/tests/error_local_static_import_from_remote.ts.out deleted file mode 100644 index 38f4c02bc..000000000 --- a/cli/tests/error_local_static_import_from_remote.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. - Importing: file:///some/dir/file.ts - at http://localhost:4545/cli/tests/error_local_static_import_from_remote.ts:1:0 diff --git a/cli/tests/error_missing_module_named_import.ts b/cli/tests/error_missing_module_named_import.ts deleted file mode 100644 index 9eb5239ff..000000000 --- a/cli/tests/error_missing_module_named_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { a } from "./does_not_exist.js"; - -console.log(a); diff --git a/cli/tests/error_missing_module_named_import.ts.out b/cli/tests/error_missing_module_named_import.ts.out deleted file mode 100644 index 4da7c2885..000000000 --- a/cli/tests/error_missing_module_named_import.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Cannot resolve module "[WILDCARD]cli/tests/does_not_exist.js" from "[WILDCARD]cli/tests/error_missing_module_named_import.ts". - at [WILDCARD]cli/tests/error_missing_module_named_import.ts:1:0 diff --git a/cli/tests/error_no_check.ts b/cli/tests/error_no_check.ts deleted file mode 100644 index db9257a1d..000000000 --- a/cli/tests/error_no_check.ts +++ /dev/null @@ -1 +0,0 @@ -export { AnInterface, isAnInterface } from "./subdir/type_and_code.ts"; diff --git a/cli/tests/error_no_check.ts.out b/cli/tests/error_no_check.ts.out deleted file mode 100644 index cac1367ba..000000000 --- a/cli/tests/error_no_check.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Uncaught SyntaxError: The requested module './subdir/type_and_code.ts' does not provide an export named 'AnInterface' -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/error_syntax.js b/cli/tests/error_syntax.js deleted file mode 100644 index c0414c356..000000000 --- a/cli/tests/error_syntax.js +++ /dev/null @@ -1,3 +0,0 @@ - -// deno-fmt-ignore-file -(the following is a syntax error ^^ ! ) diff --git a/cli/tests/error_syntax.js.out b/cli/tests/error_syntax.js.out deleted file mode 100644 index d458bae49..000000000 --- a/cli/tests/error_syntax.js.out +++ /dev/null @@ -1 +0,0 @@ -error: Expected ,, got following at [WILDCARD]tests/error_syntax.js:3:5 diff --git a/cli/tests/error_syntax_empty_trailing_line.mjs b/cli/tests/error_syntax_empty_trailing_line.mjs deleted file mode 100644 index 864dfb0c7..000000000 --- a/cli/tests/error_syntax_empty_trailing_line.mjs +++ /dev/null @@ -1,2 +0,0 @@ -// Deliberately using .mjs to avoid triggering dprint -setTimeout(() => {}), diff --git a/cli/tests/error_syntax_empty_trailing_line.mjs.out b/cli/tests/error_syntax_empty_trailing_line.mjs.out deleted file mode 100644 index 3b78a23a6..000000000 --- a/cli/tests/error_syntax_empty_trailing_line.mjs.out +++ /dev/null @@ -1 +0,0 @@ -error: Unexpected eof at [WILDCARD]tests/error_syntax_empty_trailing_line.mjs:2:21 diff --git a/cli/tests/error_type_definitions.ts b/cli/tests/error_type_definitions.ts deleted file mode 100644 index ceb11787e..000000000 --- a/cli/tests/error_type_definitions.ts +++ /dev/null @@ -1,5 +0,0 @@ -// @deno-types="./type_definitions/bar.d.ts" -import { Bar } from "./type_definitions/bar.js"; - -const bar = new Bar(); -console.log(bar); diff --git a/cli/tests/error_type_definitions.ts.out b/cli/tests/error_type_definitions.ts.out deleted file mode 100644 index 304ec1bdf..000000000 --- a/cli/tests/error_type_definitions.ts.out +++ /dev/null @@ -1 +0,0 @@ -[WILDCARD]error: Relative import path "baz" not prefixed with / or ./ or ../ from "[WILDCARD]/type_definitions/bar.d.ts" diff --git a/cli/tests/error_worker_permissions_local.ts b/cli/tests/error_worker_permissions_local.ts deleted file mode 100644 index b43c8fe94..000000000 --- a/cli/tests/error_worker_permissions_local.ts +++ /dev/null @@ -1,4 +0,0 @@ -new Worker( - new URL("./subdeb/worker_types.ts", import.meta.url).toString(), - { type: "module" }, -); diff --git a/cli/tests/error_worker_permissions_local.ts.out b/cli/tests/error_worker_permissions_local.ts.out deleted file mode 100644 index e6404e8e3..000000000 --- a/cli/tests/error_worker_permissions_local.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -error: Uncaught (in worker "") Requires read access to "[WILDCARD]worker_types.ts", run again with the --allow-read flag -[WILDCARD] diff --git a/cli/tests/error_worker_permissions_remote.ts b/cli/tests/error_worker_permissions_remote.ts deleted file mode 100644 index 9fd1ba5a8..000000000 --- a/cli/tests/error_worker_permissions_remote.ts +++ /dev/null @@ -1,4 +0,0 @@ -new Worker( - "http://localhost:4545/cli/tests/subdir/worker_types.ts", - { type: "module" }, -); diff --git a/cli/tests/error_worker_permissions_remote.ts.out b/cli/tests/error_worker_permissions_remote.ts.out deleted file mode 100644 index 74c7c3974..000000000 --- a/cli/tests/error_worker_permissions_remote.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -error: Uncaught (in worker "") Requires net access to "localhost:4545", run again with the --allow-net flag -[WILDCARD] diff --git a/cli/tests/es_private_fields.js b/cli/tests/es_private_fields.js deleted file mode 100644 index b5f83e39c..000000000 --- a/cli/tests/es_private_fields.js +++ /dev/null @@ -1,15 +0,0 @@ -class Foo { - #field = "field"; - - setValue(val) { - this.#field = val; - } - - getValue() { - return this.#field; - } -} - -const bar = new Foo(); -bar.setValue("PRIVATE"); -console.log(bar.getValue()); diff --git a/cli/tests/es_private_fields.js.out b/cli/tests/es_private_fields.js.out deleted file mode 100644 index be1970b05..000000000 --- a/cli/tests/es_private_fields.js.out +++ /dev/null @@ -1 +0,0 @@ -PRIVATE diff --git a/cli/tests/esm_imports_a.js b/cli/tests/esm_imports_a.js deleted file mode 100644 index 673cd9aa3..000000000 --- a/cli/tests/esm_imports_a.js +++ /dev/null @@ -1,3 +0,0 @@ -import { retb } from "./esm_imports_b.js"; - -if (retb() != "b") throw Error(); diff --git a/cli/tests/esm_imports_b.js b/cli/tests/esm_imports_b.js deleted file mode 100644 index 840121368..000000000 --- a/cli/tests/esm_imports_b.js +++ /dev/null @@ -1,4 +0,0 @@ -// deno-lint-ignore-file -export function retb() { - return "b"; -} diff --git a/cli/tests/exec_path.ts b/cli/tests/exec_path.ts deleted file mode 100644 index b70b23237..000000000 --- a/cli/tests/exec_path.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(Deno.execPath()); diff --git a/cli/tests/exit_error42.ts b/cli/tests/exit_error42.ts deleted file mode 100644 index e4db41f3a..000000000 --- a/cli/tests/exit_error42.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log("before"); -Deno.exit(42); -console.log("after"); diff --git a/cli/tests/exit_error42.ts.out b/cli/tests/exit_error42.ts.out deleted file mode 100644 index 90be1f305..000000000 --- a/cli/tests/exit_error42.ts.out +++ /dev/null @@ -1 +0,0 @@ -before diff --git a/cli/tests/export_type_def.ts b/cli/tests/export_type_def.ts deleted file mode 100644 index e33b70a64..000000000 --- a/cli/tests/export_type_def.ts +++ /dev/null @@ -1,2 +0,0 @@ -// @deno-types="./type_definitions/foo.d.ts" -export { foo } from "./type_definitions/foo.js"; diff --git a/cli/tests/fetch/hello.txt b/cli/tests/fetch/hello.txt deleted file mode 100644 index af5626b4a..000000000 --- a/cli/tests/fetch/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, world! diff --git a/cli/tests/fetch/other.ts b/cli/tests/fetch/other.ts deleted file mode 100644 index ab85b226f..000000000 --- a/cli/tests/fetch/other.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts"; diff --git a/cli/tests/fetch/test.ts b/cli/tests/fetch/test.ts deleted file mode 100644 index 1b49a76c8..000000000 --- a/cli/tests/fetch/test.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/cli/tests/subdir/mod2.ts"; diff --git a/cli/tests/fetch_response_finalization.js b/cli/tests/fetch_response_finalization.js deleted file mode 100644 index dd7c355eb..000000000 --- a/cli/tests/fetch_response_finalization.js +++ /dev/null @@ -1,16 +0,0 @@ -async function doAFetch() { - const resp = await fetch("http://localhost:4545/README.md"); - console.log(Deno.resources()); // print the current resources - const _resp = resp; - // at this point resp can be GC'ed -} - -await doAFetch(); // create a resource - -globalThis.gc(); // force GC - -// It is very important that there is a yield here, otherwise the finalizer for -// the response body is not called and the resource is not closed. -await new Promise((resolve) => setTimeout(resolve, 0)); - -console.log(Deno.resources()); // print the current resources diff --git a/cli/tests/fetch_response_finalization.js.out b/cli/tests/fetch_response_finalization.js.out deleted file mode 100644 index 844a4e4b2..000000000 --- a/cli/tests/fetch_response_finalization.js.out +++ /dev/null @@ -1,2 +0,0 @@ -{ "0": "stdin", "1": "stdout", "2": "stderr", "5": "fetchResponseBody" } -{ "0": "stdin", "1": "stdout", "2": "stderr" } diff --git a/cli/tests/file_exists.ts b/cli/tests/file_exists.ts deleted file mode 100644 index 20de4d4f2..000000000 --- a/cli/tests/file_exists.ts +++ /dev/null @@ -1,6 +0,0 @@ -try { - await Deno.open(Deno.args[0]); - Deno.exit(0); -} catch (_e) { - Deno.exit(1); -} diff --git a/cli/tests/finalization_registry.js b/cli/tests/finalization_registry.js deleted file mode 100644 index f75979358..000000000 --- a/cli/tests/finalization_registry.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -"use strict"; - -function assertEquals(a, b) { - if (a === b) return; - throw a + " does not equal " + b; -} - -const registry = new FinalizationRegistry((value) => { - assertEquals(value, "called!"); - Deno.core.print("FinalizationRegistry called!\n"); -}); - -(function () { - let x = {}; - registry.register(x, "called!"); - x = null; -})(); - -gc(); diff --git a/cli/tests/finalization_registry.js.out b/cli/tests/finalization_registry.js.out deleted file mode 100644 index fee61413a..000000000 --- a/cli/tests/finalization_registry.js.out +++ /dev/null @@ -1 +0,0 @@ -FinalizationRegistry called! diff --git a/cli/tests/fix_dynamic_import_errors.js b/cli/tests/fix_dynamic_import_errors.js deleted file mode 100644 index 317047ccb..000000000 --- a/cli/tests/fix_dynamic_import_errors.js +++ /dev/null @@ -1,7 +0,0 @@ -import("./dynamic_import/b.js").catch(() => { - console.log("caught import error from b.js"); -}); - -import("./dynamic_import/c.js").catch(() => { - console.log("caught import error from c.js"); -}); diff --git a/cli/tests/fix_dynamic_import_errors.js.out b/cli/tests/fix_dynamic_import_errors.js.out deleted file mode 100644 index e7856fb9c..000000000 --- a/cli/tests/fix_dynamic_import_errors.js.out +++ /dev/null @@ -1,2 +0,0 @@ -caught import error from [WILDCARD].js -caught import error from [WILDCARD].js diff --git a/cli/tests/fix_emittable_skipped.js b/cli/tests/fix_emittable_skipped.js deleted file mode 100644 index f61907b06..000000000 --- a/cli/tests/fix_emittable_skipped.js +++ /dev/null @@ -1,7 +0,0 @@ -/// - -import "./subdir/polyfill.ts"; - -export const a = "a"; - -console.log(globalThis.polyfill); diff --git a/cli/tests/fix_emittable_skipped.ts.out b/cli/tests/fix_emittable_skipped.ts.out deleted file mode 100644 index 108c2d67f..000000000 --- a/cli/tests/fix_emittable_skipped.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -[Function] diff --git a/cli/tests/fix_exotic_specifiers.ts b/cli/tests/fix_exotic_specifiers.ts deleted file mode 100644 index 101667b2a..000000000 --- a/cli/tests/fix_exotic_specifiers.ts +++ /dev/null @@ -1,3 +0,0 @@ -import clone from "https://jspm.dev/lodash@4/clone"; - -console.log(clone); diff --git a/cli/tests/fix_exotic_specifiers.ts.out b/cli/tests/fix_exotic_specifiers.ts.out deleted file mode 100644 index 7afdb808d..000000000 --- a/cli/tests/fix_exotic_specifiers.ts.out +++ /dev/null @@ -1 +0,0 @@ -[Function: clone] diff --git a/cli/tests/fix_js_import_js.ts b/cli/tests/fix_js_import_js.ts deleted file mode 100644 index c9f341748..000000000 --- a/cli/tests/fix_js_import_js.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { isMod4 } from "./subdir/mod6.js"; - -console.log(isMod4); diff --git a/cli/tests/fix_js_import_js.ts.out b/cli/tests/fix_js_import_js.ts.out deleted file mode 100644 index 27ba77dda..000000000 --- a/cli/tests/fix_js_import_js.ts.out +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/cli/tests/fix_js_imports.ts b/cli/tests/fix_js_imports.ts deleted file mode 100644 index 4770b1ab6..000000000 --- a/cli/tests/fix_js_imports.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as amdLike from "./subdir/amd_like.js"; - -console.log(amdLike); diff --git a/cli/tests/fix_js_imports.ts.out b/cli/tests/fix_js_imports.ts.out deleted file mode 100644 index 5e45122de..000000000 --- a/cli/tests/fix_js_imports.ts.out +++ /dev/null @@ -1 +0,0 @@ -Module {} diff --git a/cli/tests/fix_tsc_file_exists.out b/cli/tests/fix_tsc_file_exists.out deleted file mode 100644 index ce0136250..000000000 --- a/cli/tests/fix_tsc_file_exists.out +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/cli/tests/fix_worker_dispatchevent.ts b/cli/tests/fix_worker_dispatchevent.ts deleted file mode 100644 index 1b73b52dc..000000000 --- a/cli/tests/fix_worker_dispatchevent.ts +++ /dev/null @@ -1,43 +0,0 @@ -const code = ` -addEventListener("message", () => { - postMessage("pong"); -}); - -const context = new EventTarget(); - -Object.defineProperty(globalThis, "dispatchEvent", { - value: context.dispatchEvent.bind(context), - writable: true, - enumerable: true, - configurable: true, -}); - -postMessage("start"); -`; - -const blob = new Blob([code], { type: "application/javascript" }); - -const url = URL.createObjectURL(blob); - -const worker = new Worker(url, { type: "module" }); - -let terminated = false; - -worker.addEventListener("message", (evt) => { - if (evt.data === "start") { - worker.postMessage("ping"); - } else if (evt.data === "pong") { - worker.terminate(); - terminated = true; - console.log("success"); - } else { - throw new Error("unexpected message from worker"); - } -}); - -setTimeout(() => { - if (!terminated) { - worker.terminate(); - throw new Error("did not receive message from worker in time"); - } -}, 2000); diff --git a/cli/tests/fix_worker_dispatchevent.ts.out b/cli/tests/fix_worker_dispatchevent.ts.out deleted file mode 100644 index 2e9ba477f..000000000 --- a/cli/tests/fix_worker_dispatchevent.ts.out +++ /dev/null @@ -1 +0,0 @@ -success diff --git a/cli/tests/fixture.json b/cli/tests/fixture.json deleted file mode 100644 index 56e056b6a..000000000 --- a/cli/tests/fixture.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "deno", - "private": true, - "devDependencies": { - "@types/prettier": "1.16.1", - "@typescript-eslint/eslint-plugin": "2.5.0", - "@typescript-eslint/parser": "2.5.0", - "eslint": "5.15.1", - "eslint-config-prettier": "4.1.0", - "magic-string": "0.25.2", - "prettier": "1.17.1", - "typescript": "3.6.3" - } -} diff --git a/cli/tests/fmt/expected_fmt_check_formatted_files.out b/cli/tests/fmt/expected_fmt_check_formatted_files.out deleted file mode 100644 index 5a4833dd4..000000000 --- a/cli/tests/fmt/expected_fmt_check_formatted_files.out +++ /dev/null @@ -1 +0,0 @@ -Checked 4 files diff --git a/cli/tests/fmt/expected_fmt_check_ignore.out b/cli/tests/fmt/expected_fmt_check_ignore.out deleted file mode 100644 index 7c1e471b9..000000000 --- a/cli/tests/fmt/expected_fmt_check_ignore.out +++ /dev/null @@ -1 +0,0 @@ -Checked 3 files diff --git a/cli/tests/fmt/expected_fmt_check_tests_dir.out b/cli/tests/fmt/expected_fmt_check_tests_dir.out deleted file mode 100644 index e2dc2b4ae..000000000 --- a/cli/tests/fmt/expected_fmt_check_tests_dir.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -error: Found 6 not formatted files in [WILDCARD] files diff --git a/cli/tests/fmt/expected_fmt_check_verbose_formatted_files.out b/cli/tests/fmt/expected_fmt_check_verbose_formatted_files.out deleted file mode 100644 index 158c556c2..000000000 --- a/cli/tests/fmt/expected_fmt_check_verbose_formatted_files.out +++ /dev/null @@ -1 +0,0 @@ -Checked 2 files diff --git a/cli/tests/fmt/expected_fmt_check_verbose_tests_dir.out b/cli/tests/fmt/expected_fmt_check_verbose_tests_dir.out deleted file mode 100644 index 04cd5ec64..000000000 --- a/cli/tests/fmt/expected_fmt_check_verbose_tests_dir.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -error: Found 1 not formatted file in [WILDCARD] files diff --git a/cli/tests/fmt/formatted1.js b/cli/tests/fmt/formatted1.js deleted file mode 100644 index 587aa5b96..000000000 --- a/cli/tests/fmt/formatted1.js +++ /dev/null @@ -1,5 +0,0 @@ -function foo() { - return 42; -} - -foo(); diff --git a/cli/tests/fmt/formatted2.ts b/cli/tests/fmt/formatted2.ts deleted file mode 100644 index 4a8036806..000000000 --- a/cli/tests/fmt/formatted2.ts +++ /dev/null @@ -1,5 +0,0 @@ -function bar(): number { - return 42; -} - -bar(); diff --git a/cli/tests/fmt/formatted3.md b/cli/tests/fmt/formatted3.md deleted file mode 100644 index e6e616584..000000000 --- a/cli/tests/fmt/formatted3.md +++ /dev/null @@ -1,17 +0,0 @@ -# Hello - -```js -function foo() { - return 42; -} - -foo(); -``` - -```ts -function bar(): number { - return 42; -} - -bar(); -``` diff --git a/cli/tests/fmt/formatted4.jsonc b/cli/tests/fmt/formatted4.jsonc deleted file mode 100644 index f0f72a6ed..000000000 --- a/cli/tests/fmt/formatted4.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - // Comment - "key": "value" -} diff --git a/cli/tests/heapstats.js b/cli/tests/heapstats.js deleted file mode 100644 index 675fac2d6..000000000 --- a/cli/tests/heapstats.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -"use strict"; - -function allocTest(alloc, allocAssert, deallocAssert) { - // Helper func that GCs then returns memory usage - const sample = () => { - // deno-lint-ignore no-undef - gc(); - return Deno.memoryUsage(); - }; - const delta = (t1, t2) => t2.heapUsed - t1.heapUsed; - - // Sample "clean" heap usage - const t1 = sample(); - - // Alloc - // deno-lint-ignore no-unused-vars - let x = alloc(); - const t2 = sample(); - allocAssert(delta(t1, t2)); - - // Free - x = null; - const t3 = sample(); - deallocAssert(delta(t2, t3)); -} - -function main() { - // Large-array test, 1M slot array consumes ~4MB (4B per slot) - allocTest( - () => new Array(1e6), - (delta) => console.log("Allocated:", Math.round(delta / 1e6) + "MB"), - (delta) => console.log("Freed:", Math.round(delta / 1e6) + "MB"), - ); -} - -main(); diff --git a/cli/tests/heapstats.js.out b/cli/tests/heapstats.js.out deleted file mode 100644 index b75a755f8..000000000 --- a/cli/tests/heapstats.js.out +++ /dev/null @@ -1,2 +0,0 @@ -Allocated: 4MB -Freed: -4MB diff --git a/cli/tests/hello.txt b/cli/tests/hello.txt deleted file mode 100644 index 6769dd60b..000000000 --- a/cli/tests/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! \ No newline at end of file diff --git a/cli/tests/https_import.ts b/cli/tests/https_import.ts deleted file mode 100644 index e78a342a0..000000000 --- a/cli/tests/https_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello } from "https://localhost:5545/cli/tests/subdir/print_hello.ts"; - -printHello(); diff --git a/cli/tests/https_import.ts.out b/cli/tests/https_import.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/https_import.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/if_main.ts b/cli/tests/if_main.ts deleted file mode 100644 index 4dcfecea0..000000000 --- a/cli/tests/if_main.ts +++ /dev/null @@ -1,6 +0,0 @@ -if (import.meta.main) { - console.log("main"); -} else { - console.log("import.meta.url", import.meta.url); - throw Error("not main"); -} diff --git a/cli/tests/if_main.ts.out b/cli/tests/if_main.ts.out deleted file mode 100644 index ba2906d06..000000000 --- a/cli/tests/if_main.ts.out +++ /dev/null @@ -1 +0,0 @@ -main diff --git a/cli/tests/ignore_require.js b/cli/tests/ignore_require.js deleted file mode 100644 index a8ef15021..000000000 --- a/cli/tests/ignore_require.js +++ /dev/null @@ -1,2 +0,0 @@ -// deno-lint-ignore-file -require("invalid module specifier"); diff --git a/cli/tests/import_blob_url.ts b/cli/tests/import_blob_url.ts deleted file mode 100644 index 86bb634e1..000000000 --- a/cli/tests/import_blob_url.ts +++ /dev/null @@ -1,13 +0,0 @@ -const blob = new Blob( - ['export const a = "a";\n\nexport enum A {\n A,\n B,\n C,\n}\n'], - { - type: "application/typescript", - }, -); -const url = URL.createObjectURL(blob); - -const a = await import(url); - -console.log(a.a); -console.log(a.A); -console.log(a.A.A); diff --git a/cli/tests/import_blob_url.ts.out b/cli/tests/import_blob_url.ts.out deleted file mode 100644 index bfa0b9d94..000000000 --- a/cli/tests/import_blob_url.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -a -{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } -0 diff --git a/cli/tests/import_blob_url_error_stack.ts b/cli/tests/import_blob_url_error_stack.ts deleted file mode 100644 index f9c4f2e9d..000000000 --- a/cli/tests/import_blob_url_error_stack.ts +++ /dev/null @@ -1,13 +0,0 @@ -const blob = new Blob( - [ - "enum A {\n A,\n B,\n C,\n }\n \n export function a() {\n throw new Error(`Hello ${A.C}`);\n }\n ", - ], - { - type: "application/typescript", - }, -); -const url = URL.createObjectURL(blob); - -const { a } = await import(url); - -a(); diff --git a/cli/tests/import_blob_url_error_stack.ts.out b/cli/tests/import_blob_url_error_stack.ts.out deleted file mode 100644 index 18ca023e3..000000000 --- a/cli/tests/import_blob_url_error_stack.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught (in promise) Error: Hello 2 - throw new Error(`Hello ${A.C}`); - ^ - at a (blob:null/[WILDCARD]:8:10) - at file:///[WILDCARD]/cli/tests/import_blob_url_error_stack.ts:13:1 -[WILDCARD] diff --git a/cli/tests/import_blob_url_import_relative.ts b/cli/tests/import_blob_url_import_relative.ts deleted file mode 100644 index ad130bdac..000000000 --- a/cli/tests/import_blob_url_import_relative.ts +++ /dev/null @@ -1,8 +0,0 @@ -const blob = new Blob(['export { a } from "./a.ts";'], { - type: "application/javascript", -}); -const url = URL.createObjectURL(blob); - -const a = await import(url); - -console.log(a); diff --git a/cli/tests/import_blob_url_import_relative.ts.out b/cli/tests/import_blob_url_import_relative.ts.out deleted file mode 100644 index 9d47ab719..000000000 --- a/cli/tests/import_blob_url_import_relative.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in promise) TypeError: invalid URL: relative URL with a cannot-be-a-base base -const a = await import(url); - ^ - at async file://[WILDCARD]/cli/tests/import_blob_url_import_relative.ts:6:11 diff --git a/cli/tests/import_blob_url_imports.ts b/cli/tests/import_blob_url_imports.ts deleted file mode 100644 index 7c2b10865..000000000 --- a/cli/tests/import_blob_url_imports.ts +++ /dev/null @@ -1,11 +0,0 @@ -const blob = new Blob( - [ - 'export { printHello } from "http://localhost:4545/cli/tests/subdir/mod2.ts"', - ], - { type: "application/javascript" }, -); -const url = URL.createObjectURL(blob); - -const { printHello } = await import(url); - -printHello(); diff --git a/cli/tests/import_blob_url_imports.ts.out b/cli/tests/import_blob_url_imports.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/import_blob_url_imports.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/import_blob_url_jsx.ts b/cli/tests/import_blob_url_jsx.ts deleted file mode 100644 index 8d645796a..000000000 --- a/cli/tests/import_blob_url_jsx.ts +++ /dev/null @@ -1,16 +0,0 @@ -const blob = new Blob( - ["export default function() {\n return
Hello Deno!
\n}\n"], - { type: "text/jsx" }, -); -const url = URL.createObjectURL(blob); - -const { default: render } = await import(url); - -// deno-lint-ignore no-explicit-any -(globalThis as any).React = { - createElement(...args: unknown[]) { - console.log(...args); - }, -}; - -render(); diff --git a/cli/tests/import_blob_url_jsx.ts.out b/cli/tests/import_blob_url_jsx.ts.out deleted file mode 100644 index c1c85f250..000000000 --- a/cli/tests/import_blob_url_jsx.ts.out +++ /dev/null @@ -1 +0,0 @@ -div null Hello Deno! diff --git a/cli/tests/import_data_url.ts b/cli/tests/import_data_url.ts deleted file mode 100644 index 258514a5e..000000000 --- a/cli/tests/import_data_url.ts +++ /dev/null @@ -1,12 +0,0 @@ -// export const a = "a"; - -// export enum A { -// A, -// B, -// C, -// } -import * as a from "data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo="; - -console.log(a.a); -console.log(a.A); -console.log(a.A.A); diff --git a/cli/tests/import_data_url.ts.out b/cli/tests/import_data_url.ts.out deleted file mode 100644 index bfa0b9d94..000000000 --- a/cli/tests/import_data_url.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -a -{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } -0 diff --git a/cli/tests/import_data_url_error_stack.ts b/cli/tests/import_data_url_error_stack.ts deleted file mode 100644 index 022e49fe1..000000000 --- a/cli/tests/import_data_url_error_stack.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { a } from "data:application/typescript;base64,ZW51bSBBIHsKICBBLAogIEIsCiAgQywKIH0KIAogZXhwb3J0IGZ1bmN0aW9uIGEoKSB7CiAgIHRocm93IG5ldyBFcnJvcihgSGVsbG8gJHtBLkN9YCk7CiB9CiA="; - -a(); diff --git a/cli/tests/import_data_url_error_stack.ts.out b/cli/tests/import_data_url_error_stack.ts.out deleted file mode 100644 index 466c1beed..000000000 --- a/cli/tests/import_data_url_error_stack.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD]error: Uncaught Error: Hello 2 - throw new Error(`Hello ${A.C}`); - ^ - at a (data:application/typescript;base64,ZW51bSBBIHsKICBBLAogIEIsCiAgQywKIH0KIAogZXhwb3J0IGZ1bmN0aW9uIGEoKSB7CiAgIHRocm93IG5ldyBFcnJvcihgSGVsbG8gJHtBLkN9YCk7CiB9CiA=:8:10) - at file:///[WILDCARD]/cli/tests/import_data_url_error_stack.ts:3:1 -[WILDCARD] diff --git a/cli/tests/import_data_url_import_relative.ts b/cli/tests/import_data_url_import_relative.ts deleted file mode 100644 index 23947fe60..000000000 --- a/cli/tests/import_data_url_import_relative.ts +++ /dev/null @@ -1,4 +0,0 @@ -// export { a } from "./a.ts"; -import * as a from "data:application/javascript;base64,ZXhwb3J0IHsgYSB9IGZyb20gIi4vYS50cyI7Cg=="; - -console.log(a); diff --git a/cli/tests/import_data_url_import_relative.ts.out b/cli/tests/import_data_url_import_relative.ts.out deleted file mode 100644 index 1f4f3e9ef..000000000 --- a/cli/tests/import_data_url_import_relative.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: invalid URL: relative URL with a cannot-be-a-base base - -Caused by: - relative URL with a cannot-be-a-base base diff --git a/cli/tests/import_data_url_imports.ts b/cli/tests/import_data_url_imports.ts deleted file mode 100644 index f25c2c389..000000000 --- a/cli/tests/import_data_url_imports.ts +++ /dev/null @@ -1,4 +0,0 @@ -// export { printHello } from "http://localhost:4545/cli/tests/subdir/mod2.ts"; -import { printHello } from "data:application/typescript;base64,ZXhwb3J0IHsgcHJpbnRIZWxsbyB9IGZyb20gImh0dHA6Ly9sb2NhbGhvc3Q6NDU0NS9jbGkvdGVzdHMvc3ViZGlyL21vZDIudHMiOwo="; - -printHello(); diff --git a/cli/tests/import_data_url_imports.ts.out b/cli/tests/import_data_url_imports.ts.out deleted file mode 100644 index e965047ad..000000000 --- a/cli/tests/import_data_url_imports.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/cli/tests/import_data_url_jsx.ts b/cli/tests/import_data_url_jsx.ts deleted file mode 100644 index 1881211f9..000000000 --- a/cli/tests/import_data_url_jsx.ts +++ /dev/null @@ -1,10 +0,0 @@ -import render from "data:text/jsx;base64,ZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24oKSB7CiAgcmV0dXJuIDxkaXY+SGVsbG8gRGVubyE8L2Rpdj4KfQo="; - -// deno-lint-ignore no-explicit-any -(globalThis as any).React = { - createElement(...args: unknown[]) { - console.log(...args); - }, -}; - -render(); diff --git a/cli/tests/import_data_url_jsx.ts.out b/cli/tests/import_data_url_jsx.ts.out deleted file mode 100644 index c1c85f250..000000000 --- a/cli/tests/import_data_url_jsx.ts.out +++ /dev/null @@ -1 +0,0 @@ -div null Hello Deno! diff --git a/cli/tests/import_dynamic_data_url.ts b/cli/tests/import_dynamic_data_url.ts deleted file mode 100644 index 53a0fbcd3..000000000 --- a/cli/tests/import_dynamic_data_url.ts +++ /dev/null @@ -1,14 +0,0 @@ -// export const a = "a"; - -// export enum A { -// A, -// B, -// C, -// } -const a = await import( - "data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=" -); - -console.log(a.a); -console.log(a.A); -console.log(a.A.A); diff --git a/cli/tests/import_dynamic_data_url.ts.out b/cli/tests/import_dynamic_data_url.ts.out deleted file mode 100644 index bfa0b9d94..000000000 --- a/cli/tests/import_dynamic_data_url.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -a -{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } -0 diff --git a/cli/tests/import_file_with_colon.ts b/cli/tests/import_file_with_colon.ts deleted file mode 100644 index 5a2bbceb6..000000000 --- a/cli/tests/import_file_with_colon.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/cli/tests/subdir/file_with_:_in_name.ts"; diff --git a/cli/tests/import_file_with_colon.ts.out b/cli/tests/import_file_with_colon.ts.out deleted file mode 100644 index f60bbf4b1..000000000 --- a/cli/tests/import_file_with_colon.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello from file_with_:_in_name.ts diff --git a/cli/tests/import_maps/import_map.json b/cli/tests/import_maps/import_map.json deleted file mode 100644 index 601874aab..000000000 --- a/cli/tests/import_maps/import_map.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "imports": { - "moment": "./moment/moment.ts", - "moment/": "./moment/", - "lodash": "./lodash/lodash.ts", - "lodash/": "./lodash/", - "https://www.unpkg.com/vue/dist/vue.runtime.esm.js": "./vue.ts" - }, - "scopes": { - "scope/": { - "moment": "./scoped_moment.ts" - } - } -} diff --git a/cli/tests/import_maps/import_map_remote.json b/cli/tests/import_maps/import_map_remote.json deleted file mode 100644 index 51f90f69c..000000000 --- a/cli/tests/import_maps/import_map_remote.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "imports": { - "moment": "./moment/moment.ts", - "moment/": "./moment/", - "lodash": "./lodash/lodash.ts", - "lodash/": "./lodash/", - "https://www.unpkg.com/vue/dist/vue.runtime.esm.js": "./vue.ts" - } -} diff --git a/cli/tests/import_maps/lodash/lodash.ts b/cli/tests/import_maps/lodash/lodash.ts deleted file mode 100644 index 2ec04ed3c..000000000 --- a/cli/tests/import_maps/lodash/lodash.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello from remapped lodash!"); diff --git a/cli/tests/import_maps/lodash/other_file.ts b/cli/tests/import_maps/lodash/other_file.ts deleted file mode 100644 index 714adae3f..000000000 --- a/cli/tests/import_maps/lodash/other_file.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello from remapped lodash dir!"); diff --git a/cli/tests/import_maps/moment/moment.ts b/cli/tests/import_maps/moment/moment.ts deleted file mode 100644 index 2b54a431e..000000000 --- a/cli/tests/import_maps/moment/moment.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello from remapped moment!"); diff --git a/cli/tests/import_maps/moment/other_file.ts b/cli/tests/import_maps/moment/other_file.ts deleted file mode 100644 index 24f3a0226..000000000 --- a/cli/tests/import_maps/moment/other_file.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello from remapped moment dir!"); diff --git a/cli/tests/import_maps/scope/scoped.ts b/cli/tests/import_maps/scope/scoped.ts deleted file mode 100644 index 9a0b5d8e3..000000000 --- a/cli/tests/import_maps/scope/scoped.ts +++ /dev/null @@ -1,2 +0,0 @@ -import "moment"; -console.log("Hello from scoped!"); diff --git a/cli/tests/import_maps/scoped_moment.ts b/cli/tests/import_maps/scoped_moment.ts deleted file mode 100644 index 9f67f88d4..000000000 --- a/cli/tests/import_maps/scoped_moment.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello from scoped moment!"); diff --git a/cli/tests/import_maps/test.ts b/cli/tests/import_maps/test.ts deleted file mode 100644 index 9b09e9953..000000000 --- a/cli/tests/import_maps/test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import "moment"; -import "moment/other_file.ts"; -import "lodash"; -import "lodash/other_file.ts"; -import "https://www.unpkg.com/vue/dist/vue.runtime.esm.js"; -import "./scope/scoped.ts"; diff --git a/cli/tests/import_maps/test_remote.ts b/cli/tests/import_maps/test_remote.ts deleted file mode 100644 index 206bdbd5f..000000000 --- a/cli/tests/import_maps/test_remote.ts +++ /dev/null @@ -1,5 +0,0 @@ -import "moment"; -import "moment/other_file.ts"; -import "lodash"; -import "lodash/other_file.ts"; -import "https://www.unpkg.com/vue/dist/vue.runtime.esm.js"; diff --git a/cli/tests/import_maps/vue.ts b/cli/tests/import_maps/vue.ts deleted file mode 100644 index 76dbe1917..000000000 --- a/cli/tests/import_maps/vue.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello from remapped Vue!"); diff --git a/cli/tests/import_meta.ts b/cli/tests/import_meta.ts deleted file mode 100644 index d111059ea..000000000 --- a/cli/tests/import_meta.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log("import_meta", import.meta.url, import.meta.main); - -import "./import_meta2.ts"; diff --git a/cli/tests/import_meta.ts.out b/cli/tests/import_meta.ts.out deleted file mode 100644 index f38aa98ea..000000000 --- a/cli/tests/import_meta.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -import_meta2 [WILDCARD]import_meta2.ts false -import_meta [WILDCARD]import_meta.ts true diff --git a/cli/tests/import_meta2.ts b/cli/tests/import_meta2.ts deleted file mode 100644 index 7f59a5a46..000000000 --- a/cli/tests/import_meta2.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("import_meta2", import.meta.url, import.meta.main); diff --git a/cli/tests/info/data_null_error/data_null_error.out b/cli/tests/info/data_null_error/data_null_error.out deleted file mode 100644 index 89961be65..000000000 --- a/cli/tests/info/data_null_error/data_null_error.out +++ /dev/null @@ -1,6 +0,0 @@ -local: [WILDCARD]mod.ts -type: TypeScript -dependencies: 1 unique (total [WILDCARD]) - -file://[WILDCARD]/mod.ts ([WILDCARD]) -└── file://[WILDCARD]/types.d.ts ([WILDCARD]) diff --git a/cli/tests/info/data_null_error/mod.ts b/cli/tests/info/data_null_error/mod.ts deleted file mode 100644 index 6e3e99bd4..000000000 --- a/cli/tests/info/data_null_error/mod.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/cli/tests/info/data_null_error/types.d.ts b/cli/tests/info/data_null_error/types.d.ts deleted file mode 100644 index 6ecc85676..000000000 --- a/cli/tests/info/data_null_error/types.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare class Test {} diff --git a/cli/tests/info/types_header.out b/cli/tests/info/types_header.out deleted file mode 100644 index d3b6e8c4e..000000000 --- a/cli/tests/info/types_header.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD] -local: [WILDCARD]type_directives_01.ts -type: TypeScript -dependencies: 2 unique (total [WILDCARD]) - -[WILDCARD]/type_directives_01.ts ([WILDCARD]) -└─┬ http://127.0.0.1:4545/xTypeScriptTypes.js ([WILDCARD]) - └── http://127.0.0.1:4545/xTypeScriptTypes.d.ts ([WILDCARD]) diff --git a/cli/tests/info_json.out b/cli/tests/info_json.out deleted file mode 100644 index 4ba5a95f4..000000000 --- a/cli/tests/info_json.out +++ /dev/null @@ -1,7 +0,0 @@ -{ - "denoDir": "[WILDCARD]", - "modulesCache": "[WILDCARD]deps", - "typescriptCache": "[WILDCARD]gen", - "registryCache": "[WILDCARD]registries", - "originStorage": "[WILDCARD]location_data" -} diff --git a/cli/tests/info_json_location.out b/cli/tests/info_json_location.out deleted file mode 100644 index 6c4cddefb..000000000 --- a/cli/tests/info_json_location.out +++ /dev/null @@ -1,8 +0,0 @@ -{ - "denoDir": "[WILDCARD]", - "modulesCache": "[WILDCARD]deps", - "typescriptCache": "[WILDCARD]gen", - "registryCache": "[WILDCARD]registries", - "originStorage": "[WILDCARD]location_data[WILDCARD]", - "localStorage": "[WILDCARD]location_data[WILDCARD]local_storage" -} diff --git a/cli/tests/info_missing_module.out b/cli/tests/info_missing_module.out deleted file mode 100644 index e01cd098e..000000000 --- a/cli/tests/info_missing_module.out +++ /dev/null @@ -1,6 +0,0 @@ -local: [WILDCARD]error_009_missing_js_module.js -type: JavaScript -dependencies: 1 unique (total 26B) - -file://[WILDCARD]/cli/tests/error_009_missing_js_module.js (26B) -└── file://[WILDCARD]/cli/tests/bad-module.js (error) diff --git a/cli/tests/info_recursive_imports_test.out b/cli/tests/info_recursive_imports_test.out deleted file mode 100644 index 7b53ed89b..000000000 --- a/cli/tests/info_recursive_imports_test.out +++ /dev/null @@ -1,12 +0,0 @@ -local: [WILDCARD]info_recursive_imports_test.ts -type: TypeScript -dependencies: 4 unique (total [WILDCARD]) - -file://[WILDCARD]cli/tests/info_recursive_imports_test.ts ([WILDCARD]) -└─┬ file://[WILDCARD]cli/tests/recursive_imports/A.ts ([WILDCARD]) - ├─┬ file://[WILDCARD]cli/tests/recursive_imports/B.ts ([WILDCARD]) - │ ├─┬ file://[WILDCARD]cli/tests/recursive_imports/C.ts ([WILDCARD]) - │ │ ├── file://[WILDCARD]cli/tests/recursive_imports/A.ts * - │ │ └── file://[WILDCARD]cli/tests/recursive_imports/common.ts ([WILDCARD]) - │ └── file://[WILDCARD]cli/tests/recursive_imports/common.ts * - └── file://[WILDCARD]cli/tests/recursive_imports/common.ts * diff --git a/cli/tests/info_recursive_imports_test.ts b/cli/tests/info_recursive_imports_test.ts deleted file mode 100644 index c9ba44755..000000000 --- a/cli/tests/info_recursive_imports_test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { A } from "./recursive_imports/A.ts"; - -export function test() { - A(); -} diff --git a/cli/tests/info_type_import.out b/cli/tests/info_type_import.out deleted file mode 100644 index 6b9869f1f..000000000 --- a/cli/tests/info_type_import.out +++ /dev/null @@ -1,5 +0,0 @@ -local: [WILDCARD]info_type_import.ts -type: TypeScript -dependencies: 1 unique (total [WILDCARD]) -[WILDCARD]info_type_import.ts ([WILDCARD]) -└── [WILDCARD]type_and_code.ts ([WILDCARD]) diff --git a/cli/tests/info_type_import.ts b/cli/tests/info_type_import.ts deleted file mode 100644 index eeef46c89..000000000 --- a/cli/tests/info_type_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { AnInterface as _, isAnInterface } from "./subdir/type_and_code.ts"; - -isAnInterface({}); diff --git a/cli/tests/inline_js_source_map.ts b/cli/tests/inline_js_source_map.ts deleted file mode 100644 index 5ae7c226a..000000000 --- a/cli/tests/inline_js_source_map.ts +++ /dev/null @@ -1,6 +0,0 @@ -1 + 1; -interface Test { - hello: string; -} - -// throw new Error("Hello world!" as string); diff --git a/cli/tests/inline_js_source_map_2.js b/cli/tests/inline_js_source_map_2.js deleted file mode 100644 index 199ff7bb0..000000000 --- a/cli/tests/inline_js_source_map_2.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -1 + 1; -throw new Error("Hello world!"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2NsaS90ZXN0cy9pbmxpbmVfanNfc291cmNlX21hcF8yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/cli/tests/inline_js_source_map_2.js.out b/cli/tests/inline_js_source_map_2.js.out deleted file mode 100644 index 13e50bac4..000000000 --- a/cli/tests/inline_js_source_map_2.js.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Uncaught Error: Hello world! - at http://localhost:4545/cli/tests/inline_js_source_map_2.ts:6:7 diff --git a/cli/tests/inline_js_source_map_2.ts b/cli/tests/inline_js_source_map_2.ts deleted file mode 100644 index fa50586e6..000000000 --- a/cli/tests/inline_js_source_map_2.ts +++ /dev/null @@ -1,6 +0,0 @@ -1 + 1; -interface Test { - hello: string; -} - -throw new Error("Hello world!" as unknown as string); diff --git a/cli/tests/inline_js_source_map_2_with_inline_contents.js b/cli/tests/inline_js_source_map_2_with_inline_contents.js deleted file mode 100644 index a225b3975..000000000 --- a/cli/tests/inline_js_source_map_2_with_inline_contents.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; - -throw new Error("Hello world!"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2NsaS90ZXN0cy9pbmxpbmVfanNfc291cmNlX21hcF8yLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIjErMTtcbmludGVyZmFjZSBUZXN0IHtcbiAgaGVsbG86IHN0cmluZztcbn1cblxudGhyb3cgbmV3IEVycm9yKFwiSGVsbG8gd29ybGQhXCIgYXMgdW5rbm93biBhcyBzdHJpbmcpO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/cli/tests/inline_js_source_map_2_with_inline_contents.js.out b/cli/tests/inline_js_source_map_2_with_inline_contents.js.out deleted file mode 100644 index c123de41e..000000000 --- a/cli/tests/inline_js_source_map_2_with_inline_contents.js.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught Error: Hello world! -throw new Error("Hello world!" as unknown as string); - ^ - at http://localhost:4545/cli/tests/inline_js_source_map_2.ts:6:7 diff --git a/cli/tests/inline_js_source_map_with_contents_from_graph.js b/cli/tests/inline_js_source_map_with_contents_from_graph.js deleted file mode 100644 index 5324e0ed2..000000000 --- a/cli/tests/inline_js_source_map_with_contents_from_graph.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -import "http://localhost:4545/cli/tests/inline_js_source_map.ts"; -throw new Error("Hello world!"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2NsaS90ZXN0cy9pbmxpbmVfanNfc291cmNlX21hcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsQ0FBQyxHQUFDLENBQUMsQ0FBQztBQUtKLE1BQU0sSUFBSSxLQUFLLENBQUMsY0FBK0IsQ0FBQyxDQUFDIn0= \ No newline at end of file diff --git a/cli/tests/inline_js_source_map_with_contents_from_graph.js.out b/cli/tests/inline_js_source_map_with_contents_from_graph.js.out deleted file mode 100644 index a0ba9fe98..000000000 --- a/cli/tests/inline_js_source_map_with_contents_from_graph.js.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught Error: Hello world! -// throw new Error("Hello world!" as string); - ^ - at http://localhost:4545/cli/tests/inline_js_source_map.ts:6:7 diff --git a/cli/tests/inspector1.js b/cli/tests/inspector1.js deleted file mode 100644 index 5cb059def..000000000 --- a/cli/tests/inspector1.js +++ /dev/null @@ -1,3 +0,0 @@ -setInterval(() => { - console.log("hello"); -}, 1000); diff --git a/cli/tests/inspector2.js b/cli/tests/inspector2.js deleted file mode 100644 index 57f80ef94..000000000 --- a/cli/tests/inspector2.js +++ /dev/null @@ -1,4 +0,0 @@ -console.log("hello from the script"); - -// This process will be killed before the timeout is over. -await new Promise((res, _) => setTimeout(res, 1000)); diff --git a/cli/tests/inspector3.js b/cli/tests/inspector3.js deleted file mode 100644 index b1b00b5a0..000000000 --- a/cli/tests/inspector3.js +++ /dev/null @@ -1,7 +0,0 @@ -// deno-lint-ignore-file -for (let i = 0; i < 128; i++) { - console.log(i); - debugger; -} -await new Promise((res, _) => setTimeout(res, 100)); -console.log("done"); diff --git a/cli/tests/inspector4.js b/cli/tests/inspector4.js deleted file mode 100644 index 1bf419650..000000000 --- a/cli/tests/inspector4.js +++ /dev/null @@ -1,5 +0,0 @@ -console.log("hello"); - -setInterval(() => { - console.log("hello from interval"); -}, 1000); diff --git a/cli/tests/integration/bundle_tests.rs b/cli/tests/integration/bundle_tests.rs index 1ef1a39f5..4e68af0b1 100644 --- a/cli/tests/integration/bundle_tests.rs +++ b/cli/tests/integration/bundle_tests.rs @@ -7,12 +7,12 @@ use test_util as util; #[test] fn bundle_exports() { // First we have to generate a bundle of some module that has exports. - let mod1 = util::root_path().join("cli/tests/subdir/mod1.ts"); + let mod1 = util::testdata_path().join("subdir/mod1.ts"); assert!(mod1.is_file()); let t = TempDir::new().expect("tempdir fail"); let bundle = t.path().join("mod1.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg(mod1) .arg(&bundle) @@ -33,7 +33,7 @@ fn bundle_exports() { .expect("error writing file"); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(&test) .output() @@ -49,12 +49,12 @@ fn bundle_exports() { #[test] fn bundle_exports_no_check() { // First we have to generate a bundle of some module that has exports. - let mod1 = util::root_path().join("cli/tests/subdir/mod1.ts"); + let mod1 = util::testdata_path().join("subdir/mod1.ts"); assert!(mod1.is_file()); let t = TempDir::new().expect("tempdir fail"); let bundle = t.path().join("mod1.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg("--no-check") .arg(mod1) @@ -76,7 +76,7 @@ fn bundle_exports_no_check() { .expect("error writing file"); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(&test) .output() @@ -92,12 +92,12 @@ fn bundle_exports_no_check() { #[test] fn bundle_circular() { // First we have to generate a bundle of some module that has exports. - let circular1 = util::root_path().join("cli/tests/subdir/circular1.ts"); + let circular1 = util::testdata_path().join("subdir/circular1.ts"); assert!(circular1.is_file()); let t = TempDir::new().expect("tempdir fail"); let bundle = t.path().join("circular1.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg(circular1) .arg(&bundle) @@ -108,7 +108,7 @@ fn bundle_circular() { assert!(bundle.is_file()); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(&bundle) .output() @@ -124,13 +124,12 @@ fn bundle_circular() { #[test] fn bundle_single_module() { // First we have to generate a bundle of some module that has exports. - let single_module = - util::root_path().join("cli/tests/subdir/single_module.ts"); + let single_module = util::testdata_path().join("subdir/single_module.ts"); assert!(single_module.is_file()); let t = TempDir::new().expect("tempdir fail"); let bundle = t.path().join("single_module.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg(single_module) .arg(&bundle) @@ -141,7 +140,7 @@ fn bundle_single_module() { assert!(bundle.is_file()); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(&bundle) .output() @@ -157,12 +156,12 @@ fn bundle_single_module() { #[test] fn bundle_tla() { // First we have to generate a bundle of some module that has exports. - let tla_import = util::root_path().join("cli/tests/subdir/tla.ts"); + let tla_import = util::testdata_path().join("subdir/tla.ts"); assert!(tla_import.is_file()); let t = tempfile::TempDir::new().expect("tempdir fail"); let bundle = t.path().join("tla.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg(tla_import) .arg(&bundle) @@ -183,7 +182,7 @@ fn bundle_tla() { .expect("error writing file"); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(&test) .output() @@ -199,12 +198,12 @@ fn bundle_tla() { #[test] fn bundle_js() { // First we have to generate a bundle of some module that has exports. - let mod6 = util::root_path().join("cli/tests/subdir/mod6.js"); + let mod6 = util::testdata_path().join("subdir/mod6.js"); assert!(mod6.is_file()); let t = TempDir::new().expect("tempdir fail"); let bundle = t.path().join("mod6.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg(mod6) .arg(&bundle) @@ -215,7 +214,7 @@ fn bundle_js() { assert!(bundle.is_file()); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(&bundle) .output() @@ -227,13 +226,12 @@ fn bundle_js() { #[test] fn bundle_dynamic_import() { let _g = util::http_server(); - let dynamic_import = - util::root_path().join("cli/tests/bundle_dynamic_import.ts"); + let dynamic_import = util::testdata_path().join("bundle_dynamic_import.ts"); assert!(dynamic_import.is_file()); let t = TempDir::new().expect("tempdir fail"); let bundle = t.path().join("bundle_dynamic_import.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg(dynamic_import) .arg(&bundle) @@ -244,7 +242,7 @@ fn bundle_dynamic_import() { assert!(bundle.is_file()); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg("--allow-net") .arg("--quiet") @@ -261,13 +259,13 @@ fn bundle_dynamic_import() { #[test] fn bundle_import_map() { - let import = util::root_path().join("cli/tests/bundle_im.ts"); - let import_map_path = util::root_path().join("cli/tests/bundle_im.json"); + let import = util::testdata_path().join("bundle_im.ts"); + let import_map_path = util::testdata_path().join("bundle_im.json"); assert!(import.is_file()); let t = TempDir::new().expect("tempdir fail"); let bundle = t.path().join("import_map.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg("--import-map") .arg(import_map_path) @@ -290,7 +288,7 @@ fn bundle_import_map() { .expect("error writing file"); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(&test) .output() @@ -305,13 +303,13 @@ fn bundle_import_map() { #[test] fn bundle_import_map_no_check() { - let import = util::root_path().join("cli/tests/bundle_im.ts"); - let import_map_path = util::root_path().join("cli/tests/bundle_im.json"); + let import = util::testdata_path().join("bundle_im.ts"); + let import_map_path = util::testdata_path().join("bundle_im.json"); assert!(import.is_file()); let t = TempDir::new().expect("tempdir fail"); let bundle = t.path().join("import_map.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg("--no-check") .arg("--import-map") @@ -335,7 +333,7 @@ fn bundle_import_map_no_check() { .expect("error writing file"); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(&test) .output() @@ -349,7 +347,7 @@ fn bundle_import_map_no_check() { } itest!(lock_check_err_with_bundle { - args: "bundle --lock=lock_check_err_with_bundle.json http://127.0.0.1:4545/cli/tests/subdir/mod1.ts", + args: "bundle --lock=lock_check_err_with_bundle.json http://127.0.0.1:4545/subdir/mod1.ts", output: "lock_check_err_with_bundle.out", exit_code: 10, http_server: true, diff --git a/cli/tests/integration/cache_tests.rs b/cli/tests/integration/cache_tests.rs index c97741a13..1fc035b9b 100644 --- a/cli/tests/integration/cache_tests.rs +++ b/cli/tests/integration/cache_tests.rs @@ -21,13 +21,13 @@ itest!(_095_cache_with_bare_import { }); itest!(cache_extensionless { - args: "cache --reload http://localhost:4545/cli/tests/subdir/no_js_ext", + args: "cache --reload http://localhost:4545/subdir/no_js_ext", output: "cache_extensionless.out", http_server: true, }); itest!(cache_random_extension { - args: "cache --reload http://localhost:4545/cli/tests/subdir/no_js_ext@1.0.0", + args: "cache --reload http://localhost:4545/subdir/no_js_ext@1.0.0", output: "cache_random_extension.out", http_server: true, }); @@ -39,7 +39,7 @@ itest!(performance_stats { itest!(redirect_cache { http_server: true, - args: "cache --reload http://localhost:4548/cli/tests/subdir/redirects/a.ts", + args: "cache --reload http://localhost:4548/subdir/redirects/a.ts", output: "redirect_cache.out", }); diff --git a/cli/tests/integration/compile_tests.rs b/cli/tests/integration/compile_tests.rs index 0748821dd..067f6b9eb 100644 --- a/cli/tests/integration/compile_tests.rs +++ b/cli/tests/integration/compile_tests.rs @@ -71,12 +71,12 @@ fn standalone_args() { dir.path().join("args") }; let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("compile") .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./cli/tests/028_args.ts") + .arg("./028_args.ts") .arg("a") .arg("b") .stdout(std::process::Stdio::piped()) @@ -107,12 +107,12 @@ fn standalone_error() { dir.path().join("error") }; let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("compile") .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./cli/tests/standalone_error.ts") + .arg("./standalone_error.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -143,12 +143,12 @@ fn standalone_no_module_load() { dir.path().join("hello") }; let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("compile") .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./cli/tests/standalone_import.ts") + .arg("./standalone_import.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -178,12 +178,12 @@ fn standalone_load_datauri() { dir.path().join("load_datauri") }; let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("compile") .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./cli/tests/standalone_import_datauri.ts") + .arg("./standalone_import_datauri.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -210,12 +210,12 @@ fn standalone_compiler_ops() { dir.path().join("standalone_compiler_ops") }; let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("compile") .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./cli/tests/standalone_compiler_ops.ts") + .arg("./standalone_compiler_ops.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -243,12 +243,12 @@ fn compile_with_directory_exists_error() { }; std::fs::create_dir(&exe).expect("cannot create directory"); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("compile") .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./cli/tests/028_args.ts") + .arg("./028_args.ts") .stderr(std::process::Stdio::piped()) .spawn() .unwrap() @@ -272,12 +272,12 @@ fn compile_with_conflict_file_exists_error() { std::fs::write(&exe, b"SHOULD NOT BE OVERWRITTEN") .expect("cannot create file"); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("compile") .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./cli/tests/028_args.ts") + .arg("./028_args.ts") .stderr(std::process::Stdio::piped()) .spawn() .unwrap() @@ -303,12 +303,12 @@ fn compile_and_overwrite_file() { dir.path().join("args") }; let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("compile") .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./cli/tests/028_args.ts") + .arg("./028_args.ts") .stderr(std::process::Stdio::piped()) .spawn() .unwrap() @@ -318,12 +318,12 @@ fn compile_and_overwrite_file() { assert!(&exe.exists()); let recompile_output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("compile") .arg("--unstable") .arg("--output") .arg(&exe) - .arg("./cli/tests/028_args.ts") + .arg("./028_args.ts") .stderr(std::process::Stdio::piped()) .spawn() .unwrap() @@ -341,7 +341,7 @@ fn standalone_runtime_flags() { dir.path().join("flags") }; let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("compile") .arg("--unstable") .arg("--allow-read") @@ -349,7 +349,7 @@ fn standalone_runtime_flags() { .arg("1") .arg("--output") .arg(&exe) - .arg("./cli/tests/standalone_runtime_flags.ts") + .arg("./standalone_runtime_flags.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() diff --git a/cli/tests/integration/coverage_tests.rs b/cli/tests/integration/coverage_tests.rs index dce3fb38c..4580b5cec 100644 --- a/cli/tests/integration/coverage_tests.rs +++ b/cli/tests/integration/coverage_tests.rs @@ -9,12 +9,12 @@ fn branch() { let tempdir = TempDir::new().expect("tempdir fail"); let tempdir = tempdir.path().join("cov"); let status = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("test") .arg("--quiet") .arg("--unstable") .arg(format!("--coverage={}", tempdir.to_str().unwrap())) - .arg("cli/tests/coverage/branch_test.ts") + .arg("coverage/branch_test.ts") .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::inherit()) .status() @@ -23,7 +23,7 @@ fn branch() { assert!(status.success()); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("coverage") .arg("--quiet") .arg("--unstable") @@ -38,7 +38,7 @@ fn branch() { .to_string(); let expected = fs::read_to_string( - util::root_path().join("cli/tests/coverage/expected_branch.out"), + util::testdata_path().join("coverage/expected_branch.out"), ) .unwrap(); @@ -51,7 +51,7 @@ fn branch() { assert!(output.status.success()); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("coverage") .arg("--quiet") .arg("--unstable") @@ -67,7 +67,7 @@ fn branch() { .to_string(); let expected = fs::read_to_string( - util::root_path().join("cli/tests/coverage/expected_branch.lcov"), + util::testdata_path().join("coverage/expected_branch.lcov"), ) .unwrap(); @@ -84,12 +84,12 @@ fn branch() { fn complex() { let tempdir = TempDir::new().expect("tempdir fail"); let status = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("test") .arg("--quiet") .arg("--unstable") .arg(format!("--coverage={}", tempdir.path().to_str().unwrap())) - .arg("cli/tests/coverage/complex_test.ts") + .arg("coverage/complex_test.ts") .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::inherit()) .status() @@ -98,7 +98,7 @@ fn complex() { assert!(status.success()); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("coverage") .arg("--quiet") .arg("--unstable") @@ -113,7 +113,7 @@ fn complex() { .to_string(); let expected = fs::read_to_string( - util::root_path().join("cli/tests/coverage/expected_complex.out"), + util::testdata_path().join("coverage/expected_complex.out"), ) .unwrap(); @@ -126,7 +126,7 @@ fn complex() { assert!(output.status.success()); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("coverage") .arg("--quiet") .arg("--unstable") @@ -142,7 +142,7 @@ fn complex() { .to_string(); let expected = fs::read_to_string( - util::root_path().join("cli/tests/coverage/expected_complex.lcov"), + util::testdata_path().join("coverage/expected_complex.lcov"), ) .unwrap(); diff --git a/cli/tests/integration/fmt_tests.rs b/cli/tests/integration/fmt_tests.rs index 4aab38fcf..00565a5d0 100644 --- a/cli/tests/integration/fmt_tests.rs +++ b/cli/tests/integration/fmt_tests.rs @@ -7,33 +7,32 @@ use test_util as util; #[test] fn fmt_test() { let t = TempDir::new().expect("tempdir fail"); - let fixed_js = util::root_path().join("cli/tests/badly_formatted_fixed.js"); + let fixed_js = util::testdata_path().join("badly_formatted_fixed.js"); let badly_formatted_original_js = - util::root_path().join("cli/tests/badly_formatted.mjs"); + util::testdata_path().join("badly_formatted.mjs"); let badly_formatted_js = t.path().join("badly_formatted.js"); let badly_formatted_js_str = badly_formatted_js.to_str().unwrap(); std::fs::copy(&badly_formatted_original_js, &badly_formatted_js) .expect("Failed to copy file"); - let fixed_md = util::root_path().join("cli/tests/badly_formatted_fixed.md"); + let fixed_md = util::testdata_path().join("badly_formatted_fixed.md"); let badly_formatted_original_md = - util::root_path().join("cli/tests/badly_formatted.md"); + util::testdata_path().join("badly_formatted.md"); let badly_formatted_md = t.path().join("badly_formatted.md"); let badly_formatted_md_str = badly_formatted_md.to_str().unwrap(); std::fs::copy(&badly_formatted_original_md, &badly_formatted_md) .expect("Failed to copy file"); - let fixed_json = - util::root_path().join("cli/tests/badly_formatted_fixed.json"); + let fixed_json = util::testdata_path().join("badly_formatted_fixed.json"); let badly_formatted_original_json = - util::root_path().join("cli/tests/badly_formatted.json"); + util::testdata_path().join("badly_formatted.json"); let badly_formatted_json = t.path().join("badly_formatted.json"); let badly_formatted_json_str = badly_formatted_json.to_str().unwrap(); std::fs::copy(&badly_formatted_original_json, &badly_formatted_json) .expect("Failed to copy file"); // First, check formatting by ignoring the badly formatted file. let status = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("fmt") .arg(format!( "--ignore={},{},{}", @@ -52,7 +51,7 @@ fn fmt_test() { // Check without ignore. let status = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("fmt") .arg("--check") .arg(badly_formatted_js_str) @@ -66,7 +65,7 @@ fn fmt_test() { // Format the source file. let status = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("fmt") .arg(badly_formatted_js_str) .arg(badly_formatted_md_str) @@ -91,7 +90,7 @@ fn fmt_test() { fn fmt_stdin_error() { use std::io::Write; let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("fmt") .arg("-") .stdin(std::process::Stdio::piped()) @@ -112,7 +111,7 @@ fn fmt_stdin_error() { #[test] fn fmt_ignore_unexplicit_files() { let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .env("NO_COLOR", "1") .arg("fmt") .arg("--check") diff --git a/cli/tests/integration/info_tests.rs b/cli/tests/integration/info_tests.rs index af0f259ea..9e7dbda5b 100644 --- a/cli/tests/integration/info_tests.rs +++ b/cli/tests/integration/info_tests.rs @@ -7,12 +7,12 @@ use test_util as util; #[test] fn info_with_compiled_source() { let _g = util::http_server(); - let module_path = "http://127.0.0.1:4545/cli/tests/048_media_types_jsx.ts"; + let module_path = "http://127.0.0.1:4545/048_media_types_jsx.ts"; let t = TempDir::new().expect("tempdir fail"); let mut deno = util::deno_cmd() .env("DENO_DIR", t.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("cache") .arg(&module_path) .spawn() @@ -23,7 +23,7 @@ fn info_with_compiled_source() { let output = util::deno_cmd() .env("DENO_DIR", t.path()) .env("NO_COLOR", "1") - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("info") .arg(&module_path) .output() @@ -37,7 +37,7 @@ fn info_with_compiled_source() { } itest!(_022_info_flag_script { - args: "info http://127.0.0.1:4545/cli/tests/019_media_types.ts", + args: "info http://127.0.0.1:4545/019_media_types.ts", output: "022_info_flag_script.out", http_server: true, }); @@ -68,7 +68,7 @@ itest!(info_json_location { }); itest!(_049_info_flag_script_jsx { - args: "info http://127.0.0.1:4545/cli/tests/048_media_types_jsx.ts", + args: "info http://127.0.0.1:4545/048_media_types_jsx.ts", output: "049_info_flag_script_jsx.out", http_server: true, }); diff --git a/cli/tests/integration/inspector_tests.rs b/cli/tests/integration/inspector_tests.rs index edc18b8d7..520a5b4f7 100644 --- a/cli/tests/integration/inspector_tests.rs +++ b/cli/tests/integration/inspector_tests.rs @@ -30,7 +30,7 @@ fn extract_ws_url_from_stderr( #[tokio::test] async fn inspector_connect() { - let script = util::tests_path().join("inspector1.js"); + let script = util::testdata_path().join("inspector1.js"); let mut child = util::deno_cmd() .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) @@ -64,7 +64,7 @@ enum TestStep { #[tokio::test] async fn inspector_break_on_first_line() { - let script = util::tests_path().join("inspector2.js"); + let script = util::testdata_path().join("inspector2.js"); let mut child = util::deno_cmd() .arg("run") .arg(inspect_flag_with_unique_port("--inspect-brk")) @@ -132,7 +132,7 @@ async fn inspector_break_on_first_line() { #[tokio::test] async fn inspector_pause() { - let script = util::tests_path().join("inspector1.js"); + let script = util::testdata_path().join("inspector1.js"); let mut child = util::deno_cmd() .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) @@ -202,7 +202,7 @@ async fn inspector_port_collision() { return; } - let script = util::tests_path().join("inspector1.js"); + let script = util::testdata_path().join("inspector1.js"); let inspect_flag = inspect_flag_with_unique_port("--inspect"); let mut child1 = util::deno_cmd() @@ -242,7 +242,7 @@ async fn inspector_port_collision() { #[tokio::test] async fn inspector_does_not_hang() { - let script = util::tests_path().join("inspector3.js"); + let script = util::testdata_path().join("inspector3.js"); let mut child = util::deno_cmd() .arg("run") .arg(inspect_flag_with_unique_port("--inspect-brk")) @@ -330,7 +330,7 @@ async fn inspector_does_not_hang() { #[tokio::test] async fn inspector_without_brk_runs_code() { - let script = util::tests_path().join("inspector4.js"); + let script = util::testdata_path().join("inspector4.js"); let mut child = util::deno_cmd() .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) @@ -438,7 +438,7 @@ async fn inspector_runtime_evaluate_does_not_crash() { #[tokio::test] async fn inspector_json() { - let script = util::tests_path().join("inspector1.js"); + let script = util::testdata_path().join("inspector1.js"); let mut child = util::deno_cmd() .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) @@ -467,7 +467,7 @@ async fn inspector_json() { #[tokio::test] async fn inspector_json_list() { - let script = util::tests_path().join("inspector1.js"); + let script = util::testdata_path().join("inspector1.js"); let mut child = util::deno_cmd() .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) @@ -498,7 +498,7 @@ async fn inspector_json_list() { async fn inspector_connect_non_ws() { // https://github.com/denoland/deno/issues/11449 // Verify we don't panic if non-WS connection is being established - let script = util::tests_path().join("inspector1.js"); + let script = util::testdata_path().join("inspector1.js"); let mut child = util::deno_cmd() .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) diff --git a/cli/tests/integration/install_tests.rs b/cli/tests/integration/install_tests.rs index e5229df8f..ff93c157f 100644 --- a/cli/tests/integration/install_tests.rs +++ b/cli/tests/integration/install_tests.rs @@ -16,7 +16,7 @@ fn installer_test_local_module_run() { .arg("echo_test") .arg("--root") .arg(temp_dir.path()) - .arg(util::tests_path().join("echo.ts")) + .arg(util::testdata_path().join("echo.ts")) .arg("hello") .spawn() .unwrap() @@ -47,13 +47,13 @@ fn installer_test_remote_module_run() { let bin_dir = temp_dir.path().join("bin"); std::fs::create_dir(&bin_dir).unwrap(); let status = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("install") .arg("--name") .arg("echo_test") .arg("--root") .arg(temp_dir.path()) - .arg("http://localhost:4545/cli/tests/echo.ts") + .arg("http://localhost:4545/echo.ts") .arg("hello") .spawn() .unwrap() diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index 518dfe850..f0cb6d4b8 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -12,17 +12,17 @@ use tempfile::TempDir; use test_util::deno_exe_path; use test_util::http_server; use test_util::lsp::LspClient; -use test_util::root_path; +use test_util::testdata_path; fn load_fixture(path: &str) -> Value { - let fixtures_path = root_path().join("cli/tests/lsp"); + let fixtures_path = testdata_path().join("lsp"); let path = fixtures_path.join(path); let fixture_str = fs::read_to_string(path).unwrap(); serde_json::from_str(&fixture_str).unwrap() } fn load_fixture_str(path: &str) -> String { - let fixtures_path = root_path().join("cli/tests/lsp"); + let fixtures_path = testdata_path().join("lsp"); let path = fixtures_path.join(path); fs::read_to_string(path).unwrap() } @@ -921,7 +921,7 @@ fn lsp_hover_dependency() { Some(json!({ "contents": { "kind": "markdown", - "value": "**Resolved Dependency**\n\n**Code**: http​://127.0.0.1:4545/cli/tests/subdir/type_reference.js\n" + "value": "**Resolved Dependency**\n\n**Code**: http​://127.0.0.1:4545/subdir/type_reference.js\n" }, "range": { "start": { @@ -930,7 +930,7 @@ fn lsp_hover_dependency() { }, "end":{ "line": 3, - "character": 76 + "character": 66 } } })) @@ -955,7 +955,7 @@ fn lsp_hover_dependency() { Some(json!({ "contents": { "kind": "markdown", - "value": "**Resolved Dependency**\n\n**Code**: http​://127.0.0.1:4545/cli/tests/subdir/mod1.ts\n" + "value": "**Resolved Dependency**\n\n**Code**: http​://127.0.0.1:4545/subdir/mod1.ts\n" }, "range": { "start": { @@ -964,7 +964,7 @@ fn lsp_hover_dependency() { }, "end":{ "line": 4, - "character": 66 + "character": 56 } } })) @@ -2713,7 +2713,7 @@ fn lsp_diagnostics_warn() { "uri": "file:///a/file.ts", "languageId": "typescript", "version": 1, - "text": "import * as a from \"http://127.0.0.1:4545/cli/tests/x_deno_warning.js\";\n\nconsole.log(a)\n", + "text": "import * as a from \"http://127.0.0.1:4545/x_deno_warning.js\";\n\nconsole.log(a)\n", }, }), ); @@ -2726,7 +2726,7 @@ fn lsp_diagnostics_warn() { }, "uris": [ { - "uri": "http://127.0.0.1:4545/cli/tests/x_deno_warning.js", + "uri": "http://127.0.0.1:4545/x_deno_warning.js", } ], }), @@ -2755,7 +2755,7 @@ fn lsp_diagnostics_warn() { }, end: lsp::Position { line: 0, - character: 70 + character: 60 } }, severity: Some(lsp::DiagnosticSeverity::Warning), diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs index b8917fc91..1d6555ff7 100644 --- a/cli/tests/integration/mod.rs +++ b/cli/tests/integration/mod.rs @@ -74,7 +74,7 @@ mod worker; #[test] fn help_flag() { let status = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("--help") .spawn() .unwrap() @@ -86,7 +86,7 @@ fn help_flag() { #[test] fn version_short_flag() { let status = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("-V") .spawn() .unwrap() @@ -98,7 +98,7 @@ fn version_short_flag() { #[test] fn version_long_flag() { let status = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("--version") .spawn() .unwrap() @@ -117,11 +117,10 @@ fn cache_test() { let _g = util::http_server(); let deno_dir = TempDir::new().expect("tempdir fail"); let module_url = - url::Url::parse("http://localhost:4545/cli/tests/006_url_imports.ts") - .unwrap(); + url::Url::parse("http://localhost:4545/006_url_imports.ts").unwrap(); let output = Command::new(util::deno_exe_path()) .env("DENO_DIR", deno_dir.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("cache") .arg("-L") .arg("debug") @@ -141,7 +140,7 @@ fn cache_test() { .env("DENO_DIR", deno_dir.path()) .env("HTTP_PROXY", "http://nil") .env("NO_COLOR", "1") - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(module_url.to_string()) .output() @@ -149,8 +148,7 @@ fn cache_test() { let str_output = std::str::from_utf8(&output.stdout).unwrap(); - let module_output_path = - util::root_path().join("cli/tests/006_url_imports.ts.out"); + let module_output_path = util::testdata_path().join("006_url_imports.ts.out"); let mut module_output = String::new(); let mut module_output_file = fs::File::open(module_output_path).unwrap(); module_output_file @@ -173,7 +171,7 @@ fn cache_invalidation_test() { } let output = Command::new(util::deno_exe_path()) .env("DENO_DIR", deno_dir.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(fixture_path.to_str().unwrap()) .output() @@ -190,7 +188,7 @@ fn cache_invalidation_test() { } let output = Command::new(util::deno_exe_path()) .env("DENO_DIR", deno_dir.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(fixture_path.to_str().unwrap()) .output() @@ -213,7 +211,7 @@ fn cache_invalidation_test_no_check() { } let output = Command::new(util::deno_exe_path()) .env("DENO_DIR", deno_dir.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg("--no-check") .arg(fixture_path.to_str().unwrap()) @@ -231,7 +229,7 @@ fn cache_invalidation_test_no_check() { } let output = Command::new(util::deno_exe_path()) .env("DENO_DIR", deno_dir.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg("--no-check") .arg(fixture_path.to_str().unwrap()) @@ -269,7 +267,7 @@ fn ts_dependency_recompilation() { .unwrap(); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .env("NO_COLOR", "1") .arg("run") .arg(&ats) @@ -291,7 +289,7 @@ fn ts_dependency_recompilation() { .expect("error writing file"); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .env("NO_COLOR", "1") .arg("run") .arg(&ats) @@ -312,12 +310,12 @@ fn ts_no_recheck_on_redirect() { let deno_dir = util::new_deno_dir(); let e = util::deno_exe_path(); - let redirect_ts = util::root_path().join("cli/tests/017_import_redirect.ts"); + let redirect_ts = util::testdata_path().join("017_import_redirect.ts"); assert!(redirect_ts.is_file()); let mut cmd = Command::new(e.clone()); cmd.env("DENO_DIR", deno_dir.path()); let mut initial = cmd - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(redirect_ts.clone()) .spawn() @@ -329,7 +327,7 @@ fn ts_no_recheck_on_redirect() { let mut cmd = Command::new(e); cmd.env("DENO_DIR", deno_dir.path()); let output = cmd - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(redirect_ts) .output() @@ -340,12 +338,12 @@ fn ts_no_recheck_on_redirect() { #[test] fn ts_reload() { - let hello_ts = util::root_path().join("cli/tests/002_hello.ts"); + let hello_ts = util::testdata_path().join("002_hello.ts"); assert!(hello_ts.is_file()); let deno_dir = TempDir::new().expect("tempdir fail"); let mut initial = util::deno_cmd_with_deno_dir(deno_dir.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("cache") .arg(&hello_ts) .spawn() @@ -355,7 +353,7 @@ fn ts_reload() { assert!(status_initial.success()); let output = util::deno_cmd_with_deno_dir(deno_dir.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("cache") .arg("--reload") .arg("-L") @@ -391,7 +389,7 @@ console.log("finish"); "#; let mut p = util::deno_cmd() - .current_dir(util::tests_path()) + .current_dir(util::testdata_path()) .arg("run") .arg("-") .stdin(std::process::Stdio::piped()) @@ -411,7 +409,7 @@ console.log("finish"); #[test] fn compiler_api() { let status = util::deno_cmd() - .current_dir(util::tests_path()) + .current_dir(util::testdata_path()) .arg("test") .arg("--unstable") .arg("--reload") @@ -431,7 +429,7 @@ fn broken_stdout() { drop(reader); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("eval") .arg("console.log(3.14)") .stdout(writer) @@ -461,14 +459,14 @@ itest!(cafile_ts_fetch { }); itest!(cafile_eval { - args: "eval --cert tls/RootCA.pem fetch('https://localhost:5545/cli/tests/cafile_ts_fetch.ts.out').then(r=>r.text()).then(t=>console.log(t.trimEnd()))", + args: "eval --cert tls/RootCA.pem fetch('https://localhost:5545/cafile_ts_fetch.ts.out').then(r=>r.text()).then(t=>console.log(t.trimEnd()))", output: "cafile_ts_fetch.ts.out", http_server: true, }); itest!(cafile_info { args: - "info --quiet --cert tls/RootCA.pem https://localhost:5545/cli/tests/cafile_info.ts", + "info --quiet --cert tls/RootCA.pem https://localhost:5545/cafile_info.ts", output: "cafile_info.ts.out", http_server: true, }); @@ -506,13 +504,12 @@ fn cafile_env_fetch() { let _g = util::http_server(); let deno_dir = TempDir::new().expect("tempdir fail"); let module_url = - Url::parse("https://localhost:5545/cli/tests/cafile_url_imports.ts") - .unwrap(); - let cafile = util::root_path().join("cli/tests/tls/RootCA.pem"); + Url::parse("https://localhost:5545/cafile_url_imports.ts").unwrap(); + let cafile = util::testdata_path().join("tls/RootCA.pem"); let output = Command::new(util::deno_exe_path()) .env("DENO_DIR", deno_dir.path()) .env("DENO_CERT", cafile) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("cache") .arg(module_url.to_string()) .output() @@ -526,12 +523,11 @@ fn cafile_fetch() { let _g = util::http_server(); let deno_dir = TempDir::new().expect("tempdir fail"); let module_url = - Url::parse("http://localhost:4545/cli/tests/cafile_url_imports.ts") - .unwrap(); - let cafile = util::root_path().join("cli/tests/tls/RootCA.pem"); + Url::parse("http://localhost:4545/cafile_url_imports.ts").unwrap(); + let cafile = util::testdata_path().join("tls/RootCA.pem"); let output = Command::new(util::deno_exe_path()) .env("DENO_DIR", deno_dir.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("cache") .arg("--cert") .arg(cafile) @@ -550,11 +546,11 @@ fn cafile_install_remote_module() { let bin_dir = temp_dir.path().join("bin"); std::fs::create_dir(&bin_dir).unwrap(); let deno_dir = TempDir::new().expect("tempdir fail"); - let cafile = util::root_path().join("cli/tests/tls/RootCA.pem"); + let cafile = util::testdata_path().join("tls/RootCA.pem"); let install_output = Command::new(util::deno_exe_path()) .env("DENO_DIR", deno_dir.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("install") .arg("--cert") .arg(cafile) @@ -562,7 +558,7 @@ fn cafile_install_remote_module() { .arg(temp_dir.path()) .arg("-n") .arg("echo_test") - .arg("https://localhost:5545/cli/tests/echo.ts") + .arg("https://localhost:5545/echo.ts") .output() .expect("Failed to spawn script"); println!("{}", std::str::from_utf8(&install_output.stdout).unwrap()); @@ -590,12 +586,12 @@ fn cafile_bundle_remote_exports() { let _g = util::http_server(); // First we have to generate a bundle of some remote module that has exports. - let mod1 = "https://localhost:5545/cli/tests/subdir/mod1.ts"; - let cafile = util::root_path().join("cli/tests/tls/RootCA.pem"); + let mod1 = "https://localhost:5545/subdir/mod1.ts"; + let cafile = util::testdata_path().join("tls/RootCA.pem"); let t = TempDir::new().expect("tempdir fail"); let bundle = t.path().join("mod1.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg("--cert") .arg(cafile) @@ -618,7 +614,7 @@ fn cafile_bundle_remote_exports() { .expect("error writing file"); let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(&test) .output() @@ -635,8 +631,8 @@ fn cafile_bundle_remote_exports() { fn websocket() { let _g = util::http_server(); - let script = util::tests_path().join("websocket_test.ts"); - let root_ca = util::tests_path().join("tls/RootCA.pem"); + let script = util::testdata_path().join("websocket_test.ts"); + let root_ca = util::testdata_path().join("tls/RootCA.pem"); let status = util::deno_cmd() .arg("test") .arg("--unstable") @@ -656,8 +652,8 @@ fn websocket() { fn websocketstream() { let _g = util::http_server(); - let script = util::tests_path().join("websocketstream_test.ts"); - let root_ca = util::tests_path().join("tls/RootCA.pem"); + let script = util::testdata_path().join("websocketstream_test.ts"); + let root_ca = util::testdata_path().join("tls/RootCA.pem"); let status = util::deno_cmd() .arg("test") .arg("--unstable") @@ -872,7 +868,7 @@ async fn test_resolve_dns() { // Pass: `--allow-net` { let output = util::deno_cmd() - .current_dir(util::tests_path()) + .current_dir(util::testdata_path()) .env("NO_COLOR", "1") .arg("run") .arg("--allow-net") @@ -890,7 +886,7 @@ async fn test_resolve_dns() { assert!(err.starts_with("Check file")); let expected = - std::fs::read_to_string(util::tests_path().join("resolve_dns.ts.out")) + std::fs::read_to_string(util::testdata_path().join("resolve_dns.ts.out")) .unwrap(); assert_eq!(expected, out); } @@ -898,7 +894,7 @@ async fn test_resolve_dns() { // Pass: `--allow-net=127.0.0.1:4553` { let output = util::deno_cmd() - .current_dir(util::tests_path()) + .current_dir(util::testdata_path()) .env("NO_COLOR", "1") .arg("run") .arg("--allow-net=127.0.0.1:4553") @@ -916,7 +912,7 @@ async fn test_resolve_dns() { assert!(err.starts_with("Check file")); let expected = - std::fs::read_to_string(util::tests_path().join("resolve_dns.ts.out")) + std::fs::read_to_string(util::testdata_path().join("resolve_dns.ts.out")) .unwrap(); assert_eq!(expected, out); } @@ -924,7 +920,7 @@ async fn test_resolve_dns() { // Permission error: `--allow-net=deno.land` { let output = util::deno_cmd() - .current_dir(util::tests_path()) + .current_dir(util::testdata_path()) .env("NO_COLOR", "1") .arg("run") .arg("--allow-net=deno.land") @@ -947,7 +943,7 @@ async fn test_resolve_dns() { // Permission error: no permission specified { let output = util::deno_cmd() - .current_dir(util::tests_path()) + .current_dir(util::testdata_path()) .env("NO_COLOR", "1") .arg("run") .arg("--unstable") @@ -1001,7 +997,7 @@ fn js_unit_tests_lint() { let status = util::deno_cmd() .arg("lint") .arg("--unstable") - .arg(util::root_path().join("cli/tests/unit")) + .arg(util::tests_path().join("unit")) .spawn() .unwrap() .wait() @@ -1022,7 +1018,7 @@ fn js_unit_tests() { .arg("--unstable") .arg("--location=http://js-unit-tests/foo/bar") .arg("-A") - .arg("cli/tests/unit") + .arg(util::tests_path().join("unit")) .spawn() .expect("failed to spawn script"); @@ -1038,13 +1034,13 @@ async fn listen_tls_alpn() { LocalSet::new() .run_until(async { let mut child = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg("--unstable") .arg("--quiet") .arg("--allow-net") .arg("--allow-read") - .arg("./cli/tests/listen_tls_alpn.ts") + .arg("./listen_tls_alpn.ts") .arg("4504") .stdout(std::process::Stdio::piped()) .spawn() @@ -1057,8 +1053,9 @@ async fn listen_tls_alpn() { assert_eq!(msg, "READY"); let mut cfg = rustls::ClientConfig::new(); - let reader = - &mut BufReader::new(Cursor::new(include_bytes!("../tls/RootCA.crt"))); + let reader = &mut BufReader::new(Cursor::new(include_bytes!( + "../testdata/tls/RootCA.crt" + ))); cfg.root_store.add_pem_file(reader).unwrap(); cfg.alpn_protocols.push("foobar".as_bytes().to_vec()); let cfg = Arc::new(cfg); @@ -1090,13 +1087,13 @@ async fn listen_tls_alpn_fail() { LocalSet::new() .run_until(async { let mut child = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg("--unstable") .arg("--quiet") .arg("--allow-net") .arg("--allow-read") - .arg("./cli/tests/listen_tls_alpn.ts") + .arg("./listen_tls_alpn.ts") .arg("4505") .stdout(std::process::Stdio::piped()) .spawn() @@ -1109,8 +1106,9 @@ async fn listen_tls_alpn_fail() { assert_eq!(msg, "READY"); let mut cfg = rustls::ClientConfig::new(); - let reader = - &mut BufReader::new(Cursor::new(include_bytes!("../tls/RootCA.crt"))); + let reader = &mut BufReader::new(Cursor::new(include_bytes!( + "../testdata/tls/RootCA.crt" + ))); cfg.root_store.add_pem_file(reader).unwrap(); cfg.alpn_protocols.push("boofar".as_bytes().to_vec()); let cfg = Arc::new(cfg); diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index 7ce91d406..20dfccb7e 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -549,8 +549,7 @@ fn lexical_scoped_variable() { fn missing_deno_dir() { use std::fs::{read_dir, remove_dir_all}; const DENO_DIR: &str = "nonexistent"; - let test_deno_dir = - util::root_path().join("cli").join("tests").join(DENO_DIR); + let test_deno_dir = test_util::testdata_path().join(DENO_DIR); let (out, err) = util::run_and_collect_output( true, "repl", diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index 4ca0616f7..f5ac82e9c 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -144,7 +144,7 @@ itest!(_033_import_map { itest!(_033_import_map_remote { args: - "run --quiet --reload --import-map=http://127.0.0.1:4545/cli/tests/import_maps/import_map_remote.json --unstable import_maps/test_remote.ts", + "run --quiet --reload --import-map=http://127.0.0.1:4545/import_maps/import_map_remote.json --unstable import_maps/test_remote.ts", output: "033_import_map_remote.out", http_server: true, }); @@ -155,8 +155,7 @@ itest!(_034_onload { }); itest!(_035_cached_only_flag { - args: - "run --reload --cached-only http://127.0.0.1:4545/cli/tests/019_media_types.ts", + args: "run --reload --cached-only http://127.0.0.1:4545/019_media_types.ts", output: "035_cached_only_flag.out", exit_code: 1, http_server: true, @@ -203,8 +202,7 @@ itest!(_048_media_types_jsx { }); itest!(_052_no_remote_flag { - args: - "run --reload --no-remote http://127.0.0.1:4545/cli/tests/019_media_types.ts", + args: "run --reload --no-remote http://127.0.0.1:4545/019_media_types.ts", output: "052_no_remote_flag.out", exit_code: 1, http_server: true, @@ -239,7 +237,7 @@ itest!(_071_location_unset { }); itest!(_072_location_relative_fetch { - args: "run --location http://127.0.0.1:4545/cli/tests/ --allow-net 072_location_relative_fetch.ts", + args: "run --location http://127.0.0.1:4545/ --allow-net 072_location_relative_fetch.ts", output: "072_location_relative_fetch.ts.out", http_server: true, }); @@ -288,18 +286,17 @@ itest!(_082_prepare_stack_trace_throw { fn _083_legacy_external_source_map() { let _g = util::http_server(); let deno_dir = TempDir::new().expect("tempdir fail"); - let module_url = url::Url::parse( - "http://localhost:4545/cli/tests/083_legacy_external_source_map.ts", - ) - .unwrap(); + let module_url = + url::Url::parse("http://localhost:4545/083_legacy_external_source_map.ts") + .unwrap(); // Write a faulty old external source map. let faulty_map_path = deno_dir.path().join("gen/http/localhost_PORT4545/9576bd5febd0587c5c4d88d57cb3ac8ebf2600c529142abe3baa9a751d20c334.js.map"); std::fs::create_dir_all(faulty_map_path.parent().unwrap()) .expect("Failed to create faulty source map dir."); - std::fs::write(faulty_map_path, "{\"version\":3,\"file\":\"\",\"sourceRoot\":\"\",\"sources\":[\"http://localhost:4545/cli/tests/083_legacy_external_source_map.ts\"],\"names\":[],\"mappings\":\";AAAA,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC\"}").expect("Failed to write faulty source map."); + std::fs::write(faulty_map_path, "{\"version\":3,\"file\":\"\",\"sourceRoot\":\"\",\"sources\":[\"http://localhost:4545/083_legacy_external_source_map.ts\"],\"names\":[],\"mappings\":\";AAAA,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC\"}").expect("Failed to write faulty source map."); let output = Command::new(util::deno_exe_path()) .env("DENO_DIR", deno_dir.path()) - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg(module_url.to_string()) .output() @@ -394,10 +391,11 @@ itest!(lock_write_fetch { }); itest!(lock_check_ok { - args: "run --lock=lock_check_ok.json http://127.0.0.1:4545/cli/tests/003_relative_import.ts", - output: "003_relative_import.ts.out", - http_server: true, - }); + args: + "run --lock=lock_check_ok.json http://127.0.0.1:4545/003_relative_import.ts", + output: "003_relative_import.ts.out", + http_server: true, +}); itest!(lock_check_ok2 { args: "run --lock=lock_check_ok2.json 019_media_types.ts", @@ -406,14 +404,14 @@ itest!(lock_check_ok2 { }); itest!(lock_dynamic_imports { - args: "run --lock=lock_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/cli/tests/013_dynamic_import.ts", + args: "run --lock=lock_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/013_dynamic_import.ts", output: "lock_dynamic_imports.out", exit_code: 10, http_server: true, }); itest!(lock_check_err { - args: "run --lock=lock_check_err.json http://127.0.0.1:4545/cli/tests/003_relative_import.ts", + args: "run --lock=lock_check_err.json http://127.0.0.1:4545/003_relative_import.ts", output: "lock_check_err.out", exit_code: 10, http_server: true, @@ -452,7 +450,7 @@ itest!(config_types_remote { itest!(empty_typescript { args: "run --reload subdir/empty.ts", - output_str: Some("Check file:[WILDCARD]tests/subdir/empty.ts\n"), + output_str: Some("Check file:[WILDCARD]/subdir/empty.ts\n"), }); itest!(error_001 { @@ -649,14 +647,14 @@ itest!(error_type_definitions { }); itest!(error_local_static_import_from_remote_ts { - args: "run --reload http://localhost:4545/cli/tests/error_local_static_import_from_remote.ts", + args: "run --reload http://localhost:4545/error_local_static_import_from_remote.ts", exit_code: 1, http_server: true, output: "error_local_static_import_from_remote.ts.out", }); itest!(error_local_static_import_from_remote_js { - args: "run --reload http://localhost:4545/cli/tests/error_local_static_import_from_remote.js", + args: "run --reload http://localhost:4545/error_local_static_import_from_remote.js", exit_code: 1, http_server: true, output: "error_local_static_import_from_remote.js.out", @@ -938,14 +936,14 @@ itest!(_053_import_compression { }); itest!(disallow_http_from_https_js { - args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/cli/tests/disallow_http_from_https.js", + args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/disallow_http_from_https.js", output: "disallow_http_from_https_js.out", http_server: true, exit_code: 1, }); itest!(disallow_http_from_https_ts { - args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/cli/tests/disallow_http_from_https.ts", + args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/disallow_http_from_https.ts", output: "disallow_http_from_https_ts.out", http_server: true, exit_code: 1, @@ -1175,9 +1173,9 @@ itest!(worker_close_race { #[test] fn no_validate_asm() { let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") - .arg("cli/tests/no_validate_asm.js") + .arg("no_validate_asm.js") .stderr(std::process::Stdio::piped()) .stdout(std::process::Stdio::piped()) .spawn() @@ -1192,10 +1190,10 @@ fn no_validate_asm() { #[test] fn exec_path() { let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg("--allow-read") - .arg("cli/tests/exec_path.ts") + .arg("exec_path.ts") .stdout(std::process::Stdio::piped()) .spawn() .unwrap() @@ -1223,7 +1221,7 @@ fn run_deno_script_constrained( script_path: std::path::PathBuf, constraints: WinProcConstraints, ) -> Result<(), i64> { - let file_path = "cli/tests/DenoWinRunner.ps1"; + let file_path = "DenoWinRunner.ps1"; let constraints = match constraints { WinProcConstraints::NoStdIn => "1", WinProcConstraints::NoStdOut => "2", @@ -1244,7 +1242,7 @@ fn run_deno_script_constrained( #[test] fn should_not_panic_on_no_stdin() { let output = run_deno_script_constrained( - util::tests_path().join("echo.ts"), + util::testdata_path().join("echo.ts"), WinProcConstraints::NoStdIn, ); output.unwrap(); @@ -1254,7 +1252,7 @@ fn should_not_panic_on_no_stdin() { #[test] fn should_not_panic_on_no_stdout() { let output = run_deno_script_constrained( - util::tests_path().join("echo.ts"), + util::testdata_path().join("echo.ts"), WinProcConstraints::NoStdOut, ); output.unwrap(); @@ -1264,7 +1262,7 @@ fn should_not_panic_on_no_stdout() { #[test] fn should_not_panic_on_no_stderr() { let output = run_deno_script_constrained( - util::tests_path().join("echo.ts"), + util::testdata_path().join("echo.ts"), WinProcConstraints::NoStdErr, ); output.unwrap(); @@ -1274,9 +1272,9 @@ fn should_not_panic_on_no_stderr() { #[test] fn should_not_panic_on_undefined_home_environment_variable() { let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") - .arg("cli/tests/echo.ts") + .arg("echo.ts") .env_remove("HOME") .spawn() .unwrap() @@ -1288,9 +1286,9 @@ fn should_not_panic_on_undefined_home_environment_variable() { #[test] fn should_not_panic_on_undefined_deno_dir_environment_variable() { let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") - .arg("cli/tests/echo.ts") + .arg("echo.ts") .env_remove("DENO_DIR") .spawn() .unwrap() @@ -1303,9 +1301,9 @@ fn should_not_panic_on_undefined_deno_dir_environment_variable() { #[test] fn should_not_panic_on_undefined_deno_dir_and_home_environment_variables() { let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") - .arg("cli/tests/echo.ts") + .arg("echo.ts") .env_remove("DENO_DIR") .env_remove("HOME") .spawn() @@ -1319,9 +1317,9 @@ fn should_not_panic_on_undefined_deno_dir_and_home_environment_variables() { fn rust_log() { // Without RUST_LOG the stderr is empty. let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") - .arg("cli/tests/001_hello.js") + .arg("001_hello.js") .stderr(std::process::Stdio::piped()) .spawn() .unwrap() @@ -1332,9 +1330,9 @@ fn rust_log() { // With RUST_LOG the stderr is not empty. let output = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") - .arg("cli/tests/001_hello.js") + .arg("001_hello.js") .env("RUST_LOG", "debug") .stderr(std::process::Stdio::piped()) .spawn() @@ -1352,7 +1350,7 @@ mod permissions { fn with_allow() { for permission in &util::PERMISSION_VARIANTS { let status = util::deno_cmd() - .current_dir(&util::tests_path()) + .current_dir(&util::testdata_path()) .arg("run") .arg(format!("--allow-{0}", permission)) .arg("permission_test.ts") @@ -1384,12 +1382,15 @@ mod permissions { const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"]; for permission in &PERMISSION_VARIANTS { let status = util::deno_cmd() - .current_dir(&util::tests_path()) + .current_dir(&util::testdata_path()) .arg("run") .arg(format!( "--allow-{0}={1}", permission, - util::root_path().into_os_string().into_string().unwrap() + util::testdata_path() + .into_os_string() + .into_string() + .unwrap() )) .arg("complex_permissions_test.ts") .arg(permission) @@ -1411,9 +1412,7 @@ mod permissions { &format!( "run --allow-{0}={1} complex_permissions_test.ts {0} {2}", permission, - util::root_path() - .join("cli") - .join("tests") + util::testdata_path() .into_os_string() .into_string() .unwrap(), @@ -1436,14 +1435,12 @@ mod permissions { const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"]; for permission in &PERMISSION_VARIANTS { let status = util::deno_cmd() - .current_dir(&util::tests_path()) + .current_dir(&util::testdata_path()) .arg("run") .arg(format!( "--allow-{0}={1}", permission, - util::root_path() - .join("cli") - .join("tests") + util::testdata_path() .into_os_string() .into_string() .unwrap() @@ -1462,9 +1459,7 @@ mod permissions { #[test] fn rw_outside_test_and_js_dir() { const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"]; - let test_dir = util::root_path() - .join("cli") - .join("tests") + let test_dir = util::testdata_path() .into_os_string() .into_string() .unwrap(); @@ -1498,9 +1493,7 @@ mod permissions { #[test] fn rw_inside_test_and_js_dir() { const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"]; - let test_dir = util::root_path() - .join("cli") - .join("tests") + let test_dir = util::testdata_path() .into_os_string() .into_string() .unwrap(); @@ -1511,7 +1504,7 @@ mod permissions { .unwrap(); for permission in &PERMISSION_VARIANTS { let status = util::deno_cmd() - .current_dir(&util::tests_path()) + .current_dir(&util::testdata_path()) .arg("run") .arg(format!("--allow-{0}={1},{2}", permission, test_dir, js_dir)) .arg("complex_permissions_test.ts") @@ -1530,7 +1523,7 @@ mod permissions { const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"]; for permission in &PERMISSION_VARIANTS { let status = util::deno_cmd() - .current_dir(&util::tests_path()) + .current_dir(&util::testdata_path()) .arg("run") .arg(format!("--allow-{0}=.", permission)) .arg("complex_permissions_test.ts") @@ -1549,7 +1542,7 @@ mod permissions { const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"]; for permission in &PERMISSION_VARIANTS { let status = util::deno_cmd() - .current_dir(&util::tests_path()) + .current_dir(&util::testdata_path()) .arg("run") .arg(format!("--allow-{0}=tls/../", permission)) .arg("complex_permissions_test.ts") diff --git a/cli/tests/integration/watcher_tests.rs b/cli/tests/integration/watcher_tests.rs index ed574a0bf..8b03ae470 100644 --- a/cli/tests/integration/watcher_tests.rs +++ b/cli/tests/integration/watcher_tests.rs @@ -50,15 +50,15 @@ fn wait_for_process_failed( #[test] fn fmt_watch_test() { let t = TempDir::new().expect("tempdir fail"); - let fixed = util::root_path().join("cli/tests/badly_formatted_fixed.js"); + let fixed = util::testdata_path().join("badly_formatted_fixed.js"); let badly_formatted_original = - util::root_path().join("cli/tests/badly_formatted.mjs"); + util::testdata_path().join("badly_formatted.mjs"); let badly_formatted = t.path().join("badly_formatted.js"); std::fs::copy(&badly_formatted_original, &badly_formatted) .expect("Failed to copy file"); let mut child = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("fmt") .arg(&badly_formatted) .arg("--watch") @@ -109,7 +109,7 @@ fn bundle_js_watch() { let t = TempDir::new().expect("tempdir fail"); let bundle = t.path().join("mod6.bundle.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg(&file_to_watch) .arg(&bundle) @@ -173,7 +173,7 @@ fn bundle_watch_not_exit() { let target_file = t.path().join("target.js"); let mut deno = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("bundle") .arg(&file_to_watch) .arg(&target_file) @@ -224,7 +224,7 @@ fn run_watch() { .expect("error writing file"); let mut child = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg("--watch") .arg("--unstable") @@ -330,7 +330,7 @@ fn run_watch_not_exit() { .expect("error writing file"); let mut child = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg("--watch") .arg("--unstable") @@ -377,14 +377,14 @@ fn run_watch_with_import_map_and_relative_paths() { let absolute_path = directory.path().join(filename); std::fs::write(&absolute_path, filecontent).expect("error writing file"); let relative_path = absolute_path - .strip_prefix(util::root_path()) + .strip_prefix(util::testdata_path()) .expect("unable to create relative temporary file") .to_owned(); assert!(relative_path.is_relative()); relative_path } let temp_directory = - TempDir::new_in(util::root_path()).expect("tempdir fail"); + TempDir::new_in(util::testdata_path()).expect("tempdir fail"); let file_to_watch = create_relative_tmp_file( &temp_directory, "file_to_watch.js", @@ -397,7 +397,7 @@ fn run_watch_with_import_map_and_relative_paths() { ); let mut child = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("run") .arg("--unstable") .arg("--watch") @@ -443,7 +443,7 @@ fn test_watch() { let t = TempDir::new().expect("tempdir fail"); let mut child = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("test") .arg("--watch") .arg("--unstable") @@ -612,7 +612,7 @@ fn test_watch_doc() { let t = TempDir::new().expect("tempdir fail"); let mut child = util::deno_cmd() - .current_dir(util::root_path()) + .current_dir(util::testdata_path()) .arg("test") .arg("--watch") .arg("--doc") diff --git a/cli/tests/integration/worker_tests.rs b/cli/tests/integration/worker_tests.rs index 2340fa705..c158776ee 100644 --- a/cli/tests/integration/worker_tests.rs +++ b/cli/tests/integration/worker_tests.rs @@ -3,7 +3,7 @@ use crate::itest; itest!(workers { - args: "test --reload --location http://127.0.0.1:4545/cli/tests/ --allow-net --allow-read --unstable workers/test.ts", + args: "test --reload --location http://127.0.0.1:4545/ --allow-net --allow-read --unstable workers/test.ts", output: "workers/test.ts.out", http_server: true, }); diff --git a/cli/tests/js_import_detect.ts b/cli/tests/js_import_detect.ts deleted file mode 100644 index 751741996..000000000 --- a/cli/tests/js_import_detect.ts +++ /dev/null @@ -1,3 +0,0 @@ -function define(_foo: string[]) {} -define(["long"]); -console.log("ok"); diff --git a/cli/tests/js_import_detect.ts.out b/cli/tests/js_import_detect.ts.out deleted file mode 100644 index 9766475a4..000000000 --- a/cli/tests/js_import_detect.ts.out +++ /dev/null @@ -1 +0,0 @@ -ok diff --git a/cli/tests/jsx_import_from_ts.App.jsx b/cli/tests/jsx_import_from_ts.App.jsx deleted file mode 100644 index 649230613..000000000 --- a/cli/tests/jsx_import_from_ts.App.jsx +++ /dev/null @@ -1,11 +0,0 @@ -const React = { - createElement() {}, -}; - -export default function app() { - return ( -
-

asdf

-
- ); -} diff --git a/cli/tests/jsx_import_from_ts.ts b/cli/tests/jsx_import_from_ts.ts deleted file mode 100644 index 3cc916698..000000000 --- a/cli/tests/jsx_import_from_ts.ts +++ /dev/null @@ -1,3 +0,0 @@ -import app from "./jsx_import_from_ts.App.jsx"; - -console.log(app); diff --git a/cli/tests/jsx_import_from_ts.ts.out b/cli/tests/jsx_import_from_ts.ts.out deleted file mode 100644 index d449b8c9a..000000000 --- a/cli/tests/jsx_import_from_ts.ts.out +++ /dev/null @@ -1 +0,0 @@ -[Function: app] diff --git a/cli/tests/lib_dom_asynciterable.ts b/cli/tests/lib_dom_asynciterable.ts deleted file mode 100644 index d932011f4..000000000 --- a/cli/tests/lib_dom_asynciterable.ts +++ /dev/null @@ -1,23 +0,0 @@ -const { diagnostics, files } = await Deno.emit("/main.ts", { - compilerOptions: { - target: "esnext", - lib: ["esnext", "dom", "dom.iterable", "dom.asynciterable"], - }, - sources: { - "/main.ts": `const rs = new ReadableStream({ - start(c) { - c.enqueue("hello"); - c.enqueue("deno"); - c.close(); - } - }); - - for await (const s of rs) { - console.log("s"); - } - `, - }, -}); - -console.log(diagnostics); -console.log(Object.keys(files).sort()); diff --git a/cli/tests/lib_dom_asynciterable.ts.out b/cli/tests/lib_dom_asynciterable.ts.out deleted file mode 100644 index 8b5e7adb6..000000000 --- a/cli/tests/lib_dom_asynciterable.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[] -[ "[WILDCARD]/main.ts.js", "[WILDCARD]/main.ts.js.map" ] diff --git a/cli/tests/lib_ref.ts b/cli/tests/lib_ref.ts deleted file mode 100644 index 2454f8b5d..000000000 --- a/cli/tests/lib_ref.ts +++ /dev/null @@ -1,16 +0,0 @@ -const { diagnostics, files } = await Deno.emit( - "/main.ts", - { - sources: { - "/main.ts": - `/// \n\ndocument.getElementById("foo");\nDeno.args;`, - }, - compilerOptions: { - target: "es2018", - lib: ["es2018", "deno.ns"], - }, - }, -); - -console.log(diagnostics); -console.log(Object.keys(files).sort()); diff --git a/cli/tests/lib_ref.ts.out b/cli/tests/lib_ref.ts.out deleted file mode 100644 index 4e0f933fc..000000000 --- a/cli/tests/lib_ref.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[] -[ "file:///[WILDCARD]main.ts.js", "file:///[WILDCARD]main.ts.js.map" ] diff --git a/cli/tests/lib_runtime_api.ts b/cli/tests/lib_runtime_api.ts deleted file mode 100644 index 450d9480b..000000000 --- a/cli/tests/lib_runtime_api.ts +++ /dev/null @@ -1,14 +0,0 @@ -const { diagnostics, files } = await Deno.emit( - "/main.ts", - { - sources: { - "/main.ts": `document.getElementById("foo");`, - }, - compilerOptions: { - lib: ["dom", "esnext"], - }, - }, -); - -console.log(diagnostics); -console.log(Object.keys(files).sort()); diff --git a/cli/tests/lib_runtime_api.ts.out b/cli/tests/lib_runtime_api.ts.out deleted file mode 100644 index 4e0f933fc..000000000 --- a/cli/tests/lib_runtime_api.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[] -[ "file:///[WILDCARD]main.ts.js", "file:///[WILDCARD]main.ts.js.map" ] diff --git a/cli/tests/lint/expected.out b/cli/tests/lint/expected.out deleted file mode 100644 index eb8a2651a..000000000 --- a/cli/tests/lint/expected.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -Found 3 problems -Checked 3 files diff --git a/cli/tests/lint/expected_from_stdin.out b/cli/tests/lint/expected_from_stdin.out deleted file mode 100644 index 90f455fdc..000000000 --- a/cli/tests/lint/expected_from_stdin.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -Found 1 problem -Checked 1 file diff --git a/cli/tests/lint/expected_from_stdin_json.out b/cli/tests/lint/expected_from_stdin_json.out deleted file mode 100644 index 7ea40e957..000000000 --- a/cli/tests/lint/expected_from_stdin_json.out +++ /dev/null @@ -1,23 +0,0 @@ -{ - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "col": 8, - "bytePos": 8 - }, - "end": { - "line": 1, - "col": 11, - "bytePos": 11 - } - }, - "filename": "_stdin.ts", - "message": "`any` type is not allowed", - "code": "no-explicit-any", - "hint": [WILDCARD] - } - ], - "errors": [] -} diff --git a/cli/tests/lint/expected_glob.out b/cli/tests/lint/expected_glob.out deleted file mode 100644 index eb8a2651a..000000000 --- a/cli/tests/lint/expected_glob.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -Found 3 problems -Checked 3 files diff --git a/cli/tests/lint/expected_ignore.out b/cli/tests/lint/expected_ignore.out deleted file mode 100644 index b5f78ee04..000000000 --- a/cli/tests/lint/expected_ignore.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -Found 1 problem -Checked 2 files diff --git a/cli/tests/lint/expected_json.out b/cli/tests/lint/expected_json.out deleted file mode 100644 index dbeb8039b..000000000 --- a/cli/tests/lint/expected_json.out +++ /dev/null @@ -1,64 +0,0 @@ -{ - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "col": 0, - "bytePos": 0 - }, - "end": { - "line": 1, - "col": 19, - "bytePos": 19 - } - }, - "filename": "[WILDCARD]file1.js", - "message": "Ignore directive requires lint rule name(s)", - "code": "ban-untagged-ignore", - "hint": [WILDCARD] - }, - { - "range": { - "start": { - "line": 2, - "col": 14, - "bytePos": 34 - }, - "end": { - "line": 2, - "col": 16, - "bytePos": 36 - } - }, - "filename": "[WILDCARD]file1.js", - "message": "Empty block statement", - "code": "no-empty", - "hint": [WILDCARD] - }, - { - "range": { - "start": { - "line": 3, - "col": 13, - "bytePos": 57 - }, - "end": { - "line": 3, - "col": 15, - "bytePos": 59 - } - }, - "filename": "[WILDCARD]file2.ts", - "message": "Empty block statement", - "code": "no-empty", - "hint": [WILDCARD] - } - ], - "errors": [ - { - "file_path": "[WILDCARD]malformed.js", - "message": "Expected }, got at [WILDCARD]malformed.js:4:15" - } - ] -} diff --git a/cli/tests/lint/expected_quiet.out b/cli/tests/lint/expected_quiet.out deleted file mode 100644 index d7c9d7bb9..000000000 --- a/cli/tests/lint/expected_quiet.out +++ /dev/null @@ -1,14 +0,0 @@ -(ban-untagged-ignore) Ignore directive requires lint rule name(s) -// deno-lint-ignore -^^^^^^^^^^^^^^^^^^^ - at [WILDCARD]file1.js:1:0 - - hint: [WILDCARD] - -(no-empty) Empty block statement -while (false) {} - ^^ - at [WILDCARD]file1.js:2:14 - - hint: [WILDCARD] - diff --git a/cli/tests/lint/expected_rules.out b/cli/tests/lint/expected_rules.out deleted file mode 100644 index 4afab7b9b..000000000 --- a/cli/tests/lint/expected_rules.out +++ /dev/null @@ -1,2 +0,0 @@ -Available rules: -[WILDCARD] diff --git a/cli/tests/lint/expected_verbose.out b/cli/tests/lint/expected_verbose.out deleted file mode 100644 index eb8a2651a..000000000 --- a/cli/tests/lint/expected_verbose.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -Found 3 problems -Checked 3 files diff --git a/cli/tests/lint/file1.js b/cli/tests/lint/file1.js deleted file mode 100644 index 737f26818..000000000 --- a/cli/tests/lint/file1.js +++ /dev/null @@ -1,2 +0,0 @@ -// deno-lint-ignore -while (false) {} diff --git a/cli/tests/lint/file2.ts b/cli/tests/lint/file2.ts deleted file mode 100644 index 73c612c35..000000000 --- a/cli/tests/lint/file2.ts +++ /dev/null @@ -1,6 +0,0 @@ -try { - await Deno.open("./some/file.txt"); -} catch (_e) {} - -// deno-lint-ignore no-explicit-any -function _foo(): any {} diff --git a/cli/tests/lint/ignored_file.ts b/cli/tests/lint/ignored_file.ts deleted file mode 100644 index 97befafa3..000000000 --- a/cli/tests/lint/ignored_file.ts +++ /dev/null @@ -1,3 +0,0 @@ -// deno-lint-ignore-file - -function foo(): any {} diff --git a/cli/tests/lint/malformed.js b/cli/tests/lint/malformed.js deleted file mode 100644 index 5ad4650d6..000000000 --- a/cli/tests/lint/malformed.js +++ /dev/null @@ -1,4 +0,0 @@ -// deno-fmt-ignore-file - -// intentionally malformed file -export class A { \ No newline at end of file diff --git a/cli/tests/listen_tls_alpn.ts b/cli/tests/listen_tls_alpn.ts deleted file mode 100644 index 6aedf0e4f..000000000 --- a/cli/tests/listen_tls_alpn.ts +++ /dev/null @@ -1,12 +0,0 @@ -const listener = Deno.listenTls({ - port: Number(Deno.args[0]), - certFile: "./cli/tests/tls/localhost.crt", - keyFile: "./cli/tests/tls/localhost.key", - alpnProtocols: ["h2", "http/1.1", "foobar"], -}); - -console.log("READY"); - -for await (const conn of listener) { - conn.close(); -} diff --git a/cli/tests/localhost_unsafe_ssl.ts.out b/cli/tests/localhost_unsafe_ssl.ts.out deleted file mode 100644 index 9ea991a64..000000000 --- a/cli/tests/localhost_unsafe_ssl.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -DANGER: TLS certificate validation is disabled for: deno.land -error: error sending request for url (https://localhost:5545/cli/tests/subdir/mod2.ts): error trying to connect: invalid certificate: UnknownIssuer - at [WILDCARD]tests/cafile_url_imports.ts:1:0 diff --git a/cli/tests/lock_check_err.json b/cli/tests/lock_check_err.json deleted file mode 100644 index 0a1380dfc..000000000 --- a/cli/tests/lock_check_err.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "http://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/cli/tests/003_relative_import.ts": "bad" -} diff --git a/cli/tests/lock_check_err.out b/cli/tests/lock_check_err.out deleted file mode 100644 index c12f4af34..000000000 --- a/cli/tests/lock_check_err.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/cli/tests/003_relative_import.ts - Lock file: lock_check_err.json diff --git a/cli/tests/lock_check_err2.json b/cli/tests/lock_check_err2.json deleted file mode 100644 index b26c1f0ae..000000000 --- a/cli/tests/lock_check_err2.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "http://localhost:4545/cli/tests/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js": "bad", - "http://localhost:4545/cli/tests/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" -} diff --git a/cli/tests/lock_check_err2.out b/cli/tests/lock_check_err2.out deleted file mode 100644 index d3ccfc46e..000000000 --- a/cli/tests/lock_check_err2.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js - Lock file: lock_check_err2.json diff --git a/cli/tests/lock_check_err_with_bundle.json b/cli/tests/lock_check_err_with_bundle.json deleted file mode 100644 index 9c6a2e5f6..000000000 --- a/cli/tests/lock_check_err_with_bundle.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "http://127.0.0.1:4545/cli/tests/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", - "http://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts": "bad" -} diff --git a/cli/tests/lock_check_err_with_bundle.out b/cli/tests/lock_check_err_with_bundle.out deleted file mode 100644 index d6eae26b1..000000000 --- a/cli/tests/lock_check_err_with_bundle.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts - Lock file: lock_check_err_with_bundle.json diff --git a/cli/tests/lock_check_ok.json b/cli/tests/lock_check_ok.json deleted file mode 100644 index e0ee0a17e..000000000 --- a/cli/tests/lock_check_ok.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "http://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/cli/tests/003_relative_import.ts": "aa9e16de824f81871a1c7164d5bd6857df7db2e18621750bd66b0bde4df07f21" -} diff --git a/cli/tests/lock_check_ok2.json b/cli/tests/lock_check_ok2.json deleted file mode 100644 index 38b450f86..000000000 --- a/cli/tests/lock_check_ok2.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "http://localhost:4545/cli/tests/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/cli/tests/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" -} diff --git a/cli/tests/lock_dynamic_imports.json b/cli/tests/lock_dynamic_imports.json deleted file mode 100644 index fb822f64e..000000000 --- a/cli/tests/lock_dynamic_imports.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "http://127.0.0.1:4545/cli/tests/013_dynamic_import.ts": "f0d2d108c100e769cda9f26b74326f21e44cab81611aa7f6cd2b731d4cbc1995", - "http://127.0.0.1:4545/cli/tests/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", - "http://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts": "bad" -} diff --git a/cli/tests/lock_dynamic_imports.out b/cli/tests/lock_dynamic_imports.out deleted file mode 100644 index 3bf6342c8..000000000 --- a/cli/tests/lock_dynamic_imports.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts - Lock file: lock_dynamic_imports.json diff --git a/cli/tests/lock_write_fetch.ts b/cli/tests/lock_write_fetch.ts deleted file mode 100644 index b6ecf4747..000000000 --- a/cli/tests/lock_write_fetch.ts +++ /dev/null @@ -1,58 +0,0 @@ -try { - Deno.removeSync("./lock_write_fetch.json"); -} catch { - // pass -} - -const fetchProc = Deno.run({ - stdout: "null", - stderr: "null", - cmd: [ - Deno.execPath(), - "cache", - "--reload", - "--lock=lock_write_fetch.json", - "--lock-write", - "--cert=tls/RootCA.pem", - "https_import.ts", - ], -}); - -const fetchCode = (await fetchProc.status()).code; -console.log(`fetch code: ${fetchCode}`); - -const fetchCheckProc = Deno.run({ - stdout: "null", - stderr: "null", - cmd: [ - Deno.execPath(), - "cache", - "--lock=lock_write_fetch.json", - "--cert=tls/RootCA.pem", - "https_import.ts", - ], -}); - -const fetchCheckProcCode = (await fetchCheckProc.status()).code; -console.log(`fetch check code: ${fetchCheckProcCode}`); - -Deno.removeSync("./lock_write_fetch.json"); - -const runProc = Deno.run({ - stdout: "null", - stderr: "null", - cmd: [ - Deno.execPath(), - "run", - "--lock=lock_write_fetch.json", - "--lock-write", - "--allow-read", - "file_exists.ts", - "lock_write_fetch.json", - ], -}); - -const runCode = (await runProc.status()).code; -console.log(`run code: ${runCode}`); - -Deno.removeSync("./lock_write_fetch.json"); diff --git a/cli/tests/lock_write_fetch.ts.out b/cli/tests/lock_write_fetch.ts.out deleted file mode 100644 index bfdb952f9..000000000 --- a/cli/tests/lock_write_fetch.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -fetch code: 0 -fetch check code: 0 -run code: 0 diff --git a/cli/tests/lock_write_requires_lock.out b/cli/tests/lock_write_requires_lock.out deleted file mode 100644 index 7cc5906f6..000000000 --- a/cli/tests/lock_write_requires_lock.out +++ /dev/null @@ -1,3 +0,0 @@ -error: The following required arguments were not provided: - --lock -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/lsp/a.d.ts b/cli/tests/lsp/a.d.ts deleted file mode 100644 index 7f587e144..000000000 --- a/cli/tests/lsp/a.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var a: string; diff --git a/cli/tests/lsp/b.d.ts b/cli/tests/lsp/b.d.ts deleted file mode 100644 index 9d4b96cb8..000000000 --- a/cli/tests/lsp/b.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var b: string; diff --git a/cli/tests/lsp/code_action_ignore_lint_params.json b/cli/tests/lsp/code_action_ignore_lint_params.json deleted file mode 100644 index 7711812fd..000000000 --- a/cli/tests/lsp/code_action_ignore_lint_params.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "textDocument": { - "uri": "file:///a/file.ts" - }, - "range": { - "start": { - "line": 1, - "character": 5 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "context": { - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 5 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "severity": 1, - "code": "prefer-const", - "source": "deno-lint", - "message": "'message' is never reassigned\nUse 'const' instead", - "relatedInformation": [] - } - ], - "only": [ - "quickfix" - ] - } -} diff --git a/cli/tests/lsp/code_action_ignore_lint_response.json b/cli/tests/lsp/code_action_ignore_lint_response.json deleted file mode 100644 index f5c24ec21..000000000 --- a/cli/tests/lsp/code_action_ignore_lint_response.json +++ /dev/null @@ -1,62 +0,0 @@ -[ - { - "title": "Disable prefer-const for this line", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { "line": 1, "character": 5 }, - "end": { "line": 1, "character": 12 } - }, - "severity": 1, - "code": "prefer-const", - "source": "deno-lint", - "message": "'message' is never reassigned\nUse 'const' instead", - "relatedInformation": [] - } - ], - "edit": { - "changes": { - "file:///a/file.ts": [ - { - "range": { - "start": { "line": 1, "character": 0 }, - "end": { "line": 1, "character": 0 } - }, - "newText": "// deno-lint-ignore prefer-const\n" - } - ] - } - } - }, - { - "title": "Ignore lint errors for the entire file", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { "line": 1, "character": 5 }, - "end": { "line": 1, "character": 12 } - }, - "severity": 1, - "code": "prefer-const", - "source": "deno-lint", - "message": "'message' is never reassigned\nUse 'const' instead", - "relatedInformation": [] - } - ], - "edit": { - "changes": { - "file:///a/file.ts": [ - { - "range": { - "start": { "line": 0, "character": 0 }, - "end": { "line": 0, "character": 0 } - }, - "newText": "// deno-lint-ignore-file\n" - } - ] - } - } - } -] diff --git a/cli/tests/lsp/code_action_params.json b/cli/tests/lsp/code_action_params.json deleted file mode 100644 index d026d61f6..000000000 --- a/cli/tests/lsp/code_action_params.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "textDocument": { - "uri": "file:///a/file.ts" - }, - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "context": { - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "severity": 1, - "code": 1308, - "source": "deno-ts", - "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", - "relatedInformation": [] - } - ], - "only": [ - "quickfix" - ] - } -} diff --git a/cli/tests/lsp/code_action_params_cache.json b/cli/tests/lsp/code_action_params_cache.json deleted file mode 100644 index 61ae555a3..000000000 --- a/cli/tests/lsp/code_action_params_cache.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "textDocument": { - "uri": "file:///a/file.ts" - }, - "range": { - "start": { - "line": 0, - "character": 19 - }, - "end": { - "line": 0, - "character": 49 - } - }, - "context": { - "diagnostics": [ - { - "range": { - "start": { - "line": 0, - "character": 19 - }, - "end": { - "line": 0, - "character": 49 - } - }, - "severity": 1, - "code": "no-cache", - "source": "deno", - "message": "Unable to load the remote module: \"https://deno.land/x/a/mod.ts\".", - "data": { - "specifier": "https://deno.land/x/a/mod.ts" - } - } - ], - "only": [ - "quickfix" - ] - } -} diff --git a/cli/tests/lsp/code_action_params_deadlock.json b/cli/tests/lsp/code_action_params_deadlock.json deleted file mode 100644 index be0e317e1..000000000 --- a/cli/tests/lsp/code_action_params_deadlock.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "textDocument": { - "uri": "file:///a/file.ts" - }, - "range": { - "start": { - "line": 441, - "character": 33 - }, - "end": { - "line": 441, - "character": 42 - } - }, - "context": { - "diagnostics": [ - { - "range": { - "start": { - "line": 441, - "character": 33 - }, - "end": { - "line": 441, - "character": 42 - } - }, - "severity": 1, - "code": 7031, - "source": "deno-ts", - "message": "Binding element 'debugFlag' implicitly has an 'any' type." - } - ], - "only": [ - "quickfix" - ] - } -} diff --git a/cli/tests/lsp/code_action_params_imports.json b/cli/tests/lsp/code_action_params_imports.json deleted file mode 100644 index 7a5824923..000000000 --- a/cli/tests/lsp/code_action_params_imports.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "textDocument": { - "uri": "file:///a/file01.ts" - }, - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "context": { - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'abc'." - }, - { - "range": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 15 - } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'def'." - } - ], - "only": [ - "quickfix" - ] - } -} diff --git a/cli/tests/lsp/code_action_params_refactor.json b/cli/tests/lsp/code_action_params_refactor.json deleted file mode 100644 index 121c400ed..000000000 --- a/cli/tests/lsp/code_action_params_refactor.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "textDocument": { - "uri": "file:///a/file.ts" - }, - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "context": { - "diagnostics": [], - "only": [ - "refactor" - ] - } -} diff --git a/cli/tests/lsp/code_action_resolve_params.json b/cli/tests/lsp/code_action_resolve_params.json deleted file mode 100644 index 50c1f9a43..000000000 --- a/cli/tests/lsp/code_action_resolve_params.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "title": "Add all missing 'async' modifiers", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "severity": 1, - "code": 1308, - "source": "deno-ts", - "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", - "relatedInformation": [] - } - ], - "data": { - "specifier": "file:///a/file.ts", - "fixId": "fixAwaitInSyncFunction" - } -} diff --git a/cli/tests/lsp/code_action_resolve_params_imports.json b/cli/tests/lsp/code_action_resolve_params_imports.json deleted file mode 100644 index 60178bbfe..000000000 --- a/cli/tests/lsp/code_action_resolve_params_imports.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "title": "Add all missing imports", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'abc'." - } - ], - "data": { - "specifier": "file:///a/file01.ts", - "fixId": "fixMissingImport" - } -} diff --git a/cli/tests/lsp/code_action_resolve_params_refactor.json b/cli/tests/lsp/code_action_resolve_params_refactor.json deleted file mode 100644 index d4bb3bd81..000000000 --- a/cli/tests/lsp/code_action_resolve_params_refactor.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "title": "Extract to interface", - "kind": "refactor.extract.interface", - "isPreferred": true, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 33 - } - }, - "refactorName": "Extract type", - "actionName": "Extract to interface" - } -} diff --git a/cli/tests/lsp/code_action_resolve_response.json b/cli/tests/lsp/code_action_resolve_response.json deleted file mode 100644 index e3f5b3f0e..000000000 --- a/cli/tests/lsp/code_action_resolve_response.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "title": "Add all missing 'async' modifiers", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "severity": 1, - "code": 1308, - "source": "deno-ts", - "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", - "relatedInformation": [] - } - ], - "edit": { - "documentChanges": [ - { - "textDocument": { - "uri": "file:///a/file.ts", - "version": 1 - }, - "edits": [ - { - "range": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "newText": "async " - }, - { - "range": { - "start": { - "line": 0, - "character": 21 - }, - "end": { - "line": 0, - "character": 25 - } - }, - "newText": "Promise" - }, - { - "range": { - "start": { - "line": 4, - "character": 7 - }, - "end": { - "line": 4, - "character": 7 - } - }, - "newText": "async " - }, - { - "range": { - "start": { - "line": 4, - "character": 21 - }, - "end": { - "line": 4, - "character": 25 - } - }, - "newText": "Promise" - } - ] - } - ] - }, - "data": { - "specifier": "file:///a/file.ts", - "fixId": "fixAwaitInSyncFunction" - } -} diff --git a/cli/tests/lsp/code_action_resolve_response_imports.json b/cli/tests/lsp/code_action_resolve_response_imports.json deleted file mode 100644 index 6621c501f..000000000 --- a/cli/tests/lsp/code_action_resolve_response_imports.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "title": "Add all missing imports", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'abc'." - } - ], - "edit": { - "documentChanges": [ - { - "textDocument": { - "uri": "file:///a/file01.ts", - "version": 1 - }, - "edits": [ - { - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "newText": "import { abc,def } from \"./file00.ts\";\n" - } - ] - } - ] - }, - "data": { - "specifier": "file:///a/file01.ts", - "fixId": "fixMissingImport" - } -} diff --git a/cli/tests/lsp/code_action_resolve_response_refactor.json b/cli/tests/lsp/code_action_resolve_response_refactor.json deleted file mode 100644 index 721a76a6b..000000000 --- a/cli/tests/lsp/code_action_resolve_response_refactor.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "title": "Extract to interface", - "kind": "refactor.extract.interface", - "edit": { - "documentChanges": [ - { - "textDocument": { - "uri": "file:///a/file.ts", - "version": 1 - }, - "edits": [ - { - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "newText": "interface NewType {\n a?: number;\n b?: string;\n}\n\n" - }, - { - "range": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 33 - } - }, - "newText": "NewType" - } - ] - } - ] - }, - "isPreferred": true, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 33 - } - }, - "refactorName": "Extract type", - "actionName": "Extract to interface" - } -} diff --git a/cli/tests/lsp/code_action_response.json b/cli/tests/lsp/code_action_response.json deleted file mode 100644 index ab30898f8..000000000 --- a/cli/tests/lsp/code_action_response.json +++ /dev/null @@ -1,90 +0,0 @@ -[ - { - "title": "Add async modifier to containing function", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "severity": 1, - "code": 1308, - "source": "deno-ts", - "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", - "relatedInformation": [] - } - ], - "edit": { - "documentChanges": [ - { - "textDocument": { - "uri": "file:///a/file.ts", - "version": 1 - }, - "edits": [ - { - "range": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "newText": "async " - }, - { - "range": { - "start": { - "line": 0, - "character": 21 - }, - "end": { - "line": 0, - "character": 25 - } - }, - "newText": "Promise" - } - ] - } - ] - } - }, - { - "title": "Add all missing 'async' modifiers", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "severity": 1, - "code": 1308, - "source": "deno-ts", - "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", - "relatedInformation": [] - } - ], - "data": { - "specifier": "file:///a/file.ts", - "fixId": "fixAwaitInSyncFunction" - } - } -] diff --git a/cli/tests/lsp/code_action_response_cache.json b/cli/tests/lsp/code_action_response_cache.json deleted file mode 100644 index c56b35023..000000000 --- a/cli/tests/lsp/code_action_response_cache.json +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "title": "Cache \"https://deno.land/x/a/mod.ts\" and its dependencies.", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 0, - "character": 19 - }, - "end": { - "line": 0, - "character": 49 - } - }, - "severity": 1, - "code": "no-cache", - "source": "deno", - "message": "Unable to load the remote module: \"https://deno.land/x/a/mod.ts\".", - "data": { - "specifier": "https://deno.land/x/a/mod.ts" - } - } - ], - "command": { - "title": "", - "command": "deno.cache", - "arguments": [ - [ - "https://deno.land/x/a/mod.ts" - ] - ] - } - } -] diff --git a/cli/tests/lsp/code_action_response_imports.json b/cli/tests/lsp/code_action_response_imports.json deleted file mode 100644 index e4d926bdd..000000000 --- a/cli/tests/lsp/code_action_response_imports.json +++ /dev/null @@ -1,242 +0,0 @@ -[ - { - "title": "Import 'abc' from module \"./file00.ts\"", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'abc'." - } - ], - "edit": { - "documentChanges": [ - { - "textDocument": { - "uri": "file:///a/file01.ts", - "version": 1 - }, - "edits": [ - { - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "newText": "import { abc } from \"./file00.ts\";\n" - } - ] - } - ] - } - }, - { - "title": "Add all missing imports", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'abc'." - } - ], - "data": { - "specifier": "file:///a/file01.ts", - "fixId": "fixMissingImport" - } - }, - { - "title": "Add missing function declaration 'abc'", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'abc'." - } - ], - "edit": { - "documentChanges": [ - { - "textDocument": { - "uri": "file:///a/file01.ts", - "version": 1 - }, - "edits": [ - { - "range": { - "start": { - "line": 3, - "character": 0 - }, - "end": { - "line": 3, - "character": 0 - } - }, - "newText": "\nfunction abc(abc: any) {\nthrow new Error(\"Function not implemented.\");\n}\n" - } - ] - } - ] - } - }, - { - "title": "Import 'def' from module \"./file00.ts\"", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 15 - } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'def'." - } - ], - "edit": { - "documentChanges": [ - { - "textDocument": { - "uri": "file:///a/file01.ts", - "version": 1 - }, - "edits": [ - { - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "newText": "import { def } from \"./file00.ts\";\n" - } - ] - } - ] - } - }, - { - "title": "Add missing function declaration 'def'", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 15 - } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'def'." - } - ], - "edit": { - "documentChanges": [ - { - "textDocument": { - "uri": "file:///a/file01.ts", - "version": 1 - }, - "edits": [ - { - "range": { - "start": { - "line": 3, - "character": 0 - }, - "end": { - "line": 3, - "character": 0 - } - }, - "newText": "\nfunction def(def: any) {\nthrow new Error(\"Function not implemented.\");\n}\n" - } - ] - } - ] - } - }, - { - "title": "Add all missing function declarations", - "kind": "quickfix", - "diagnostics": [ - { - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'abc'." - } - ], - "data": { - "specifier": "file:///a/file01.ts", - "fixId": "fixMissingFunctionDeclaration" - } - } -] diff --git a/cli/tests/lsp/code_action_response_no_disabled.json b/cli/tests/lsp/code_action_response_no_disabled.json deleted file mode 100644 index c69bd1120..000000000 --- a/cli/tests/lsp/code_action_response_no_disabled.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "title": "Move to a new file", - "kind": "refactor.move.newFile", - "isPreferred": false, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 14, - "character": 0 - } - }, - "refactorName": "Move to a new file", - "actionName": "Move to a new file" - } - } -] diff --git a/cli/tests/lsp/code_action_response_refactor.json b/cli/tests/lsp/code_action_response_refactor.json deleted file mode 100644 index a9fbd2827..000000000 --- a/cli/tests/lsp/code_action_response_refactor.json +++ /dev/null @@ -1,177 +0,0 @@ -[ - { - "title": "Extract to function in global scope", - "kind": "refactor.extract.function", - "isPreferred": false, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "refactorName": "Extract Symbol", - "actionName": "function_scope_0" - } - }, - { - "title": "Extract to constant in enclosing scope", - "kind": "refactor.extract.constant", - "isPreferred": false, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "refactorName": "Extract Symbol", - "actionName": "constant_scope_0" - } - }, - { - "title": "Move to a new file", - "kind": "refactor.move.newFile", - "isPreferred": false, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "refactorName": "Move to a new file", - "actionName": "Move to a new file" - } - }, - { - "title": "Convert default export to named export", - "kind": "refactor.rewrite.export.named", - "isPreferred": false, - "disabled": { - "reason": "This file already has a default export" - }, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "refactorName": "Convert export", - "actionName": "Convert default export to named export" - } - }, - { - "title": "Convert named export to default export", - "kind": "refactor.rewrite.export.default", - "isPreferred": false, - "disabled": { - "reason": "This file already has a default export" - }, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "refactorName": "Convert export", - "actionName": "Convert named export to default export" - } - }, - { - "title": "Convert namespace import to named imports", - "kind": "refactor.rewrite.import.named", - "isPreferred": false, - "disabled": { - "reason": "Selection is not an import declaration." - }, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "refactorName": "Convert import", - "actionName": "Convert namespace import to named imports" - } - }, - { - "title": "Convert named imports to namespace import", - "kind": "refactor.rewrite.import.namespace", - "isPreferred": false, - "disabled": { - "reason": "Selection is not an import declaration." - }, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "refactorName": "Convert import", - "actionName": "Convert named imports to namespace import" - } - }, - { - "title": "Convert to optional chain expression", - "kind": "refactor.rewrite.expression.optionalChain", - "isPreferred": false, - "disabled": { - "reason": "Could not find convertible access expression" - }, - "data": { - "specifier": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "refactorName": "Convert to optional chain expression", - "actionName": "Convert to optional chain expression" - } - } -] diff --git a/cli/tests/lsp/code_lens_resolve_response.json b/cli/tests/lsp/code_lens_resolve_response.json deleted file mode 100644 index 1400eb4e6..000000000 --- a/cli/tests/lsp/code_lens_resolve_response.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "range": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "command": { - "title": "1 reference", - "command": "deno.showReferences", - "arguments": [ - "file:///a/file.ts", - { - "line": 0, - "character": 6 - }, - [ - { - "uri": "file:///a/file.ts", - "range": { - "start": { - "line": 12, - "character": 14 - }, - "end": { - "line": 12, - "character": 15 - } - } - } - ] - ] - } -} diff --git a/cli/tests/lsp/code_lens_resolve_response_impl.json b/cli/tests/lsp/code_lens_resolve_response_impl.json deleted file mode 100644 index cabf2f833..000000000 --- a/cli/tests/lsp/code_lens_resolve_response_impl.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "range": { - "start": { - "line": 0, - "character": 10 - }, - "end": { - "line": 0, - "character": 11 - } - }, - "command": { - "title": "1 implementation", - "command": "deno.showReferences", - "arguments": [ - "file:///a/file.ts", - { - "line": 0, - "character": 10 - }, - [ - { - "uri": "file:///a/file.ts", - "range": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 7 - } - } - } - ] - ] - } -} diff --git a/cli/tests/lsp/code_lens_response.json b/cli/tests/lsp/code_lens_response.json deleted file mode 100644 index e3a87e4be..000000000 --- a/cli/tests/lsp/code_lens_response.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "range": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "references" - } - }, - { - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 3 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "references" - } - } -] diff --git a/cli/tests/lsp/code_lens_response_changed.json b/cli/tests/lsp/code_lens_response_changed.json deleted file mode 100644 index b0073a23f..000000000 --- a/cli/tests/lsp/code_lens_response_changed.json +++ /dev/null @@ -1,50 +0,0 @@ -[ - { - "range": { - "start": { - "line": 0, - "character": 10 - }, - "end": { - "line": 0, - "character": 11 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "implementations" - } - }, - { - "range": { - "start": { - "line": 0, - "character": 10 - }, - "end": { - "line": 0, - "character": 11 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "references" - } - }, - { - "range": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 7 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "references" - } - } -] diff --git a/cli/tests/lsp/code_lens_response_impl.json b/cli/tests/lsp/code_lens_response_impl.json deleted file mode 100644 index c6e5bd92d..000000000 --- a/cli/tests/lsp/code_lens_response_impl.json +++ /dev/null @@ -1,98 +0,0 @@ -[ - { - "range": { - "start": { - "line": 0, - "character": 10 - }, - "end": { - "line": 0, - "character": 11 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "implementations" - } - }, - { - "range": { - "start": { - "line": 0, - "character": 10 - }, - "end": { - "line": 0, - "character": 11 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "references" - } - }, - { - "range": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 7 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "references" - } - }, - { - "range": { - "start": { - "line": 10, - "character": 10 - }, - "end": { - "line": 10, - "character": 11 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "implementations" - } - }, - { - "range": { - "start": { - "line": 10, - "character": 10 - }, - "end": { - "line": 10, - "character": 11 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "references" - } - }, - { - "range": { - "start": { - "line": 11, - "character": 2 - }, - "end": { - "line": 11, - "character": 3 - } - }, - "data": { - "specifier": "file:///a/file.ts", - "source": "references" - } - } -] diff --git a/cli/tests/lsp/code_lens_response_test.json b/cli/tests/lsp/code_lens_response_test.json deleted file mode 100644 index b2cb4588a..000000000 --- a/cli/tests/lsp/code_lens_response_test.json +++ /dev/null @@ -1,162 +0,0 @@ -[ - { - "range": { - "start": { - "line": 4, - "character": 5 - }, - "end": { - "line": 4, - "character": 9 - } - }, - "command": { - "title": "▶︎ Run Test", - "command": "deno.test", - "arguments": [ - "file:///a/file.ts", - "test a" - ] - } - }, - { - "range": { - "start": { - "line": 5, - "character": 5 - }, - "end": { - "line": 5, - "character": 9 - } - }, - "command": { - "title": "▶︎ Run Test", - "command": "deno.test", - "arguments": [ - "file:///a/file.ts", - "test b" - ] - } - }, - { - "range": { - "start": { - "line": 9, - "character": 0 - }, - "end": { - "line": 9, - "character": 4 - } - }, - "command": { - "title": "▶︎ Run Test", - "command": "deno.test", - "arguments": [ - "file:///a/file.ts", - "test c" - ] - } - }, - { - "range": { - "start": { - "line": 13, - "character": 0 - }, - "end": { - "line": 13, - "character": 4 - } - }, - "command": { - "title": "▶︎ Run Test", - "command": "deno.test", - "arguments": [ - "file:///a/file.ts", - "test d" - ] - } - }, - { - "range": { - "start": { - "line": 14, - "character": 0 - }, - "end": { - "line": 14, - "character": 5 - } - }, - "command": { - "title": "▶︎ Run Test", - "command": "deno.test", - "arguments": [ - "file:///a/file.ts", - "test e" - ] - } - }, - { - "range": { - "start": { - "line": 18, - "character": 0 - }, - "end": { - "line": 18, - "character": 5 - } - }, - "command": { - "title": "▶︎ Run Test", - "command": "deno.test", - "arguments": [ - "file:///a/file.ts", - "test f" - ] - } - }, - { - "range": { - "start": { - "line": 19, - "character": 0 - }, - "end": { - "line": 19, - "character": 5 - } - }, - "command": { - "title": "▶︎ Run Test", - "command": "deno.test", - "arguments": [ - "file:///a/file.ts", - "test g" - ] - } - }, - { - "range": { - "start": { - "line": 23, - "character": 0 - }, - "end": { - "line": 23, - "character": 5 - } - }, - "command": { - "title": "▶︎ Run Test", - "command": "deno.test", - "arguments": [ - "file:///a/file.ts", - "test h" - ] - } - } -] diff --git a/cli/tests/lsp/completion_request_params_optional.json b/cli/tests/lsp/completion_request_params_optional.json deleted file mode 100644 index 1f3c079c7..000000000 --- a/cli/tests/lsp/completion_request_params_optional.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "textDocument": { - "uri": "file:///a/file.ts" - }, - "position": { - "line": 8, - "character": 4 - }, - "context": { - "triggerKind": 2, - "triggerCharacter": "." - } -} diff --git a/cli/tests/lsp/completion_request_response_empty.json b/cli/tests/lsp/completion_request_response_empty.json deleted file mode 100644 index 272dfb475..000000000 --- a/cli/tests/lsp/completion_request_response_empty.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "isIncomplete": false, - "items": [ - { - "label": ".", - "kind": 19, - "detail": "(local)", - "sortText": "1", - "insertText": "." - }, - { - "label": "..", - "kind": 19, - "detail": "(local)", - "sortText": "1", - "insertText": ".." - }, - { - "label": "http://localhost:4545", - "kind": 19, - "detail": "(registry)", - "sortText": "2", - "textEdit": { - "range": { - "start": { - "line": 0, - "character": 20 - }, - "end": { - "line": 0, - "character": 20 - } - }, - "newText": "http://localhost:4545" - } - } - ] -} diff --git a/cli/tests/lsp/completion_resolve_params.json b/cli/tests/lsp/completion_resolve_params.json deleted file mode 100644 index 26231036d..000000000 --- a/cli/tests/lsp/completion_resolve_params.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "label": "build", - "kind": 6, - "sortText": "1", - "insertTextFormat": 1, - "data": { - "tsc": { - "specifier": "file:///a/file.ts", - "position": 5, - "name": "build", - "useCodeSnippet": false - } - } -} diff --git a/cli/tests/lsp/completion_resolve_params_optional.json b/cli/tests/lsp/completion_resolve_params_optional.json deleted file mode 100644 index cb99bf960..000000000 --- a/cli/tests/lsp/completion_resolve_params_optional.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "label": "b?", - "kind": 5, - "sortText": "1", - "filterText": "b", - "insertText": "b", - "data": { - "tsc": { - "specifier": "file:///a/file.ts", - "position": 79, - "name": "b", - "useCodeSnippet": false - } - } -} diff --git a/cli/tests/lsp/completion_resolve_params_registry.json b/cli/tests/lsp/completion_resolve_params_registry.json deleted file mode 100644 index 99a4a048e..000000000 --- a/cli/tests/lsp/completion_resolve_params_registry.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "label": "v2.0.0", - "kind": 19, - "detail": "(version)", - "sortText": "0000000003", - "filterText": "http://localhost:4545/x/a@v2.0.0", - "textEdit": { - "range": { - "start": { - "line": 0, - "character": 20 - }, - "end": { - "line": 0, - "character": 46 - } - }, - "newText": "http://localhost:4545/x/a@v2.0.0" - } -} diff --git a/cli/tests/lsp/completion_resolve_response.json b/cli/tests/lsp/completion_resolve_response.json deleted file mode 100644 index 0edbc14ef..000000000 --- a/cli/tests/lsp/completion_resolve_response.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "label": "build", - "kind": 6, - "detail": "const Deno.build: {\n target: string;\n arch: \"x86_64\" | \"aarch64\";\n os: \"darwin\" | \"linux\" | \"windows\";\n vendor: string;\n env?: string | undefined;\n}", - "documentation": { - "kind": "markdown", - "value": "Build related information." - }, - "sortText": "1", - "insertTextFormat": 1 -} diff --git a/cli/tests/lsp/completion_resolve_response_registry.json b/cli/tests/lsp/completion_resolve_response_registry.json deleted file mode 100644 index 99a4a048e..000000000 --- a/cli/tests/lsp/completion_resolve_response_registry.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "label": "v2.0.0", - "kind": 19, - "detail": "(version)", - "sortText": "0000000003", - "filterText": "http://localhost:4545/x/a@v2.0.0", - "textEdit": { - "range": { - "start": { - "line": 0, - "character": 20 - }, - "end": { - "line": 0, - "character": 46 - } - }, - "newText": "http://localhost:4545/x/a@v2.0.0" - } -} diff --git a/cli/tests/lsp/diagnostics_deno_deps.json b/cli/tests/lsp/diagnostics_deno_deps.json deleted file mode 100644 index ec6cc4f51..000000000 --- a/cli/tests/lsp/diagnostics_deno_deps.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "uri": "file:///a/file.ts", - "diagnostics": [ - { - "range": { - "start": { - "line": 0, - "character": 19 - }, - "end": { - "line": 0, - "character": 49 - } - }, - "severity": 1, - "code": "no-cache", - "source": "deno", - "message": "Uncached or missing remote URL: \"https://deno.land/x/a/mod.ts\".", - "data": { - "specifier": "https://deno.land/x/a/mod.ts" - } - } - ], - "version": 1 -} diff --git a/cli/tests/lsp/diagnostics_deno_types.json b/cli/tests/lsp/diagnostics_deno_types.json deleted file mode 100644 index f33945a59..000000000 --- a/cli/tests/lsp/diagnostics_deno_types.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "uri": "file:///a/file.ts", - "diagnostics": [ - { - "range": { - "start": { - "line": 0, - "character": 21 - }, - "end": { - "line": 0, - "character": 51 - } - }, - "severity": 1, - "code": "no-cache", - "source": "deno", - "message": "Uncached or missing remote URL: \"https://example.com/a/b.d.ts\".", - "data": { - "specifier": "https://example.com/a/b.d.ts" - } - }, - { - "range": { - "start": { - "line": 7, - "character": 19 - }, - "end": { - "line": 7, - "character": 47 - } - }, - "severity": 1, - "code": "no-cache", - "source": "deno", - "message": "Uncached or missing remote URL: \"https://example.com/a/e.js\".", - "data": { - "specifier": "https://example.com/a/e.js" - } - }, - { - "range": { - "start": { - "line": 6, - "character": 16 - }, - "end": { - "line": 6, - "character": 44 - } - }, - "severity": 1, - "code": "no-cache", - "source": "deno", - "message": "Uncached or missing remote URL: \"https://example.com/a/e.d.ts\".", - "data": { - "specifier": "https://example.com/a/e.d.ts" - } - }, - { - "range": { - "start": { - "line": 4, - "character": 19 - }, - "end": { - "line": 4, - "character": 47 - } - }, - "severity": 1, - "code": "no-cache", - "source": "deno", - "message": "Uncached or missing remote URL: \"https://example.com/a/d.js\".", - "data": { - "specifier": "https://example.com/a/d.js" - } - }, - { - "range": { - "start": { - "line": 3, - "character": 15 - }, - "end": { - "line": 3, - "character": 43 - } - }, - "severity": 1, - "code": "no-cache", - "source": "deno", - "message": "Uncached or missing remote URL: \"https://example.com/a/d.d.ts\".", - "data": { - "specifier": "https://example.com/a/d.d.ts" - } - } - ], - "version": 1 -} diff --git a/cli/tests/lsp/did_open_params_deno_types.json b/cli/tests/lsp/did_open_params_deno_types.json deleted file mode 100644 index 6f085d045..000000000 --- a/cli/tests/lsp/did_open_params_deno_types.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "textDocument": { - "uri": "file:///a/file.ts", - "languageId": "typescript", - "version": 1, - "text": "/// \n/// \n// deno-lint-ignore-file no-undef\n\n// This module is the entry point for \"compiler\" isolate, ie. the one\n// that is created when Deno needs to type check TypeScript, and in some\n// instances convert TypeScript to JavaScript.\n\n// Removes the `__proto__` for security reasons. This intentionally makes\n// Deno non compliant with ECMA-262 Annex B.2.2.1\ndelete Object.prototype.__proto__;\n\n((window) => {\n /** @type {DenoCore} */\n const core = window.Deno.core;\n\n let logDebug = false;\n let logSource = \"JS\";\n\n function setLogDebug(debug, source) {\n logDebug = debug;\n if (source) {\n logSource = source;\n }\n }\n\n function debug(...args) {\n if (logDebug) {\n const stringifiedArgs = args.map((arg) =>\n typeof arg === \"string\" ? arg : JSON.stringify(arg)\n ).join(\" \");\n // adding a non-zero integer value to the end of the debug string causes\n // the message to be printed to stderr instead of stdout, which is better\n // aligned to the behaviour of debug messages\n core.print(`DEBUG ${logSource} - ${stringifiedArgs}\\n`, 1);\n }\n }\n\n function error(...args) {\n const stringifiedArgs = args.map((arg) =>\n typeof arg === \"string\" || arg instanceof Error\n ? String(arg)\n : JSON.stringify(arg)\n ).join(\" \");\n core.print(`ERROR ${logSource} = ${stringifiedArgs}\\n`, 1);\n }\n\n class AssertionError extends Error {\n constructor(msg) {\n super(msg);\n this.name = \"AssertionError\";\n }\n }\n\n function assert(cond, msg = \"Assertion failed.\") {\n if (!cond) {\n throw new AssertionError(msg);\n }\n }\n\n /** @type {Map} */\n const sourceFileCache = new Map();\n\n /** @param {ts.DiagnosticRelatedInformation} diagnostic */\n function fromRelatedInformation({\n start,\n length,\n file,\n messageText: msgText,\n ...ri\n }) {\n let messageText;\n let messageChain;\n if (typeof msgText === \"object\") {\n messageChain = msgText;\n } else {\n messageText = msgText;\n }\n if (start !== undefined && length !== undefined && file) {\n const startPos = file.getLineAndCharacterOfPosition(start);\n const sourceLine = file.getFullText().split(\"\\n\")[startPos.line];\n const fileName = file.fileName;\n return {\n start: startPos,\n end: file.getLineAndCharacterOfPosition(start + length),\n fileName,\n messageChain,\n messageText,\n sourceLine,\n ...ri,\n };\n } else {\n return {\n messageChain,\n messageText,\n ...ri,\n };\n }\n }\n\n /** @param {ts.Diagnostic[]} diagnostics */\n function fromTypeScriptDiagnostic(diagnostics) {\n return diagnostics.map(({ relatedInformation: ri, source, ...diag }) => {\n /** @type {any} */\n const value = fromRelatedInformation(diag);\n value.relatedInformation = ri\n ? ri.map(fromRelatedInformation)\n : undefined;\n value.source = source;\n return value;\n });\n }\n\n // Using incremental compile APIs requires that all\n // paths must be either relative or absolute. Since\n // analysis in Rust operates on fully resolved URLs,\n // it makes sense to use the same scheme here.\n const ASSETS = \"asset:///\";\n const CACHE = \"cache:///\";\n\n /** Diagnostics that are intentionally ignored when compiling TypeScript in\n * Deno, as they provide misleading or incorrect information. */\n const IGNORED_DIAGNOSTICS = [\n // TS1208: All files must be modules when the '--isolatedModules' flag is\n // provided. We can ignore because we guarantee that all files are\n // modules.\n 1208,\n // TS1375: 'await' expressions are only allowed at the top level of a file\n // when that file is a module, but this file has no imports or exports.\n // Consider adding an empty 'export {}' to make this file a module.\n 1375,\n // TS1103: 'for-await-of' statement is only allowed within an async function\n // or async generator.\n 1103,\n // TS2306: File 'file:///Users/rld/src/deno/cli/tests/subdir/amd_like.js' is\n // not a module.\n 2306,\n // TS2691: An import path cannot end with a '.ts' extension. Consider\n // importing 'bad-module' instead.\n 2691,\n // TS2792: Cannot find module. Did you mean to set the 'moduleResolution'\n // option to 'node', or to add aliases to the 'paths' option?\n 2792,\n // TS5009: Cannot find the common subdirectory path for the input files.\n 5009,\n // TS5055: Cannot write file\n // 'http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js'\n // because it would overwrite input file.\n 5055,\n // TypeScript is overly opinionated that only CommonJS modules kinds can\n // support JSON imports. Allegedly this was fixed in\n // Microsoft/TypeScript#26825 but that doesn't seem to be working here,\n // so we will ignore complaints about this compiler setting.\n 5070,\n // TS7016: Could not find a declaration file for module '...'. '...'\n // implicitly has an 'any' type. This is due to `allowJs` being off by\n // default but importing of a JavaScript module.\n 7016,\n ];\n\n const SNAPSHOT_COMPILE_OPTIONS = {\n esModuleInterop: true,\n jsx: ts.JsxEmit.React,\n module: ts.ModuleKind.ESNext,\n noEmit: true,\n strict: true,\n target: ts.ScriptTarget.ESNext,\n };\n\n class ScriptSnapshot {\n /** @type {string} */\n specifier;\n /** @type {string} */\n version;\n /**\n * @param {string} specifier\n * @param {string} version \n */\n constructor(specifier, version) {\n this.specifier = specifier;\n this.version = version;\n }\n /**\n * @param {number} start \n * @param {number} end \n * @returns {string}\n */\n getText(start, end) {\n const { specifier, version } = this;\n debug(\n `snapshot.getText(${start}, ${end}) specifier: ${specifier} version: ${version}`,\n );\n return core.jsonOpSync(\"op_get_text\", { specifier, version, start, end });\n }\n /**\n * @returns {number}\n */\n getLength() {\n const { specifier, version } = this;\n debug(`snapshot.getLength() specifier: ${specifier} version: ${version}`);\n return core.jsonOpSync(\"op_get_length\", { specifier, version });\n }\n /**\n * @param {ScriptSnapshot} oldSnapshot\n * @returns {ts.TextChangeRange | undefined}\n */\n getChangeRange(oldSnapshot) {\n const { specifier, version } = this;\n const { version: oldVersion } = oldSnapshot;\n const oldLength = oldSnapshot.getLength();\n debug(\n `snapshot.getLength() specifier: ${specifier} oldVersion: ${oldVersion} version: ${version}`,\n );\n return core.jsonOpSync(\n \"op_get_change_range\",\n { specifier, oldLength, oldVersion, version },\n );\n }\n dispose() {\n const { specifier, version } = this;\n debug(`snapshot.dispose() specifier: ${specifier} version: ${version}`);\n core.jsonOpSync(\"op_dispose\", { specifier, version });\n }\n }\n\n /** @type {ts.CompilerOptions} */\n let compilationSettings = {};\n\n /** @type {ts.LanguageService} */\n let languageService;\n\n /** An object literal of the incremental compiler host, which provides the\n * specific \"bindings\" to the Deno environment that tsc needs to work.\n *\n * @type {ts.CompilerHost & ts.LanguageServiceHost} */\n const host = {\n fileExists(fileName) {\n debug(`host.fileExists(\"${fileName}\")`);\n return false;\n },\n readFile(specifier) {\n debug(`host.readFile(\"${specifier}\")`);\n return core.jsonOpSync(\"op_load\", { specifier }).data;\n },\n getSourceFile(\n specifier,\n languageVersion,\n _onError,\n _shouldCreateNewSourceFile,\n ) {\n debug(\n `host.getSourceFile(\"${specifier}\", ${\n ts.ScriptTarget[languageVersion]\n })`,\n );\n let sourceFile = sourceFileCache.get(specifier);\n if (sourceFile) {\n return sourceFile;\n }\n\n /** @type {{ data: string; hash?: string; scriptKind: ts.ScriptKind }} */\n const { data, hash, scriptKind } = core.jsonOpSync(\n \"op_load\",\n { specifier },\n );\n assert(\n data != null,\n `\"data\" is unexpectedly null for \"${specifier}\".`,\n );\n sourceFile = ts.createSourceFile(\n specifier,\n data,\n languageVersion,\n false,\n scriptKind,\n );\n sourceFile.moduleName = specifier;\n sourceFile.version = hash;\n sourceFileCache.set(specifier, sourceFile);\n return sourceFile;\n },\n getDefaultLibFileName() {\n return `${ASSETS}/lib.esnext.d.ts`;\n },\n getDefaultLibLocation() {\n return ASSETS;\n },\n writeFile(fileName, data, _writeByteOrderMark, _onError, sourceFiles) {\n debug(`host.writeFile(\"${fileName}\")`);\n let maybeSpecifiers;\n if (sourceFiles) {\n maybeSpecifiers = sourceFiles.map((sf) => sf.moduleName);\n }\n return core.jsonOpSync(\n \"op_emit\",\n { maybeSpecifiers, fileName, data },\n );\n },\n getCurrentDirectory() {\n return CACHE;\n },\n getCanonicalFileName(fileName) {\n return fileName;\n },\n useCaseSensitiveFileNames() {\n return true;\n },\n getNewLine() {\n return \"\\n\";\n },\n resolveModuleNames(specifiers, base) {\n debug(`host.resolveModuleNames()`);\n debug(` base: ${base}`);\n debug(` specifiers: ${specifiers.join(\", \")}`);\n /** @type {Array<[string, ts.Extension] | undefined>} */\n const resolved = core.jsonOpSync(\"op_resolve\", {\n specifiers,\n base,\n });\n if (resolved) {\n const result = resolved.map((item) => {\n if (item) {\n const [resolvedFileName, extension] = item;\n return {\n resolvedFileName,\n extension,\n isExternalLibraryImport: false,\n };\n }\n return undefined;\n });\n result.length = specifiers.length;\n return result;\n } else {\n return new Array(specifiers.length);\n }\n },\n createHash(data) {\n return core.jsonOpSync(\"op_create_hash\", { data }).hash;\n },\n\n // LanguageServiceHost\n getCompilationSettings() {\n debug(\"host.getCompilationSettings()\");\n return compilationSettings;\n },\n getScriptFileNames() {\n debug(\"host.getScriptFileNames()\");\n return core.jsonOpSync(\"op_script_names\", undefined);\n },\n getScriptVersion(specifier) {\n debug(`host.getScriptVersion(\"${specifier}\")`);\n const sourceFile = sourceFileCache.get(specifier);\n if (sourceFile) {\n return sourceFile.version ?? \"1\";\n }\n return core.jsonOpSync(\"op_script_version\", { specifier });\n },\n getScriptSnapshot(specifier) {\n debug(`host.getScriptSnapshot(\"${specifier}\")`);\n const sourceFile = sourceFileCache.get(specifier);\n if (sourceFile) {\n return {\n getText(start, end) {\n return sourceFile.text.substring(start, end);\n },\n getLength() {\n return sourceFile.text.length;\n },\n getChangeRange() {\n return undefined;\n },\n };\n }\n /** @type {string | undefined} */\n const version = core.jsonOpSync(\"op_script_version\", { specifier });\n if (version != null) {\n return new ScriptSnapshot(specifier, version);\n }\n return undefined;\n },\n };\n\n /** @type {Array<[string, number]>} */\n const stats = [];\n let statsStart = 0;\n\n function performanceStart() {\n stats.length = 0;\n statsStart = Date.now();\n ts.performance.enable();\n }\n\n /**\n * @param {{ program: ts.Program | ts.EmitAndSemanticDiagnosticsBuilderProgram, fileCount?: number }} options \n */\n function performanceProgram({ program, fileCount }) {\n if (program) {\n if (\"getProgram\" in program) {\n program = program.getProgram();\n }\n stats.push([\"Files\", program.getSourceFiles().length]);\n stats.push([\"Nodes\", program.getNodeCount()]);\n stats.push([\"Identifiers\", program.getIdentifierCount()]);\n stats.push([\"Symbols\", program.getSymbolCount()]);\n stats.push([\"Types\", program.getTypeCount()]);\n stats.push([\"Instantiations\", program.getInstantiationCount()]);\n } else if (fileCount != null) {\n stats.push([\"Files\", fileCount]);\n }\n const programTime = ts.performance.getDuration(\"Program\");\n const bindTime = ts.performance.getDuration(\"Bind\");\n const checkTime = ts.performance.getDuration(\"Check\");\n const emitTime = ts.performance.getDuration(\"Emit\");\n stats.push([\"Parse time\", programTime]);\n stats.push([\"Bind time\", bindTime]);\n stats.push([\"Check time\", checkTime]);\n stats.push([\"Emit time\", emitTime]);\n stats.push(\n [\"Total TS time\", programTime + bindTime + checkTime + emitTime],\n );\n }\n\n function performanceEnd() {\n const duration = Date.now() - statsStart;\n stats.push([\"Compile time\", duration]);\n return stats;\n }\n\n /**\n * @typedef {object} Request\n * @property {Record} config\n * @property {boolean} debug\n * @property {string[]} rootNames\n */\n\n /** The API that is called by Rust when executing a request.\n * @param {Request} request\n */\n function exec({ config, debug: debugFlag, rootNames }) {\n setLogDebug(debugFlag, \"TS\");\n performanceStart();\n debug(\">>> exec start\", { rootNames });\n debug(config);\n\n const { options, errors: configFileParsingDiagnostics } = ts\n .convertCompilerOptionsFromJson(config, \"\");\n // The `allowNonTsExtensions` is a \"hidden\" compiler option used in VSCode\n // which is not allowed to be passed in JSON, we need it to allow special\n // URLs which Deno supports. So we need to either ignore the diagnostic, or\n // inject it ourselves.\n Object.assign(options, { allowNonTsExtensions: true });\n const program = ts.createIncrementalProgram({\n rootNames,\n options,\n host,\n configFileParsingDiagnostics,\n });\n\n const { diagnostics: emitDiagnostics } = program.emit();\n\n const diagnostics = [\n ...program.getConfigFileParsingDiagnostics(),\n ...program.getSyntacticDiagnostics(),\n ...program.getOptionsDiagnostics(),\n ...program.getGlobalDiagnostics(),\n ...program.getSemanticDiagnostics(),\n ...emitDiagnostics,\n ].filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code));\n performanceProgram({ program });\n\n core.jsonOpSync(\"op_respond\", {\n diagnostics: fromTypeScriptDiagnostic(diagnostics),\n stats: performanceEnd(),\n });\n debug(\"<<< exec stop\");\n }\n\n /**\n * @param {number} id \n * @param {any} data \n */\n function respond(id, data = null) {\n core.jsonOpSync(\"op_respond\", { id, data });\n }\n\n /**\n * @param {LanguageServerRequest} request \n */\n function serverRequest({ id, ...request }) {\n debug(`serverRequest()`, { id, ...request });\n switch (request.method) {\n case \"configure\": {\n const { options, errors } = ts\n .convertCompilerOptionsFromJson(request.compilerOptions, \"\");\n Object.assign(options, { allowNonTsExtensions: true });\n if (errors.length) {\n debug(ts.formatDiagnostics(errors, host));\n }\n compilationSettings = options;\n return respond(id, true);\n }\n case \"getAsset\": {\n const sourceFile = host.getSourceFile(\n request.specifier,\n ts.ScriptTarget.ESNext,\n );\n return respond(id, sourceFile && sourceFile.text);\n }\n case \"getDiagnostics\": {\n try {\n /** @type {Record} */\n const diagnosticMap = {};\n for (const specifier of request.specifiers) {\n diagnosticMap[specifier] = fromTypeScriptDiagnostic([\n ...languageService.getSemanticDiagnostics(specifier),\n ...languageService.getSuggestionDiagnostics(specifier),\n ...languageService.getSyntacticDiagnostics(specifier),\n ].filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code)));\n }\n return respond(id, diagnosticMap);\n } catch (e) {\n if (\"stack\" in e) {\n error(e.stack);\n } else {\n error(e);\n }\n return respond(id, {});\n }\n }\n case \"getQuickInfo\": {\n return respond(\n id,\n languageService.getQuickInfoAtPosition(\n request.specifier,\n request.position,\n ),\n );\n }\n case \"getCompletions\": {\n return respond(\n id,\n languageService.getCompletionsAtPosition(\n request.specifier,\n request.position,\n request.preferences,\n ),\n );\n }\n case \"getDocumentHighlights\": {\n return respond(\n id,\n languageService.getDocumentHighlights(\n request.specifier,\n request.position,\n request.filesToSearch,\n ),\n );\n }\n case \"getReferences\": {\n return respond(\n id,\n languageService.getReferencesAtPosition(\n request.specifier,\n request.position,\n ),\n );\n }\n case \"getDefinition\": {\n return respond(\n id,\n languageService.getDefinitionAndBoundSpan(\n request.specifier,\n request.position,\n ),\n );\n }\n case \"getImplementation\": {\n return respond(\n id,\n languageService.getImplementationAtPosition(\n request.specifier,\n request.position,\n ),\n );\n }\n case \"findRenameLocations\": {\n return respond(\n id,\n languageService.findRenameLocations(\n request.specifier,\n request.position,\n request.findInStrings,\n request.findInComments,\n request.providePrefixAndSuffixTextForRename,\n ),\n );\n }\n default:\n throw new TypeError(\n // @ts-ignore exhausted case statement sets type to never\n `Invalid request method for request: \"${request.method}\" (${id})`,\n );\n }\n }\n\n /** @param {{ debug: boolean; }} init */\n function serverInit({ debug: debugFlag }) {\n if (hasStarted) {\n throw new Error(\"The language server has already been initialized.\");\n }\n hasStarted = true;\n languageService = ts.createLanguageService(host);\n core.ops();\n setLogDebug(debugFlag, \"TSLS\");\n debug(\"serverInit()\");\n }\n\n let hasStarted = false;\n\n /** Startup the runtime environment, setting various flags.\n * @param {{ debugFlag?: boolean; legacyFlag?: boolean; }} msg\n */\n function startup({ debugFlag = false }) {\n if (hasStarted) {\n throw new Error(\"The compiler runtime already started.\");\n }\n hasStarted = true;\n core.ops();\n setLogDebug(!!debugFlag, \"TS\");\n }\n\n // Setup the compiler runtime during the build process.\n core.ops();\n core.registerErrorClass(\"Error\", Error);\n\n // A build time only op that provides some setup information that is used to\n // ensure the snapshot is setup properly.\n /** @type {{ buildSpecifier: string; libs: string[] }} */\n const { buildSpecifier, libs } = core.jsonOpSync(\"op_build_info\", {});\n for (const lib of libs) {\n const specifier = `lib.${lib}.d.ts`;\n // we are using internal APIs here to \"inject\" our custom libraries into\n // tsc, so things like `\"lib\": [ \"deno.ns\" ]` are supported.\n if (!ts.libs.includes(lib)) {\n ts.libs.push(lib);\n ts.libMap.set(lib, `lib.${lib}.d.ts`);\n }\n // we are caching in memory common type libraries that will be re-used by\n // tsc on when the snapshot is restored\n assert(\n host.getSourceFile(`${ASSETS}${specifier}`, ts.ScriptTarget.ESNext),\n );\n }\n // this helps ensure as much as possible is in memory that is re-usable\n // before the snapshotting is done, which helps unsure fast \"startup\" for\n // subsequent uses of tsc in Deno.\n const TS_SNAPSHOT_PROGRAM = ts.createProgram({\n rootNames: [buildSpecifier],\n options: SNAPSHOT_COMPILE_OPTIONS,\n host,\n });\n ts.getPreEmitDiagnostics(TS_SNAPSHOT_PROGRAM);\n\n // exposes the two functions that are called by `tsc::exec()` when type\n // checking TypeScript.\n globalThis.startup = startup;\n globalThis.exec = exec;\n\n // exposes the functions that are called when the compiler is used as a\n // language service.\n globalThis.serverInit = serverInit;\n globalThis.serverRequest = serverRequest;\n})(this);\n" - } -} diff --git a/cli/tests/lsp/did_open_params_semantic_tokens.json b/cli/tests/lsp/did_open_params_semantic_tokens.json deleted file mode 100644 index 5cf48ae05..000000000 --- a/cli/tests/lsp/did_open_params_semantic_tokens.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "textDocument": { - "uri": "file:///a/file.ts", - "languageId": "typescript", - "version": 1, - "text": "enum Values { value1, value2 }\n\nasync function baz(s: string): Promise {\n const r = s.slice(0);\n return r;\n}\n\ninterface IFoo {\n readonly x: number;\n foo(): boolean;\n}\n\nclass Bar implements IFoo {\n constructor(public readonly x: number) { }\n foo() { return true; }\n static staticBar = new Bar(0);\n private static getStaticBar() { return Bar.staticBar; }\n}\n" - } -} diff --git a/cli/tests/lsp/did_open_params_test_code_lens.json b/cli/tests/lsp/did_open_params_test_code_lens.json deleted file mode 100644 index dcb9e11f3..000000000 --- a/cli/tests/lsp/did_open_params_test_code_lens.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "textDocument": { - "uri": "file:///a/file.ts", - "languageId": "typescript", - "version": 1, - "text": "const { test } = Deno;\nconst { test: test2 } = Deno;\nconst test3 = Deno.test;\n\nDeno.test(\"test a\", () => {});\nDeno.test({\n name: \"test b\",\n fn() {},\n});\ntest({\n name: \"test c\",\n fn() {},\n});\ntest(\"test d\", () => {});\ntest2({\n name: \"test e\",\n fn() {},\n});\ntest2(\"test f\", () => {});\ntest3({\n name: \"test g\",\n fn() {},\n});\ntest3(\"test h\", () => {});\n" - } -} diff --git a/cli/tests/lsp/document_symbol_response.json b/cli/tests/lsp/document_symbol_response.json deleted file mode 100644 index 89d56ef70..000000000 --- a/cli/tests/lsp/document_symbol_response.json +++ /dev/null @@ -1,371 +0,0 @@ -[ - { - "name": "bar", - "kind": 13, - "range": { - "start": { - "line": 17, - "character": 4 - }, - "end": { - "line": 17, - "character": 26 - } - }, - "selectionRange": { - "start": { - "line": 17, - "character": 4 - }, - "end": { - "line": 17, - "character": 7 - } - } - }, - { - "name": "Bar", - "kind": 5, - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 13, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 9 - } - }, - "children": [ - { - "name": "constructor", - "kind": 9, - "range": { - "start": { - "line": 5, - "character": 2 - }, - "end": { - "line": 5, - "character": 35 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 2 - }, - "end": { - "line": 5, - "character": 35 - } - } - }, - { - "name": "baz", - "kind": 6, - "tags": [ - 1 - ], - "range": { - "start": { - "line": 8, - "character": 2 - }, - "end": { - "line": 8, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 2 - }, - "end": { - "line": 8, - "character": 5 - } - } - }, - { - "name": "foo", - "kind": 6, - "range": { - "start": { - "line": 6, - "character": 2 - }, - "end": { - "line": 6, - "character": 24 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 2 - }, - "end": { - "line": 6, - "character": 5 - } - } - }, - { - "name": "getStaticBar", - "kind": 6, - "range": { - "start": { - "line": 12, - "character": 2 - }, - "end": { - "line": 12, - "character": 57 - } - }, - "selectionRange": { - "start": { - "line": 12, - "character": 17 - }, - "end": { - "line": 12, - "character": 29 - } - } - }, - { - "name": "staticBar", - "kind": 7, - "range": { - "start": { - "line": 11, - "character": 2 - }, - "end": { - "line": 11, - "character": 32 - } - }, - "selectionRange": { - "start": { - "line": 11, - "character": 9 - }, - "end": { - "line": 11, - "character": 18 - } - } - }, - { - "name": "value", - "kind": 7, - "range": { - "start": { - "line": 9, - "character": 2 - }, - "end": { - "line": 9, - "character": 35 - } - }, - "selectionRange": { - "start": { - "line": 9, - "character": 6 - }, - "end": { - "line": 9, - "character": 11 - } - } - }, - { - "name": "value", - "kind": 7, - "range": { - "start": { - "line": 10, - "character": 2 - }, - "end": { - "line": 10, - "character": 42 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 6 - }, - "end": { - "line": 10, - "character": 11 - } - } - }, - { - "name": "x", - "kind": 7, - "range": { - "start": { - "line": 5, - "character": 14 - }, - "end": { - "line": 5, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 21 - }, - "end": { - "line": 5, - "character": 22 - } - } - } - ] - }, - { - "name": "IFoo", - "kind": 11, - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 2, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 10 - }, - "end": { - "line": 0, - "character": 14 - } - }, - "children": [ - { - "name": "foo", - "kind": 6, - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 5 - } - } - } - ] - }, - { - "name": "Values", - "kind": 10, - "range": { - "start": { - "line": 15, - "character": 0 - }, - "end": { - "line": 15, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 15, - "character": 5 - }, - "end": { - "line": 15, - "character": 11 - } - }, - "children": [ - { - "name": "value1", - "kind": 13, - "range": { - "start": { - "line": 15, - "character": 14 - }, - "end": { - "line": 15, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 15, - "character": 14 - }, - "end": { - "line": 15, - "character": 20 - } - } - }, - { - "name": "value2", - "kind": 13, - "range": { - "start": { - "line": 15, - "character": 22 - }, - "end": { - "line": 15, - "character": 28 - } - }, - "selectionRange": { - "start": { - "line": 15, - "character": 22 - }, - "end": { - "line": 15, - "character": 28 - } - } - } - ] - } -] diff --git a/cli/tests/lsp/formatting_mbc_response.json b/cli/tests/lsp/formatting_mbc_response.json deleted file mode 100644 index 1c0b9f8e8..000000000 --- a/cli/tests/lsp/formatting_mbc_response.json +++ /dev/null @@ -1,54 +0,0 @@ -[ - { - "range": { - "start": { - "line": 0, - "character": 12 - }, - "end": { - "line": 0, - "character": 13 - } - }, - "newText": "\"" - }, - { - "range": { - "start": { - "line": 0, - "character": 21 - }, - "end": { - "line": 0, - "character": 22 - } - }, - "newText": "\";" - }, - { - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 13 - } - }, - "newText": "\"" - }, - { - "range": { - "start": { - "line": 1, - "character": 23 - }, - "end": { - "line": 1, - "character": 25 - } - }, - "newText": "\");" - } -] diff --git a/cli/tests/lsp/import-map.json b/cli/tests/lsp/import-map.json deleted file mode 100644 index 75d5d0849..000000000 --- a/cli/tests/lsp/import-map.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "imports": { - "/~/": "./lib/" - } -} diff --git a/cli/tests/lsp/incoming_calls_params.json b/cli/tests/lsp/incoming_calls_params.json deleted file mode 100644 index 6b38d26ee..000000000 --- a/cli/tests/lsp/incoming_calls_params.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "item": { - "name": "baz", - "kind": 6, - "detail": "Bar", - "uri": "file:///a/file.ts", - "range": { - "start": { - "line": 5, - "character": 2 - }, - "end": { - "line": 7, - "character": 3 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 2 - }, - "end": { - "line": 5, - "character": 5 - } - } - } -} diff --git a/cli/tests/lsp/incoming_calls_response.json b/cli/tests/lsp/incoming_calls_response.json deleted file mode 100644 index 231919a8c..000000000 --- a/cli/tests/lsp/incoming_calls_response.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "from": { - "name": "main", - "kind": 12, - "detail": "", - "uri": "file:///a/file.ts", - "range": { - "start": { - "line": 10, - "character": 0 - }, - "end": { - "line": 13, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 9 - }, - "end": { - "line": 10, - "character": 13 - } - } - }, - "fromRanges": [ - { - "start": { - "line": 12, - "character": 6 - }, - "end": { - "line": 12, - "character": 9 - } - } - ] - } -] diff --git a/cli/tests/lsp/initialize_params.json b/cli/tests/lsp/initialize_params.json deleted file mode 100644 index 3b99be4f0..000000000 --- a/cli/tests/lsp/initialize_params.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "processId": 0, - "clientInfo": { - "name": "test-harness", - "version": "1.0.0" - }, - "rootUri": null, - "initializationOptions": { - "enable": true, - "cache": null, - "codeLens": { - "implementations": true, - "references": true, - "test": true - }, - "config": "", - "importMap": null, - "lint": true, - "suggest": { - "autoImports": true, - "completeFunctionCalls": false, - "names": true, - "paths": true, - "imports": { - "hosts": {} - } - }, - "unstable": false - }, - "capabilities": { - "textDocument": { - "codeAction": { - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "quickfix", - "refactor" - ] - } - }, - "isPreferredSupport": true, - "dataSupport": true, - "disabledSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - } - }, - "foldingRange": { - "lineFoldingOnly": true - }, - "synchronization": { - "dynamicRegistration": true, - "willSave": true, - "willSaveWaitUntil": true, - "didSave": true - } - }, - "workspace": { - "configuration": true, - "workspaceFolders": true - } - } -} diff --git a/cli/tests/lsp/initialize_params_bad_config_option.json b/cli/tests/lsp/initialize_params_bad_config_option.json deleted file mode 100644 index 053cb70f3..000000000 --- a/cli/tests/lsp/initialize_params_bad_config_option.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "processId": 0, - "clientInfo": { - "name": "test-harness", - "version": "1.0.0" - }, - "rootUri": null, - "initializationOptions": { - "enable": true, - "cache": null, - "codeLens": { - "implementations": true, - "references": true, - "test": true - }, - "config": "bad_tsconfig.json", - "importMap": null, - "lint": true, - "suggest": { - "autoImports": true, - "completeFunctionCalls": false, - "names": true, - "paths": true, - "imports": { - "hosts": {} - } - }, - "unstable": false - }, - "capabilities": { - "textDocument": { - "codeAction": { - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "quickfix", - "refactor" - ] - } - }, - "isPreferredSupport": true, - "dataSupport": true, - "disabledSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - } - }, - "foldingRange": { - "lineFoldingOnly": true - }, - "synchronization": { - "dynamicRegistration": true, - "willSave": true, - "willSaveWaitUntil": true, - "didSave": true - } - }, - "workspace": { - "configuration": true, - "workspaceFolders": true - } - } -} diff --git a/cli/tests/lsp/initialize_params_ca_no_disabled.json b/cli/tests/lsp/initialize_params_ca_no_disabled.json deleted file mode 100644 index 3df87aded..000000000 --- a/cli/tests/lsp/initialize_params_ca_no_disabled.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "processId": 0, - "clientInfo": { - "name": "test-harness", - "version": "1.0.0" - }, - "rootUri": null, - "initializationOptions": { - "enable": true, - "cache": null, - "codeLens": { - "implementations": true, - "references": true, - "test": true - }, - "config": "", - "importMap": null, - "lint": true, - "suggest": { - "autoImports": true, - "completeFunctionCalls": false, - "names": true, - "paths": true, - "imports": { - "hosts": {} - } - }, - "unstable": false - }, - "capabilities": { - "textDocument": { - "codeAction": { - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "quickfix", - "refactor" - ] - } - }, - "isPreferredSupport": true, - "dataSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - } - }, - "foldingRange": { - "lineFoldingOnly": true - }, - "synchronization": { - "dynamicRegistration": true, - "willSave": true, - "willSaveWaitUntil": true, - "didSave": true - } - }, - "workspace": { - "configuration": true, - "workspaceFolders": true - } - } -} diff --git a/cli/tests/lsp/initialize_params_code_lens_test.json b/cli/tests/lsp/initialize_params_code_lens_test.json deleted file mode 100644 index bdd01bfca..000000000 --- a/cli/tests/lsp/initialize_params_code_lens_test.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "processId": 0, - "clientInfo": { - "name": "test-harness", - "version": "1.0.0" - }, - "rootUri": null, - "initializationOptions": { - "enable": true, - "cache": null, - "importMap": null, - "lint": true, - "suggest": { - "autoImports": true, - "completeFunctionCalls": false, - "names": true, - "paths": true, - "imports": { - "hosts": {} - } - }, - "unstable": false - }, - "capabilities": { - "textDocument": { - "codeAction": { - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "quickfix", - "refactor" - ] - } - }, - "isPreferredSupport": true, - "dataSupport": true, - "disabledSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - } - }, - "foldingRange": { - "lineFoldingOnly": true - }, - "synchronization": { - "dynamicRegistration": true, - "willSave": true, - "willSaveWaitUntil": true, - "didSave": true - } - }, - "workspace": { - "configuration": true, - "workspaceFolders": true - } - } -} diff --git a/cli/tests/lsp/initialize_params_code_lens_test_disabled.json b/cli/tests/lsp/initialize_params_code_lens_test_disabled.json deleted file mode 100644 index 1d18934ae..000000000 --- a/cli/tests/lsp/initialize_params_code_lens_test_disabled.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "processId": 0, - "clientInfo": { - "name": "test-harness", - "version": "1.0.0" - }, - "rootUri": null, - "initializationOptions": { - "enable": true, - "cache": null, - "codeLens": { - "implementations": true, - "references": true, - "test": false - }, - "importMap": null, - "lint": true, - "suggest": { - "autoImports": true, - "completeFunctionCalls": false, - "names": true, - "paths": true, - "imports": { - "hosts": {} - } - }, - "unstable": false - }, - "capabilities": { - "textDocument": { - "codeAction": { - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "quickfix", - "refactor" - ] - } - }, - "isPreferredSupport": true, - "dataSupport": true, - "disabledSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - } - }, - "foldingRange": { - "lineFoldingOnly": true - }, - "synchronization": { - "dynamicRegistration": true, - "willSave": true, - "willSaveWaitUntil": true, - "didSave": true - } - }, - "workspace": { - "configuration": true, - "workspaceFolders": true - } - } -} diff --git a/cli/tests/lsp/initialize_params_did_config_change.json b/cli/tests/lsp/initialize_params_did_config_change.json deleted file mode 100644 index 870ad6e0f..000000000 --- a/cli/tests/lsp/initialize_params_did_config_change.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "processId": 0, - "clientInfo": { - "name": "test-harness", - "version": "1.0.0" - }, - "rootUri": null, - "initializationOptions": { - "enable": true, - "cache": null, - "codeLens": { - "implementations": true, - "references": true - }, - "importMap": null, - "lint": true, - "suggest": { - "autoImports": true, - "completeFunctionCalls": false, - "names": true, - "paths": true, - "imports": { - "hosts": { - "http://localhost:4545/": false - } - } - }, - "unstable": false - }, - "capabilities": { - "textDocument": { - "codeAction": { - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "quickfix", - "refactor" - ] - } - }, - "isPreferredSupport": true, - "dataSupport": true, - "disabledSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - } - }, - "foldingRange": { - "lineFoldingOnly": true - }, - "synchronization": { - "dynamicRegistration": true, - "willSave": true, - "willSaveWaitUntil": true, - "didSave": true - } - }, - "workspace": { - "configuration": true, - "workspaceFolders": true - } - } -} diff --git a/cli/tests/lsp/initialize_params_disabled.json b/cli/tests/lsp/initialize_params_disabled.json deleted file mode 100644 index 879b1181c..000000000 --- a/cli/tests/lsp/initialize_params_disabled.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "processId": 0, - "clientInfo": { - "name": "test-harness", - "version": "1.0.0" - }, - "rootUri": null, - "initializationOptions": { - "enable": false, - "cache": null, - "codeLens": { - "implementations": true, - "references": true - }, - "importMap": null, - "lint": true, - "suggest": { - "autoImports": true, - "completeFunctionCalls": false, - "names": true, - "paths": true, - "imports": { - "hosts": {} - } - }, - "unstable": false - }, - "capabilities": { - "textDocument": { - "codeAction": { - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "quickfix", - "refactor" - ] - } - }, - "isPreferredSupport": true, - "dataSupport": true, - "disabledSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - } - }, - "foldingRange": { - "lineFoldingOnly": true - }, - "synchronization": { - "dynamicRegistration": true, - "willSave": true, - "willSaveWaitUntil": true, - "didSave": true - } - }, - "workspace": { - "configuration": true, - "workspaceFolders": true - } - } -} diff --git a/cli/tests/lsp/initialize_params_registry.json b/cli/tests/lsp/initialize_params_registry.json deleted file mode 100644 index 67559ebb3..000000000 --- a/cli/tests/lsp/initialize_params_registry.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "processId": 0, - "clientInfo": { - "name": "test-harness", - "version": "1.0.0" - }, - "rootUri": null, - "initializationOptions": { - "enable": true, - "cache": null, - "codeLens": { - "implementations": true, - "references": true - }, - "importMap": null, - "lint": true, - "suggest": { - "autoImports": true, - "completeFunctionCalls": false, - "names": true, - "paths": true, - "imports": { - "hosts": { - "http://localhost:4545/": true - } - } - }, - "unstable": false - }, - "capabilities": { - "textDocument": { - "codeAction": { - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "quickfix", - "refactor" - ] - } - }, - "isPreferredSupport": true, - "dataSupport": true, - "disabledSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - } - }, - "foldingRange": { - "lineFoldingOnly": true - }, - "synchronization": { - "dynamicRegistration": true, - "willSave": true, - "willSaveWaitUntil": true, - "didSave": true - } - }, - "workspace": { - "configuration": true, - "workspaceFolders": true - } - } -} diff --git a/cli/tests/lsp/initialize_params_unstable.json b/cli/tests/lsp/initialize_params_unstable.json deleted file mode 100644 index 104db16f2..000000000 --- a/cli/tests/lsp/initialize_params_unstable.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "processId": 0, - "clientInfo": { - "name": "test-harness", - "version": "1.0.0" - }, - "rootUri": null, - "initializationOptions": { - "enable": true, - "cache": null, - "codeLens": { - "implementations": true, - "references": true - }, - "importMap": null, - "lint": true, - "suggest": { - "autoImports": true, - "completeFunctionCalls": false, - "names": true, - "paths": true, - "imports": { - "hosts": {} - } - }, - "unstable": true - }, - "capabilities": { - "textDocument": { - "codeAction": { - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "quickfix", - "refactor" - ] - } - }, - "isPreferredSupport": true, - "dataSupport": true, - "disabledSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - } - }, - "foldingRange": { - "lineFoldingOnly": true - }, - "synchronization": { - "dynamicRegistration": true, - "willSave": true, - "willSaveWaitUntil": true, - "didSave": true - } - }, - "workspace": { - "configuration": true, - "workspaceFolders": true - } - } -} diff --git a/cli/tests/lsp/lib.tsconfig.json b/cli/tests/lsp/lib.tsconfig.json deleted file mode 100644 index 8d2ae8a8b..000000000 --- a/cli/tests/lsp/lib.tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "lib": ["deno.ns", "deno.unstable", "dom"] - } -} diff --git a/cli/tests/lsp/outgoing_calls_params.json b/cli/tests/lsp/outgoing_calls_params.json deleted file mode 100644 index 6b38d26ee..000000000 --- a/cli/tests/lsp/outgoing_calls_params.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "item": { - "name": "baz", - "kind": 6, - "detail": "Bar", - "uri": "file:///a/file.ts", - "range": { - "start": { - "line": 5, - "character": 2 - }, - "end": { - "line": 7, - "character": 3 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 2 - }, - "end": { - "line": 5, - "character": 5 - } - } - } -} diff --git a/cli/tests/lsp/outgoing_calls_response.json b/cli/tests/lsp/outgoing_calls_response.json deleted file mode 100644 index c7cf85cf8..000000000 --- a/cli/tests/lsp/outgoing_calls_response.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "to": { - "name": "foo", - "kind": 12, - "detail": "", - "uri": "file:///a/file.ts", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 2, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 12 - } - } - }, - "fromRanges": [ - { - "start": { - "line": 6, - "character": 11 - }, - "end": { - "line": 6, - "character": 14 - } - } - ] - } -] diff --git a/cli/tests/lsp/prepare_call_hierarchy_response.json b/cli/tests/lsp/prepare_call_hierarchy_response.json deleted file mode 100644 index 93a7d4f1b..000000000 --- a/cli/tests/lsp/prepare_call_hierarchy_response.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "name": "baz", - "kind": 6, - "detail": "Bar", - "uri": "file:///a/file.ts", - "range": { - "start": { - "line": 5, - "character": 2 - }, - "end": { - "line": 7, - "character": 3 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 2 - }, - "end": { - "line": 5, - "character": 5 - } - } - } -] diff --git a/cli/tests/lsp/registries/a_latest.json b/cli/tests/lsp/registries/a_latest.json deleted file mode 100644 index f9f9d111e..000000000 --- a/cli/tests/lsp/registries/a_latest.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "b/c.ts", - "d/e.js" -] diff --git a/cli/tests/lsp/registries/a_v1.0.0.json b/cli/tests/lsp/registries/a_v1.0.0.json deleted file mode 100644 index f9f9d111e..000000000 --- a/cli/tests/lsp/registries/a_v1.0.0.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "b/c.ts", - "d/e.js" -] diff --git a/cli/tests/lsp/registries/a_v1.0.1.json b/cli/tests/lsp/registries/a_v1.0.1.json deleted file mode 100644 index f9f9d111e..000000000 --- a/cli/tests/lsp/registries/a_v1.0.1.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "b/c.ts", - "d/e.js" -] diff --git a/cli/tests/lsp/registries/a_v2.0.0.json b/cli/tests/lsp/registries/a_v2.0.0.json deleted file mode 100644 index f9f9d111e..000000000 --- a/cli/tests/lsp/registries/a_v2.0.0.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "b/c.ts", - "d/e.js" -] diff --git a/cli/tests/lsp/registries/a_versions.json b/cli/tests/lsp/registries/a_versions.json deleted file mode 100644 index 930e38323..000000000 --- a/cli/tests/lsp/registries/a_versions.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "v1.0.0", - "v1.0.1", - "v2.0.0" -] diff --git a/cli/tests/lsp/registries/b_latest.json b/cli/tests/lsp/registries/b_latest.json deleted file mode 100644 index f9f9d111e..000000000 --- a/cli/tests/lsp/registries/b_latest.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "b/c.ts", - "d/e.js" -] diff --git a/cli/tests/lsp/registries/b_v0.0.1.json b/cli/tests/lsp/registries/b_v0.0.1.json deleted file mode 100644 index f9f9d111e..000000000 --- a/cli/tests/lsp/registries/b_v0.0.1.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "b/c.ts", - "d/e.js" -] diff --git a/cli/tests/lsp/registries/b_v0.0.2.json b/cli/tests/lsp/registries/b_v0.0.2.json deleted file mode 100644 index f9f9d111e..000000000 --- a/cli/tests/lsp/registries/b_v0.0.2.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "b/c.ts", - "d/e.js" -] diff --git a/cli/tests/lsp/registries/b_v0.0.3.json b/cli/tests/lsp/registries/b_v0.0.3.json deleted file mode 100644 index f9f9d111e..000000000 --- a/cli/tests/lsp/registries/b_v0.0.3.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "b/c.ts", - "d/e.js" -] diff --git a/cli/tests/lsp/registries/b_versions.json b/cli/tests/lsp/registries/b_versions.json deleted file mode 100644 index 9532fbb85..000000000 --- a/cli/tests/lsp/registries/b_versions.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "v0.0.1", - "v0.0.2", - "v0.0.3" -] diff --git a/cli/tests/lsp/registries/deno-import-intellisense.json b/cli/tests/lsp/registries/deno-import-intellisense.json deleted file mode 100644 index ff28fac07..000000000 --- a/cli/tests/lsp/registries/deno-import-intellisense.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "version": 1, - "registries": [ - { - "schema": "/x/:module([a-z0-9_]*)@:version?/:path*", - "variables": [ - { - "key": "module", - "url": "http://localhost:4545/cli/tests/lsp/registries/modules.json" - }, - { - "key": "version", - "url": "http://localhost:4545/cli/tests/lsp/registries/${module}_versions.json" - }, - { - "key": "path", - "url": "http://localhost:4545/cli/tests/lsp/registries/${module}_${{version}}.json" - } - ] - }, - { - "schema": "/x/:module([a-z0-9_]*)/:path*", - "variables": [ - { - "key": "module", - "url": "http://localhost:4545/cli/tests/lsp/registries/modules.json" - }, - { - "key": "path", - "url": "http://localhost:4545/cli/tests/lsp/registries/${module}_latest.json" - } - ] - } - ] -} diff --git a/cli/tests/lsp/registries/modules.json b/cli/tests/lsp/registries/modules.json deleted file mode 100644 index 517c9d68e..000000000 --- a/cli/tests/lsp/registries/modules.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "a", - "b" -] diff --git a/cli/tests/lsp/rename_response.json b/cli/tests/lsp/rename_response.json deleted file mode 100644 index 5e0e28e4c..000000000 --- a/cli/tests/lsp/rename_response.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "documentChanges": [ - { - "textDocument": { - "uri": "file:///a/file.ts", - "version": 1 - }, - "edits": [ - { - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 12 - } - }, - "newText": "variable_modified" - }, - { - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 20 - } - }, - "newText": "variable_modified" - } - ] - } - ] -} diff --git a/cli/tests/lsp/selection_range_response.json b/cli/tests/lsp/selection_range_response.json deleted file mode 100644 index b5eef5ddc..000000000 --- a/cli/tests/lsp/selection_range_response.json +++ /dev/null @@ -1,86 +0,0 @@ -[ - { - "range": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 9 - } - }, - "parent": { - "range": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 15 - } - }, - "parent": { - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 4, - "character": 5 - } - }, - "parent": { - "range": { - "start": { - "line": 1, - "character": 13 - }, - "end": { - "line": 6, - "character": 2 - } - }, - "parent": { - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 6, - "character": 3 - } - }, - "parent": { - "range": { - "start": { - "line": 0, - "character": 11 - }, - "end": { - "line": 7, - "character": 0 - } - }, - "parent": { - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 7, - "character": 1 - } - } - } - } - } - } - } - } - } -] diff --git a/cli/tests/lsp/types.tsconfig.json b/cli/tests/lsp/types.tsconfig.json deleted file mode 100644 index ba7f3344d..000000000 --- a/cli/tests/lsp/types.tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "types": [ - "./a.d.ts" - ] - } -} diff --git a/cli/tests/main_module.ts b/cli/tests/main_module.ts deleted file mode 100644 index 19988f4bf..000000000 --- a/cli/tests/main_module.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log("main_module", Deno.mainModule); - -import "./main_module2.ts"; diff --git a/cli/tests/main_module.ts.out b/cli/tests/main_module.ts.out deleted file mode 100644 index 31adb20cb..000000000 --- a/cli/tests/main_module.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -main_module2 [WILDCARD]tests/main_module.ts -main_module [WILDCARD]tests/main_module.ts diff --git a/cli/tests/main_module2.ts b/cli/tests/main_module2.ts deleted file mode 100644 index 585615c7f..000000000 --- a/cli/tests/main_module2.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("main_module2", Deno.mainModule); diff --git a/cli/tests/module_graph/file_tests-a.mjs b/cli/tests/module_graph/file_tests-a.mjs deleted file mode 100644 index 72b3a67bc..000000000 --- a/cli/tests/module_graph/file_tests-a.mjs +++ /dev/null @@ -1,3 +0,0 @@ -import * as b from "./b.ts"; - -console.log(b); diff --git a/cli/tests/module_graph/file_tests-b-mod.js b/cli/tests/module_graph/file_tests-b-mod.js deleted file mode 100644 index 59d168993..000000000 --- a/cli/tests/module_graph/file_tests-b-mod.js +++ /dev/null @@ -1 +0,0 @@ -export const b = "b"; diff --git a/cli/tests/module_graph/file_tests-b.ts b/cli/tests/module_graph/file_tests-b.ts deleted file mode 100644 index 59d168993..000000000 --- a/cli/tests/module_graph/file_tests-b.ts +++ /dev/null @@ -1 +0,0 @@ -export const b = "b"; diff --git a/cli/tests/module_graph/file_tests-c-mod.ts b/cli/tests/module_graph/file_tests-c-mod.ts deleted file mode 100644 index 7f2cfac77..000000000 --- a/cli/tests/module_graph/file_tests-c-mod.ts +++ /dev/null @@ -1 +0,0 @@ -export const c = "c"; diff --git a/cli/tests/module_graph/file_tests-checkwithconfig.ts b/cli/tests/module_graph/file_tests-checkwithconfig.ts deleted file mode 100644 index e7af5fa19..000000000 --- a/cli/tests/module_graph/file_tests-checkwithconfig.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ServerRequest } from "https://deno.land/std/http/server.ts"; - -export default (req: ServerRequest) => { - req.respond({ body: `Hello, from Deno v${Deno.version.deno}!` }); -}; diff --git a/cli/tests/module_graph/file_tests-diag.ts b/cli/tests/module_graph/file_tests-diag.ts deleted file mode 100644 index ba365234a..000000000 --- a/cli/tests/module_graph/file_tests-diag.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as c from "./c/mod.ts"; - -// deno-lint-ignore no-undef -consol.log(c); diff --git a/cli/tests/module_graph/file_tests-dynamicimport.ts b/cli/tests/module_graph/file_tests-dynamicimport.ts deleted file mode 100644 index b5c9f080f..000000000 --- a/cli/tests/module_graph/file_tests-dynamicimport.ts +++ /dev/null @@ -1,5 +0,0 @@ -try { - await import("bare_module_specifier"); -} catch (err) { - console.log(err); -} diff --git a/cli/tests/module_graph/file_tests-importjson.ts b/cli/tests/module_graph/file_tests-importjson.ts deleted file mode 100644 index c2bc2bca7..000000000 --- a/cli/tests/module_graph/file_tests-importjson.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as config from "./some.json"; - -console.log(config); diff --git a/cli/tests/module_graph/file_tests-importremap.ts b/cli/tests/module_graph/file_tests-importremap.ts deleted file mode 100644 index 17f012673..000000000 --- a/cli/tests/module_graph/file_tests-importremap.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as a from "https://deno.land/x/a/mod.ts"; - -console.log(a); diff --git a/cli/tests/module_graph/file_tests-main.ts b/cli/tests/module_graph/file_tests-main.ts deleted file mode 100644 index aa8eef1b8..000000000 --- a/cli/tests/module_graph/file_tests-main.ts +++ /dev/null @@ -1,4 +0,0 @@ -// @deno-types="https://deno.land/x/lib/mod.d.ts" -import * as lib from "https://deno.land/x/lib/mod.js"; - -console.log(lib); diff --git a/cli/tests/module_graph/file_tests-some.json b/cli/tests/module_graph/file_tests-some.json deleted file mode 100644 index 567c4ba21..000000000 --- a/cli/tests/module_graph/file_tests-some.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "config": { - "debug": true - } -} diff --git a/cli/tests/module_graph/file_typesref.d.ts b/cli/tests/module_graph/file_typesref.d.ts deleted file mode 100644 index 8ae31dde3..000000000 --- a/cli/tests/module_graph/file_typesref.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const a: "a"; diff --git a/cli/tests/module_graph/file_typesref.js b/cli/tests/module_graph/file_typesref.js deleted file mode 100644 index 79da24cae..000000000 --- a/cli/tests/module_graph/file_typesref.js +++ /dev/null @@ -1,3 +0,0 @@ -/// - -export const a = "a"; diff --git a/cli/tests/module_graph/https_deno.land-std-http-server.ts b/cli/tests/module_graph/https_deno.land-std-http-server.ts deleted file mode 100644 index 0b3c995ec..000000000 --- a/cli/tests/module_graph/https_deno.land-std-http-server.ts +++ /dev/null @@ -1,5 +0,0 @@ -export class ServerRequest { - respond(value: { body: string }) { - console.log(value); - } -} diff --git a/cli/tests/module_graph/https_deno.land-x-a-mod.ts b/cli/tests/module_graph/https_deno.land-x-a-mod.ts deleted file mode 100644 index 1e334d399..000000000 --- a/cli/tests/module_graph/https_deno.land-x-a-mod.ts +++ /dev/null @@ -1 +0,0 @@ -export * as b from "../b/mod.js"; diff --git a/cli/tests/module_graph/https_deno.land-x-a.ts b/cli/tests/module_graph/https_deno.land-x-a.ts deleted file mode 100644 index a6e3cea80..000000000 --- a/cli/tests/module_graph/https_deno.land-x-a.ts +++ /dev/null @@ -1 +0,0 @@ -export const a = "hello"; diff --git a/cli/tests/module_graph/https_deno.land-x-import_map.ts b/cli/tests/module_graph/https_deno.land-x-import_map.ts deleted file mode 100644 index e285d863a..000000000 --- a/cli/tests/module_graph/https_deno.land-x-import_map.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as $ from "jquery"; -import * as _ from "lodash"; - -console.log($, _); diff --git a/cli/tests/module_graph/https_deno.land-x-jquery.js b/cli/tests/module_graph/https_deno.land-x-jquery.js deleted file mode 100644 index 71896157a..000000000 --- a/cli/tests/module_graph/https_deno.land-x-jquery.js +++ /dev/null @@ -1,3 +0,0 @@ -const $ = {}; - -export default $; diff --git a/cli/tests/module_graph/https_deno.land-x-lib-a.ts b/cli/tests/module_graph/https_deno.land-x-lib-a.ts deleted file mode 100644 index a0a6f8e94..000000000 --- a/cli/tests/module_graph/https_deno.land-x-lib-a.ts +++ /dev/null @@ -1 +0,0 @@ -export const a: string[] = []; diff --git a/cli/tests/module_graph/https_deno.land-x-lib-b.js b/cli/tests/module_graph/https_deno.land-x-lib-b.js deleted file mode 100644 index 13cacdd8b..000000000 --- a/cli/tests/module_graph/https_deno.land-x-lib-b.js +++ /dev/null @@ -1 +0,0 @@ -export const b = []; diff --git a/cli/tests/module_graph/https_deno.land-x-lib-c.d.ts b/cli/tests/module_graph/https_deno.land-x-lib-c.d.ts deleted file mode 100644 index fac988e49..000000000 --- a/cli/tests/module_graph/https_deno.land-x-lib-c.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const c: string[]; diff --git a/cli/tests/module_graph/https_deno.land-x-lib-c.js b/cli/tests/module_graph/https_deno.land-x-lib-c.js deleted file mode 100644 index 620ca0b66..000000000 --- a/cli/tests/module_graph/https_deno.land-x-lib-c.js +++ /dev/null @@ -1,3 +0,0 @@ -/// - -export const c = []; diff --git a/cli/tests/module_graph/https_deno.land-x-lib-mod.d.ts b/cli/tests/module_graph/https_deno.land-x-lib-mod.d.ts deleted file mode 100644 index 76ed81df0..000000000 --- a/cli/tests/module_graph/https_deno.land-x-lib-mod.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * as a from "./a.ts"; -export * as b from "./b.js"; -export * as c from "./c.js"; - -export interface A { - a: string; -} - -export const mod: A[]; diff --git a/cli/tests/module_graph/https_deno.land-x-lib-mod.js b/cli/tests/module_graph/https_deno.land-x-lib-mod.js deleted file mode 100644 index 505162094..000000000 --- a/cli/tests/module_graph/https_deno.land-x-lib-mod.js +++ /dev/null @@ -1,5 +0,0 @@ -export * as a from "./a.ts"; -export * as b from "./b.js"; -export * as c from "./c.js"; - -export const mod = []; diff --git a/cli/tests/module_graph/https_deno.land-x-mod.ts b/cli/tests/module_graph/https_deno.land-x-mod.ts deleted file mode 100644 index 35d76ef75..000000000 --- a/cli/tests/module_graph/https_deno.land-x-mod.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as a from "./a.ts"; - -console.log(a); diff --git a/cli/tests/module_graph/https_deno.land-x-transpile.tsx b/cli/tests/module_graph/https_deno.land-x-transpile.tsx deleted file mode 100644 index 02955bad8..000000000 --- a/cli/tests/module_graph/https_deno.land-x-transpile.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export default class A { - render() { - return
Hello world!
; - } -} diff --git a/cli/tests/module_graph/https_unpkg.com-lodash-index.js b/cli/tests/module_graph/https_unpkg.com-lodash-index.js deleted file mode 100644 index d16c126a6..000000000 --- a/cli/tests/module_graph/https_unpkg.com-lodash-index.js +++ /dev/null @@ -1,3 +0,0 @@ -const _ = {}; - -export default _; diff --git a/cli/tests/module_graph/lockfile.json b/cli/tests/module_graph/lockfile.json deleted file mode 100644 index 03cfe1185..000000000 --- a/cli/tests/module_graph/lockfile.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "https://deno.land/x/lib/a.ts": "4437fee72a750d9540a9575ea6426761d0aa1beedfa308fb1bc38701d97011b8", - "https://deno.land/x/lib/b.js": "093cc4164ca7a9adb11597ad291e021634f0b2d8c048137f7e9fb0d709499028", - "https://deno.land/x/lib/c.d.ts": "a95647377477cc663559f5e857bf318c584622ed1295a8ccb0c091d06bee0456", - "https://deno.land/x/lib/c.js": "4ff934f4b3b06f320c3130326376d9f2435e2ecedd582940ca90938137d004e1", - "https://deno.land/x/lib/mod.d.ts": "e54b994fbf63cb7f01076ea54f2ed67b185f2a48e8ff71d74bd9c8180a338eb7", - "https://deno.land/x/lib/mod.js": "3f6fcb8ef83ed6c66e71774d5079d14d22a6948dc6e5358ac30e0ab55e1a6404" -} diff --git a/cli/tests/module_graph/lockfile_fail.json b/cli/tests/module_graph/lockfile_fail.json deleted file mode 100644 index c0019fba4..000000000 --- a/cli/tests/module_graph/lockfile_fail.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "https://deno.land/x/lib/a.ts": "4437fee72a750d9540a9575ea6426761d0aa1beedfa308fb1bc38701d97011b8", - "https://deno.land/x/lib/b.js": "093cc4164ca7a9adb11597ad291e021634f0b2d8c048137f7e9fb0d709499028", - "https://deno.land/x/lib/c.d.ts": "a95647377477cc663559f5e857bf318c584622ed1295a8ccb0c091d06bee0456", - "https://deno.land/x/lib/c.js": "4ff934f4b3b06f320c3130326376d9f2435e2ecedd582940ca90938137d004e1", - "https://deno.land/x/lib/mod.d.ts": "e54b994fbf63cb7f01076ea54f2ed67b185f2a48e8ff71d74bd9c8180a338eb7", - "https://deno.land/x/lib/mod.js": "3f6fcb8ef83fd6c66e71774d5079d14d22a6948dc6e5358ac30e0ab55e1a6404" -} diff --git a/cli/tests/module_graph/tsconfig.json b/cli/tests/module_graph/tsconfig.json deleted file mode 100644 index a4c5f4f33..000000000 --- a/cli/tests/module_graph/tsconfig.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "target": "ES5", - "jsx": "preserve" - } -} diff --git a/cli/tests/module_graph/tsconfig_01.json b/cli/tests/module_graph/tsconfig_01.json deleted file mode 100644 index f7496d475..000000000 --- a/cli/tests/module_graph/tsconfig_01.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "strict": false, - "noImplicitAny": false, - "noImplicitThis": false, - "alwaysStrict": false, - "strictNullChecks": false, - "strictFunctionTypes": true, - "strictPropertyInitialization": false, - "experimentalDecorators": true, - "emitDecoratorMetadata": true - } -} diff --git a/cli/tests/no_check_decorators.ts b/cli/tests/no_check_decorators.ts deleted file mode 100644 index 9f7ec550d..000000000 --- a/cli/tests/no_check_decorators.ts +++ /dev/null @@ -1,21 +0,0 @@ -// deno-lint-ignore-file -function a() { - console.log("a(): evaluated"); - return ( - _target: any, - _propertyKey: string, - _descriptor: PropertyDescriptor, - ) => { - console.log("a(): called"); - }; -} - -class B { - @a() - method() { - console.log("method"); - } -} - -const b = new B(); -b.method(); diff --git a/cli/tests/no_check_decorators.ts.out b/cli/tests/no_check_decorators.ts.out deleted file mode 100644 index 015f7076e..000000000 --- a/cli/tests/no_check_decorators.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -a(): evaluated -a(): called -method diff --git a/cli/tests/no_color.js b/cli/tests/no_color.js deleted file mode 100644 index cea11a52f..000000000 --- a/cli/tests/no_color.js +++ /dev/null @@ -1 +0,0 @@ -console.log("noColor", Deno.noColor); diff --git a/cli/tests/no_mem_cache.js b/cli/tests/no_mem_cache.js deleted file mode 100644 index a486732b6..000000000 --- a/cli/tests/no_mem_cache.js +++ /dev/null @@ -1,33 +0,0 @@ -const fixtureFile = await Deno.makeTempFile(); -let prefix = "file://"; -if (Deno.build.os == "windows") { - prefix += "/"; -} -const fixtureUrl = new URL(`${prefix}${fixtureFile}`); -let resolve; - -let p = new Promise((res) => resolve = res); - -await Deno.writeTextFile(fixtureUrl, `self.postMessage("hello");\n`); - -const workerA = new Worker(fixtureUrl.href, { type: "module" }); -workerA.onmessage = (msg) => { - console.log(msg.data); - resolve(); -}; - -await p; -workerA.terminate(); - -p = new Promise((res) => resolve = res); - -await Deno.writeTextFile(fixtureUrl, `self.postMessage("goodbye");\n`); - -const workerB = new Worker(fixtureUrl.href, { type: "module" }); -workerB.onmessage = (msg) => { - console.log(msg.data); - resolve(); -}; - -await p; -workerB.terminate(); diff --git a/cli/tests/no_mem_cache.js.out b/cli/tests/no_mem_cache.js.out deleted file mode 100644 index a32119c8a..000000000 --- a/cli/tests/no_mem_cache.js.out +++ /dev/null @@ -1,2 +0,0 @@ -hello -goodbye diff --git a/cli/tests/no_validate_asm.js b/cli/tests/no_validate_asm.js deleted file mode 100644 index ef999e080..000000000 --- a/cli/tests/no_validate_asm.js +++ /dev/null @@ -1,20 +0,0 @@ -// V8 logs any asmjs validation errors to stdout, but it shows line numbers that -// are non-existent in the source. - -const _asmJsModule = function () { - "use asm"; - - function func( - x, - ) { - x = +x; // cast to float - - ~x; - // asmjs error: `~` is only valid on integers - // should not log to stdout with --no-validate-asm - } - - return { - f: func, - }; -}(); diff --git a/cli/tests/performance_stats.out b/cli/tests/performance_stats.out deleted file mode 100644 index 141829ee6..000000000 --- a/cli/tests/performance_stats.out +++ /dev/null @@ -1,16 +0,0 @@ -[WILDCARD] -DEBUG RS - [WILDCARD] - Compilation statistics: - Files: [WILDCARD] - Nodes: [WILDCARD] - Identifiers: [WILDCARD] - Symbols: [WILDCARD] - Types: [WILDCARD] - Instantiations: [WILDCARD] - Parse time: [WILDCARD] - Bind time: [WILDCARD] - Check time: [WILDCARD] - Emit time: [WILDCARD] - Total TS time: [WILDCARD] - Compile time: [WILDCARD] - -[WILDCARD] diff --git a/cli/tests/permission_test.ts b/cli/tests/permission_test.ts deleted file mode 100644 index 057e935af..000000000 --- a/cli/tests/permission_test.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -const name = Deno.args[0]; -// deno-lint-ignore no-explicit-any -const test: { [key: string]: (...args: any[]) => void | Promise } = { - readRequired() { - Deno.readFileSync("README.md"); - return Promise.resolve(); - }, - writeRequired() { - Deno.makeTempDirSync(); - }, - envRequired() { - Deno.env.get("home"); - }, - netRequired() { - Deno.listen({ transport: "tcp", port: 4541 }); - }, - runRequired() { - const p = Deno.run({ - cmd: Deno.build.os === "windows" - ? ["cmd.exe", "/c", "echo hello"] - : ["printf", "hello"], - }); - p.close(); - }, -}; - -if (!test[name]) { - console.log("Unknown test:", name); - Deno.exit(1); -} - -test[name](); diff --git a/cli/tests/preserve_imports.tsconfig.json b/cli/tests/preserve_imports.tsconfig.json deleted file mode 100644 index 9b19291aa..000000000 --- a/cli/tests/preserve_imports.tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "importsNotUsedAsValues": "preserve" - } -} diff --git a/cli/tests/proto_exploit.js b/cli/tests/proto_exploit.js deleted file mode 100644 index 8bd22cfe5..000000000 --- a/cli/tests/proto_exploit.js +++ /dev/null @@ -1,5 +0,0 @@ -const payload = `{ "__proto__": null }`; -const obj = {}; -console.log("Before: " + obj); -Object.assign(obj, JSON.parse(payload)); -console.log("After: " + obj); diff --git a/cli/tests/proto_exploit.js.out b/cli/tests/proto_exploit.js.out deleted file mode 100644 index fde881dc5..000000000 --- a/cli/tests/proto_exploit.js.out +++ /dev/null @@ -1,2 +0,0 @@ -Before: [object Object] -After: [object Object] diff --git a/cli/tests/raw_mode.ts b/cli/tests/raw_mode.ts deleted file mode 100644 index 87502e7d9..000000000 --- a/cli/tests/raw_mode.ts +++ /dev/null @@ -1,18 +0,0 @@ -Deno.setRaw(0, true); -Deno.setRaw(0, true); // Can be called multiple times - -Deno.stdout.writeSync(new TextEncoder().encode("S")); - -const buf = new Uint8Array(3); -for (let i = 0; i < 3; i++) { - const nread = await Deno.stdin.read(buf); - if (nread === null) { - break; - } else { - const data = new TextDecoder().decode(buf.subarray(0, nread)); - Deno.stdout.writeSync(new TextEncoder().encode(data.toUpperCase())); - } -} - -Deno.setRaw(0, false); // restores old mode. -Deno.setRaw(0, false); // Can be safely called multiple times diff --git a/cli/tests/raw_mode_cbreak.ts b/cli/tests/raw_mode_cbreak.ts deleted file mode 100644 index b1c6d324b..000000000 --- a/cli/tests/raw_mode_cbreak.ts +++ /dev/null @@ -1,17 +0,0 @@ -Deno.setRaw(0, true); -Deno.setRaw(0, true, { cbreak: true }); // Can be called multiple times - -const signal = Deno.signals.interrupt(); - -Deno.stdout.writeSync(new TextEncoder().encode("S")); - -signal.then(() => { - Deno.stdout.writeSync(new TextEncoder().encode("A")); - - signal.dispose(); - - Deno.setRaw(0, false); // restores old mode. - Deno.setRaw(0, false); // Can be safely called multiple times -}); - -setTimeout(() => {}, 10000); // Keep the program running diff --git a/cli/tests/recursive_imports/A.ts b/cli/tests/recursive_imports/A.ts deleted file mode 100644 index 43ecdbe5e..000000000 --- a/cli/tests/recursive_imports/A.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { B } from "./B.ts"; -import { thing } from "./common.ts"; - -export function A() { - thing(); - B(); -} diff --git a/cli/tests/recursive_imports/B.ts b/cli/tests/recursive_imports/B.ts deleted file mode 100644 index 9fff0fdc9..000000000 --- a/cli/tests/recursive_imports/B.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { C } from "./C.ts"; -import { thing } from "./common.ts"; - -export function B() { - thing(); - C(); -} diff --git a/cli/tests/recursive_imports/C.ts b/cli/tests/recursive_imports/C.ts deleted file mode 100644 index e47e77b41..000000000 --- a/cli/tests/recursive_imports/C.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { A } from "./A.ts"; -import { thing } from "./common.ts"; - -export function C() { - if (A != null) { - thing(); - } -} diff --git a/cli/tests/recursive_imports/common.ts b/cli/tests/recursive_imports/common.ts deleted file mode 100644 index 2b16a7bf1..000000000 --- a/cli/tests/recursive_imports/common.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function thing() { -} diff --git a/cli/tests/redirect_cache.out b/cli/tests/redirect_cache.out deleted file mode 100644 index 609e523f7..000000000 --- a/cli/tests/redirect_cache.out +++ /dev/null @@ -1,5 +0,0 @@ -Download http://localhost:4548/cli/tests/subdir/redirects/a.ts -Download http://localhost:4546/cli/tests/subdir/redirects/a.ts -Download http://localhost:4545/cli/tests/subdir/redirects/a.ts -Download http://localhost:4545/cli/tests/subdir/redirects/b.ts -Check http://localhost:4548/cli/tests/subdir/redirects/a.ts diff --git a/cli/tests/reference_types.ts b/cli/tests/reference_types.ts deleted file mode 100644 index 105e23b37..000000000 --- a/cli/tests/reference_types.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// - -console.log(globalThis.a); diff --git a/cli/tests/reference_types.ts.out b/cli/tests/reference_types.ts.out deleted file mode 100644 index 417b7b537..000000000 --- a/cli/tests/reference_types.ts.out +++ /dev/null @@ -1 +0,0 @@ -undefined diff --git a/cli/tests/reference_types_remote.ts b/cli/tests/reference_types_remote.ts deleted file mode 100644 index 2e7a80098..000000000 --- a/cli/tests/reference_types_remote.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// - -console.log(globalThis.a); diff --git a/cli/tests/reference_types_remote.ts.out b/cli/tests/reference_types_remote.ts.out deleted file mode 100644 index 417b7b537..000000000 --- a/cli/tests/reference_types_remote.ts.out +++ /dev/null @@ -1 +0,0 @@ -undefined diff --git a/cli/tests/resolve_dns.ts b/cli/tests/resolve_dns.ts deleted file mode 100644 index d765e0536..000000000 --- a/cli/tests/resolve_dns.ts +++ /dev/null @@ -1,42 +0,0 @@ -const nameServer = { nameServer: { ipAddr: "127.0.0.1", port: 4553 } }; - -const [a, aaaa, aname, cname, mx, ptr, 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("foo", "CNAME", nameServer), - Deno.resolveDns("www.example.com", "MX", nameServer), - Deno.resolveDns("5.6.7.8", "PTR", nameServer), - Deno.resolveDns("_Service._TCP.example.com", "SRV", nameServer), - Deno.resolveDns("www.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("CNAME"); -console.log(JSON.stringify(cname)); - -console.log("MX"); -console.log(JSON.stringify(mx)); - -console.log("PTR"); -console.log(JSON.stringify(ptr)); - -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 thrown for not-found-example.com"); -} diff --git a/cli/tests/resolve_dns.ts.out b/cli/tests/resolve_dns.ts.out deleted file mode 100644 index 78381e6c6..000000000 --- a/cli/tests/resolve_dns.ts.out +++ /dev/null @@ -1,17 +0,0 @@ -A -["1.2.3.4"] -AAAA -["1:2:3:4:5:6:7:8"] -ANAME -["aname.com."] -CNAME -["cname.com."] -MX -[{"preference":0,"exchange":"mx.com."}] -PTR -["ptr.com."] -SRV -[{"priority":0,"weight":100,"port":1234,"target":"srv.com."}] -TXT -[["foo","bar"]] -Error thrown for not-found-example.com diff --git a/cli/tests/runtime_decorators.ts b/cli/tests/runtime_decorators.ts deleted file mode 100644 index 5da109110..000000000 --- a/cli/tests/runtime_decorators.ts +++ /dev/null @@ -1,42 +0,0 @@ -// deno-lint-ignore-file -function A() { - console.log("@A evaluated"); - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ) { - console.log("@A called"); - const fn = descriptor.value; - descriptor.value = function () { - console.log("fn() called from @A"); - fn(); - }; - }; -} - -function B() { - console.log("@B evaluated"); - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ) { - console.log("@B called"); - const fn = descriptor.value; - descriptor.value = function () { - console.log("fn() called from @B"); - fn(); - }; - }; -} - -class C { - @A() - @B() - static test() { - console.log("C.test() called"); - } -} - -C.test(); diff --git a/cli/tests/runtime_decorators.ts.out b/cli/tests/runtime_decorators.ts.out deleted file mode 100644 index 0fc1d4590..000000000 --- a/cli/tests/runtime_decorators.ts.out +++ /dev/null @@ -1,7 +0,0 @@ -@A evaluated -@B evaluated -@B called -@A called -fn() called from @A -fn() called from @B -C.test() called diff --git a/cli/tests/seed_random.js b/cli/tests/seed_random.js deleted file mode 100644 index 7f6e336df..000000000 --- a/cli/tests/seed_random.js +++ /dev/null @@ -1,11 +0,0 @@ -for (let i = 0; i < 10; ++i) { - console.log(Math.random()); -} - -const arr = new Uint8Array(32); - -crypto.getRandomValues(arr); -console.log(arr); - -crypto.getRandomValues(arr); -console.log(arr); diff --git a/cli/tests/seed_random.js.out b/cli/tests/seed_random.js.out deleted file mode 100644 index 4d1ebd081..000000000 --- a/cli/tests/seed_random.js.out +++ /dev/null @@ -1,22 +0,0 @@ -0.858562739044346 -0.8973397944553141 -0.15335012655691727 -0.36867387434349963 -0.3591039342838782 -0.7044499748617652 -0.7461423057751548 -0.3824611207183364 -0.5950178237266042 -0.22440633214343908 -Uint8Array(32) [ - 153, 221, 127, 193, 173, 88, 77, 155, - 23, 66, 117, 239, 157, 231, 189, 160, - 79, 198, 30, 56, 137, 159, 220, 226, - 47, 211, 26, 73, 243, 252, 71, 214 -] -Uint8Array(32) [ - 18, 98, 66, 131, 76, 87, 93, 76, - 205, 81, 250, 112, 129, 119, 92, 9, - 116, 99, 5, 171, 8, 137, 132, 79, - 255, 9, 194, 1, 138, 85, 72, 189 -] diff --git a/cli/tests/single_compile_with_reload.ts b/cli/tests/single_compile_with_reload.ts deleted file mode 100644 index f84e91f2f..000000000 --- a/cli/tests/single_compile_with_reload.ts +++ /dev/null @@ -1,18 +0,0 @@ -await import("./single_compile_with_reload_dyn.ts"); -console.log("1"); -await import("./single_compile_with_reload_dyn.ts"); -console.log("2"); -await new Promise((r) => - new Worker( - new URL("single_compile_with_reload_worker.ts", import.meta.url).href, - { type: "module" }, - ).onmessage = r -); -console.log("3"); -await new Promise((r) => - new Worker( - new URL("single_compile_with_reload_worker.ts", import.meta.url).href, - { type: "module" }, - ).onmessage = r -); -console.log("4"); diff --git a/cli/tests/single_compile_with_reload.ts.out b/cli/tests/single_compile_with_reload.ts.out deleted file mode 100644 index b0b2fcaf1..000000000 --- a/cli/tests/single_compile_with_reload.ts.out +++ /dev/null @@ -1,9 +0,0 @@ -Check [WILDCARD]single_compile_with_reload.ts -Hello -1 -2 -Check [WILDCARD]single_compile_with_reload_worker.ts -Hello from worker -3 -Hello from worker -4 diff --git a/cli/tests/single_compile_with_reload_dyn.ts b/cli/tests/single_compile_with_reload_dyn.ts deleted file mode 100644 index 0266bf46c..000000000 --- a/cli/tests/single_compile_with_reload_dyn.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { printHello3, returnsFoo2, returnsHi } from "./subdir/mod1.ts"; - -printHello3(); - -if (returnsHi() !== "Hi") { - throw Error("Unexpected"); -} - -if (returnsFoo2() !== "Foo") { - throw Error("Unexpected"); -} diff --git a/cli/tests/single_compile_with_reload_worker.ts b/cli/tests/single_compile_with_reload_worker.ts deleted file mode 100644 index 103cafe20..000000000 --- a/cli/tests/single_compile_with_reload_worker.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log("Hello from worker"); -postMessage(null); -close(); diff --git a/cli/tests/standalone_compiler_ops.ts b/cli/tests/standalone_compiler_ops.ts deleted file mode 100644 index b95e1222e..000000000 --- a/cli/tests/standalone_compiler_ops.ts +++ /dev/null @@ -1,12 +0,0 @@ -const { files } = await Deno.emit("/mod.ts", { - bundle: "classic", - sources: { - "/mod.ts": `import { hello } from "/hello.ts"; console.log(hello);`, - "/hello.ts": `export const hello: string = "Hello, Compiler API!"`, - }, - compilerOptions: { - sourceMap: false, - }, -}); - -eval(files["deno:///bundle.js"]); diff --git a/cli/tests/standalone_error.ts b/cli/tests/standalone_error.ts deleted file mode 100644 index 279398113..000000000 --- a/cli/tests/standalone_error.ts +++ /dev/null @@ -1,9 +0,0 @@ -function boom() { - throw new Error("boom!"); -} - -function foo() { - boom(); -} - -foo(); diff --git a/cli/tests/standalone_import.ts b/cli/tests/standalone_import.ts deleted file mode 100644 index 804102a53..000000000 --- a/cli/tests/standalone_import.ts +++ /dev/null @@ -1,2 +0,0 @@ -console.log("start"); -await import("./001_hello.js"); diff --git a/cli/tests/standalone_import_datauri.ts b/cli/tests/standalone_import_datauri.ts deleted file mode 100644 index 68f348828..000000000 --- a/cli/tests/standalone_import_datauri.ts +++ /dev/null @@ -1,4 +0,0 @@ -const c = await import( - "data:text/javascript;base64,ZXhwb3J0IGRlZmF1bHQgJ0hlbGxvIERlbm8hJw==" -); -console.log(c.default); // Output: "Hello Deno!" diff --git a/cli/tests/standalone_runtime_flags.ts b/cli/tests/standalone_runtime_flags.ts deleted file mode 100644 index 0154c7f4e..000000000 --- a/cli/tests/standalone_runtime_flags.ts +++ /dev/null @@ -1,3 +0,0 @@ -console.log(Math.random()); -await Deno.stat("."); -await Deno.create("foo.txt"); diff --git a/cli/tests/std_lint.out b/cli/tests/std_lint.out deleted file mode 100644 index 9d62fcc67..000000000 --- a/cli/tests/std_lint.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] - -Found [WILDCARD] problems \ No newline at end of file diff --git a/cli/tests/stdout_write_all.out b/cli/tests/stdout_write_all.out deleted file mode 100644 index af5626b4a..000000000 --- a/cli/tests/stdout_write_all.out +++ /dev/null @@ -1 +0,0 @@ -Hello, world! diff --git a/cli/tests/stdout_write_all.ts b/cli/tests/stdout_write_all.ts deleted file mode 100644 index 623bd8f53..000000000 --- a/cli/tests/stdout_write_all.ts +++ /dev/null @@ -1,8 +0,0 @@ -const encoder = new TextEncoder(); -const pending = [ - Deno.stdout.write(encoder.encode("Hello, ")), - Deno.stdout.write(encoder.encode("world!")), -]; - -await Promise.all(pending); -await Deno.stdout.write(encoder.encode("\n")); diff --git a/cli/tests/subdir/amd_like.js b/cli/tests/subdir/amd_like.js deleted file mode 100644 index f27e505e4..000000000 --- a/cli/tests/subdir/amd_like.js +++ /dev/null @@ -1,3 +0,0 @@ -// looks like an AMD module, but isn't -const define = () => {}; -define(["fake_module"], () => {}); diff --git a/cli/tests/subdir/auto_print_hello.ts b/cli/tests/subdir/auto_print_hello.ts deleted file mode 100644 index 5efa72e03..000000000 --- a/cli/tests/subdir/auto_print_hello.ts +++ /dev/null @@ -1,2 +0,0 @@ -console.log("hello!"); -export default {}; diff --git a/cli/tests/subdir/circular1.ts b/cli/tests/subdir/circular1.ts deleted file mode 100644 index 06fdb3373..000000000 --- a/cli/tests/subdir/circular1.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as circular2 from "./circular2.ts"; - -export function f1() { - console.log("f1"); -} - -circular2.f2(); diff --git a/cli/tests/subdir/circular2.ts b/cli/tests/subdir/circular2.ts deleted file mode 100644 index 0864b7adf..000000000 --- a/cli/tests/subdir/circular2.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as circular1 from "./circular1.ts"; - -export function f2() { - console.log("f2"); -} - -circular1.f1(); diff --git a/cli/tests/subdir/comment.ts b/cli/tests/subdir/comment.ts deleted file mode 100644 index ea7e630c0..000000000 --- a/cli/tests/subdir/comment.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This is a comment. -export function comment(): string { - return "comment"; -} diff --git a/cli/tests/subdir/config.json b/cli/tests/subdir/config.json deleted file mode 100644 index 01c3b5e79..000000000 --- a/cli/tests/subdir/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "foo": { - "bar": true, - "baz": ["qat", 1] - } -} diff --git a/cli/tests/subdir/emittable.d.ts b/cli/tests/subdir/emittable.d.ts deleted file mode 100644 index 425b80f24..000000000 --- a/cli/tests/subdir/emittable.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const a: string; diff --git a/cli/tests/subdir/empty.ts b/cli/tests/subdir/empty.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/subdir/evil_remote_import.js b/cli/tests/subdir/evil_remote_import.js deleted file mode 100644 index 4ff7d1b97..000000000 --- a/cli/tests/subdir/evil_remote_import.js +++ /dev/null @@ -1,4 +0,0 @@ -// We expect to get a permission denied error if we dynamically -// import this module without --allow-read. -export * from "file:///c:/etc/passwd"; -console.log("Hello from evil_remote_import.js"); diff --git a/cli/tests/subdir/foo_types.d.ts b/cli/tests/subdir/foo_types.d.ts deleted file mode 100644 index c489584b9..000000000 --- a/cli/tests/subdir/foo_types.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare namespace Foo { - const bar: string; -} diff --git a/cli/tests/subdir/form_urlencoded.txt b/cli/tests/subdir/form_urlencoded.txt deleted file mode 100644 index 70e087c20..000000000 --- a/cli/tests/subdir/form_urlencoded.txt +++ /dev/null @@ -1 +0,0 @@ -field_1=Hi&field_2=%3CDeno%3E \ No newline at end of file diff --git a/cli/tests/subdir/indirect_import_error.js b/cli/tests/subdir/indirect_import_error.js deleted file mode 100644 index 84011d291..000000000 --- a/cli/tests/subdir/indirect_import_error.js +++ /dev/null @@ -1 +0,0 @@ -export * from "does not exist either"; diff --git a/cli/tests/subdir/indirect_throws.js b/cli/tests/subdir/indirect_throws.js deleted file mode 100644 index e1810a66c..000000000 --- a/cli/tests/subdir/indirect_throws.js +++ /dev/null @@ -1 +0,0 @@ -export * from "./throws.js"; diff --git a/cli/tests/subdir/json_1.json b/cli/tests/subdir/json_1.json deleted file mode 100644 index 754d16b84..000000000 --- a/cli/tests/subdir/json_1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$var": { "a": 123, "b": [1, 2, 3], "c": null }, - "with space": "invalid variable name", - "function": "reserved word" -} diff --git a/cli/tests/subdir/json_2.json b/cli/tests/subdir/json_2.json deleted file mode 100644 index 7deb8b173..000000000 --- a/cli/tests/subdir/json_2.json +++ /dev/null @@ -1 +0,0 @@ -"just a string" diff --git a/cli/tests/subdir/main.ts b/cli/tests/subdir/main.ts deleted file mode 100644 index 29acf42e0..000000000 --- a/cli/tests/subdir/main.ts +++ /dev/null @@ -1,3 +0,0 @@ -if (import.meta.main) { - console.log("Hello, world!"); -} diff --git a/cli/tests/subdir/mismatch_ext.ts b/cli/tests/subdir/mismatch_ext.ts deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/mismatch_ext.ts +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/mod1.ts b/cli/tests/subdir/mod1.ts deleted file mode 100644 index 5e58f432e..000000000 --- a/cli/tests/subdir/mod1.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { printHello2, returnsFoo } from "./subdir2/mod2.ts"; - -export function returnsHi(): string { - return "Hi"; -} - -export function returnsFoo2(): string { - return returnsFoo(); -} - -export function printHello3() { - printHello2(); -} - -export function throwsError() { - throw Error("exception from mod1"); -} diff --git a/cli/tests/subdir/mod2.ts b/cli/tests/subdir/mod2.ts deleted file mode 100644 index ce1adc0e8..000000000 --- a/cli/tests/subdir/mod2.ts +++ /dev/null @@ -1 +0,0 @@ -export { printHello } from "./print_hello.ts"; diff --git a/cli/tests/subdir/mod3.js b/cli/tests/subdir/mod3.js deleted file mode 100644 index ce534f570..000000000 --- a/cli/tests/subdir/mod3.js +++ /dev/null @@ -1 +0,0 @@ -export const isTSFile = false; diff --git a/cli/tests/subdir/mod4.js b/cli/tests/subdir/mod4.js deleted file mode 100644 index 71332dbc4..000000000 --- a/cli/tests/subdir/mod4.js +++ /dev/null @@ -1 +0,0 @@ -export const isMod4 = true; diff --git a/cli/tests/subdir/mod5.mjs b/cli/tests/subdir/mod5.mjs deleted file mode 100644 index f21d8862b..000000000 --- a/cli/tests/subdir/mod5.mjs +++ /dev/null @@ -1 +0,0 @@ -export const isMod5 = true; diff --git a/cli/tests/subdir/mod6.js b/cli/tests/subdir/mod6.js deleted file mode 100644 index 5e17c9ee0..000000000 --- a/cli/tests/subdir/mod6.js +++ /dev/null @@ -1 +0,0 @@ -export { isMod4 } from "./mod4.js"; diff --git a/cli/tests/subdir/more_decorators.ts b/cli/tests/subdir/more_decorators.ts deleted file mode 100644 index 674705d56..000000000 --- a/cli/tests/subdir/more_decorators.ts +++ /dev/null @@ -1,18 +0,0 @@ -// deno-lint-ignore-file -function a() { - console.log("a(): evaluated"); - return ( - _target: any, - _propertyKey: string, - _descriptor: PropertyDescriptor, - ) => { - console.log("a(): called"); - }; -} - -export class B { - @a() - method() { - console.log("method"); - } -} diff --git a/cli/tests/subdir/mt_application_ecmascript.j2.js b/cli/tests/subdir/mt_application_ecmascript.j2.js deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/mt_application_ecmascript.j2.js +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx b/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx deleted file mode 100644 index c5c27f9f9..000000000 --- a/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx +++ /dev/null @@ -1,5 +0,0 @@ -const React = { - createElement() {}, -}; -const temp =
; -export const loaded = true; diff --git a/cli/tests/subdir/mt_application_x_javascript.j4.js b/cli/tests/subdir/mt_application_x_javascript.j4.js deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/mt_application_x_javascript.j4.js +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx b/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx deleted file mode 100644 index c5c27f9f9..000000000 --- a/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx +++ /dev/null @@ -1,5 +0,0 @@ -const React = { - createElement() {}, -}; -const temp =
; -export const loaded = true; diff --git a/cli/tests/subdir/mt_application_x_typescript.t4.ts b/cli/tests/subdir/mt_application_x_typescript.t4.ts deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/mt_application_x_typescript.t4.ts +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx b/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx deleted file mode 100644 index c5c27f9f9..000000000 --- a/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx +++ /dev/null @@ -1,5 +0,0 @@ -const React = { - createElement() {}, -}; -const temp =
; -export const loaded = true; diff --git a/cli/tests/subdir/mt_javascript.js b/cli/tests/subdir/mt_javascript.js deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/mt_javascript.js +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/mt_javascript_jsx.jsx b/cli/tests/subdir/mt_javascript_jsx.jsx deleted file mode 100644 index c5c27f9f9..000000000 --- a/cli/tests/subdir/mt_javascript_jsx.jsx +++ /dev/null @@ -1,5 +0,0 @@ -const React = { - createElement() {}, -}; -const temp =
; -export const loaded = true; diff --git a/cli/tests/subdir/mt_text_ecmascript.j3.js b/cli/tests/subdir/mt_text_ecmascript.j3.js deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/mt_text_ecmascript.j3.js +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx b/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx deleted file mode 100644 index c5c27f9f9..000000000 --- a/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx +++ /dev/null @@ -1,5 +0,0 @@ -const React = { - createElement() {}, -}; -const temp =
; -export const loaded = true; diff --git a/cli/tests/subdir/mt_text_javascript.j1.js b/cli/tests/subdir/mt_text_javascript.j1.js deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/mt_text_javascript.j1.js +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx b/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx deleted file mode 100644 index c5c27f9f9..000000000 --- a/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx +++ /dev/null @@ -1,5 +0,0 @@ -const React = { - createElement() {}, -}; -const temp =
; -export const loaded = true; diff --git a/cli/tests/subdir/mt_text_typescript.t1.ts b/cli/tests/subdir/mt_text_typescript.t1.ts deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/mt_text_typescript.t1.ts +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx b/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx deleted file mode 100644 index c5c27f9f9..000000000 --- a/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx +++ /dev/null @@ -1,5 +0,0 @@ -const React = { - createElement() {}, -}; -const temp =
; -export const loaded = true; diff --git a/cli/tests/subdir/mt_video_mp2t.t3.ts b/cli/tests/subdir/mt_video_mp2t.t3.ts deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/mt_video_mp2t.t3.ts +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx b/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx deleted file mode 100644 index c5c27f9f9..000000000 --- a/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx +++ /dev/null @@ -1,5 +0,0 @@ -const React = { - createElement() {}, -}; -const temp =
; -export const loaded = true; diff --git a/cli/tests/subdir/mt_video_vdn.t2.ts b/cli/tests/subdir/mt_video_vdn.t2.ts deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/mt_video_vdn.t2.ts +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx b/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx deleted file mode 100644 index c5c27f9f9..000000000 --- a/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx +++ /dev/null @@ -1,5 +0,0 @@ -const React = { - createElement() {}, -}; -const temp =
; -export const loaded = true; diff --git a/cli/tests/subdir/no_ext b/cli/tests/subdir/no_ext deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/no_ext +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/subdir/no_js_ext b/cli/tests/subdir/no_js_ext deleted file mode 100644 index 8322a106f..000000000 --- a/cli/tests/subdir/no_js_ext +++ /dev/null @@ -1,3 +0,0 @@ -// @ts-check -import { printHello } from "./mod2.ts"; -printHello(); diff --git a/cli/tests/subdir/polyfill.ts b/cli/tests/subdir/polyfill.ts deleted file mode 100644 index e1cd923cb..000000000 --- a/cli/tests/subdir/polyfill.ts +++ /dev/null @@ -1,10 +0,0 @@ -declare global { - const polyfill: () => void; -} - -export {}; - -// deno-lint-ignore no-explicit-any -(globalThis as any).polyfill = () => { - console.log("polyfill"); -}; diff --git a/cli/tests/subdir/print_hello.ts b/cli/tests/subdir/print_hello.ts deleted file mode 100644 index b9c0ad527..000000000 --- a/cli/tests/subdir/print_hello.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function printHello() { - console.log("Hello"); -} diff --git a/cli/tests/subdir/redirects/a.ts b/cli/tests/subdir/redirects/a.ts deleted file mode 100644 index 071ee4728..000000000 --- a/cli/tests/subdir/redirects/a.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { createA } from "./b.ts"; - -export class A { - private _a = "a"; -} - -export function start(): A { - return createA(); -} diff --git a/cli/tests/subdir/redirects/b.ts b/cli/tests/subdir/redirects/b.ts deleted file mode 100644 index cdb71eaae..000000000 --- a/cli/tests/subdir/redirects/b.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { A } from "./a.ts"; - -export function createA(): A { - return new A(); -} diff --git a/cli/tests/subdir/redirects/redirect1.js b/cli/tests/subdir/redirects/redirect1.js deleted file mode 100644 index d674be88c..000000000 --- a/cli/tests/subdir/redirects/redirect1.js +++ /dev/null @@ -1 +0,0 @@ -export const redirect = 1; diff --git a/cli/tests/subdir/redirects/redirect1.ts b/cli/tests/subdir/redirects/redirect1.ts deleted file mode 100644 index d674be88c..000000000 --- a/cli/tests/subdir/redirects/redirect1.ts +++ /dev/null @@ -1 +0,0 @@ -export const redirect = 1; diff --git a/cli/tests/subdir/redirects/redirect2.js b/cli/tests/subdir/redirects/redirect2.js deleted file mode 100644 index e4244f638..000000000 --- a/cli/tests/subdir/redirects/redirect2.js +++ /dev/null @@ -1 +0,0 @@ -import "./redirect1.js"; diff --git a/cli/tests/subdir/redirects/redirect3.js b/cli/tests/subdir/redirects/redirect3.js deleted file mode 100644 index e24f2af32..000000000 --- a/cli/tests/subdir/redirects/redirect3.js +++ /dev/null @@ -1,2 +0,0 @@ -import { redirect } from "./redirect1.js"; -export const value = `3 imports ${redirect}`; diff --git a/cli/tests/subdir/redirects/redirect4.ts b/cli/tests/subdir/redirects/redirect4.ts deleted file mode 100644 index 45c65c5eb..000000000 --- a/cli/tests/subdir/redirects/redirect4.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { redirect } from "./redirect1.ts"; -export const value = `4 imports ${redirect}`; diff --git a/cli/tests/subdir/single_module.ts b/cli/tests/subdir/single_module.ts deleted file mode 100644 index f41b0a4b5..000000000 --- a/cli/tests/subdir/single_module.ts +++ /dev/null @@ -1,2 +0,0 @@ -console.log("Hello world!"); -export {}; // TODO(ry) This shouldn't be necessary. diff --git a/cli/tests/subdir/subdir2/dynamic_import.ts b/cli/tests/subdir/subdir2/dynamic_import.ts deleted file mode 100644 index 573887b71..000000000 --- a/cli/tests/subdir/subdir2/dynamic_import.ts +++ /dev/null @@ -1,6 +0,0 @@ -(async () => { - const { printHello } = await import("../mod2.ts"); - printHello(); -})(); - -export {}; diff --git a/cli/tests/subdir/subdir2/mod2.ts b/cli/tests/subdir/subdir2/mod2.ts deleted file mode 100644 index 9071d0aeb..000000000 --- a/cli/tests/subdir/subdir2/mod2.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { printHello } from "../print_hello.ts"; - -export function returnsFoo(): string { - return "Foo"; -} - -export function printHello2() { - printHello(); -} diff --git a/cli/tests/subdir/test_worker_basic.js b/cli/tests/subdir/test_worker_basic.js deleted file mode 100644 index b960128b4..000000000 --- a/cli/tests/subdir/test_worker_basic.js +++ /dev/null @@ -1,14 +0,0 @@ -console.log("hello from test_worker_basic.js"); - -if (self.name !== "jsWorker") { - throw Error(`Bad worker name: ${self.name}, expected jsWorker`); -} - -onmessage = function (e) { - postMessage(e.data); - close(); -}; - -onerror = function () { - return false; -}; diff --git a/cli/tests/subdir/throws.js b/cli/tests/subdir/throws.js deleted file mode 100644 index abdf29156..000000000 --- a/cli/tests/subdir/throws.js +++ /dev/null @@ -1,6 +0,0 @@ -// deno-lint-ignore-file -export function boo() { - console.log("Boo!"); -} - -throw new Error("An error"); diff --git a/cli/tests/subdir/tla.ts b/cli/tests/subdir/tla.ts deleted file mode 100644 index 713dbfca0..000000000 --- a/cli/tests/subdir/tla.ts +++ /dev/null @@ -1 +0,0 @@ -export const foo = await Promise.resolve("Hello"); diff --git a/cli/tests/subdir/type_and_code.ts b/cli/tests/subdir/type_and_code.ts deleted file mode 100644 index b14713419..000000000 --- a/cli/tests/subdir/type_and_code.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface AnInterface { - a: string; -} - -export function isAnInterface(value: unknown): value is AnInterface { - return value && typeof value === "object" && "a" in value; -} diff --git a/cli/tests/subdir/type_reference.d.ts b/cli/tests/subdir/type_reference.d.ts deleted file mode 100644 index f9b8de5ed..000000000 --- a/cli/tests/subdir/type_reference.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const foo: "foo"; diff --git a/cli/tests/subdir/type_reference.js b/cli/tests/subdir/type_reference.js deleted file mode 100644 index 917d89198..000000000 --- a/cli/tests/subdir/type_reference.js +++ /dev/null @@ -1,3 +0,0 @@ -/// - -export const foo = "foo"; diff --git a/cli/tests/subdir/types.d.ts b/cli/tests/subdir/types.d.ts deleted file mode 100644 index 7f587e144..000000000 --- a/cli/tests/subdir/types.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var a: string; diff --git a/cli/tests/subdir/unknown_ext.deno b/cli/tests/subdir/unknown_ext.deno deleted file mode 100644 index e67d2a017..000000000 --- a/cli/tests/subdir/unknown_ext.deno +++ /dev/null @@ -1 +0,0 @@ -export const loaded = true; diff --git a/cli/tests/swc_syntax_error.ts b/cli/tests/swc_syntax_error.ts deleted file mode 100644 index 991ca9214..000000000 --- a/cli/tests/swc_syntax_error.ts +++ /dev/null @@ -1,4 +0,0 @@ -// deno-fmt-ignore-file -for await (const req of s) { - let something: -} diff --git a/cli/tests/swc_syntax_error.ts.out b/cli/tests/swc_syntax_error.ts.out deleted file mode 100644 index 53ed29cb6..000000000 --- a/cli/tests/swc_syntax_error.ts.out +++ /dev/null @@ -1 +0,0 @@ -error: 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:0 diff --git a/cli/tests/symlink_to_subdir b/cli/tests/symlink_to_subdir deleted file mode 120000 index fe0c45aa4..000000000 --- a/cli/tests/symlink_to_subdir +++ /dev/null @@ -1 +0,0 @@ -subdir/ \ No newline at end of file diff --git a/cli/tests/test/allow_all.out b/cli/tests/test/allow_all.out deleted file mode 100644 index 9b7367b94..000000000 --- a/cli/tests/test/allow_all.out +++ /dev/null @@ -1,18 +0,0 @@ -[WILDCARD] -running 14 tests from [WILDCARD] -test read false ... ok [WILDCARD] -test read true ... ok [WILDCARD] -test write false ... ok [WILDCARD] -test write true ... ok [WILDCARD] -test net false ... ok [WILDCARD] -test net true ... ok [WILDCARD] -test env false ... ok [WILDCARD] -test env true ... ok [WILDCARD] -test run false ... ok [WILDCARD] -test run true ... ok [WILDCARD] -test ffi false ... ok [WILDCARD] -test ffi true ... ok [WILDCARD] -test hrtime false ... ok [WILDCARD] -test hrtime true ... ok [WILDCARD] - -test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD] diff --git a/cli/tests/test/allow_all.ts b/cli/tests/test/allow_all.ts deleted file mode 100644 index b8f8c647d..000000000 --- a/cli/tests/test/allow_all.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { assertEquals } from "../../../test_util/std/testing/asserts.ts"; - -const permissions: Deno.PermissionName[] = [ - "read", - "write", - "net", - "env", - "run", - "ffi", - "hrtime", -]; - -for (const name of permissions) { - Deno.test({ - name: `${name} false`, - permissions: { - [name]: false, - }, - async fn() { - const status = await Deno.permissions.query({ name }); - assertEquals(status.state, "denied"); - }, - }); - - Deno.test({ - name: `${name} true`, - permissions: { - [name]: true, - }, - async fn() { - const status = await Deno.permissions.query({ name }); - assertEquals(status.state, "granted"); - }, - }); -} diff --git a/cli/tests/test/allow_none.out b/cli/tests/test/allow_none.out deleted file mode 100644 index b79c7e6bf..000000000 --- a/cli/tests/test/allow_none.out +++ /dev/null @@ -1,51 +0,0 @@ -[WILDCARD] -running 7 tests from [WILDCARD] -test read ... FAILED [WILDCARD] -test write ... FAILED [WILDCARD] -test net ... FAILED [WILDCARD] -test env ... FAILED [WILDCARD] -test run ... FAILED [WILDCARD] -test ffi ... FAILED [WILDCARD] -test hrtime ... FAILED [WILDCARD] - -failures: - -read -PermissionDenied: Can't escalate parent thread permissions -[WILDCARD] - -write -PermissionDenied: Can't escalate parent thread permissions -[WILDCARD] - -net -PermissionDenied: Can't escalate parent thread permissions -[WILDCARD] - -env -PermissionDenied: Can't escalate parent thread permissions -[WILDCARD] - -run -PermissionDenied: Can't escalate parent thread permissions -[WILDCARD] - -ffi -PermissionDenied: Can't escalate parent thread permissions -[WILDCARD] - -hrtime -PermissionDenied: Can't escalate parent thread permissions -[WILDCARD] - -failures: - - read - write - net - env - run - ffi - hrtime - -test result: FAILED. 0 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD] diff --git a/cli/tests/test/allow_none.ts b/cli/tests/test/allow_none.ts deleted file mode 100644 index 7872c774e..000000000 --- a/cli/tests/test/allow_none.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { unreachable } from "../../../test_util/std/testing/asserts.ts"; - -const permissions: Deno.PermissionName[] = [ - "read", - "write", - "net", - "env", - "run", - "ffi", - "hrtime", -]; - -for (const name of permissions) { - Deno.test({ - name, - permissions: { - [name]: true, - }, - fn() { - unreachable(); - }, - }); -} diff --git a/cli/tests/test/clear_timeout.out b/cli/tests/test/clear_timeout.out deleted file mode 100644 index c9f459dbe..000000000 --- a/cli/tests/test/clear_timeout.out +++ /dev/null @@ -1,8 +0,0 @@ -Check [WILDCARD]/test/clear_timeout.ts -running 3 tests from [WILDCARD]/test/clear_timeout.ts -test test 1 ... ok ([WILDCARD]) -test test 2 ... ok ([WILDCARD]) -test test 3 ... ok ([WILDCARD]) - -test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - diff --git a/cli/tests/test/clear_timeout.ts b/cli/tests/test/clear_timeout.ts deleted file mode 100644 index 00056e853..000000000 --- a/cli/tests/test/clear_timeout.ts +++ /dev/null @@ -1,5 +0,0 @@ -clearTimeout(setTimeout(() => {}, 1000)); - -Deno.test("test 1", () => {}); -Deno.test("test 2", () => {}); -Deno.test("test 3", () => {}); diff --git a/cli/tests/test/doc.out b/cli/tests/test/doc.out deleted file mode 100644 index 91ecbd4d4..000000000 --- a/cli/tests/test/doc.out +++ /dev/null @@ -1,10 +0,0 @@ -Check [WILDCARD]/doc.ts$2-5.ts -Check [WILDCARD]/doc.ts$6-9.js -Check [WILDCARD]/doc.ts$10-13.jsx -Check [WILDCARD]/doc.ts$14-17.ts -Check [WILDCARD]/doc.ts$18-21.tsx -Check [WILDCARD]/doc.ts$30-35.ts -error: TS2367 [ERROR]: This condition will always return 'false' since the types 'string' and 'number' have no overlap. -console.assert(check() == 42); - ~~~~~~~~~~~~~ - at [WILDCARD]/doc.ts$30-35.ts:3:16 diff --git a/cli/tests/test/doc.ts b/cli/tests/test/doc.ts deleted file mode 100644 index 52fe6bdf0..000000000 --- a/cli/tests/test/doc.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * ``` - * import * as doc from "./doc.ts"; - * ``` - * - * ```js - * import * as doc from "./doc.ts"; - * ``` - * - * ```jsx - * import * as doc from "./doc.ts"; - * ``` - * - * ```ts - * import * as doc from "./doc.ts"; - * ``` - * - * ```tsx - * import * as doc from "./doc.ts"; - * ``` - * - * ```text - * import * as doc from "./doc.ts"; - * ``` - * - * @module doc - */ - -/** - * ``` - * import { check } from "./doc.ts"; - * - * console.assert(check() == 42); - * ``` - */ -export function check(): string { - return "check"; -} diff --git a/cli/tests/test/doc_markdown.out b/cli/tests/test/doc_markdown.out deleted file mode 100644 index 9d2c35974..000000000 --- a/cli/tests/test/doc_markdown.out +++ /dev/null @@ -1,7 +0,0 @@ -Check [WILDCARD]/test/doc_markdown/doc.md$11-14.js -Check [WILDCARD]/test/doc_markdown/doc.md$17-20.ts -Check [WILDCARD]/test/doc_markdown/doc.md$23-26.ts -error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. -const a: string = 42; - ^ - at [WILDCARD]/test/doc_markdown/doc.md$23-26.ts:1:7 diff --git a/cli/tests/test/doc_markdown/doc.md b/cli/tests/test/doc_markdown/doc.md deleted file mode 100644 index e5afb841b..000000000 --- a/cli/tests/test/doc_markdown/doc.md +++ /dev/null @@ -1,25 +0,0 @@ -# Documentation - -The following block does not have a language attribute and should be ignored: - -``` -This is a fenced block without attributes, it's invalid and it should be ignored. -``` - -The following block should be given a js extension on extraction: - -```js -console.log("js"); -``` - -The following block should be given a ts extension on extraction: - -```ts -console.log("ts"); -``` - -The following example will trigger the type-checker to fail: - -```ts -const a: string = 42; -``` diff --git a/cli/tests/test/exit_sanitizer.out b/cli/tests/test/exit_sanitizer.out deleted file mode 100644 index f331d7a70..000000000 --- a/cli/tests/test/exit_sanitizer.out +++ /dev/null @@ -1,35 +0,0 @@ -Check [WILDCARD]/test/exit_sanitizer.ts -running 3 tests from [WILDCARD]/test/exit_sanitizer.ts -test exit(0) ... FAILED ([WILDCARD]) -test exit(1) ... FAILED ([WILDCARD]) -test exit(2) ... FAILED ([WILDCARD]) - -failures: - -exit(0) -AssertionError: Test case attempted to exit with exit code: 0 - at [WILDCARD] - at [WILDCARD]/test/exit_sanitizer.ts:2:8 - at [WILDCARD] - -exit(1) -AssertionError: Test case attempted to exit with exit code: 1 - at [WILDCARD] - at [WILDCARD]/test/exit_sanitizer.ts:6:8 - at [WILDCARD] - -exit(2) -AssertionError: Test case attempted to exit with exit code: 2 - at [WILDCARD] - at [WILDCARD]/test/exit_sanitizer.ts:10:8 - at [WILDCARD] - -failures: - - exit(0) - exit(1) - exit(2) - -test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - -error: Test failed diff --git a/cli/tests/test/exit_sanitizer.ts b/cli/tests/test/exit_sanitizer.ts deleted file mode 100644 index 186406a9d..000000000 --- a/cli/tests/test/exit_sanitizer.ts +++ /dev/null @@ -1,11 +0,0 @@ -Deno.test("exit(0)", function () { - Deno.exit(0); -}); - -Deno.test("exit(1)", function () { - Deno.exit(1); -}); - -Deno.test("exit(2)", function () { - Deno.exit(2); -}); diff --git a/cli/tests/test/fail.out b/cli/tests/test/fail.out deleted file mode 100644 index 66d471cdf..000000000 --- a/cli/tests/test/fail.out +++ /dev/null @@ -1,81 +0,0 @@ -Check [WILDCARD]/test/fail.ts -running 10 tests from [WILDCARD]/test/fail.ts -test test 0 ... FAILED ([WILDCARD]) -test test 1 ... FAILED ([WILDCARD]) -test test 2 ... FAILED ([WILDCARD]) -test test 3 ... FAILED ([WILDCARD]) -test test 4 ... FAILED ([WILDCARD]) -test test 5 ... FAILED ([WILDCARD]) -test test 6 ... FAILED ([WILDCARD]) -test test 7 ... FAILED ([WILDCARD]) -test test 8 ... FAILED ([WILDCARD]) -test test 9 ... FAILED ([WILDCARD]) - -failures: - -test 0 -Error - at [WILDCARD]/test/fail.ts:2:9 - at [WILDCARD] - -test 1 -Error - at [WILDCARD]/test/fail.ts:5:9 - at [WILDCARD] - -test 2 -Error - at [WILDCARD]/test/fail.ts:8:9 - at [WILDCARD] - -test 3 -Error - at [WILDCARD]/test/fail.ts:11:9 - at [WILDCARD] - -test 4 -Error - at [WILDCARD]/test/fail.ts:14:9 - at [WILDCARD] - -test 5 -Error - at [WILDCARD]/test/fail.ts:17:9 - at [WILDCARD] - -test 6 -Error - at [WILDCARD]/test/fail.ts:20:9 - at [WILDCARD] - -test 7 -Error - at [WILDCARD]/test/fail.ts:23:9 - at [WILDCARD] - -test 8 -Error - at [WILDCARD]/test/fail.ts:26:9 - at [WILDCARD] - -test 9 -Error - at [WILDCARD]/test/fail.ts:29:9 - at [WILDCARD] - -failures: - - test 0 - test 1 - test 2 - test 3 - test 4 - test 5 - test 6 - test 7 - test 8 - test 9 - -test result: FAILED. 0 passed; 10 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - -error: Test failed diff --git a/cli/tests/test/fail.ts b/cli/tests/test/fail.ts deleted file mode 100644 index 9340db556..000000000 --- a/cli/tests/test/fail.ts +++ /dev/null @@ -1,30 +0,0 @@ -Deno.test("test 0", () => { - throw new Error(); -}); -Deno.test("test 1", () => { - throw new Error(); -}); -Deno.test("test 2", () => { - throw new Error(); -}); -Deno.test("test 3", () => { - throw new Error(); -}); -Deno.test("test 4", () => { - throw new Error(); -}); -Deno.test("test 5", () => { - throw new Error(); -}); -Deno.test("test 6", () => { - throw new Error(); -}); -Deno.test("test 7", () => { - throw new Error(); -}); -Deno.test("test 8", () => { - throw new Error(); -}); -Deno.test("test 9", () => { - throw new Error(); -}); diff --git a/cli/tests/test/fail_fast.out b/cli/tests/test/fail_fast.out deleted file mode 100644 index c97f854fa..000000000 --- a/cli/tests/test/fail_fast.out +++ /dev/null @@ -1,18 +0,0 @@ -Check [WILDCARD]/test/fail_fast.ts -running 10 tests from [WILDCARD]/test/fail_fast.ts -test test 1 ... FAILED ([WILDCARD]) - -failures: - -test 1 -Error - at [WILDCARD]/test/fail_fast.ts:2:9 - at [WILDCARD] - -failures: - - test 1 - -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - -error: Test failed diff --git a/cli/tests/test/fail_fast.ts b/cli/tests/test/fail_fast.ts deleted file mode 100644 index 637e825ec..000000000 --- a/cli/tests/test/fail_fast.ts +++ /dev/null @@ -1,30 +0,0 @@ -Deno.test("test 1", () => { - throw new Error(); -}); -Deno.test("test 2", () => { - throw new Error(); -}); -Deno.test("test 3", () => { - throw new Error(); -}); -Deno.test("test 4", () => { - throw new Error(); -}); -Deno.test("test 5", () => { - throw new Error(); -}); -Deno.test("test 6", () => { - throw new Error(); -}); -Deno.test("test 7", () => { - throw new Error(); -}); -Deno.test("test 8", () => { - throw new Error(); -}); -Deno.test("test 9", () => { - throw new Error(); -}); -Deno.test("test 0", () => { - throw new Error(); -}); diff --git a/cli/tests/test/fail_fast_with_val.out b/cli/tests/test/fail_fast_with_val.out deleted file mode 100644 index a902e4c7b..000000000 --- a/cli/tests/test/fail_fast_with_val.out +++ /dev/null @@ -1,23 +0,0 @@ -[WILDCARD] -running 10 tests from [WILDCARD]/test/fail_fast_with_val.ts -test test 1 ... FAILED ([WILDCARD]) -test test 2 ... FAILED ([WILDCARD]) - -failures: - -test 1 -Error - at [WILDCARD]/test/fail_fast_with_val.ts:2:9 - at [WILDCARD] - -test 2 -Error - at [WILDCARD]/test/fail_fast_with_val.ts:5:9 - at [WILDCARD] - -failures: - - test 1 - test 2 - -test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) diff --git a/cli/tests/test/fail_fast_with_val.ts b/cli/tests/test/fail_fast_with_val.ts deleted file mode 100644 index 637e825ec..000000000 --- a/cli/tests/test/fail_fast_with_val.ts +++ /dev/null @@ -1,30 +0,0 @@ -Deno.test("test 1", () => { - throw new Error(); -}); -Deno.test("test 2", () => { - throw new Error(); -}); -Deno.test("test 3", () => { - throw new Error(); -}); -Deno.test("test 4", () => { - throw new Error(); -}); -Deno.test("test 5", () => { - throw new Error(); -}); -Deno.test("test 6", () => { - throw new Error(); -}); -Deno.test("test 7", () => { - throw new Error(); -}); -Deno.test("test 8", () => { - throw new Error(); -}); -Deno.test("test 9", () => { - throw new Error(); -}); -Deno.test("test 0", () => { - throw new Error(); -}); diff --git a/cli/tests/test/finally_timeout.out b/cli/tests/test/finally_timeout.out deleted file mode 100644 index 570e9108f..000000000 --- a/cli/tests/test/finally_timeout.out +++ /dev/null @@ -1,19 +0,0 @@ -Check [WILDCARD]/test/finally_timeout.ts -running 2 tests from [WILDCARD]/test/finally_timeout.ts -test error ... FAILED ([WILDCARD]) -test success ... ok ([WILDCARD]) - -failures: - -error -Error: fail - at [WILDCARD]/test/finally_timeout.ts:4:11 - at [WILDCARD] - -failures: - - error - -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - -error: Test failed diff --git a/cli/tests/test/finally_timeout.ts b/cli/tests/test/finally_timeout.ts deleted file mode 100644 index dcc0a4d64..000000000 --- a/cli/tests/test/finally_timeout.ts +++ /dev/null @@ -1,11 +0,0 @@ -Deno.test("error", function () { - const timer = setTimeout(() => null, 10000); - try { - throw new Error("fail"); - } finally { - clearTimeout(timer); - } -}); - -Deno.test("success", function () { -}); diff --git a/cli/tests/test/ignore.out b/cli/tests/test/ignore.out deleted file mode 100644 index a7c68261d..000000000 --- a/cli/tests/test/ignore.out +++ /dev/null @@ -1,15 +0,0 @@ -Check [WILDCARD]/test/ignore.ts -running 10 tests from [WILDCARD]/test/ignore.ts -test test 0 ... ignored ([WILDCARD]) -test test 1 ... ignored ([WILDCARD]) -test test 2 ... ignored ([WILDCARD]) -test test 3 ... ignored ([WILDCARD]) -test test 4 ... ignored ([WILDCARD]) -test test 5 ... ignored ([WILDCARD]) -test test 6 ... ignored ([WILDCARD]) -test test 7 ... ignored ([WILDCARD]) -test test 8 ... ignored ([WILDCARD]) -test test 9 ... ignored ([WILDCARD]) - -test result: ok. 0 passed; 0 failed; 10 ignored; 0 measured; 0 filtered out ([WILDCARD]) - diff --git a/cli/tests/test/ignore.ts b/cli/tests/test/ignore.ts deleted file mode 100644 index 01113a129..000000000 --- a/cli/tests/test/ignore.ts +++ /dev/null @@ -1,9 +0,0 @@ -for (let i = 0; i < 10; i++) { - Deno.test({ - name: `test ${i}`, - ignore: true, - fn() { - throw new Error("unreachable"); - }, - }); -} diff --git a/cli/tests/test/ignore_permissions.out b/cli/tests/test/ignore_permissions.out deleted file mode 100644 index c4d273d8f..000000000 --- a/cli/tests/test/ignore_permissions.out +++ /dev/null @@ -1,6 +0,0 @@ -Check [WILDCARD]/test/ignore_permissions.ts -running 1 test from [WILDCARD]/test/ignore_permissions.ts -test ignore ... ignored ([WILDCARD]) - -test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out ([WILDCARD]) - diff --git a/cli/tests/test/ignore_permissions.ts b/cli/tests/test/ignore_permissions.ts deleted file mode 100644 index ff3084441..000000000 --- a/cli/tests/test/ignore_permissions.ts +++ /dev/null @@ -1,16 +0,0 @@ -Deno.test({ - name: "ignore", - permissions: { - read: true, - write: true, - net: true, - env: true, - run: true, - ffi: true, - hrtime: true, - }, - ignore: true, - fn() { - throw new Error("unreachable"); - }, -}); diff --git a/cli/tests/test/meta.out b/cli/tests/test/meta.out deleted file mode 100644 index a8c7acd63..000000000 --- a/cli/tests/test/meta.out +++ /dev/null @@ -1,7 +0,0 @@ -Check [WILDCARD]/test/meta.ts -import.meta.main: false -import.meta.url: [WILDCARD]/test/meta.ts -running 0 tests from [WILDCARD]/test/meta.ts - -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - diff --git a/cli/tests/test/meta.ts b/cli/tests/test/meta.ts deleted file mode 100644 index e32fdeea6..000000000 --- a/cli/tests/test/meta.ts +++ /dev/null @@ -1,2 +0,0 @@ -console.log("import.meta.main: %s", import.meta.main); -console.log("import.meta.url: %s", import.meta.url); diff --git a/cli/tests/test/no_check.out b/cli/tests/test/no_check.out deleted file mode 100644 index 9daab7ac4..000000000 --- a/cli/tests/test/no_check.out +++ /dev/null @@ -1,8 +0,0 @@ - -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - -error: Uncaught TypeError: Cannot read properties of undefined (reading 'fn') -Deno.test(); - ^ - at [WILDCARD] - at [WILDCARD]/test/no_check.ts:1:6 diff --git a/cli/tests/test/no_check.ts b/cli/tests/test/no_check.ts deleted file mode 100644 index 79d75f989..000000000 --- a/cli/tests/test/no_check.ts +++ /dev/null @@ -1 +0,0 @@ -Deno.test(); diff --git a/cli/tests/test/no_color.ts b/cli/tests/test/no_color.ts deleted file mode 100644 index 38c531ee9..000000000 --- a/cli/tests/test/no_color.ts +++ /dev/null @@ -1,17 +0,0 @@ -Deno.test({ - name: "success", - fn() {}, -}); - -Deno.test({ - name: "fail", - fn() { - throw new Error("fail"); - }, -}); - -Deno.test({ - name: "ignored", - ignore: true, - fn() {}, -}); diff --git a/cli/tests/test/no_run.out b/cli/tests/test/no_run.out deleted file mode 100644 index 5edf03fe0..000000000 --- a/cli/tests/test/no_run.out +++ /dev/null @@ -1,5 +0,0 @@ -Check [WILDCARD]/test/no_run.ts -error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. -const _value: string = 1; - ~~~~~~ - at [WILDCARD]/test/no_run.ts:1:7 diff --git a/cli/tests/test/no_run.ts b/cli/tests/test/no_run.ts deleted file mode 100644 index b75915753..000000000 --- a/cli/tests/test/no_run.ts +++ /dev/null @@ -1 +0,0 @@ -const _value: string = 1; diff --git a/cli/tests/test/only.out b/cli/tests/test/only.out deleted file mode 100644 index dc78cae80..000000000 --- a/cli/tests/test/only.out +++ /dev/null @@ -1,7 +0,0 @@ -Check [WILDCARD]/test/only.ts -running 1 test from [WILDCARD]/test/only.ts -test only ... ok ([WILDCARD]) - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out ([WILDCARD]) - -error: Test failed because the "only" option was used diff --git a/cli/tests/test/only.ts b/cli/tests/test/only.ts deleted file mode 100644 index 03c4dcac3..000000000 --- a/cli/tests/test/only.ts +++ /dev/null @@ -1,15 +0,0 @@ -Deno.test({ - name: "before", - fn() {}, -}); - -Deno.test({ - only: true, - name: "only", - fn() {}, -}); - -Deno.test({ - name: "after", - fn() {}, -}); diff --git a/cli/tests/test/pass.out b/cli/tests/test/pass.out deleted file mode 100644 index cf81ac2e7..000000000 --- a/cli/tests/test/pass.out +++ /dev/null @@ -1,15 +0,0 @@ -Check [WILDCARD]/test/pass.ts -running 10 tests from [WILDCARD]/test/pass.ts -test test 0 ... ok ([WILDCARD]) -test test 1 ... ok ([WILDCARD]) -test test 2 ... ok ([WILDCARD]) -test test 3 ... ok ([WILDCARD]) -test test 4 ... ok ([WILDCARD]) -test test 5 ... ok ([WILDCARD]) -test test 6 ... ok ([WILDCARD]) -test test 7 ... ok ([WILDCARD]) -test test 8 ... ok ([WILDCARD]) -test test 9 ... ok ([WILDCARD]) - -test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - diff --git a/cli/tests/test/pass.ts b/cli/tests/test/pass.ts deleted file mode 100644 index 288cc7c83..000000000 --- a/cli/tests/test/pass.ts +++ /dev/null @@ -1,10 +0,0 @@ -Deno.test("test 0", () => {}); -Deno.test("test 1", () => {}); -Deno.test("test 2", () => {}); -Deno.test("test 3", () => {}); -Deno.test("test 4", () => {}); -Deno.test("test 5", () => {}); -Deno.test("test 6", () => {}); -Deno.test("test 7", () => {}); -Deno.test("test 8", () => {}); -Deno.test("test 9", () => {}); diff --git a/cli/tests/test/quiet.out b/cli/tests/test/quiet.out deleted file mode 100644 index 05302fb2c..000000000 --- a/cli/tests/test/quiet.out +++ /dev/null @@ -1,8 +0,0 @@ -running 4 tests from [WILDCARD]/test/quiet.ts -test console.log ... ok ([WILDCARD]) -test console.error ... ok ([WILDCARD]) -test console.info ... ok ([WILDCARD]) -test console.warn ... ok ([WILDCARD]) - -test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - diff --git a/cli/tests/test/quiet.ts b/cli/tests/test/quiet.ts deleted file mode 100644 index f40805bfb..000000000 --- a/cli/tests/test/quiet.ts +++ /dev/null @@ -1,15 +0,0 @@ -Deno.test("console.log", function () { - console.log("log"); -}); - -Deno.test("console.error", function () { - console.error("error"); -}); - -Deno.test("console.info", function () { - console.info("info"); -}); - -Deno.test("console.warn", function () { - console.info("warn"); -}); diff --git a/cli/tests/test/shuffle.out b/cli/tests/test/shuffle.out deleted file mode 100644 index 04dd08ee2..000000000 --- a/cli/tests/test/shuffle.out +++ /dev/null @@ -1,39 +0,0 @@ -Check [WILDCARD]/test/shuffle/foo_test.ts -Check [WILDCARD]/test/shuffle/baz_test.ts -Check [WILDCARD]/test/shuffle/bar_test.ts -running 10 tests from [WILDCARD]/test/shuffle/foo_test.ts -test test 2 ... ok ([WILDCARD]) -test test 3 ... ok ([WILDCARD]) -test test 6 ... ok ([WILDCARD]) -test test 9 ... ok ([WILDCARD]) -test test 8 ... ok ([WILDCARD]) -test test 7 ... ok ([WILDCARD]) -test test 5 ... ok ([WILDCARD]) -test test 4 ... ok ([WILDCARD]) -test test 1 ... ok ([WILDCARD]) -test test 0 ... ok ([WILDCARD]) -running 10 tests from [WILDCARD]/test/shuffle/baz_test.ts -test test 2 ... ok ([WILDCARD]) -test test 3 ... ok ([WILDCARD]) -test test 6 ... ok ([WILDCARD]) -test test 9 ... ok ([WILDCARD]) -test test 8 ... ok ([WILDCARD]) -test test 7 ... ok ([WILDCARD]) -test test 5 ... ok ([WILDCARD]) -test test 4 ... ok ([WILDCARD]) -test test 1 ... ok ([WILDCARD]) -test test 0 ... ok ([WILDCARD]) -running 10 tests from [WILDCARD]/test/shuffle/bar_test.ts -test test 2 ... ok ([WILDCARD]) -test test 3 ... ok ([WILDCARD]) -test test 6 ... ok ([WILDCARD]) -test test 9 ... ok ([WILDCARD]) -test test 8 ... ok ([WILDCARD]) -test test 7 ... ok ([WILDCARD]) -test test 5 ... ok ([WILDCARD]) -test test 4 ... ok ([WILDCARD]) -test test 1 ... ok ([WILDCARD]) -test test 0 ... ok ([WILDCARD]) - -test result: ok. 30 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - diff --git a/cli/tests/test/shuffle/bar_test.ts b/cli/tests/test/shuffle/bar_test.ts deleted file mode 100644 index ca118dc0d..000000000 --- a/cli/tests/test/shuffle/bar_test.ts +++ /dev/null @@ -1,3 +0,0 @@ -for (let i = 0; i < 10; i++) { - Deno.test(`test ${i}`, () => {}); -} diff --git a/cli/tests/test/shuffle/baz_test.ts b/cli/tests/test/shuffle/baz_test.ts deleted file mode 100644 index ca118dc0d..000000000 --- a/cli/tests/test/shuffle/baz_test.ts +++ /dev/null @@ -1,3 +0,0 @@ -for (let i = 0; i < 10; i++) { - Deno.test(`test ${i}`, () => {}); -} diff --git a/cli/tests/test/shuffle/foo_test.ts b/cli/tests/test/shuffle/foo_test.ts deleted file mode 100644 index ca118dc0d..000000000 --- a/cli/tests/test/shuffle/foo_test.ts +++ /dev/null @@ -1,3 +0,0 @@ -for (let i = 0; i < 10; i++) { - Deno.test(`test ${i}`, () => {}); -} diff --git a/cli/tests/test/unhandled_rejection.out b/cli/tests/test/unhandled_rejection.out deleted file mode 100644 index fae353a28..000000000 --- a/cli/tests/test/unhandled_rejection.out +++ /dev/null @@ -1,10 +0,0 @@ -Check [WILDCARD]/test/unhandled_rejection.ts - -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - -error: Uncaught (in promise) Error: rejection - reject(new Error("rejection")); - ^ - at [WILDCARD]/test/unhandled_rejection.ts:2:10 - at new Promise () - at [WILDCARD]/test/unhandled_rejection.ts:1:1 diff --git a/cli/tests/test/unhandled_rejection.ts b/cli/tests/test/unhandled_rejection.ts deleted file mode 100644 index 32f3111ea..000000000 --- a/cli/tests/test/unhandled_rejection.ts +++ /dev/null @@ -1,3 +0,0 @@ -new Promise((_resolve, reject) => { - reject(new Error("rejection")); -}); diff --git a/cli/tests/test/unresolved_promise.out b/cli/tests/test/unresolved_promise.out deleted file mode 100644 index cd505bcbf..000000000 --- a/cli/tests/test/unresolved_promise.out +++ /dev/null @@ -1,6 +0,0 @@ -Check [WILDCARD]/test/unresolved_promise.ts -running 2 tests from [WILDCARD]/test/unresolved_promise.ts -test unresolved promise ... -test result: FAILED. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) - -error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promise. diff --git a/cli/tests/test/unresolved_promise.ts b/cli/tests/test/unresolved_promise.ts deleted file mode 100644 index 8f50e907a..000000000 --- a/cli/tests/test/unresolved_promise.ts +++ /dev/null @@ -1,11 +0,0 @@ -Deno.test({ - name: "unresolved promise", - fn() { - return new Promise((_resolve, _reject) => {}); - }, -}); - -Deno.test({ - name: "ok", - fn() {}, -}); diff --git a/cli/tests/testdata/001_hello.js b/cli/tests/testdata/001_hello.js new file mode 100644 index 000000000..accefceba --- /dev/null +++ b/cli/tests/testdata/001_hello.js @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/cli/tests/testdata/001_hello.js.out b/cli/tests/testdata/001_hello.js.out new file mode 100644 index 000000000..557db03de --- /dev/null +++ b/cli/tests/testdata/001_hello.js.out @@ -0,0 +1 @@ +Hello World diff --git a/cli/tests/testdata/002_hello.ts b/cli/tests/testdata/002_hello.ts new file mode 100644 index 000000000..accefceba --- /dev/null +++ b/cli/tests/testdata/002_hello.ts @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/cli/tests/testdata/002_hello.ts.out b/cli/tests/testdata/002_hello.ts.out new file mode 100644 index 000000000..557db03de --- /dev/null +++ b/cli/tests/testdata/002_hello.ts.out @@ -0,0 +1 @@ +Hello World diff --git a/cli/tests/testdata/003_relative_import.ts b/cli/tests/testdata/003_relative_import.ts new file mode 100644 index 000000000..01d5d7faa --- /dev/null +++ b/cli/tests/testdata/003_relative_import.ts @@ -0,0 +1,3 @@ +import { printHello } from "./subdir/print_hello.ts"; + +printHello(); diff --git a/cli/tests/testdata/003_relative_import.ts.out b/cli/tests/testdata/003_relative_import.ts.out new file mode 100644 index 000000000..699b756ed --- /dev/null +++ b/cli/tests/testdata/003_relative_import.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +Hello diff --git a/cli/tests/testdata/004_set_timeout.ts b/cli/tests/testdata/004_set_timeout.ts new file mode 100644 index 000000000..214b25086 --- /dev/null +++ b/cli/tests/testdata/004_set_timeout.ts @@ -0,0 +1,11 @@ +setTimeout(() => { + console.log("World"); +}, 10); + +console.log("Hello"); + +const id = setTimeout(() => { + console.log("Not printed"); +}, 10000); + +clearTimeout(id); diff --git a/cli/tests/testdata/004_set_timeout.ts.out b/cli/tests/testdata/004_set_timeout.ts.out new file mode 100644 index 000000000..f9264f7fb --- /dev/null +++ b/cli/tests/testdata/004_set_timeout.ts.out @@ -0,0 +1,2 @@ +Hello +World diff --git a/cli/tests/testdata/005_more_imports.ts b/cli/tests/testdata/005_more_imports.ts new file mode 100644 index 000000000..0266bf46c --- /dev/null +++ b/cli/tests/testdata/005_more_imports.ts @@ -0,0 +1,11 @@ +import { printHello3, returnsFoo2, returnsHi } from "./subdir/mod1.ts"; + +printHello3(); + +if (returnsHi() !== "Hi") { + throw Error("Unexpected"); +} + +if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); +} diff --git a/cli/tests/testdata/005_more_imports.ts.out b/cli/tests/testdata/005_more_imports.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/005_more_imports.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/006_url_imports.ts b/cli/tests/testdata/006_url_imports.ts new file mode 100644 index 000000000..4036f27ed --- /dev/null +++ b/cli/tests/testdata/006_url_imports.ts @@ -0,0 +1,3 @@ +import { printHello } from "http://localhost:4545/subdir/mod2.ts"; +printHello(); +console.log("success"); diff --git a/cli/tests/testdata/006_url_imports.ts.out b/cli/tests/testdata/006_url_imports.ts.out new file mode 100644 index 000000000..989ce33e9 --- /dev/null +++ b/cli/tests/testdata/006_url_imports.ts.out @@ -0,0 +1,2 @@ +Hello +success diff --git a/cli/tests/testdata/012_async.ts b/cli/tests/testdata/012_async.ts new file mode 100644 index 000000000..536197b68 --- /dev/null +++ b/cli/tests/testdata/012_async.ts @@ -0,0 +1,11 @@ +// Check that we can use the async keyword. +async function main() { + await new Promise((resolve) => { + console.log("2"); + setTimeout(resolve, 100); + }); + console.log("3"); +} + +console.log("1"); +main(); diff --git a/cli/tests/testdata/012_async.ts.out b/cli/tests/testdata/012_async.ts.out new file mode 100644 index 000000000..01e79c32a --- /dev/null +++ b/cli/tests/testdata/012_async.ts.out @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/cli/tests/testdata/013_dynamic_import.ts b/cli/tests/testdata/013_dynamic_import.ts new file mode 100644 index 000000000..d4dc55152 --- /dev/null +++ b/cli/tests/testdata/013_dynamic_import.ts @@ -0,0 +1,15 @@ +(async () => { + const { returnsHi, returnsFoo2, printHello3 } = await import( + "./subdir/mod1.ts" + ); + + printHello3(); + + if (returnsHi() !== "Hi") { + throw Error("Unexpected"); + } + + if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); + } +})(); diff --git a/cli/tests/testdata/013_dynamic_import.ts.out b/cli/tests/testdata/013_dynamic_import.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/013_dynamic_import.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/014_duplicate_import.ts b/cli/tests/testdata/014_duplicate_import.ts new file mode 100644 index 000000000..88f934526 --- /dev/null +++ b/cli/tests/testdata/014_duplicate_import.ts @@ -0,0 +1,9 @@ +// with all the imports of the same module, the module should only be +// instantiated once +import "./subdir/auto_print_hello.ts"; + +import "./subdir/auto_print_hello.ts"; + +(async () => { + await import("./subdir/auto_print_hello.ts"); +})(); diff --git a/cli/tests/testdata/014_duplicate_import.ts.out b/cli/tests/testdata/014_duplicate_import.ts.out new file mode 100644 index 000000000..4effa19f4 --- /dev/null +++ b/cli/tests/testdata/014_duplicate_import.ts.out @@ -0,0 +1 @@ +hello! diff --git a/cli/tests/testdata/015_duplicate_parallel_import.js b/cli/tests/testdata/015_duplicate_parallel_import.js new file mode 100644 index 000000000..172eeaf53 --- /dev/null +++ b/cli/tests/testdata/015_duplicate_parallel_import.js @@ -0,0 +1,20 @@ +// Importing the same module in parallel, the module should only be +// instantiated once. + +const promises = new Array(100) + .fill(null) + .map(() => import("./subdir/mod1.ts")); + +Promise.all(promises).then((imports) => { + const mod = imports.reduce((first, cur) => { + if (typeof first !== "object") { + throw new Error("Expected an object."); + } + if (first !== cur) { + throw new Error("More than one instance of the same module."); + } + return first; + }); + + mod.printHello3(); +}); diff --git a/cli/tests/testdata/015_duplicate_parallel_import.js.out b/cli/tests/testdata/015_duplicate_parallel_import.js.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/015_duplicate_parallel_import.js.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/016_double_await.ts b/cli/tests/testdata/016_double_await.ts new file mode 100644 index 000000000..457a53ff3 --- /dev/null +++ b/cli/tests/testdata/016_double_await.ts @@ -0,0 +1,8 @@ +// This is to test if Deno would die at 2nd await +// See https://github.com/denoland/deno/issues/919 +(async () => { + const currDirInfo = await Deno.stat("."); + const parentDirInfo = await Deno.stat(".."); + console.log(currDirInfo.isDirectory); + console.log(parentDirInfo.isFile); +})(); diff --git a/cli/tests/testdata/016_double_await.ts.out b/cli/tests/testdata/016_double_await.ts.out new file mode 100644 index 000000000..da29283aa --- /dev/null +++ b/cli/tests/testdata/016_double_await.ts.out @@ -0,0 +1,2 @@ +true +false diff --git a/cli/tests/testdata/017_import_redirect.ts b/cli/tests/testdata/017_import_redirect.ts new file mode 100644 index 000000000..1265dd4ed --- /dev/null +++ b/cli/tests/testdata/017_import_redirect.ts @@ -0,0 +1,4 @@ +// http -> https redirect would happen: +import { printHello } from "http://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts"; + +printHello(); diff --git a/cli/tests/testdata/017_import_redirect.ts.out b/cli/tests/testdata/017_import_redirect.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/017_import_redirect.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/017_import_redirect_info.out b/cli/tests/testdata/017_import_redirect_info.out new file mode 100644 index 000000000..d3a2e86fc --- /dev/null +++ b/cli/tests/testdata/017_import_redirect_info.out @@ -0,0 +1,6 @@ +local: [WILDCARD]017_import_redirect.ts +type: TypeScript +dependencies: 1 unique (total 278B) + +file:///[WILDCARD]/017_import_redirect.ts ([WILDCARD]) +└── https://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts ([WILDCARD]) diff --git a/cli/tests/testdata/018_async_catch.ts b/cli/tests/testdata/018_async_catch.ts new file mode 100644 index 000000000..ac43a52e8 --- /dev/null +++ b/cli/tests/testdata/018_async_catch.ts @@ -0,0 +1,14 @@ +function fn(): Promise { + throw new Error("message"); +} +async function call() { + try { + console.log("before await fn()"); + await fn(); + console.log("after await fn()"); + } catch (_error) { + console.log("catch"); + } + console.log("after try-catch"); +} +call().catch(() => console.log("outer catch")); diff --git a/cli/tests/testdata/018_async_catch.ts.out b/cli/tests/testdata/018_async_catch.ts.out new file mode 100644 index 000000000..4fc219973 --- /dev/null +++ b/cli/tests/testdata/018_async_catch.ts.out @@ -0,0 +1,3 @@ +before await fn() +catch +after try-catch diff --git a/cli/tests/testdata/019_media_types.ts b/cli/tests/testdata/019_media_types.ts new file mode 100644 index 000000000..d985bd249 --- /dev/null +++ b/cli/tests/testdata/019_media_types.ts @@ -0,0 +1,24 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. + +import { loaded as loadedTs1 } from "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; +import { loaded as loadedTs2 } from "http://localhost:4545/subdir/mt_video_vdn.t2.ts"; +import { loaded as loadedTs3 } from "http://localhost:4545/subdir/mt_video_mp2t.t3.ts"; +import { loaded as loadedTs4 } from "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts"; +import { loaded as loadedJs1 } from "http://localhost:4545/subdir/mt_text_javascript.j1.js"; +import { loaded as loadedJs2 } from "http://localhost:4545/subdir/mt_application_ecmascript.j2.js"; +import { loaded as loadedJs3 } from "http://localhost:4545/subdir/mt_text_ecmascript.j3.js"; +import { loaded as loadedJs4 } from "http://localhost:4545/subdir/mt_application_x_javascript.j4.js"; + +console.log( + "success", + loadedTs1, + loadedTs2, + loadedTs3, + loadedTs4, + loadedJs1, + loadedJs2, + loadedJs3, + loadedJs4, +); diff --git a/cli/tests/testdata/019_media_types.ts.out b/cli/tests/testdata/019_media_types.ts.out new file mode 100644 index 000000000..b3e94678c --- /dev/null +++ b/cli/tests/testdata/019_media_types.ts.out @@ -0,0 +1 @@ +[WILDCARD]success true true true true true true true true diff --git a/cli/tests/testdata/020_json_modules.ts b/cli/tests/testdata/020_json_modules.ts new file mode 100644 index 000000000..fdc85c440 --- /dev/null +++ b/cli/tests/testdata/020_json_modules.ts @@ -0,0 +1,2 @@ +import config from "./subdir/config.json"; +console.log(JSON.stringify(config)); diff --git a/cli/tests/testdata/020_json_modules.ts.out b/cli/tests/testdata/020_json_modules.ts.out new file mode 100644 index 000000000..bfb7c80cf --- /dev/null +++ b/cli/tests/testdata/020_json_modules.ts.out @@ -0,0 +1,5 @@ +[WILDCARD] +error: An unsupported media type was attempted to be imported as a module. + Specifier: [WILDCARD]/subdir/config.json + MediaType: Json +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/021_mjs_modules.ts b/cli/tests/testdata/021_mjs_modules.ts new file mode 100644 index 000000000..6052b9081 --- /dev/null +++ b/cli/tests/testdata/021_mjs_modules.ts @@ -0,0 +1,2 @@ +import { isMod5 } from "./subdir/mod5.mjs"; +console.log(isMod5); diff --git a/cli/tests/testdata/021_mjs_modules.ts.out b/cli/tests/testdata/021_mjs_modules.ts.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/testdata/021_mjs_modules.ts.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/testdata/022_info_flag_script.out b/cli/tests/testdata/022_info_flag_script.out new file mode 100644 index 000000000..e86b7dda4 --- /dev/null +++ b/cli/tests/testdata/022_info_flag_script.out @@ -0,0 +1,14 @@ +[WILDCARD] +local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD] +type: TypeScript +dependencies: 8 unique (total [WILDCARD]) + +http://127.0.0.1:4545/019_media_types.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_ecmascript.j2.js ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_x_javascript.j4.js ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_x_typescript.t4.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_ecmascript.j3.js ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_javascript.j1.js ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_typescript.t1.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_video_mp2t.t3.ts ([WILDCARD]) +└── http://localhost:4545/subdir/mt_video_vdn.t2.ts ([WILDCARD]) diff --git a/cli/tests/testdata/023_no_ext b/cli/tests/testdata/023_no_ext new file mode 100644 index 000000000..0dcfb6209 --- /dev/null +++ b/cli/tests/testdata/023_no_ext @@ -0,0 +1,2 @@ +import * as mod4 from "./subdir/mod4.js"; +console.log(mod4.isMod4); diff --git a/cli/tests/testdata/023_no_ext.out b/cli/tests/testdata/023_no_ext.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/testdata/023_no_ext.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/testdata/024_import_no_ext_with_headers.ts b/cli/tests/testdata/024_import_no_ext_with_headers.ts new file mode 100644 index 000000000..c8621d0e6 --- /dev/null +++ b/cli/tests/testdata/024_import_no_ext_with_headers.ts @@ -0,0 +1 @@ +import "./023_no_ext_with_headers"; diff --git a/cli/tests/testdata/024_import_no_ext_with_headers.ts.out b/cli/tests/testdata/024_import_no_ext_with_headers.ts.out new file mode 100644 index 000000000..e427984d4 --- /dev/null +++ b/cli/tests/testdata/024_import_no_ext_with_headers.ts.out @@ -0,0 +1 @@ +HELLO diff --git a/cli/tests/testdata/025_hrtime.ts b/cli/tests/testdata/025_hrtime.ts new file mode 100644 index 000000000..b69d61488 --- /dev/null +++ b/cli/tests/testdata/025_hrtime.ts @@ -0,0 +1,5 @@ +window.onload = async () => { + console.log(performance.now() % 2 !== 0); + await Deno.permissions.revoke({ name: "hrtime" }); + console.log(performance.now() % 2 === 0); +}; diff --git a/cli/tests/testdata/025_hrtime.ts.out b/cli/tests/testdata/025_hrtime.ts.out new file mode 100644 index 000000000..bb101b641 --- /dev/null +++ b/cli/tests/testdata/025_hrtime.ts.out @@ -0,0 +1,2 @@ +true +true diff --git a/cli/tests/testdata/025_reload_js_type_error.js b/cli/tests/testdata/025_reload_js_type_error.js new file mode 100644 index 000000000..3b7c23cc9 --- /dev/null +++ b/cli/tests/testdata/025_reload_js_type_error.js @@ -0,0 +1,6 @@ +// deno-lint-ignore-file +// There was a bug where if this was executed with --reload it would throw a +// type error. +window.test = null; +test = console; +test.log("hello"); diff --git a/cli/tests/testdata/025_reload_js_type_error.js.out b/cli/tests/testdata/025_reload_js_type_error.js.out new file mode 100644 index 000000000..ce0136250 --- /dev/null +++ b/cli/tests/testdata/025_reload_js_type_error.js.out @@ -0,0 +1 @@ +hello diff --git a/cli/tests/testdata/026_redirect_javascript.js b/cli/tests/testdata/026_redirect_javascript.js new file mode 100644 index 000000000..226a6b622 --- /dev/null +++ b/cli/tests/testdata/026_redirect_javascript.js @@ -0,0 +1,2 @@ +import { value } from "http://localhost:4547/redirects/redirect3.js"; +console.log(value); diff --git a/cli/tests/testdata/026_redirect_javascript.js.out b/cli/tests/testdata/026_redirect_javascript.js.out new file mode 100644 index 000000000..290864299 --- /dev/null +++ b/cli/tests/testdata/026_redirect_javascript.js.out @@ -0,0 +1 @@ +3 imports 1 diff --git a/cli/tests/testdata/027_redirect_typescript.ts b/cli/tests/testdata/027_redirect_typescript.ts new file mode 100644 index 000000000..584341975 --- /dev/null +++ b/cli/tests/testdata/027_redirect_typescript.ts @@ -0,0 +1,2 @@ +import { value } from "http://localhost:4547/redirects/redirect4.ts"; +console.log(value); diff --git a/cli/tests/testdata/027_redirect_typescript.ts.out b/cli/tests/testdata/027_redirect_typescript.ts.out new file mode 100644 index 000000000..480d4e8ca --- /dev/null +++ b/cli/tests/testdata/027_redirect_typescript.ts.out @@ -0,0 +1 @@ +4 imports 1 diff --git a/cli/tests/testdata/028_args.ts b/cli/tests/testdata/028_args.ts new file mode 100644 index 000000000..ec41d52f9 --- /dev/null +++ b/cli/tests/testdata/028_args.ts @@ -0,0 +1,3 @@ +Deno.args.forEach((arg) => { + console.log(arg); +}); diff --git a/cli/tests/testdata/028_args.ts.out b/cli/tests/testdata/028_args.ts.out new file mode 100644 index 000000000..0f1b5c59e --- /dev/null +++ b/cli/tests/testdata/028_args.ts.out @@ -0,0 +1,6 @@ +--arg1 +val1 +--arg2=val2 +-- +arg3 +arg4 diff --git a/cli/tests/testdata/029_eval.out b/cli/tests/testdata/029_eval.out new file mode 100644 index 000000000..ce0136250 --- /dev/null +++ b/cli/tests/testdata/029_eval.out @@ -0,0 +1 @@ +hello diff --git a/cli/tests/testdata/030_eval_ts.out b/cli/tests/testdata/030_eval_ts.out new file mode 100644 index 000000000..190a18037 --- /dev/null +++ b/cli/tests/testdata/030_eval_ts.out @@ -0,0 +1 @@ +123 diff --git a/cli/tests/testdata/031_info_ts_error.out b/cli/tests/testdata/031_info_ts_error.out new file mode 100644 index 000000000..2dc7bb4e8 --- /dev/null +++ b/cli/tests/testdata/031_info_ts_error.out @@ -0,0 +1,5 @@ +[WILDCARD] +local: [WILDCARD]031_info_ts_error.ts +type: TypeScript +dependencies: 0 unique (total [WILDCARD]) +[WILDCARD]031_info_ts_error.ts ([WILDCARD]) diff --git a/cli/tests/testdata/031_info_ts_error.ts b/cli/tests/testdata/031_info_ts_error.ts new file mode 100644 index 000000000..9b7492dbe --- /dev/null +++ b/cli/tests/testdata/031_info_ts_error.ts @@ -0,0 +1 @@ +const _foo: string = 1; diff --git a/cli/tests/testdata/033_import_map.out b/cli/tests/testdata/033_import_map.out new file mode 100644 index 000000000..e9b9160e9 --- /dev/null +++ b/cli/tests/testdata/033_import_map.out @@ -0,0 +1,7 @@ +Hello from remapped moment! +Hello from remapped moment dir! +Hello from remapped lodash! +Hello from remapped lodash dir! +Hello from remapped Vue! +Hello from scoped moment! +Hello from scoped! diff --git a/cli/tests/testdata/033_import_map_remote.out b/cli/tests/testdata/033_import_map_remote.out new file mode 100644 index 000000000..804fa0d57 --- /dev/null +++ b/cli/tests/testdata/033_import_map_remote.out @@ -0,0 +1,5 @@ +Hello from remapped moment! +Hello from remapped moment dir! +Hello from remapped lodash! +Hello from remapped lodash dir! +Hello from remapped Vue! diff --git a/cli/tests/testdata/034_onload.out b/cli/tests/testdata/034_onload.out new file mode 100644 index 000000000..9b1f454c9 --- /dev/null +++ b/cli/tests/testdata/034_onload.out @@ -0,0 +1,11 @@ +log from nest_imported script +log from imported script +log from main +got load event in event handler (nest_imported) +got load event in event handler (imported) +got load event in event handler (main) +got load event in onload function +got unload event in event handler (nest_imported) +got unload event in event handler (imported) +got unload event in event handler (main) +got unload event in onunload function diff --git a/cli/tests/testdata/034_onload/imported.ts b/cli/tests/testdata/034_onload/imported.ts new file mode 100644 index 000000000..bac6cf5fa --- /dev/null +++ b/cli/tests/testdata/034_onload/imported.ts @@ -0,0 +1,11 @@ +import { assert } from "../../../../test_util/std/testing/asserts.ts"; +import "./nest_imported.ts"; + +const handler = (e: Event) => { + assert(!e.cancelable); + console.log(`got ${e.type} event in event handler (imported)`); +}; + +window.addEventListener("load", handler); +window.addEventListener("unload", handler); +console.log("log from imported script"); diff --git a/cli/tests/testdata/034_onload/main.ts b/cli/tests/testdata/034_onload/main.ts new file mode 100644 index 000000000..42df21c16 --- /dev/null +++ b/cli/tests/testdata/034_onload/main.ts @@ -0,0 +1,26 @@ +import { assert } from "../../../../test_util/std/testing/asserts.ts"; +import "./imported.ts"; + +assert(window.hasOwnProperty("onload")); +assert(window.onload === null); + +const eventHandler = (e: Event) => { + assert(!e.cancelable); + console.log(`got ${e.type} event in event handler (main)`); +}; + +window.addEventListener("load", eventHandler); + +window.addEventListener("unload", eventHandler); + +window.onload = (e: Event) => { + assert(!e.cancelable); + console.log(`got ${e.type} event in onload function`); +}; + +window.onunload = (e: Event) => { + assert(!e.cancelable); + console.log(`got ${e.type} event in onunload function`); +}; + +console.log("log from main"); diff --git a/cli/tests/testdata/034_onload/nest_imported.ts b/cli/tests/testdata/034_onload/nest_imported.ts new file mode 100644 index 000000000..259e505a2 --- /dev/null +++ b/cli/tests/testdata/034_onload/nest_imported.ts @@ -0,0 +1,10 @@ +import { assert } from "../../../../test_util/std/testing/asserts.ts"; + +const handler = (e: Event) => { + assert(!e.cancelable); + console.log(`got ${e.type} event in event handler (nest_imported)`); +}; + +window.addEventListener("load", handler); +window.addEventListener("unload", handler); +console.log("log from nest_imported script"); diff --git a/cli/tests/testdata/035_cached_only_flag.out b/cli/tests/testdata/035_cached_only_flag.out new file mode 100644 index 000000000..aad3f2fbc --- /dev/null +++ b/cli/tests/testdata/035_cached_only_flag.out @@ -0,0 +1 @@ +error: Specifier not found in cache: "http://127.0.0.1:4545/019_media_types.ts", --cached-only is specified. diff --git a/cli/tests/testdata/036_import_map_fetch.out b/cli/tests/testdata/036_import_map_fetch.out new file mode 100644 index 000000000..e69de29bb diff --git a/cli/tests/testdata/037_fetch_multiple.out b/cli/tests/testdata/037_fetch_multiple.out new file mode 100644 index 000000000..09c6c0f60 --- /dev/null +++ b/cli/tests/testdata/037_fetch_multiple.out @@ -0,0 +1,5 @@ +Download http://localhost:4545/subdir/mod2.ts +Download http://localhost:4545/subdir/print_hello.ts +Check [WILDCARD]/fetch/test.ts +Download http://localhost:4545/subdir/mt_text_typescript.t1.ts +Check [WILDCARD]/fetch/other.ts diff --git a/cli/tests/testdata/038_checkjs.js b/cli/tests/testdata/038_checkjs.js new file mode 100644 index 000000000..f0856d94c --- /dev/null +++ b/cli/tests/testdata/038_checkjs.js @@ -0,0 +1,5 @@ +// console.log intentionally misspelled to trigger a type error +consol.log("hello world!"); + +// the following error should be ignored and not output to the console +const foo = new Foo(); diff --git a/cli/tests/testdata/038_checkjs.js.out b/cli/tests/testdata/038_checkjs.js.out new file mode 100644 index 000000000..4ea473e4f --- /dev/null +++ b/cli/tests/testdata/038_checkjs.js.out @@ -0,0 +1,22 @@ +[WILDCARD] +error: TS2552 [ERROR]: Cannot find name 'consol'. Did you mean 'console'? +consol.log("hello world!"); +~~~~~~ + at [WILDCARD]/038_checkjs.js:2:1 + + 'console' is declared here. + declare var console: Console; + ~~~~~~~ + at [WILDCARD] + +TS2552 [ERROR]: Cannot find name 'Foo'. Did you mean 'foo'? +const foo = new Foo(); + ~~~ + at [WILDCARD]/038_checkjs.js:5:17 + + 'foo' is declared here. + const foo = new Foo(); + ~~~ + at [WILDCARD]/038_checkjs.js:5:7 + +Found 2 errors. diff --git a/cli/tests/testdata/038_checkjs.tsconfig.json b/cli/tests/testdata/038_checkjs.tsconfig.json new file mode 100644 index 000000000..46d96db9e --- /dev/null +++ b/cli/tests/testdata/038_checkjs.tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "allowJs": true, + "checkJs": true + } +} diff --git a/cli/tests/testdata/041_dyn_import_eval.out b/cli/tests/testdata/041_dyn_import_eval.out new file mode 100644 index 000000000..12a45b8da --- /dev/null +++ b/cli/tests/testdata/041_dyn_import_eval.out @@ -0,0 +1 @@ +Module { isMod4: true } diff --git a/cli/tests/testdata/041_info_flag.out b/cli/tests/testdata/041_info_flag.out new file mode 100644 index 000000000..ded795339 --- /dev/null +++ b/cli/tests/testdata/041_info_flag.out @@ -0,0 +1,5 @@ +DENO_DIR location: "[WILDCARD]" +Remote modules cache: "[WILDCARD]deps" +Emitted modules cache: "[WILDCARD]gen" +Language server registries cache: "[WILDCARD]registries" +Origin storage: "[WILDCARD]location_data" diff --git a/cli/tests/testdata/041_info_flag_location.out b/cli/tests/testdata/041_info_flag_location.out new file mode 100644 index 000000000..207065012 --- /dev/null +++ b/cli/tests/testdata/041_info_flag_location.out @@ -0,0 +1,6 @@ +DENO_DIR location: "[WILDCARD]" +Remote modules cache: "[WILDCARD]deps" +Emitted modules cache: "[WILDCARD]gen" +Language server registries cache: "[WILDCARD]registries" +Origin storage: "[WILDCARD]location_data[WILDCARD]" +Local Storage: "[WILDCARD]location_data[WILDCARD]local_storage" diff --git a/cli/tests/testdata/042_dyn_import_evalcontext.ts b/cli/tests/testdata/042_dyn_import_evalcontext.ts new file mode 100644 index 000000000..ccda3a972 --- /dev/null +++ b/cli/tests/testdata/042_dyn_import_evalcontext.ts @@ -0,0 +1,4 @@ +// @ts-expect-error "Deno.core" is not a public interface +Deno.core.evalContext( + "(async () => console.log(await import('./subdir/mod4.js')))()", +); diff --git a/cli/tests/testdata/042_dyn_import_evalcontext.ts.out b/cli/tests/testdata/042_dyn_import_evalcontext.ts.out new file mode 100644 index 000000000..12a45b8da --- /dev/null +++ b/cli/tests/testdata/042_dyn_import_evalcontext.ts.out @@ -0,0 +1 @@ +Module { isMod4: true } diff --git a/cli/tests/testdata/044_bad_resource.ts b/cli/tests/testdata/044_bad_resource.ts new file mode 100644 index 000000000..05e1354dc --- /dev/null +++ b/cli/tests/testdata/044_bad_resource.ts @@ -0,0 +1,3 @@ +const file = await Deno.open("044_bad_resource.ts", { read: true }); +file.close(); +await file.seek(10, 0); diff --git a/cli/tests/testdata/044_bad_resource.ts.out b/cli/tests/testdata/044_bad_resource.ts.out new file mode 100644 index 000000000..33c95fc44 --- /dev/null +++ b/cli/tests/testdata/044_bad_resource.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Uncaught (in promise) BadResource: Bad resource ID +[WILDCARD] diff --git a/cli/tests/testdata/045_mod.ts b/cli/tests/testdata/045_mod.ts new file mode 100644 index 000000000..b5f2a0b5b --- /dev/null +++ b/cli/tests/testdata/045_mod.ts @@ -0,0 +1,5 @@ +import { output } from "./045_output.ts"; + +if (import.meta.main) { + output("Hello!"); +} diff --git a/cli/tests/testdata/045_output.ts b/cli/tests/testdata/045_output.ts new file mode 100644 index 000000000..398760ca0 --- /dev/null +++ b/cli/tests/testdata/045_output.ts @@ -0,0 +1,3 @@ +export function output(text: string) { + console.log(text); +} diff --git a/cli/tests/testdata/045_programmatic_proxy_client.ts b/cli/tests/testdata/045_programmatic_proxy_client.ts new file mode 100644 index 000000000..cd6659978 --- /dev/null +++ b/cli/tests/testdata/045_programmatic_proxy_client.ts @@ -0,0 +1,16 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +const client = Deno.createHttpClient({ + proxy: { + url: "http://localhost:4555", + basicAuth: { username: "username", password: "password" }, + }, +}); + +const res = await fetch( + "http://localhost:4545/045_mod.ts", + { client }, +); +console.log(`Response http: ${await res.text()}`); + +client.close(); diff --git a/cli/tests/testdata/045_proxy_client.ts b/cli/tests/testdata/045_proxy_client.ts new file mode 100644 index 000000000..fe9129312 --- /dev/null +++ b/cli/tests/testdata/045_proxy_client.ts @@ -0,0 +1,5 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +const res = await fetch( + "http://localhost:4545/045_mod.ts", +); +console.log(`Response http: ${await res.text()}`); diff --git a/cli/tests/testdata/045_proxy_test.ts b/cli/tests/testdata/045_proxy_test.ts new file mode 100644 index 000000000..6d8359518 --- /dev/null +++ b/cli/tests/testdata/045_proxy_test.ts @@ -0,0 +1,142 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +import { serve, ServerRequest } from "../../../test_util/std/http/server.ts"; +import { assertEquals } from "../../../test_util/std/testing/asserts.ts"; + +const addr = Deno.args[1] || "127.0.0.1:4555"; + +async function proxyServer() { + const server = serve(addr); + + console.log(`Proxy server listening on http://${addr}/`); + for await (const req of server) { + proxyRequest(req); + } +} + +async function proxyRequest(req: ServerRequest) { + console.log(`Proxy request to: ${req.url}`); + const proxyAuthorization = req.headers.get("proxy-authorization"); + if (proxyAuthorization) { + console.log(`proxy-authorization: ${proxyAuthorization}`); + req.headers.delete("proxy-authorization"); + } + const resp = await fetch(req.url, { + method: req.method, + headers: req.headers, + }); + req.respond({ + status: resp.status, + body: new Uint8Array(await resp.arrayBuffer()), + headers: resp.headers, + }); +} + +async function testFetch() { + const c = Deno.run({ + cmd: [ + Deno.execPath(), + "run", + "--quiet", + "--reload", + "--allow-net", + "045_proxy_client.ts", + ], + stdout: "piped", + env: { + HTTP_PROXY: `http://${addr}`, + }, + }); + + const status = await c.status(); + assertEquals(status.code, 0); + c.close(); +} + +async function testModuleDownload() { + const http = Deno.run({ + cmd: [ + Deno.execPath(), + "cache", + "--reload", + "--quiet", + "http://localhost:4545/045_mod.ts", + ], + stdout: "piped", + env: { + HTTP_PROXY: `http://${addr}`, + }, + }); + + const httpStatus = await http.status(); + assertEquals(httpStatus.code, 0); + http.close(); +} + +async function testFetchNoProxy() { + const c = Deno.run({ + cmd: [ + Deno.execPath(), + "run", + "--quiet", + "--reload", + "--allow-net", + "045_proxy_client.ts", + ], + stdout: "piped", + env: { + HTTP_PROXY: "http://not.exising.proxy.server", + NO_PROXY: "localhost", + }, + }); + + const status = await c.status(); + assertEquals(status.code, 0); + c.close(); +} + +async function testModuleDownloadNoProxy() { + const http = Deno.run({ + cmd: [ + Deno.execPath(), + "cache", + "--reload", + "--quiet", + "http://localhost:4545/045_mod.ts", + ], + stdout: "piped", + env: { + HTTP_PROXY: "http://not.exising.proxy.server", + NO_PROXY: "localhost", + }, + }); + + const httpStatus = await http.status(); + assertEquals(httpStatus.code, 0); + http.close(); +} + +async function testFetchProgrammaticProxy() { + const c = Deno.run({ + cmd: [ + Deno.execPath(), + "run", + "--quiet", + "--reload", + "--allow-net=localhost:4545,localhost:4555", + "--unstable", + "045_programmatic_proxy_client.ts", + ], + stdout: "piped", + }); + const status = await c.status(); + assertEquals(status.code, 0); + c.close(); +} + +proxyServer(); +await testFetch(); +await testModuleDownload(); +await testFetchNoProxy(); +await testModuleDownloadNoProxy(); +await testFetchProgrammaticProxy(); +Deno.exit(0); diff --git a/cli/tests/testdata/045_proxy_test.ts.out b/cli/tests/testdata/045_proxy_test.ts.out new file mode 100644 index 000000000..4ebf97dee --- /dev/null +++ b/cli/tests/testdata/045_proxy_test.ts.out @@ -0,0 +1,6 @@ +Proxy server listening on [WILDCARD] +Proxy request to: http://localhost:4545/045_mod.ts +Proxy request to: http://localhost:4545/045_mod.ts +Proxy request to: http://localhost:4545/045_output.ts +Proxy request to: http://localhost:4545/045_mod.ts +proxy-authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= diff --git a/cli/tests/testdata/046_jsx_test.tsx b/cli/tests/testdata/046_jsx_test.tsx new file mode 100644 index 000000000..a96e90baf --- /dev/null +++ b/cli/tests/testdata/046_jsx_test.tsx @@ -0,0 +1,12 @@ +declare namespace JSX { + interface IntrinsicElements { + [elemName: string]: any; + } +} +const React = { + createElement(factory: any, props: any, ...children: any[]) { + return { factory, props, children }; + }, +}; +const View = () =>
land
; +console.log(); diff --git a/cli/tests/testdata/046_jsx_test.tsx.out b/cli/tests/testdata/046_jsx_test.tsx.out new file mode 100644 index 000000000..85cfe824b --- /dev/null +++ b/cli/tests/testdata/046_jsx_test.tsx.out @@ -0,0 +1 @@ +{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/testdata/047_jsx_test.jsx b/cli/tests/testdata/047_jsx_test.jsx new file mode 100644 index 000000000..4c2314072 --- /dev/null +++ b/cli/tests/testdata/047_jsx_test.jsx @@ -0,0 +1,7 @@ +const React = { + createElement(factory, props, ...children) { + return { factory, props, children }; + }, +}; +const View = () =>
land
; +console.log(); diff --git a/cli/tests/testdata/047_jsx_test.jsx.out b/cli/tests/testdata/047_jsx_test.jsx.out new file mode 100644 index 000000000..85cfe824b --- /dev/null +++ b/cli/tests/testdata/047_jsx_test.jsx.out @@ -0,0 +1 @@ +{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/testdata/048_media_types_jsx.ts b/cli/tests/testdata/048_media_types_jsx.ts new file mode 100644 index 000000000..8dcd0ad68 --- /dev/null +++ b/cli/tests/testdata/048_media_types_jsx.ts @@ -0,0 +1,32 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. +import { loaded as loadedTsx1 } from "http://localhost:4545/subdir/mt_text_typescript_tsx.t1.tsx"; +import { loaded as loadedTsx2 } from "http://localhost:4545/subdir/mt_video_vdn_tsx.t2.tsx"; +import { loaded as loadedTsx3 } from "http://localhost:4545/subdir/mt_video_mp2t_tsx.t3.tsx"; +import { loaded as loadedTsx4 } from "http://localhost:4545/subdir/mt_application_x_typescript_tsx.t4.tsx"; +import { loaded as loadedJsx1 } from "http://localhost:4545/subdir/mt_text_javascript_jsx.j1.jsx"; +import { loaded as loadedJsx2 } from "http://localhost:4545/subdir/mt_application_ecmascript_jsx.j2.jsx"; +import { loaded as loadedJsx3 } from "http://localhost:4545/subdir/mt_text_ecmascript_jsx.j3.jsx"; +import { loaded as loadedJsx4 } from "http://localhost:4545/subdir/mt_application_x_javascript_jsx.j4.jsx"; + +declare global { + namespace JSX { + interface IntrinsicElements { + // deno-lint-ignore no-explicit-any + [elemName: string]: any; + } + } +} + +console.log( + "success", + loadedTsx1, + loadedTsx2, + loadedTsx3, + loadedTsx4, + loadedJsx1, + loadedJsx2, + loadedJsx3, + loadedJsx4, +); diff --git a/cli/tests/testdata/048_media_types_jsx.ts.out b/cli/tests/testdata/048_media_types_jsx.ts.out new file mode 100644 index 000000000..266cc5741 --- /dev/null +++ b/cli/tests/testdata/048_media_types_jsx.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +success true true true true true true true true diff --git a/cli/tests/testdata/049_info_flag_script_jsx.out b/cli/tests/testdata/049_info_flag_script_jsx.out new file mode 100644 index 000000000..860d127fe --- /dev/null +++ b/cli/tests/testdata/049_info_flag_script_jsx.out @@ -0,0 +1,14 @@ +[WILDCARD] +local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD] +type: TypeScript +dependencies: 8 unique (total [WILDCARD]) + +http://127.0.0.1:4545/048_media_types_jsx.ts ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_ecmascript_jsx.j2.jsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_x_javascript_jsx.j4.jsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_application_x_typescript_tsx.t4.tsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_ecmascript_jsx.j3.jsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_javascript_jsx.j1.jsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_text_typescript_tsx.t1.tsx ([WILDCARD]) +├── http://localhost:4545/subdir/mt_video_mp2t_tsx.t3.tsx ([WILDCARD]) +└── http://localhost:4545/subdir/mt_video_vdn_tsx.t2.tsx ([WILDCARD]) diff --git a/cli/tests/testdata/052_no_remote_flag.out b/cli/tests/testdata/052_no_remote_flag.out new file mode 100644 index 000000000..c1f9f4e13 --- /dev/null +++ b/cli/tests/testdata/052_no_remote_flag.out @@ -0,0 +1 @@ +error: A remote specifier was requested: "http://127.0.0.1:4545/019_media_types.ts", but --no-remote is specified. diff --git a/cli/tests/testdata/053_import_compression.out b/cli/tests/testdata/053_import_compression.out new file mode 100644 index 000000000..371994979 --- /dev/null +++ b/cli/tests/testdata/053_import_compression.out @@ -0,0 +1,4 @@ +gzip +brotli +console.log('gzip') +console.log('brotli'); diff --git a/cli/tests/testdata/053_import_compression/brotli b/cli/tests/testdata/053_import_compression/brotli new file mode 100644 index 000000000..65f679d57 --- /dev/null +++ b/cli/tests/testdata/053_import_compression/brotli @@ -0,0 +1,2 @@ +‹ +€console.log('brotli'); \ No newline at end of file diff --git a/cli/tests/testdata/053_import_compression/gziped b/cli/tests/testdata/053_import_compression/gziped new file mode 100644 index 000000000..9f9a7bc69 Binary files /dev/null and b/cli/tests/testdata/053_import_compression/gziped differ diff --git a/cli/tests/testdata/053_import_compression/main.ts b/cli/tests/testdata/053_import_compression/main.ts new file mode 100644 index 000000000..1ff1b0c83 --- /dev/null +++ b/cli/tests/testdata/053_import_compression/main.ts @@ -0,0 +1,13 @@ +import "http://127.0.0.1:4545/053_import_compression/gziped"; +import "http://127.0.0.1:4545/053_import_compression/brotli"; + +console.log( + await fetch( + "http://127.0.0.1:4545/053_import_compression/gziped", + ).then((res) => res.text()), +); +console.log( + await fetch( + "http://127.0.0.1:4545/053_import_compression/brotli", + ).then((res) => res.text()), +); diff --git a/cli/tests/testdata/054_info_local_imports.out b/cli/tests/testdata/054_info_local_imports.out new file mode 100644 index 000000000..cde5ff3ab --- /dev/null +++ b/cli/tests/testdata/054_info_local_imports.out @@ -0,0 +1,8 @@ +local: [WILDCARD]005_more_imports.ts +type: TypeScript +dependencies: 3 unique (total [WILDCARD]) + +file://[WILDCARD]/005_more_imports.ts ([WILDCARD]) +└─┬ file://[WILDCARD]/subdir/mod1.ts ([WILDCARD]) + └─┬ file://[WILDCARD]/subdir/subdir2/mod2.ts ([WILDCARD]) + └── file://[WILDCARD]/subdir/print_hello.ts ([WILDCARD]) diff --git a/cli/tests/testdata/055_info_file_json.out b/cli/tests/testdata/055_info_file_json.out new file mode 100644 index 000000000..4753ef0ef --- /dev/null +++ b/cli/tests/testdata/055_info_file_json.out @@ -0,0 +1,53 @@ +{ + "root": "file://[WILDCARD]/005_more_imports.ts", + "modules": [ + { + "specifier": "file://[WILDCARD]/005_more_imports.ts", + "dependencies": [ + { + "specifier": "./subdir/mod1.ts", + "code": "file://[WILDCARD]/subdir/mod1.ts" + } + ], + "size": 211, + "mediaType": "TypeScript", + "local": "[WILDCARD]005_more_imports.ts", + [WILDCARD] + }, + { + "specifier": "file://[WILDCARD]/subdir/mod1.ts", + "dependencies": [ + { + "specifier": "./subdir2/mod2.ts", + "code": "file://[WILDCARD]/subdir/subdir2/mod2.ts" + } + ], + "size": 308, + "mediaType": "TypeScript", + "local": "[WILDCARD]mod1.ts", + [WILDCARD] + }, + { + "specifier": "file://[WILDCARD]/subdir/print_hello.ts", + "dependencies": [], + "size": 57, + "mediaType": "TypeScript", + "local": "[WILDCARD]print_hello.ts", + [WILDCARD] + }, + { + "specifier": "file://[WILDCARD]/subdir/subdir2/mod2.ts", + "dependencies": [ + { + "specifier": "../print_hello.ts", + "code": "file://[WILDCARD]/subdir/print_hello.ts" + } + ], + "size": 157, + "mediaType": "TypeScript", + "local": "[WILDCARD]mod2.ts", + [WILDCARD] + } + ], + "size": 733 +} diff --git a/cli/tests/testdata/056_make_temp_file_write_perm.out b/cli/tests/testdata/056_make_temp_file_write_perm.out new file mode 100644 index 000000000..c56aae43f --- /dev/null +++ b/cli/tests/testdata/056_make_temp_file_write_perm.out @@ -0,0 +1 @@ +good [WILDCARD]subdir[WILDCARD] diff --git a/cli/tests/testdata/056_make_temp_file_write_perm.ts b/cli/tests/testdata/056_make_temp_file_write_perm.ts new file mode 100644 index 000000000..c0deda8a2 --- /dev/null +++ b/cli/tests/testdata/056_make_temp_file_write_perm.ts @@ -0,0 +1,9 @@ +const path = await Deno.makeTempFile({ dir: `subdir` }); +try { + if (!path.match(/^subdir[/\\][^/\\]+/)) { + throw Error("bad " + path); + } + console.log("good", path); +} finally { + await Deno.remove(path); +} diff --git a/cli/tests/testdata/058_tasks_microtasks_close.ts b/cli/tests/testdata/058_tasks_microtasks_close.ts new file mode 100644 index 000000000..11de55a38 --- /dev/null +++ b/cli/tests/testdata/058_tasks_microtasks_close.ts @@ -0,0 +1,18 @@ +console.log("sync 1"); +setTimeout(() => { + console.log("setTimeout 1"); + Promise.resolve().then(() => { + console.log("Promise resolve in setTimeout 1"); + }); +}); +Promise.resolve().then(() => { + console.log("promise 1"); +}); +window.close(); +console.log("sync 2"); +setTimeout(() => { + console.log("setTimeout 2"); +}); +setTimeout(() => { + console.log("setTimeout 3"); +}, 100); diff --git a/cli/tests/testdata/058_tasks_microtasks_close.ts.out b/cli/tests/testdata/058_tasks_microtasks_close.ts.out new file mode 100644 index 000000000..218273cab --- /dev/null +++ b/cli/tests/testdata/058_tasks_microtasks_close.ts.out @@ -0,0 +1,6 @@ +sync 1 +sync 2 +promise 1 +setTimeout 1 +Promise resolve in setTimeout 1 +setTimeout 2 diff --git a/cli/tests/testdata/059_fs_relative_path_perm.ts b/cli/tests/testdata/059_fs_relative_path_perm.ts new file mode 100644 index 000000000..26630fe1c --- /dev/null +++ b/cli/tests/testdata/059_fs_relative_path_perm.ts @@ -0,0 +1,2 @@ +// The permission error message shouldn't include the CWD. +Deno.readFileSync("non-existent"); diff --git a/cli/tests/testdata/059_fs_relative_path_perm.ts.out b/cli/tests/testdata/059_fs_relative_path_perm.ts.out new file mode 100644 index 000000000..b55412137 --- /dev/null +++ b/cli/tests/testdata/059_fs_relative_path_perm.ts.out @@ -0,0 +1,4 @@ +[WILDCARD]error: Uncaught PermissionDenied: Requires read access to "non-existent", run again with the --allow-read flag +Deno.readFileSync("non-existent"); + ^ + at [WILDCARD] diff --git a/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts b/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts new file mode 100644 index 000000000..854c1b464 --- /dev/null +++ b/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts @@ -0,0 +1,6 @@ +// deno-lint-ignore-file +export namespace NS { + export function test(name: string, fn: Function): void; + export function test(options: object): void; + export function test(name: string | object, fn?: Function): void {} +} diff --git a/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts.out b/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts.out new file mode 100644 index 000000000..f1a5077d8 --- /dev/null +++ b/cli/tests/testdata/060_deno_doc_displays_all_overloads_in_details_view.ts.out @@ -0,0 +1,12 @@ +Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:3:2 + +function test(name: string, fn: Function): void + +Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:4:2 + +function test(options: object): void + +Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:5:2 + +function test(name: string | object, fn?: Function): void + diff --git a/cli/tests/testdata/061_permissions_request.ts b/cli/tests/testdata/061_permissions_request.ts new file mode 100644 index 000000000..c31e7ac42 --- /dev/null +++ b/cli/tests/testdata/061_permissions_request.ts @@ -0,0 +1,9 @@ +const status1 = + (await Deno.permissions.request({ name: "read", path: "foo" })).state; +const status2 = + (await Deno.permissions.query({ name: "read", path: "bar" })).state; +const status3 = + (await Deno.permissions.request({ name: "read", path: "bar" })).state; +console.log(status1); +console.log(status2); +console.log(status3); diff --git a/cli/tests/testdata/061_permissions_request.ts.out b/cli/tests/testdata/061_permissions_request.ts.out new file mode 100644 index 000000000..362425876 --- /dev/null +++ b/cli/tests/testdata/061_permissions_request.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]granted +prompt +denied diff --git a/cli/tests/testdata/062_permissions_request_global.ts b/cli/tests/testdata/062_permissions_request_global.ts new file mode 100644 index 000000000..e431bc31b --- /dev/null +++ b/cli/tests/testdata/062_permissions_request_global.ts @@ -0,0 +1,6 @@ +const status1 = await Deno.permissions.request({ name: "read" }); +console.log(status1); +const status2 = await Deno.permissions.query({ name: "read", path: "foo" }); +console.log(status2); +const status3 = await Deno.permissions.query({ name: "read", path: "bar" }); +console.log(status3); diff --git a/cli/tests/testdata/062_permissions_request_global.ts.out b/cli/tests/testdata/062_permissions_request_global.ts.out new file mode 100644 index 000000000..57b5aa7d8 --- /dev/null +++ b/cli/tests/testdata/062_permissions_request_global.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]PermissionStatus { state: "granted", onchange: null } +PermissionStatus { state: "granted", onchange: null } +PermissionStatus { state: "granted", onchange: null } diff --git a/cli/tests/testdata/063_permissions_revoke.ts b/cli/tests/testdata/063_permissions_revoke.ts new file mode 100644 index 000000000..a81eee7cb --- /dev/null +++ b/cli/tests/testdata/063_permissions_revoke.ts @@ -0,0 +1,6 @@ +const status1 = await Deno.permissions.revoke({ name: "read", path: "foo" }); +console.log(status1); +const status2 = await Deno.permissions.query({ name: "read", path: "bar" }); +console.log(status2); +const status3 = await Deno.permissions.revoke({ name: "read", path: "bar" }); +console.log(status3); diff --git a/cli/tests/testdata/063_permissions_revoke.ts.out b/cli/tests/testdata/063_permissions_revoke.ts.out new file mode 100644 index 000000000..bbd64c557 --- /dev/null +++ b/cli/tests/testdata/063_permissions_revoke.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]PermissionStatus { state: "prompt", onchange: null } +PermissionStatus { state: "granted", onchange: null } +PermissionStatus { state: "prompt", onchange: null } diff --git a/cli/tests/testdata/064_permissions_revoke_global.ts b/cli/tests/testdata/064_permissions_revoke_global.ts new file mode 100644 index 000000000..a9b1fcd40 --- /dev/null +++ b/cli/tests/testdata/064_permissions_revoke_global.ts @@ -0,0 +1,6 @@ +const status1 = await Deno.permissions.revoke({ name: "read" }); +console.log(status1); +const status2 = await Deno.permissions.query({ name: "read", path: "foo" }); +console.log(status2); +const status3 = await Deno.permissions.query({ name: "read", path: "bar" }); +console.log(status3); diff --git a/cli/tests/testdata/064_permissions_revoke_global.ts.out b/cli/tests/testdata/064_permissions_revoke_global.ts.out new file mode 100644 index 000000000..f7e389a76 --- /dev/null +++ b/cli/tests/testdata/064_permissions_revoke_global.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]PermissionStatus { state: "prompt", onchange: null } +PermissionStatus { state: "prompt", onchange: null } +PermissionStatus { state: "prompt", onchange: null } diff --git a/cli/tests/testdata/065_import_map_info.out b/cli/tests/testdata/065_import_map_info.out new file mode 100644 index 000000000..8771d0594 --- /dev/null +++ b/cli/tests/testdata/065_import_map_info.out @@ -0,0 +1,5 @@ +[WILDCARD] +local: [WILDCARD]test.ts +type: TypeScript +dependencies: 7 unique (total [WILDCARD]) +[WILDCARD] diff --git a/cli/tests/testdata/066_prompt.ts b/cli/tests/testdata/066_prompt.ts new file mode 100644 index 000000000..e3daa7ac0 --- /dev/null +++ b/cli/tests/testdata/066_prompt.ts @@ -0,0 +1,21 @@ +const name0 = prompt("What is your name?", "Jane Doe"); // Answer John Doe +console.log(`Your name is ${name0}.`); +const name1 = prompt("What is your name?", "Jane Doe"); // Answer with default +console.log(`Your name is ${name1}.`); +const input = prompt(); // Answer foo +console.log(`Your input is ${input}.`); +const answer0 = confirm("Question 0"); // Answer y +console.log(`Your answer is ${answer0}`); +const answer1 = confirm("Question 1"); // Answer n +console.log(`Your answer is ${answer1}`); +const answer2 = confirm("Question 2"); // Answer with yes (returns false) +console.log(`Your answer is ${answer2}`); +const answer3 = confirm(); // Answer with default +console.log(`Your answer is ${answer3}`); +const windows = prompt("What is Windows EOL?"); +console.log(`Your answer is ${JSON.stringify(windows)}`); +alert("Hi"); +alert(); +console.log("The end of test"); +const eof = prompt("What is EOF?"); +console.log(`Your answer is ${JSON.stringify(eof)}`); diff --git a/cli/tests/testdata/066_prompt.ts.out b/cli/tests/testdata/066_prompt.ts.out new file mode 100644 index 000000000..7defc51e5 --- /dev/null +++ b/cli/tests/testdata/066_prompt.ts.out @@ -0,0 +1,10 @@ +[WILDCARD]What is your name? [Jane Doe] Your name is John Doe. +What is your name? [Jane Doe] Your name is Jane Doe. +Prompt Your input is foo. +Question 0 [y/N] Your answer is true +Question 1 [y/N] Your answer is false +Question 2 [y/N] Your answer is false +Confirm [y/N] Your answer is false +What is Windows EOL? Your answer is "windows" +Hi [Enter] Alert [Enter] The end of test +What is EOF? Your answer is null diff --git a/cli/tests/testdata/070_location.ts b/cli/tests/testdata/070_location.ts new file mode 100644 index 000000000..61256dcbc --- /dev/null +++ b/cli/tests/testdata/070_location.ts @@ -0,0 +1,8 @@ +console.log(Location); +console.log(Location.prototype); +console.log(location); +try { + location.hostname = "bar"; +} catch (error) { + console.log(error.toString()); +} diff --git a/cli/tests/testdata/070_location.ts.out b/cli/tests/testdata/070_location.ts.out new file mode 100644 index 000000000..e05561e58 --- /dev/null +++ b/cli/tests/testdata/070_location.ts.out @@ -0,0 +1,15 @@ +[WILDCARD][Function: Location] +Location {} +Location { + hash: "#bat", + host: "foo", + hostname: "foo", + href: "https://foo/bar?baz#bat", + origin: "https://foo", + pathname: "/bar", + port: "", + protocol: "https:", + search: "?baz" +} +NotSupportedError: Cannot set "location.hostname". +[WILDCARD] diff --git a/cli/tests/testdata/071_location_unset.ts b/cli/tests/testdata/071_location_unset.ts new file mode 100644 index 000000000..bb60df8c4 --- /dev/null +++ b/cli/tests/testdata/071_location_unset.ts @@ -0,0 +1,3 @@ +console.log(Location); +console.log(Location.prototype); +console.log(location); diff --git a/cli/tests/testdata/071_location_unset.ts.out b/cli/tests/testdata/071_location_unset.ts.out new file mode 100644 index 000000000..43308f3bd --- /dev/null +++ b/cli/tests/testdata/071_location_unset.ts.out @@ -0,0 +1,4 @@ +[WILDCARD][Function: Location] +Location {} +error: Uncaught ReferenceError: Access to "location", run again with --location . +[WILDCARD] diff --git a/cli/tests/testdata/072_location_relative_fetch.ts b/cli/tests/testdata/072_location_relative_fetch.ts new file mode 100644 index 000000000..d4764bf7f --- /dev/null +++ b/cli/tests/testdata/072_location_relative_fetch.ts @@ -0,0 +1,2 @@ +const response = await fetch("fetch/hello.txt"); +console.log(await response.text()); diff --git a/cli/tests/testdata/072_location_relative_fetch.ts.out b/cli/tests/testdata/072_location_relative_fetch.ts.out new file mode 100644 index 000000000..8151f6f88 --- /dev/null +++ b/cli/tests/testdata/072_location_relative_fetch.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]Hello, world! + diff --git a/cli/tests/testdata/075_import_local_query_hash.ts b/cli/tests/testdata/075_import_local_query_hash.ts new file mode 100644 index 000000000..99c7ceab4 --- /dev/null +++ b/cli/tests/testdata/075_import_local_query_hash.ts @@ -0,0 +1,2 @@ +import "./001_hello.js?a=b#c"; +import "./002_hello.ts?a=b#c"; diff --git a/cli/tests/testdata/075_import_local_query_hash.ts.out b/cli/tests/testdata/075_import_local_query_hash.ts.out new file mode 100644 index 000000000..340777742 --- /dev/null +++ b/cli/tests/testdata/075_import_local_query_hash.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]Hello World +Hello World diff --git a/cli/tests/testdata/076_info_json_deps_order.out b/cli/tests/testdata/076_info_json_deps_order.out new file mode 100644 index 000000000..bcb2c70ed --- /dev/null +++ b/cli/tests/testdata/076_info_json_deps_order.out @@ -0,0 +1,78 @@ +{ + "root": "file://[WILDCARD]/076_info_json_deps_order.ts", + "modules": [ + { + "specifier": "file://[WILDCARD]/076_info_json_deps_order.ts", + "dependencies": [ + { + "specifier": "./recursive_imports/A.ts", + "code": "file://[WILDCARD]/recursive_imports/A.ts" + } + ], + "size": 81, + "mediaType": "TypeScript", + "local": "[WILDCARD]076_info_json_deps_order.ts", + "checksum": "5dd40fe33e5924cca513489ce568e86c9b9fe318a87975403c8923629018680d" + }, + { + "specifier": "file://[WILDCARD]/recursive_imports/A.ts", + "dependencies": [ + { + "specifier": "./B.ts", + "code": "file://[WILDCARD]/recursive_imports/B.ts" + }, + { + "specifier": "./common.ts", + "code": "file://[WILDCARD]/recursive_imports/common.ts" + } + ], + "size": 108, + "mediaType": "TypeScript", + "local": "[WILDCARD]A.ts", + "checksum": "3b45a105d892584298490cb73372b2cac57118e1e42a677a1d5cacea704d8d3a" + }, + { + "specifier": "file://[WILDCARD]/recursive_imports/B.ts", + "dependencies": [ + { + "specifier": "./C.ts", + "code": "file://[WILDCARD]/recursive_imports/C.ts" + }, + { + "specifier": "./common.ts", + "code": "file://[WILDCARD]/recursive_imports/common.ts" + } + ], + "size": 108, + "mediaType": "TypeScript", + "local": "[WILDCARD]B.ts", + "checksum": "b12b0437ef9a91c4a4b1f66e8e4339f986b60bd8134031ccb296ce49df15b54e" + }, + { + "specifier": "file://[WILDCARD]/recursive_imports/C.ts", + "dependencies": [ + { + "specifier": "./A.ts", + "code": "file://[WILDCARD]/recursive_imports/A.ts" + }, + { + "specifier": "./common.ts", + "code": "file://[WILDCARD]/recursive_imports/common.ts" + } + ], + "size": 126, + "mediaType": "TypeScript", + "local": "[WILDCARD]C.ts", + "checksum": "605875a410741bfaeeade28cbccf45f219ad99d987ea695e35eda75d2c53a658" + }, + { + "specifier": "file://[WILDCARD]/recursive_imports/common.ts", + "dependencies": [], + "size": 28, + "mediaType": "TypeScript", + "local": "[WILDCARD]common.ts", + "checksum": "c70025f0b936c02980c3be1fbd78f6f36b6241927c44ea67580821a6e664d8b3" + } + ], + "size": 451 +} diff --git a/cli/tests/testdata/076_info_json_deps_order.ts b/cli/tests/testdata/076_info_json_deps_order.ts new file mode 100644 index 000000000..b1ae75e68 --- /dev/null +++ b/cli/tests/testdata/076_info_json_deps_order.ts @@ -0,0 +1,2 @@ +// deno-lint-ignore no-unused-vars +import { A } from "./recursive_imports/A.ts"; diff --git a/cli/tests/testdata/077_fetch_empty.ts b/cli/tests/testdata/077_fetch_empty.ts new file mode 100644 index 000000000..b10a9094e --- /dev/null +++ b/cli/tests/testdata/077_fetch_empty.ts @@ -0,0 +1 @@ +await fetch(""); diff --git a/cli/tests/testdata/077_fetch_empty.ts.out b/cli/tests/testdata/077_fetch_empty.ts.out new file mode 100644 index 000000000..e546cfcec --- /dev/null +++ b/cli/tests/testdata/077_fetch_empty.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Uncaught TypeError: Invalid URL +[WILDCARD] diff --git a/cli/tests/testdata/078_unload_on_exit.ts b/cli/tests/testdata/078_unload_on_exit.ts new file mode 100644 index 000000000..43d33eb25 --- /dev/null +++ b/cli/tests/testdata/078_unload_on_exit.ts @@ -0,0 +1,9 @@ +window.onunload = () => { + console.log("onunload is called"); + // This second exit call doesn't trigger unload event, + // and therefore actually stops the process. + Deno.exit(1); + console.log("This doesn't show up in console"); +}; +// This exit call triggers the above unload event handler. +Deno.exit(0); diff --git a/cli/tests/testdata/078_unload_on_exit.ts.out b/cli/tests/testdata/078_unload_on_exit.ts.out new file mode 100644 index 000000000..e213f9632 --- /dev/null +++ b/cli/tests/testdata/078_unload_on_exit.ts.out @@ -0,0 +1 @@ +[WILDCARD]onunload is called diff --git a/cli/tests/testdata/079_location_authentication.ts b/cli/tests/testdata/079_location_authentication.ts new file mode 100644 index 000000000..4989312ac --- /dev/null +++ b/cli/tests/testdata/079_location_authentication.ts @@ -0,0 +1 @@ +console.log(location.href); diff --git a/cli/tests/testdata/079_location_authentication.ts.out b/cli/tests/testdata/079_location_authentication.ts.out new file mode 100644 index 000000000..bb2458497 --- /dev/null +++ b/cli/tests/testdata/079_location_authentication.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +https://baz/qux +[WILDCARD] diff --git a/cli/tests/testdata/080_deno_emit_permissions.ts b/cli/tests/testdata/080_deno_emit_permissions.ts new file mode 100644 index 000000000..dc550cffb --- /dev/null +++ b/cli/tests/testdata/080_deno_emit_permissions.ts @@ -0,0 +1 @@ +await Deno.emit(new URL("001_hello.js", import.meta.url).href); diff --git a/cli/tests/testdata/080_deno_emit_permissions.ts.out b/cli/tests/testdata/080_deno_emit_permissions.ts.out new file mode 100644 index 000000000..4eb4fd1c1 --- /dev/null +++ b/cli/tests/testdata/080_deno_emit_permissions.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Uncaught (in promise) PermissionDenied: Requires read access to "[WILDCARD]001_hello.js", run again with the --allow-read flag +[WILDCARD] diff --git a/cli/tests/testdata/081_location_relative_fetch_redirect.ts b/cli/tests/testdata/081_location_relative_fetch_redirect.ts new file mode 100644 index 000000000..742ef0afb --- /dev/null +++ b/cli/tests/testdata/081_location_relative_fetch_redirect.ts @@ -0,0 +1,2 @@ +const response = await fetch("/"); +console.log(response.url); diff --git a/cli/tests/testdata/081_location_relative_fetch_redirect.ts.out b/cli/tests/testdata/081_location_relative_fetch_redirect.ts.out new file mode 100644 index 000000000..f62b93195 --- /dev/null +++ b/cli/tests/testdata/081_location_relative_fetch_redirect.ts.out @@ -0,0 +1 @@ +[WILDCARD]http://localhost:4545/ diff --git a/cli/tests/testdata/082_prepare_stack_trace_throw.js b/cli/tests/testdata/082_prepare_stack_trace_throw.js new file mode 100644 index 000000000..8137bfdc8 --- /dev/null +++ b/cli/tests/testdata/082_prepare_stack_trace_throw.js @@ -0,0 +1,6 @@ +Error.prepareStackTrace = () => { + console.trace(); + throw new Error("foo"); +}; + +new Error("bar").stack; diff --git a/cli/tests/testdata/082_prepare_stack_trace_throw.js.out b/cli/tests/testdata/082_prepare_stack_trace_throw.js.out new file mode 100644 index 000000000..751b7c971 --- /dev/null +++ b/cli/tests/testdata/082_prepare_stack_trace_throw.js.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Uncaught Error: foo +[WILDCARD] diff --git a/cli/tests/testdata/083_legacy_external_source_map.ts b/cli/tests/testdata/083_legacy_external_source_map.ts new file mode 100644 index 000000000..73d267b87 --- /dev/null +++ b/cli/tests/testdata/083_legacy_external_source_map.ts @@ -0,0 +1,2 @@ +// - +throw new Error("foo"); diff --git a/cli/tests/testdata/084_worker_custom_inspect.ts b/cli/tests/testdata/084_worker_custom_inspect.ts new file mode 100644 index 000000000..2e7b86a4e --- /dev/null +++ b/cli/tests/testdata/084_worker_custom_inspect.ts @@ -0,0 +1,4 @@ +new Worker( + new URL("084_worker_custom_inspect_worker.ts", import.meta.url).href, + { type: "module" }, +); diff --git a/cli/tests/testdata/084_worker_custom_inspect.ts.out b/cli/tests/testdata/084_worker_custom_inspect.ts.out new file mode 100644 index 000000000..b34300c40 --- /dev/null +++ b/cli/tests/testdata/084_worker_custom_inspect.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]ReadableStream { locked: false } +[WILDCARD] diff --git a/cli/tests/testdata/084_worker_custom_inspect_worker.ts b/cli/tests/testdata/084_worker_custom_inspect_worker.ts new file mode 100644 index 000000000..5be82724e --- /dev/null +++ b/cli/tests/testdata/084_worker_custom_inspect_worker.ts @@ -0,0 +1,2 @@ +console.log(new ReadableStream()); +close(); diff --git a/cli/tests/testdata/085_dynamic_import_async_error.ts b/cli/tests/testdata/085_dynamic_import_async_error.ts new file mode 100644 index 000000000..aa5ff7277 --- /dev/null +++ b/cli/tests/testdata/085_dynamic_import_async_error.ts @@ -0,0 +1,5 @@ +try { + await import("./delayed_error.ts"); +} catch (error) { + console.log(`Caught: ${error.stack}`); +} diff --git a/cli/tests/testdata/085_dynamic_import_async_error.ts.out b/cli/tests/testdata/085_dynamic_import_async_error.ts.out new file mode 100644 index 000000000..974c2e426 --- /dev/null +++ b/cli/tests/testdata/085_dynamic_import_async_error.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]Caught: Error: foo + at [WILDCARD]/delayed_error.ts:[WILDCARD] diff --git a/cli/tests/testdata/086_dynamic_import_already_rejected.ts b/cli/tests/testdata/086_dynamic_import_already_rejected.ts new file mode 100644 index 000000000..359db670c --- /dev/null +++ b/cli/tests/testdata/086_dynamic_import_already_rejected.ts @@ -0,0 +1,11 @@ +try { + await import("./error_001.ts"); +} catch (error) { + console.log(`Caught: ${error.stack}`); +} + +try { + await import("./error_001.ts"); +} catch (error) { + console.log(`Caught: ${error.stack}`); +} diff --git a/cli/tests/testdata/086_dynamic_import_already_rejected.ts.out b/cli/tests/testdata/086_dynamic_import_already_rejected.ts.out new file mode 100644 index 000000000..c3eb66f9e --- /dev/null +++ b/cli/tests/testdata/086_dynamic_import_already_rejected.ts.out @@ -0,0 +1,4 @@ +[WILDCARD]Caught: Error: bad + at [WILDCARD]/error_001.ts:[WILDCARD] +Caught: Error: bad + at [WILDCARD]/error_001.ts:[WILDCARD] diff --git a/cli/tests/testdata/087_hello.ts b/cli/tests/testdata/087_hello.ts new file mode 100644 index 000000000..1a9d8f114 --- /dev/null +++ b/cli/tests/testdata/087_hello.ts @@ -0,0 +1,2 @@ +export type SomeType = unknown; +console.log("Hello, world!"); diff --git a/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts b/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts new file mode 100644 index 000000000..64a13f9b1 --- /dev/null +++ b/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts @@ -0,0 +1,4 @@ +import { SomeType } from "./087_hello.ts"; + +const string: SomeType = "Hi!"; +console.log(string); diff --git a/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts.out b/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts.out new file mode 100644 index 000000000..f744c4183 --- /dev/null +++ b/cli/tests/testdata/087_no_check_imports_not_used_as_values.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]Hello, world! +Hi! diff --git a/cli/tests/testdata/088_dynamic_import_already_evaluating.ts b/cli/tests/testdata/088_dynamic_import_already_evaluating.ts new file mode 100644 index 000000000..272163a5d --- /dev/null +++ b/cli/tests/testdata/088_dynamic_import_already_evaluating.ts @@ -0,0 +1,2 @@ +import("./088_dynamic_import_target.ts").then(() => console.log(3)); +import("./088_dynamic_import_target.ts").then(() => console.log(3)); diff --git a/cli/tests/testdata/088_dynamic_import_already_evaluating.ts.out b/cli/tests/testdata/088_dynamic_import_already_evaluating.ts.out new file mode 100644 index 000000000..a36dd11e7 --- /dev/null +++ b/cli/tests/testdata/088_dynamic_import_already_evaluating.ts.out @@ -0,0 +1,4 @@ +[WILDCARD]1 +2 +3 +3 diff --git a/cli/tests/testdata/088_dynamic_import_target.ts b/cli/tests/testdata/088_dynamic_import_target.ts new file mode 100644 index 000000000..226f1851a --- /dev/null +++ b/cli/tests/testdata/088_dynamic_import_target.ts @@ -0,0 +1,3 @@ +console.log(1); +await new Promise((r) => setTimeout(r, 100)); +console.log(2); diff --git a/cli/tests/testdata/089_run_allow_list.ts b/cli/tests/testdata/089_run_allow_list.ts new file mode 100644 index 000000000..defb3196f --- /dev/null +++ b/cli/tests/testdata/089_run_allow_list.ts @@ -0,0 +1,13 @@ +try { + Deno.run({ + cmd: ["ls"], + }); +} catch (e) { + console.log(e); +} + +const proc = Deno.run({ + cmd: ["curl", "--help"], + stdout: "null", +}); +console.log((await proc.status()).success); diff --git a/cli/tests/testdata/089_run_allow_list.ts.out b/cli/tests/testdata/089_run_allow_list.ts.out new file mode 100644 index 000000000..68a4a2ac5 --- /dev/null +++ b/cli/tests/testdata/089_run_allow_list.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]PermissionDenied: Requires run access to "ls", run again with the --allow-run flag +[WILDCARD] +true diff --git a/cli/tests/testdata/090_run_permissions_request.ts b/cli/tests/testdata/090_run_permissions_request.ts new file mode 100644 index 000000000..044bc6e8e --- /dev/null +++ b/cli/tests/testdata/090_run_permissions_request.ts @@ -0,0 +1,9 @@ +const status1 = + (await Deno.permissions.request({ name: "run", command: "ls" })).state; +const status2 = + (await Deno.permissions.query({ name: "run", command: "cat" })).state; +const status3 = + (await Deno.permissions.request({ name: "run", command: "cat" })).state; +console.log(status1); +console.log(status2); +console.log(status3); diff --git a/cli/tests/testdata/090_run_permissions_request.ts.out b/cli/tests/testdata/090_run_permissions_request.ts.out new file mode 100644 index 000000000..362425876 --- /dev/null +++ b/cli/tests/testdata/090_run_permissions_request.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]granted +prompt +denied diff --git a/cli/tests/testdata/091_use_define_for_class_fields.ts b/cli/tests/testdata/091_use_define_for_class_fields.ts new file mode 100644 index 000000000..46be3ac0b --- /dev/null +++ b/cli/tests/testdata/091_use_define_for_class_fields.ts @@ -0,0 +1,4 @@ +class _A { + b = this.a; + constructor(public a: unknown) {} +} diff --git a/cli/tests/testdata/091_use_define_for_class_fields.ts.out b/cli/tests/testdata/091_use_define_for_class_fields.ts.out new file mode 100644 index 000000000..08f94a967 --- /dev/null +++ b/cli/tests/testdata/091_use_define_for_class_fields.ts.out @@ -0,0 +1,4 @@ +[WILDCARD]error: TS2729 [ERROR]: Property 'a' is used before its initialization. + b = this.a; + ^ +[WILDCARD] diff --git a/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts b/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts new file mode 100644 index 000000000..87684430d --- /dev/null +++ b/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts @@ -0,0 +1 @@ +await import("unmapped"); diff --git a/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts.out b/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts.out new file mode 100644 index 000000000..1a55e352b --- /dev/null +++ b/cli/tests/testdata/092_import_map_unmapped_bare_specifier.ts.out @@ -0,0 +1,4 @@ +[WILDCARD]error: Uncaught (in promise) TypeError: Relative import path "unmapped" not prefixed with / or ./ or ../ and not in import map from "[WILDCARD]" +await import("unmapped"); +^ + at [WILDCARD] diff --git a/cli/tests/testdata/095_cache_with_bare_import.ts b/cli/tests/testdata/095_cache_with_bare_import.ts new file mode 100644 index 000000000..c0748305d --- /dev/null +++ b/cli/tests/testdata/095_cache_with_bare_import.ts @@ -0,0 +1 @@ +import "foo"; diff --git a/cli/tests/testdata/095_cache_with_bare_import.ts.out b/cli/tests/testdata/095_cache_with_bare_import.ts.out new file mode 100644 index 000000000..f424f4c3e --- /dev/null +++ b/cli/tests/testdata/095_cache_with_bare_import.ts.out @@ -0,0 +1 @@ +[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ from "file:///[WILDCARD]/095_cache_with_bare_import.ts" diff --git a/cli/tests/testdata/Component.tsx b/cli/tests/testdata/Component.tsx new file mode 100644 index 000000000..81dfd6957 --- /dev/null +++ b/cli/tests/testdata/Component.tsx @@ -0,0 +1 @@ +import "./046_jsx_test.tsx"; diff --git a/cli/tests/testdata/DenoWinRunner.cs b/cli/tests/testdata/DenoWinRunner.cs new file mode 100644 index 000000000..2f9e9f89f --- /dev/null +++ b/cli/tests/testdata/DenoWinRunner.cs @@ -0,0 +1,127 @@ +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +[Flags] +public enum DenoConstraints : int +{ + None = 0, + NoStdin = 1, + NoStdout = 2, + NoStderr = 4 +} + +public class DenoWinRunner +{ + private const int STD_INPUT_HANDLE = -10; + private const int STD_OUTPUT_HANDLE = -11; + private const int STD_ERROR_HANDLE = -12; + + private const int FILE_NOT_FOUND = 2; + private const int WAIT_TIMEOUT = 258; + + [DllImport("kernel32.dll")] + private static extern void SetStdHandle(int nStdHandle, IntPtr handle); + + /// + /// Runs Deno.exe under the specified constraints + /// + /// Path to the Deno.exe file. Can be absolute or relative + /// Path to the script file Deno should run. + /// The constraints to apply to the Deno process + /// How long to wait for the Deno process to exit + /// The deno.exe exit code, or an exit code provided by the test runner + public static int RunDenoScript(string pathToDenoExe, string pathToTestScript, DenoConstraints constraints, uint timeoutMilliseconds = 1000) + { + try + { + if (!File.Exists(pathToDenoExe)) + { + Console.Error.WriteLine("Cannot find Deno.exe at " + pathToDenoExe); + return FILE_NOT_FOUND; + } + + if (!File.Exists(pathToTestScript)) + { + Console.Error.WriteLine("Cannot find test script at " + pathToTestScript); + return FILE_NOT_FOUND; + } + + ProcessStartInfo startInfo = new ProcessStartInfo(pathToDenoExe) + { + ErrorDialog = false, + UseShellExecute = false, + Arguments = @"run -A " + pathToTestScript, + RedirectStandardInput = !constraints.HasFlag(DenoConstraints.NoStdin), + RedirectStandardOutput = !constraints.HasFlag(DenoConstraints.NoStdout), + RedirectStandardError = !constraints.HasFlag(DenoConstraints.NoStderr) + }; + + startInfo.Environment.Add("RUST_BACKTRACE", "1"); + + if (constraints.HasFlag(DenoConstraints.NoStdin)) + { + SetStdHandle(STD_INPUT_HANDLE, (IntPtr)null); + } + + if (constraints.HasFlag(DenoConstraints.NoStdout)) + { + SetStdHandle(STD_OUTPUT_HANDLE, (IntPtr)null); + } + + if (constraints.HasFlag(DenoConstraints.NoStderr)) + { + SetStdHandle(STD_ERROR_HANDLE, (IntPtr)null); + } + + Process process = new Process { StartInfo = startInfo }; + process.Start(); + + Task stdErrTask = startInfo.RedirectStandardError ? + process.StandardError.ReadToEndAsync() : Task.FromResult(null); + Task stdOutTask = startInfo.RedirectStandardOutput ? + process.StandardOutput.ReadToEndAsync() : Task.FromResult(null); + + if (!process.WaitForExit((int)timeoutMilliseconds)) + { + Console.Error.WriteLine("Timed out waiting for Deno process to exit"); + try + { + process.Kill(); + } + catch + { + // Kill might fail, either because the process already exited or due to some other error + Console.Error.WriteLine("Failure killing the Deno process - possible Zombie Deno.exe process"); + } + return WAIT_TIMEOUT; + } + + // If the Deno process wrote to STDERR - append it to our STDERR + if (!constraints.HasFlag(DenoConstraints.NoStderr)) + { + string error = stdErrTask.Result; + if (!string.IsNullOrWhiteSpace(error)) + { + Console.Error.WriteLine(error); + } + } + + return process.ExitCode; + + } + catch (Win32Exception ex) + { + Console.Error.WriteLine("Win32Exception: code = " + ex.ErrorCode + ", message: " + ex.Message); + return ex.NativeErrorCode; + } + catch (Exception ex) + { + Console.Error.WriteLine("Exception: message: " + ex.Message); + return -1; + } + } +} diff --git a/cli/tests/testdata/DenoWinRunner.ps1 b/cli/tests/testdata/DenoWinRunner.ps1 new file mode 100644 index 000000000..203b5d36c --- /dev/null +++ b/cli/tests/testdata/DenoWinRunner.ps1 @@ -0,0 +1,10 @@ +$Source = [IO.File]::ReadAllText("$PSScriptRoot\DenoWinRunner.cs") +$denoExePath = $args[0] +$scriptPath = $args[1] +$constraints = $args[2] +$timeout = 5000; +Add-Type -TypeDefinition $Source -Language CSharp +Write-Output("Running Deno script: " + $args[1]) +$code = [DenoWinRunner]::RunDenoScript($denoExePath, $scriptPath, $constraints, $timeout) +Write-Output("Deno.exe or the test wrapper has exited with code: $code") +exit $code diff --git a/cli/tests/testdata/async_error.ts b/cli/tests/testdata/async_error.ts new file mode 100644 index 000000000..b55c73aeb --- /dev/null +++ b/cli/tests/testdata/async_error.ts @@ -0,0 +1,9 @@ +console.log("hello"); +// deno-lint-ignore require-await +const foo = async (): Promise => { + console.log("before error"); + throw Error("error"); +}; + +foo(); +console.log("world"); diff --git a/cli/tests/testdata/async_error.ts.out b/cli/tests/testdata/async_error.ts.out new file mode 100644 index 000000000..b424f9072 --- /dev/null +++ b/cli/tests/testdata/async_error.ts.out @@ -0,0 +1,8 @@ +[WILDCARD]hello +before error +world +error: Uncaught (in promise) Error: error + throw Error("error"); + ^ + at foo ([WILDCARD]/async_error.ts:5:9) + at [WILDCARD]/async_error.ts:8:1 diff --git a/cli/tests/testdata/badly_formatted.json b/cli/tests/testdata/badly_formatted.json new file mode 100644 index 000000000..f2bacf73d --- /dev/null +++ b/cli/tests/testdata/badly_formatted.json @@ -0,0 +1,12 @@ +{ + + + "key1": "value1", + "key2": true, + "key3": ["value2", "value3", false], + "keys": { + "more": "values" + } + + +} \ No newline at end of file diff --git a/cli/tests/testdata/badly_formatted.md b/cli/tests/testdata/badly_formatted.md new file mode 100644 index 000000000..26afe483b --- /dev/null +++ b/cli/tests/testdata/badly_formatted.md @@ -0,0 +1,46 @@ +# Hello Markdown + +```js +console.log("Hello World" + +) +``` + +```javascript +console.log("Hello World2" + +) +``` + +```ts + +function hello(name: string ) { + console.log(name); +}; + +hello( "alice"); +``` + +```typescript +function foo(): number { + return 2; +} +``` + +```jsonc + +{ + // Comment in JSON + "key": "value", + "key2": + "value2", +} + +``` + +```json +{ + "numbers": + ["1", "2"] +} +``` \ No newline at end of file diff --git a/cli/tests/testdata/badly_formatted.mjs b/cli/tests/testdata/badly_formatted.mjs new file mode 100644 index 000000000..bc515a330 --- /dev/null +++ b/cli/tests/testdata/badly_formatted.mjs @@ -0,0 +1,4 @@ +// Deliberately using .mjs to avoid triggering dprint +console.log("Hello World" + +) diff --git a/cli/tests/testdata/badly_formatted_fixed.js b/cli/tests/testdata/badly_formatted_fixed.js new file mode 100644 index 000000000..e9062ba85 --- /dev/null +++ b/cli/tests/testdata/badly_formatted_fixed.js @@ -0,0 +1,2 @@ +// Deliberately using .mjs to avoid triggering dprint +console.log("Hello World"); diff --git a/cli/tests/testdata/badly_formatted_fixed.json b/cli/tests/testdata/badly_formatted_fixed.json new file mode 100644 index 000000000..0d697a2c6 --- /dev/null +++ b/cli/tests/testdata/badly_formatted_fixed.json @@ -0,0 +1,8 @@ +{ + "key1": "value1", + "key2": true, + "key3": ["value2", "value3", false], + "keys": { + "more": "values" + } +} diff --git a/cli/tests/testdata/badly_formatted_fixed.md b/cli/tests/testdata/badly_formatted_fixed.md new file mode 100644 index 000000000..8ba74cac3 --- /dev/null +++ b/cli/tests/testdata/badly_formatted_fixed.md @@ -0,0 +1,37 @@ +# Hello Markdown + +```js +console.log("Hello World"); +``` + +```javascript +console.log("Hello World2"); +``` + +```ts +function hello(name: string) { + console.log(name); +} + +hello("alice"); +``` + +```typescript +function foo(): number { + return 2; +} +``` + +```jsonc +{ + // Comment in JSON + "key": "value", + "key2": "value2" +} +``` + +```json +{ + "numbers": ["1", "2"] +} +``` diff --git a/cli/tests/testdata/blob_gc_finalization.js b/cli/tests/testdata/blob_gc_finalization.js new file mode 100644 index 000000000..34c878513 --- /dev/null +++ b/cli/tests/testdata/blob_gc_finalization.js @@ -0,0 +1,11 @@ +// This test creates 1024 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 < 1024; i++) { + // Create a 128MB byte array, and then a blob from it. + const buf = new Uint8Array(128 * 1024 * 1024); + new Blob([buf]); + // It is very important that there is a yield here, otherwise the finalizer + // for the blob is not called and the memory is not freed. + await new Promise((resolve) => setTimeout(resolve, 0)); +} +console.log("GCed all blobs"); diff --git a/cli/tests/testdata/blob_gc_finalization.js.out b/cli/tests/testdata/blob_gc_finalization.js.out new file mode 100644 index 000000000..dcc4500f8 --- /dev/null +++ b/cli/tests/testdata/blob_gc_finalization.js.out @@ -0,0 +1 @@ +GCed all blobs diff --git a/cli/tests/testdata/bundle.test.out b/cli/tests/testdata/bundle.test.out new file mode 100644 index 000000000..030c09295 --- /dev/null +++ b/cli/tests/testdata/bundle.test.out @@ -0,0 +1,27 @@ +[WILDCARD] +function printHello() { + console.log("Hello"); +} +function returnsFoo() { + return "Foo"; +} +function printHello2() { + printHello(); +} +function returnsHi1() { + return "Hi"; +} +function returnsFoo21() { + return returnsFoo(); +} +function printHello31() { + printHello2(); +} +function throwsError1() { + throw Error("exception from mod1"); +} +export { returnsHi1 as returnsHi }; +export { returnsFoo21 as returnsFoo2 }; +export { printHello31 as printHello3 }; +export { throwsError1 as throwsError }; + diff --git a/cli/tests/testdata/bundle/file_tests-fixture01.ts b/cli/tests/testdata/bundle/file_tests-fixture01.ts new file mode 100644 index 000000000..3598d0298 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture01.ts @@ -0,0 +1,3 @@ +import * as a from "./subdir/a.ts"; + +console.log(a); diff --git a/cli/tests/testdata/bundle/file_tests-fixture02.ts b/cli/tests/testdata/bundle/file_tests-fixture02.ts new file mode 100644 index 000000000..0cd291329 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture02.ts @@ -0,0 +1,4 @@ +import * as b from "./subdir/b.ts"; + +console.log(b.b); // "b" +console.log(b.c); // { c: "c", default: class C } diff --git a/cli/tests/testdata/bundle/file_tests-fixture03.ts b/cli/tests/testdata/bundle/file_tests-fixture03.ts new file mode 100644 index 000000000..78365ce13 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture03.ts @@ -0,0 +1,3 @@ +import { d } from "./subdir/d.ts"; + +console.log(d); diff --git a/cli/tests/testdata/bundle/file_tests-fixture04.ts b/cli/tests/testdata/bundle/file_tests-fixture04.ts new file mode 100644 index 000000000..590f4fef9 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture04.ts @@ -0,0 +1,3 @@ +const a = await import("./subdir/a.ts"); + +console.log(a); diff --git a/cli/tests/testdata/bundle/file_tests-fixture05.ts b/cli/tests/testdata/bundle/file_tests-fixture05.ts new file mode 100644 index 000000000..19541ce59 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture05.ts @@ -0,0 +1,3 @@ +import { a } from "./subdir/e.ts"; + +console.log(a); diff --git a/cli/tests/testdata/bundle/file_tests-fixture06.ts b/cli/tests/testdata/bundle/file_tests-fixture06.ts new file mode 100644 index 000000000..3d94332df --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture06.ts @@ -0,0 +1,4 @@ +import { isMain, modUrl } from "./subdir/f.ts"; + +console.log(isMain, modUrl); +console.log(import.meta.main, import.meta.url); diff --git a/cli/tests/testdata/bundle/file_tests-fixture07.ts b/cli/tests/testdata/bundle/file_tests-fixture07.ts new file mode 100644 index 000000000..0475a6c53 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture07.ts @@ -0,0 +1,4 @@ +import { G } from "./subdir/g.ts"; +import { H } from "./subdir/h.ts"; + +console.log(new G(true), new H(true)); diff --git a/cli/tests/testdata/bundle/file_tests-fixture08.ts b/cli/tests/testdata/bundle/file_tests-fixture08.ts new file mode 100644 index 000000000..6af5d172e --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture08.ts @@ -0,0 +1 @@ +export * as a from "./subdir/a.ts"; diff --git a/cli/tests/testdata/bundle/file_tests-fixture09.ts b/cli/tests/testdata/bundle/file_tests-fixture09.ts new file mode 100644 index 000000000..30ba983ee --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture09.ts @@ -0,0 +1 @@ +export { a } from "./subdir/k.ts"; diff --git a/cli/tests/testdata/bundle/file_tests-fixture10.ts b/cli/tests/testdata/bundle/file_tests-fixture10.ts new file mode 100644 index 000000000..bec555da8 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture10.ts @@ -0,0 +1,7 @@ +import { a as defaultA } from "./subdir/l.ts"; + +const o: { a?: string } = {}; + +const { a = defaultA } = o; + +console.log(a); diff --git a/cli/tests/testdata/bundle/file_tests-fixture11.ts b/cli/tests/testdata/bundle/file_tests-fixture11.ts new file mode 100644 index 000000000..1c361438f --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture11.ts @@ -0,0 +1,32 @@ +import { a as defaultA, O } from "./subdir/m.ts"; +export { O } from "./subdir/m.ts"; + +interface AOptions { + a?(); + c?: O; +} + +class A { + #a: () => void; + #c?: O; + constructor(o: AOptions = {}) { + const { + a = defaultA, + c, + } = o; + this.#a = a; + this.#c = c; + } + + a() { + this.#a(); + } + + c() { + console.log(this.#c); + } +} + +const a = new A(); +a.a(); +a.c(); diff --git a/cli/tests/testdata/bundle/file_tests-fixture12.ts b/cli/tests/testdata/bundle/file_tests-fixture12.ts new file mode 100644 index 000000000..32b9566bd --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture12.ts @@ -0,0 +1,7 @@ +import { a } from "./subdir/p.ts"; + +function b() { + a(); +} + +b(); diff --git a/cli/tests/testdata/bundle/file_tests-fixture13.ts b/cli/tests/testdata/bundle/file_tests-fixture13.ts new file mode 100644 index 000000000..7dc13534c --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture13.ts @@ -0,0 +1,11 @@ +import { D, d } from "./subdir/q.ts"; + +class A { + private s: D = d(); + + a() { + this.s.resolve(); + } +} + +new A(); diff --git a/cli/tests/testdata/bundle/file_tests-fixture14.ts b/cli/tests/testdata/bundle/file_tests-fixture14.ts new file mode 100644 index 000000000..aa8eef1b8 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture14.ts @@ -0,0 +1,4 @@ +// @deno-types="https://deno.land/x/lib/mod.d.ts" +import * as lib from "https://deno.land/x/lib/mod.js"; + +console.log(lib); diff --git a/cli/tests/testdata/bundle/file_tests-fixture15.ts b/cli/tests/testdata/bundle/file_tests-fixture15.ts new file mode 100644 index 000000000..c1dd3bc89 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-fixture15.ts @@ -0,0 +1,3 @@ +export function getIndex(c: string): number { + return "\x00\r\n\x85\u2028\u2029".indexOf(c); +} diff --git a/cli/tests/testdata/bundle/file_tests-subdir-a.ts b/cli/tests/testdata/bundle/file_tests-subdir-a.ts new file mode 100644 index 000000000..9233cce2f --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-a.ts @@ -0,0 +1 @@ +export const a = "a"; diff --git a/cli/tests/testdata/bundle/file_tests-subdir-b.ts b/cli/tests/testdata/bundle/file_tests-subdir-b.ts new file mode 100644 index 000000000..1cf751c22 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-b.ts @@ -0,0 +1,3 @@ +export * as c from "./c.ts"; + +export const b = "b"; diff --git a/cli/tests/testdata/bundle/file_tests-subdir-c.ts b/cli/tests/testdata/bundle/file_tests-subdir-c.ts new file mode 100644 index 000000000..7cc01f993 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-c.ts @@ -0,0 +1,2 @@ +export const c = "c"; +export default class C {} diff --git a/cli/tests/testdata/bundle/file_tests-subdir-d.ts b/cli/tests/testdata/bundle/file_tests-subdir-d.ts new file mode 100644 index 000000000..9f1ba7f67 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-d.ts @@ -0,0 +1,3 @@ +import { a } from "./a.ts"; + +export const d = { a }; diff --git a/cli/tests/testdata/bundle/file_tests-subdir-e.ts b/cli/tests/testdata/bundle/file_tests-subdir-e.ts new file mode 100644 index 000000000..55e8e0e18 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-e.ts @@ -0,0 +1 @@ +export * from "./a.ts"; diff --git a/cli/tests/testdata/bundle/file_tests-subdir-f.ts b/cli/tests/testdata/bundle/file_tests-subdir-f.ts new file mode 100644 index 000000000..8bc8d9bf4 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-f.ts @@ -0,0 +1,2 @@ +export const isMain = import.meta.main; +export const modUrl = import.meta.url; diff --git a/cli/tests/testdata/bundle/file_tests-subdir-g.ts b/cli/tests/testdata/bundle/file_tests-subdir-g.ts new file mode 100644 index 000000000..3eb4cd3cc --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-g.ts @@ -0,0 +1,12 @@ +const g: number[] = []; + +export class G { + #g!: number[]; + constructor(shared: boolean) { + if (shared) { + this.#g = g; + } else { + this.#g = []; + } + } +} diff --git a/cli/tests/testdata/bundle/file_tests-subdir-h.ts b/cli/tests/testdata/bundle/file_tests-subdir-h.ts new file mode 100644 index 000000000..9c86dd5c5 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-h.ts @@ -0,0 +1,12 @@ +const g: number[] = []; + +export class H { + #g!: number[]; + constructor(shared: boolean) { + if (shared) { + this.#g = g; + } else { + this.#g = []; + } + } +} diff --git a/cli/tests/testdata/bundle/file_tests-subdir-i.ts b/cli/tests/testdata/bundle/file_tests-subdir-i.ts new file mode 100644 index 000000000..4ad9ce449 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-i.ts @@ -0,0 +1,3 @@ +export function a(...d: string[]): string { + return d.join(" "); +} diff --git a/cli/tests/testdata/bundle/file_tests-subdir-j.ts b/cli/tests/testdata/bundle/file_tests-subdir-j.ts new file mode 100644 index 000000000..ac7bce0ea --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-j.ts @@ -0,0 +1,3 @@ +export function a(...d: string[]): string { + return d.join("/"); +} diff --git a/cli/tests/testdata/bundle/file_tests-subdir-k.ts b/cli/tests/testdata/bundle/file_tests-subdir-k.ts new file mode 100644 index 000000000..1b8a533f1 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-k.ts @@ -0,0 +1,11 @@ +import * as _i from "./i.ts"; +import * as _j from "./j.ts"; + +const k = globalThis.value ? _i : _j; + +export const i = _i; +export const j = _j; + +export const { + a, +} = k; diff --git a/cli/tests/testdata/bundle/file_tests-subdir-l.ts b/cli/tests/testdata/bundle/file_tests-subdir-l.ts new file mode 100644 index 000000000..d767e6ad0 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-l.ts @@ -0,0 +1 @@ +export { a } from "./a.ts"; diff --git a/cli/tests/testdata/bundle/file_tests-subdir-m.ts b/cli/tests/testdata/bundle/file_tests-subdir-m.ts new file mode 100644 index 000000000..21e86d07c --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-m.ts @@ -0,0 +1,2 @@ +export { a } from "./n.ts"; +export { O } from "./o.ts"; diff --git a/cli/tests/testdata/bundle/file_tests-subdir-n.ts b/cli/tests/testdata/bundle/file_tests-subdir-n.ts new file mode 100644 index 000000000..ac3c37005 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-n.ts @@ -0,0 +1,3 @@ +export function a() { + console.log("a"); +} diff --git a/cli/tests/testdata/bundle/file_tests-subdir-o.ts b/cli/tests/testdata/bundle/file_tests-subdir-o.ts new file mode 100644 index 000000000..ab9753fea --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-o.ts @@ -0,0 +1,5 @@ +export enum O { + A, + B, + C, +} diff --git a/cli/tests/testdata/bundle/file_tests-subdir-p.ts b/cli/tests/testdata/bundle/file_tests-subdir-p.ts new file mode 100644 index 000000000..19b486f71 --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-p.ts @@ -0,0 +1 @@ +export * from "./i.ts"; diff --git a/cli/tests/testdata/bundle/file_tests-subdir-q.ts b/cli/tests/testdata/bundle/file_tests-subdir-q.ts new file mode 100644 index 000000000..eebe0a38b --- /dev/null +++ b/cli/tests/testdata/bundle/file_tests-subdir-q.ts @@ -0,0 +1,13 @@ +// deno-lint-ignore-file +export interface D { + resolve: any; + reject: any; +} + +export function d(): D { + let methods; + const promise = new Promise((resolve, reject) => { + methods = { resolve, reject }; + }); + return Object.assign(promise, methods); +} diff --git a/cli/tests/testdata/bundle/fixture01.out b/cli/tests/testdata/bundle/fixture01.out new file mode 100644 index 000000000..a825140b7 --- /dev/null +++ b/cli/tests/testdata/bundle/fixture01.out @@ -0,0 +1,7 @@ +const a = "a"; +const mod = function() { + return { + a: a + }; +}(); +console.log(mod); diff --git a/cli/tests/testdata/bundle/fixture02.out b/cli/tests/testdata/bundle/fixture02.out new file mode 100644 index 000000000..5c502e2f0 --- /dev/null +++ b/cli/tests/testdata/bundle/fixture02.out @@ -0,0 +1,12 @@ +const c = "c"; +class C { +} +const mod = function() { + return { + default: C, + c: c + }; +}(); +const b = "b"; +console.log(b); +console.log(mod); diff --git a/cli/tests/testdata/bundle/fixture03.out b/cli/tests/testdata/bundle/fixture03.out new file mode 100644 index 000000000..524e77abb --- /dev/null +++ b/cli/tests/testdata/bundle/fixture03.out @@ -0,0 +1,5 @@ +const a = "a"; +const d = { + a +}; +console.log(d); diff --git a/cli/tests/testdata/bundle/fixture04.out b/cli/tests/testdata/bundle/fixture04.out new file mode 100644 index 000000000..37869205b --- /dev/null +++ b/cli/tests/testdata/bundle/fixture04.out @@ -0,0 +1,2 @@ +const a = await import("./subdir/a.ts"); +console.log(a); diff --git a/cli/tests/testdata/bundle/fixture05.out b/cli/tests/testdata/bundle/fixture05.out new file mode 100644 index 000000000..1289cca5f --- /dev/null +++ b/cli/tests/testdata/bundle/fixture05.out @@ -0,0 +1,2 @@ +const a = "a"; +console.log(a); diff --git a/cli/tests/testdata/bundle/fixture06.out b/cli/tests/testdata/bundle/fixture06.out new file mode 100644 index 000000000..47288d5e4 --- /dev/null +++ b/cli/tests/testdata/bundle/fixture06.out @@ -0,0 +1,12 @@ +const importMeta = { + url: "file:///tests/subdir/f.ts", + main: false +}; +const isMain = importMeta.main; +const modUrl = importMeta.url; +const importMeta1 = { + url: "file:///tests/fixture06.ts", + main: import.meta.main +}; +console.log(isMain, modUrl); +console.log(importMeta1.main, importMeta1.url); diff --git a/cli/tests/testdata/bundle/fixture07.out b/cli/tests/testdata/bundle/fixture07.out new file mode 100644 index 000000000..39e6a11e8 --- /dev/null +++ b/cli/tests/testdata/bundle/fixture07.out @@ -0,0 +1,23 @@ +const g = []; +class G { + #g; + constructor(shared){ + if (shared) { + this.#g = g; + } else { + this.#g = []; + } + } +} +const g1 = []; +class H { + #g; + constructor(shared1){ + if (shared1) { + this.#g = g1; + } else { + this.#g = []; + } + } +} +console.log(new G(true), new H(true)); diff --git a/cli/tests/testdata/bundle/fixture08.out b/cli/tests/testdata/bundle/fixture08.out new file mode 100644 index 000000000..bfe40aa37 --- /dev/null +++ b/cli/tests/testdata/bundle/fixture08.out @@ -0,0 +1,7 @@ +const a1 = "a"; +const mod = function() { + return { + a: a1 + }; +}(); +export { mod as a }; diff --git a/cli/tests/testdata/bundle/fixture09.out b/cli/tests/testdata/bundle/fixture09.out new file mode 100644 index 000000000..e06cc92de --- /dev/null +++ b/cli/tests/testdata/bundle/fixture09.out @@ -0,0 +1,19 @@ +function a3(...d) { + return d.join(" "); +} +const mod = function() { + return { + a: a3 + }; +}(); +function a1(...d) { + return d.join("/"); +} +const mod1 = function() { + return { + a: a1 + }; +}(); +const k = globalThis.value ? mod : mod1; +const { a: a2 , } = k; +export { a2 as a }; diff --git a/cli/tests/testdata/bundle/fixture10.out b/cli/tests/testdata/bundle/fixture10.out new file mode 100644 index 000000000..5491e5e7f --- /dev/null +++ b/cli/tests/testdata/bundle/fixture10.out @@ -0,0 +1,5 @@ +const a = "a"; +const o = { +}; +const { a: a1 = a } = o; +console.log(a1); diff --git a/cli/tests/testdata/bundle/fixture11.out b/cli/tests/testdata/bundle/fixture11.out new file mode 100644 index 000000000..d143e8723 --- /dev/null +++ b/cli/tests/testdata/bundle/fixture11.out @@ -0,0 +1,30 @@ +function a() { + console.log("a"); +} +var O1; +(function(O1) { + O1[O1["A"] = 0] = "A"; + O1[O1["B"] = 1] = "B"; + O1[O1["C"] = 2] = "C"; +})(O1 || (O1 = { +})); +export { O1 as O }; +class A { + #a; + #c; + constructor(o = { + }){ + const { a: a1 = a , c , } = o; + this.#a = a1; + this.#c = c; + } + a() { + this.#a(); + } + c() { + console.log(this.#c); + } +} +const a2 = new A(); +a2.a(); +a2.c(); diff --git a/cli/tests/testdata/bundle/fixture12.out b/cli/tests/testdata/bundle/fixture12.out new file mode 100644 index 000000000..64e2d6cdb --- /dev/null +++ b/cli/tests/testdata/bundle/fixture12.out @@ -0,0 +1,7 @@ +function a(...d) { + return d.join(" "); +} +function b() { + a(); +} +b(); diff --git a/cli/tests/testdata/bundle/fixture13.out b/cli/tests/testdata/bundle/fixture13.out new file mode 100644 index 000000000..1c7a8c991 --- /dev/null +++ b/cli/tests/testdata/bundle/fixture13.out @@ -0,0 +1,17 @@ +function d() { + let methods; + const promise = new Promise((resolve, reject)=>{ + methods = { + resolve, + reject + }; + }); + return Object.assign(promise, methods); +} +class A { + s = d(); + a() { + this.s.resolve(); + } +} +new A(); diff --git a/cli/tests/testdata/bundle/fixture14.out b/cli/tests/testdata/bundle/fixture14.out new file mode 100644 index 000000000..392bb6478 --- /dev/null +++ b/cli/tests/testdata/bundle/fixture14.out @@ -0,0 +1,2 @@ +const mod = []; +console.log(mod); diff --git a/cli/tests/testdata/bundle/fixture15.out b/cli/tests/testdata/bundle/fixture15.out new file mode 100644 index 000000000..dc72fdeff --- /dev/null +++ b/cli/tests/testdata/bundle/fixture15.out @@ -0,0 +1,4 @@ +function getIndex1(c) { + return "\x00\r\n\x85\u2028\u2029".indexOf(c); +} +export { getIndex1 as getIndex }; diff --git a/cli/tests/testdata/bundle/https_deno.land-x-lib-a.ts b/cli/tests/testdata/bundle/https_deno.land-x-lib-a.ts new file mode 100644 index 000000000..a0a6f8e94 --- /dev/null +++ b/cli/tests/testdata/bundle/https_deno.land-x-lib-a.ts @@ -0,0 +1 @@ +export const a: string[] = []; diff --git a/cli/tests/testdata/bundle/https_deno.land-x-lib-b.js b/cli/tests/testdata/bundle/https_deno.land-x-lib-b.js new file mode 100644 index 000000000..13cacdd8b --- /dev/null +++ b/cli/tests/testdata/bundle/https_deno.land-x-lib-b.js @@ -0,0 +1 @@ +export const b = []; diff --git a/cli/tests/testdata/bundle/https_deno.land-x-lib-c.d.ts b/cli/tests/testdata/bundle/https_deno.land-x-lib-c.d.ts new file mode 100644 index 000000000..fac988e49 --- /dev/null +++ b/cli/tests/testdata/bundle/https_deno.land-x-lib-c.d.ts @@ -0,0 +1 @@ +export const c: string[]; diff --git a/cli/tests/testdata/bundle/https_deno.land-x-lib-c.js b/cli/tests/testdata/bundle/https_deno.land-x-lib-c.js new file mode 100644 index 000000000..620ca0b66 --- /dev/null +++ b/cli/tests/testdata/bundle/https_deno.land-x-lib-c.js @@ -0,0 +1,3 @@ +/// + +export const c = []; diff --git a/cli/tests/testdata/bundle/https_deno.land-x-lib-mod.d.ts b/cli/tests/testdata/bundle/https_deno.land-x-lib-mod.d.ts new file mode 100644 index 000000000..76ed81df0 --- /dev/null +++ b/cli/tests/testdata/bundle/https_deno.land-x-lib-mod.d.ts @@ -0,0 +1,9 @@ +export * as a from "./a.ts"; +export * as b from "./b.js"; +export * as c from "./c.js"; + +export interface A { + a: string; +} + +export const mod: A[]; diff --git a/cli/tests/testdata/bundle/https_deno.land-x-lib-mod.js b/cli/tests/testdata/bundle/https_deno.land-x-lib-mod.js new file mode 100644 index 000000000..505162094 --- /dev/null +++ b/cli/tests/testdata/bundle/https_deno.land-x-lib-mod.js @@ -0,0 +1,5 @@ +export * as a from "./a.ts"; +export * as b from "./b.js"; +export * as c from "./c.js"; + +export const mod = []; diff --git a/cli/tests/testdata/bundle_dynamic_import.ts b/cli/tests/testdata/bundle_dynamic_import.ts new file mode 100644 index 000000000..d8c7d08ec --- /dev/null +++ b/cli/tests/testdata/bundle_dynamic_import.ts @@ -0,0 +1,3 @@ +const mod1 = await import("http://localhost:4545/subdir/mod1.ts"); + +mod1.printHello3(); diff --git a/cli/tests/testdata/bundle_im.json b/cli/tests/testdata/bundle_im.json new file mode 100644 index 000000000..8ebc00c5b --- /dev/null +++ b/cli/tests/testdata/bundle_im.json @@ -0,0 +1,5 @@ +{ + "imports": { + "mod2": "./subdir/subdir2/mod2.ts" + } +} diff --git a/cli/tests/testdata/bundle_im.ts b/cli/tests/testdata/bundle_im.ts new file mode 100644 index 000000000..74834de20 --- /dev/null +++ b/cli/tests/testdata/bundle_im.ts @@ -0,0 +1,17 @@ +import { printHello2, returnsFoo } from "mod2"; + +export function returnsHi(): string { + return "Hi"; +} + +export function returnsFoo2(): string { + return returnsFoo(); +} + +export function printHello3() { + printHello2(); +} + +export function throwsError() { + throw Error("exception from mod1"); +} diff --git a/cli/tests/testdata/bundle_jsx.out b/cli/tests/testdata/bundle_jsx.out new file mode 100644 index 000000000..44c9e4555 --- /dev/null +++ b/cli/tests/testdata/bundle_jsx.out @@ -0,0 +1,10 @@ +[WILDCARD] +const React = { + createElement () { + } +}; +function app() { + return React.createElement("div", null, React.createElement("h2", null, "asdf")); +} +console.log(app); + diff --git a/cli/tests/testdata/cache_extensionless.out b/cli/tests/testdata/cache_extensionless.out new file mode 100644 index 000000000..3694c67cb --- /dev/null +++ b/cli/tests/testdata/cache_extensionless.out @@ -0,0 +1,2 @@ +[WILDCARD] +Check http://localhost:4545/subdir/no_js_ext diff --git a/cli/tests/testdata/cache_random_extension.out b/cli/tests/testdata/cache_random_extension.out new file mode 100644 index 000000000..745a2e0e3 --- /dev/null +++ b/cli/tests/testdata/cache_random_extension.out @@ -0,0 +1,2 @@ +[WILDCARD] +Check http://localhost:4545/subdir/no_js_ext@1.0.0 diff --git a/cli/tests/testdata/cafile_info.ts b/cli/tests/testdata/cafile_info.ts new file mode 100644 index 000000000..b41873f73 --- /dev/null +++ b/cli/tests/testdata/cafile_info.ts @@ -0,0 +1,24 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. + +import { loaded as loadedTs1 } from "https://localhost:5545/subdir/mt_text_typescript.t1.ts"; +import { loaded as loadedTs2 } from "https://localhost:5545/subdir/mt_video_vdn.t2.ts"; +import { loaded as loadedTs3 } from "https://localhost:5545/subdir/mt_video_mp2t.t3.ts"; +import { loaded as loadedTs4 } from "https://localhost:5545/subdir/mt_application_x_typescript.t4.ts"; +import { loaded as loadedJs1 } from "https://localhost:5545/subdir/mt_text_javascript.j1.js"; +import { loaded as loadedJs2 } from "https://localhost:5545/subdir/mt_application_ecmascript.j2.js"; +import { loaded as loadedJs3 } from "https://localhost:5545/subdir/mt_text_ecmascript.j3.js"; +import { loaded as loadedJs4 } from "https://localhost:5545/subdir/mt_application_x_javascript.j4.js"; + +console.log( + "success", + loadedTs1, + loadedTs2, + loadedTs3, + loadedTs4, + loadedJs1, + loadedJs2, + loadedJs3, + loadedJs4, +); diff --git a/cli/tests/testdata/cafile_info.ts.out b/cli/tests/testdata/cafile_info.ts.out new file mode 100644 index 000000000..3ce03961d --- /dev/null +++ b/cli/tests/testdata/cafile_info.ts.out @@ -0,0 +1,13 @@ +local: [WILDCARD]https[WILDCARD]localhost_PORT5545[WILDCARD] +type: TypeScript +dependencies: 8 unique (total [WILDCARD]) + +https://localhost:5545/cafile_info.ts ([WILDCARD]) +├── https://localhost:5545/subdir/mt_application_ecmascript.j2.js ([WILDCARD]) +├── https://localhost:5545/subdir/mt_application_x_javascript.j4.js ([WILDCARD]) +├── https://localhost:5545/subdir/mt_application_x_typescript.t4.ts ([WILDCARD]) +├── https://localhost:5545/subdir/mt_text_ecmascript.j3.js ([WILDCARD]) +├── https://localhost:5545/subdir/mt_text_javascript.j1.js ([WILDCARD]) +├── https://localhost:5545/subdir/mt_text_typescript.t1.ts ([WILDCARD]) +├── https://localhost:5545/subdir/mt_video_mp2t.t3.ts ([WILDCARD]) +└── https://localhost:5545/subdir/mt_video_vdn.t2.ts ([WILDCARD]) diff --git a/cli/tests/testdata/cafile_ts_fetch.ts b/cli/tests/testdata/cafile_ts_fetch.ts new file mode 100644 index 000000000..03afb6d2f --- /dev/null +++ b/cli/tests/testdata/cafile_ts_fetch.ts @@ -0,0 +1,3 @@ +fetch("https://localhost:5545/cafile_ts_fetch.ts.out") + .then((r) => r.text()) + .then((t) => console.log(t.trimEnd())); diff --git a/cli/tests/testdata/cafile_ts_fetch.ts.out b/cli/tests/testdata/cafile_ts_fetch.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/cafile_ts_fetch.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/cafile_ts_fetch_unsafe_ssl.ts.out b/cli/tests/testdata/cafile_ts_fetch_unsafe_ssl.ts.out new file mode 100644 index 000000000..1dc61c837 --- /dev/null +++ b/cli/tests/testdata/cafile_ts_fetch_unsafe_ssl.ts.out @@ -0,0 +1,2 @@ +DANGER: TLS certificate validation is disabled for all hostnames +Hello diff --git a/cli/tests/testdata/cafile_url_imports.ts b/cli/tests/testdata/cafile_url_imports.ts new file mode 100644 index 000000000..2355a8628 --- /dev/null +++ b/cli/tests/testdata/cafile_url_imports.ts @@ -0,0 +1,3 @@ +import { printHello } from "https://localhost:5545/subdir/mod2.ts"; +printHello(); +console.log("success"); diff --git a/cli/tests/testdata/cafile_url_imports.ts.out b/cli/tests/testdata/cafile_url_imports.ts.out new file mode 100644 index 000000000..989ce33e9 --- /dev/null +++ b/cli/tests/testdata/cafile_url_imports.ts.out @@ -0,0 +1,2 @@ +Hello +success diff --git a/cli/tests/testdata/cafile_url_imports_unsafe_ssl.ts.out b/cli/tests/testdata/cafile_url_imports_unsafe_ssl.ts.out new file mode 100644 index 000000000..daebcd766 --- /dev/null +++ b/cli/tests/testdata/cafile_url_imports_unsafe_ssl.ts.out @@ -0,0 +1,3 @@ +DANGER: TLS certificate validation is disabled for: localhost +Hello +success diff --git a/cli/tests/testdata/cat.ts b/cli/tests/testdata/cat.ts new file mode 100644 index 000000000..6d8f150e3 --- /dev/null +++ b/cli/tests/testdata/cat.ts @@ -0,0 +1,10 @@ +import { copy } from "../../../test_util/std/io/util.ts"; +async function main() { + for (let i = 1; i < Deno.args.length; i++) { + const filename = Deno.args[i]; + const file = await Deno.open(filename); + await copy(file, Deno.stdout); + } +} + +main(); diff --git a/cli/tests/testdata/circular1.js b/cli/tests/testdata/circular1.js new file mode 100644 index 000000000..8b2cc4960 --- /dev/null +++ b/cli/tests/testdata/circular1.js @@ -0,0 +1,2 @@ +import "./circular2.js"; +console.log("circular1"); diff --git a/cli/tests/testdata/circular1.js.out b/cli/tests/testdata/circular1.js.out new file mode 100644 index 000000000..21f7fd585 --- /dev/null +++ b/cli/tests/testdata/circular1.js.out @@ -0,0 +1,2 @@ +circular2 +circular1 diff --git a/cli/tests/testdata/circular2.js b/cli/tests/testdata/circular2.js new file mode 100644 index 000000000..62127e04d --- /dev/null +++ b/cli/tests/testdata/circular2.js @@ -0,0 +1,2 @@ +import "./circular1.js"; +console.log("circular2"); diff --git a/cli/tests/testdata/cjs_imports.ts b/cli/tests/testdata/cjs_imports.ts new file mode 100644 index 000000000..d8b77c22e --- /dev/null +++ b/cli/tests/testdata/cjs_imports.ts @@ -0,0 +1 @@ +import "./commonjs.cjs"; diff --git a/cli/tests/testdata/cjs_imports.ts.out b/cli/tests/testdata/cjs_imports.ts.out new file mode 100644 index 000000000..557db03de --- /dev/null +++ b/cli/tests/testdata/cjs_imports.ts.out @@ -0,0 +1 @@ +Hello World diff --git a/cli/tests/testdata/commonjs.cjs b/cli/tests/testdata/commonjs.cjs new file mode 100644 index 000000000..7df7d571e --- /dev/null +++ b/cli/tests/testdata/commonjs.cjs @@ -0,0 +1 @@ +console.log("Hello World"); \ No newline at end of file diff --git a/cli/tests/testdata/compiler_api_test.ts b/cli/tests/testdata/compiler_api_test.ts new file mode 100644 index 000000000..92eb4c519 --- /dev/null +++ b/cli/tests/testdata/compiler_api_test.ts @@ -0,0 +1,504 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +import { + assert, + assertEquals, + assertStringIncludes, + assertThrowsAsync, +} from "../../../test_util/std/testing/asserts.ts"; + +Deno.test({ + name: "Deno.emit() - sources provided", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "/foo.ts", + { + sources: { + "/foo.ts": `import * as bar from "./bar.ts";\n\nconsole.log(bar);\n`, + "/bar.ts": `export const bar = "bar";\n`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + const keys = Object.keys(files).sort(); + assert(keys[0].endsWith("/bar.ts.js")); + assert(keys[1].endsWith("/bar.ts.js.map")); + assert(keys[2].endsWith("/foo.ts.js")); + assert(keys[3].endsWith("/foo.ts.js.map")); + }, +}); + +Deno.test({ + name: "Deno.emit() - no sources provided", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "./subdir/mod1.ts", + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + const keys = Object.keys(files).sort(); + assertEquals(keys.length, 6); + assert(keys[0].endsWith("subdir/mod1.ts.js")); + assert(keys[1].endsWith("subdir/mod1.ts.js.map")); + }, +}); + +Deno.test({ + name: "Deno.emit() - compiler options effects emit", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "/foo.ts", + { + compilerOptions: { + module: "amd", + sourceMap: false, + }, + sources: { "/foo.ts": `export const foo = "foo";` }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + const keys = Object.keys(files); + assertEquals(keys.length, 1); + const key = keys[0]; + assert(key.endsWith("/foo.ts.js")); + assert(files[key].startsWith("define(")); + }, +}); + +Deno.test({ + name: "Deno.emit() - pass lib in compiler options", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "file:///foo.ts", + { + compilerOptions: { + lib: ["dom", "es2018", "deno.ns"], + }, + sources: { + "file:///foo.ts": `console.log(document.getElementById("foo")); + console.log(Deno.args);`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + const keys = Object.keys(files).sort(); + assertEquals(keys, ["file:///foo.ts.js", "file:///foo.ts.js.map"]); + }, +}); + +Deno.test({ + name: "Deno.emit() - type references can be loaded", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "file:///a.ts", + { + sources: { + "file:///a.ts": `/// + const b = new B(); + console.log(b.b);`, + "file:///b.d.ts": `declare class B { + b: string; + }`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + const keys = Object.keys(files).sort(); + assertEquals(keys, ["file:///a.ts.js", "file:///a.ts.js.map"]); + }, +}); + +Deno.test({ + name: "Deno.emit() - compilerOptions.types", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "file:///a.ts", + { + compilerOptions: { + types: ["file:///b.d.ts"], + }, + sources: { + "file:///a.ts": `const b = new B(); + console.log(b.b);`, + "file:///b.d.ts": `declare class B { + b: string; + }`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + const keys = Object.keys(files).sort(); + assertEquals(keys, ["file:///a.ts.js", "file:///a.ts.js.map"]); + }, +}); + +Deno.test({ + name: "Deno.emit() - import maps", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "file:///a.ts", + { + importMap: { + imports: { + "b": "./b.ts", + }, + }, + importMapPath: "file:///import-map.json", + sources: { + "file:///a.ts": `import * as b from "b" + console.log(b);`, + "file:///b.ts": `export const b = "b";`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + const keys = Object.keys(files).sort(); + assertEquals( + keys, + [ + "file:///a.ts.js", + "file:///a.ts.js.map", + "file:///b.ts.js", + "file:///b.ts.js.map", + ], + ); + }, +}); + +Deno.test({ + name: "Deno.emit() - no check", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "/foo.ts", + { + check: false, + sources: { + "/foo.ts": `export enum Foo { Foo, Bar, Baz };\n`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 3); + const keys = Object.keys(files).sort(); + assert(keys[0].endsWith("/foo.ts.js")); + assert(keys[1].endsWith("/foo.ts.js.map")); + assert(files[keys[0]].startsWith("export var Foo;")); + }, +}); + +Deno.test({ + name: "Deno.emit() - no check - config effects emit", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "/foo.ts", + { + check: false, + compilerOptions: { removeComments: true }, + sources: { + "/foo.ts": + `/** This is JSDoc */\nexport enum Foo { Foo, Bar, Baz };\n`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 3); + const keys = Object.keys(files).sort(); + assert(keys[0].endsWith("/foo.ts.js")); + assert(keys[1].endsWith("/foo.ts.js.map")); + assert(!files[keys[0]].includes("This is JSDoc")); + }, +}); + +Deno.test({ + name: "Deno.emit() - bundle as module script - with sources", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "/foo.ts", + { + bundle: "module", + sources: { + "/foo.ts": `export * from "./bar.ts";\n`, + "/bar.ts": `export const bar = "bar";\n`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + assertEquals( + Object.keys(files).sort(), + ["deno:///bundle.js", "deno:///bundle.js.map"].sort(), + ); + assert(files["deno:///bundle.js"].includes(`const bar1 = "bar"`)); + }, +}); + +Deno.test({ + name: "Deno.emit() - bundle as module script - no sources", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "./subdir/mod1.ts", + { + bundle: "module", + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + assertEquals( + Object.keys(files).sort(), + ["deno:///bundle.js", "deno:///bundle.js.map"].sort(), + ); + assert(files["deno:///bundle.js"].length); + }, +}); + +Deno.test({ + name: "Deno.emit() - bundle as module script - include js modules", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "/foo.js", + { + bundle: "module", + sources: { + "/foo.js": `export * from "./bar.js";\n`, + "/bar.js": `export const bar = "bar";\n`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + assertEquals( + Object.keys(files).sort(), + ["deno:///bundle.js.map", "deno:///bundle.js"].sort(), + ); + assert(files["deno:///bundle.js"].includes(`const bar1 = "bar"`)); + }, +}); + +Deno.test({ + name: "Deno.emit() - generates diagnostics", + async fn() { + const { diagnostics, files } = await Deno.emit( + "/foo.ts", + { + sources: { + "/foo.ts": `document.getElementById("foo");`, + }, + }, + ); + assertEquals(diagnostics.length, 1); + const keys = Object.keys(files).sort(); + assert(keys[0].endsWith("/foo.ts.js")); + assert(keys[1].endsWith("/foo.ts.js.map")); + }, +}); + +// See https://github.com/denoland/deno/issues/6908 +Deno.test({ + name: "Deno.emit() - invalid syntax does not panic", + async fn() { + await assertThrowsAsync(async () => { + await Deno.emit("/main.js", { + sources: { + "/main.js": ` + export class Foo { + constructor() { + console.log("foo"); + } + export get() { + console.log("bar"); + } + }`, + }, + }); + }); + }, +}); + +Deno.test({ + name: 'Deno.emit() - allows setting of "importsNotUsedAsValues"', + async fn() { + const { diagnostics } = await Deno.emit("/a.ts", { + sources: { + "/a.ts": `import { B } from "./b.ts"; + const b: B = { b: "b" };`, + "/b.ts": `export interface B { + b:string; + };`, + }, + compilerOptions: { + importsNotUsedAsValues: "error", + }, + }); + assert(diagnostics); + assertEquals(diagnostics.length, 1); + assert(diagnostics[0].messageText); + assert(diagnostics[0].messageText.includes("This import is never used")); + }, +}); + +Deno.test({ + name: "Deno.emit() - Unknown media type does not panic", + async fn() { + await assertThrowsAsync(async () => { + await Deno.emit("https://example.com/foo", { + sources: { + "https://example.com/foo": `let foo: string = "foo";`, + }, + }); + }); + }, +}); + +Deno.test({ + name: "Deno.emit() - non-normalized specifier and source can compile", + async fn() { + const specifier = "https://example.com/foo//bar.ts"; + const { files } = await Deno.emit(specifier, { + sources: { + [specifier]: `export let foo: string = "foo";`, + }, + }); + assertEquals(files[`${specifier}.js`], 'export let foo = "foo";\n'); + assert(typeof files[`${specifier}.js.map`] === "string"); + }, +}); + +Deno.test({ + name: `Deno.emit() - bundle as classic script iife`, + async fn() { + const { diagnostics, files } = await Deno.emit("/a.ts", { + bundle: "classic", + sources: { + "/a.ts": `import { b } from "./b.ts"; + console.log(b);`, + "/b.ts": `export const b = "b";`, + }, + }); + assert(diagnostics); + assertEquals(diagnostics.length, 0); + assertEquals(Object.keys(files).length, 2); + assert(files["deno:///bundle.js"].startsWith("(function() {\n")); + assert(files["deno:///bundle.js"].endsWith("})();\n")); + assert(files["deno:///bundle.js.map"]); + }, +}); + +Deno.test({ + name: `Deno.emit() - throws descriptive error when unable to load import map`, + async fn() { + await assertThrowsAsync( + async () => { + await Deno.emit("/a.ts", { + bundle: "classic", + sources: { + "/a.ts": `console.log("hello");`, + }, + importMapPath: "file:///import_map_does_not_exist.json", + }); + }, + Error, + "Unable to load 'file:///import_map_does_not_exist.json' import map", + ); + }, +}); + +Deno.test({ + name: `Deno.emit() - support source maps with bundle option`, + async fn() { + { + const { diagnostics, files } = await Deno.emit("/a.ts", { + bundle: "classic", + sources: { + "/a.ts": `import { b } from "./b.ts"; + console.log(b);`, + "/b.ts": `export const b = "b";`, + }, + compilerOptions: { + inlineSourceMap: true, + sourceMap: false, + }, + }); + assert(diagnostics); + assertEquals(diagnostics.length, 0); + assertEquals(Object.keys(files).length, 1); + assertStringIncludes(files["deno:///bundle.js"], "sourceMappingURL"); + } + + const { diagnostics, files } = await Deno.emit("/a.ts", { + bundle: "classic", + sources: { + "/a.ts": `import { b } from "./b.ts"; + console.log(b);`, + "/b.ts": `export const b = "b";`, + }, + }); + assert(diagnostics); + assertEquals(diagnostics.length, 0); + assertEquals(Object.keys(files).length, 2); + assert(files["deno:///bundle.js"]); + assert(files["deno:///bundle.js.map"]); + }, +}); + +Deno.test({ + name: `Deno.emit() - graph errors as diagnostics`, + ignore: Deno.build.os === "windows", + async fn() { + const { diagnostics } = await Deno.emit("/a.ts", { + sources: { + "/a.ts": `import { b } from "./b.ts"; + console.log(b);`, + }, + }); + assert(diagnostics); + assertEquals(diagnostics, [ + { + category: 1, + code: 2305, + start: { line: 0, character: 9 }, + end: { line: 0, character: 10 }, + messageText: + `Module '"deno:///missing_dependency.d.ts"' has no exported member 'b'.`, + messageChain: null, + source: null, + sourceLine: 'import { b } from "./b.ts";', + fileName: "file:///a.ts", + relatedInformation: null, + }, + { + category: 1, + code: 900001, + start: null, + end: null, + messageText: "Unable to find specifier in sources: file:///b.ts", + messageChain: null, + source: null, + sourceLine: null, + fileName: "file:///b.ts", + relatedInformation: null, + }, + ]); + assert( + Deno.formatDiagnostics(diagnostics).includes( + "Unable to find specifier in sources: file:///b.ts", + ), + ); + }, +}); diff --git a/cli/tests/testdata/complex_permissions_test.ts b/cli/tests/testdata/complex_permissions_test.ts new file mode 100644 index 000000000..bae157246 --- /dev/null +++ b/cli/tests/testdata/complex_permissions_test.ts @@ -0,0 +1,53 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +const name = Deno.args[0]; +// deno-lint-ignore no-explicit-any +const test: { [key: string]: (...args: any[]) => void | Promise } = { + read(files: string[]) { + files.forEach((file) => Deno.readFileSync(file)); + }, + write(files: string[]) { + files.forEach((file) => + Deno.writeFileSync(file, new Uint8Array(0), { append: true }) + ); + }, + netFetch(urls: string[]) { + urls.forEach((url) => fetch(url)); + }, + netListen(endpoints: string[]) { + endpoints.forEach((endpoint) => { + const index = endpoint.lastIndexOf(":"); + const [hostname, port] = [ + endpoint.substr(0, index), + endpoint.substr(index + 1), + ]; + const listener = Deno.listen({ + transport: "tcp", + hostname, + port: parseInt(port, 10), + }); + listener.close(); + }); + }, + async netConnect(endpoints: string[]) { + for (const endpoint of endpoints) { + const index = endpoint.lastIndexOf(":"); + const [hostname, port] = [ + endpoint.substr(0, index), + endpoint.substr(index + 1), + ]; + const listener = await Deno.connect({ + transport: "tcp", + hostname, + port: parseInt(port, 10), + }); + listener.close(); + } + }, +}; + +if (!test[name]) { + console.log("Unknown test:", name); + Deno.exit(1); +} + +test[name](Deno.args.slice(1)); diff --git a/cli/tests/testdata/config.ts b/cli/tests/testdata/config.ts new file mode 100644 index 000000000..cd7a1b33f --- /dev/null +++ b/cli/tests/testdata/config.ts @@ -0,0 +1,18 @@ +// deno-lint-ignore-file + +function b() { + return function ( + _target: any, + _propertyKey: string, + _descriptor: PropertyDescriptor, + ) { + console.log("b"); + }; +} + +class A { + @b() + a() { + console.log("a"); + } +} diff --git a/cli/tests/testdata/config.ts.out b/cli/tests/testdata/config.ts.out new file mode 100644 index 000000000..9f8a8ddd1 --- /dev/null +++ b/cli/tests/testdata/config.ts.out @@ -0,0 +1,7 @@ +[WILDCARD]Unsupported compiler options in "[WILDCARD]config.tsconfig.json". + The following options were ignored: + module, target +error: TS1219 [ERROR]: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. + a() { + ^ + at file:///[WILDCARD]/config.ts:[WILDCARD] diff --git a/cli/tests/testdata/config.tsconfig.json b/cli/tests/testdata/config.tsconfig.json new file mode 100644 index 000000000..dcabb50a4 --- /dev/null +++ b/cli/tests/testdata/config.tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "experimentalDecorators": false, + "module": "amd", + "target": "es5" + } +} diff --git a/cli/tests/testdata/config_types.ts b/cli/tests/testdata/config_types.ts new file mode 100644 index 000000000..f1a8d6583 --- /dev/null +++ b/cli/tests/testdata/config_types.ts @@ -0,0 +1 @@ +console.log(globalThis.a); diff --git a/cli/tests/testdata/config_types.ts.out b/cli/tests/testdata/config_types.ts.out new file mode 100644 index 000000000..417b7b537 --- /dev/null +++ b/cli/tests/testdata/config_types.ts.out @@ -0,0 +1 @@ +undefined diff --git a/cli/tests/testdata/config_types.tsconfig.json b/cli/tests/testdata/config_types.tsconfig.json new file mode 100644 index 000000000..3810d4534 --- /dev/null +++ b/cli/tests/testdata/config_types.tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "types": [ + "./subdir/types.d.ts" + ] + } +} diff --git a/cli/tests/testdata/config_types_remote.tsconfig.json b/cli/tests/testdata/config_types_remote.tsconfig.json new file mode 100644 index 000000000..f40d5b1c4 --- /dev/null +++ b/cli/tests/testdata/config_types_remote.tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "types": [ + "http://localhost:4545/subdir/types.d.ts" + ] + } +} diff --git a/cli/tests/testdata/coverage/branch.ts b/cli/tests/testdata/coverage/branch.ts new file mode 100644 index 000000000..352167109 --- /dev/null +++ b/cli/tests/testdata/coverage/branch.ts @@ -0,0 +1,15 @@ +export function branch(condition: boolean): boolean { + if (condition) { + return true; + } else { + return false; + } +} + +export function unused(condition: boolean): boolean { + if (condition) { + return false; + } else { + return true; + } +} diff --git a/cli/tests/testdata/coverage/branch_test.ts b/cli/tests/testdata/coverage/branch_test.ts new file mode 100644 index 000000000..2a44c8071 --- /dev/null +++ b/cli/tests/testdata/coverage/branch_test.ts @@ -0,0 +1,5 @@ +import { branch } from "./branch.ts"; + +Deno.test("branch", function () { + branch(true); +}); diff --git a/cli/tests/testdata/coverage/complex.ts b/cli/tests/testdata/coverage/complex.ts new file mode 100644 index 000000000..47d4ffa79 --- /dev/null +++ b/cli/tests/testdata/coverage/complex.ts @@ -0,0 +1,71 @@ +// This entire interface should be completely ignored by the coverage tool. +export interface Complex { + // These comments should be ignored. + foo: string; + + // But this is a stub, so this isn't really documentation. + bar: string; + + // Really all these are doing is padding the line count. + baz: string; +} + +// Lets add some wide characters to ensure that the absolute byte offsets are +// being matched properly. +// +// íŒ¨ë”©ì— ëŒ€í•œ ë” ë§Žì€ ë¬¸ìž. +function dependency( + foo: string, + bar: string, + baz: string, +): Complex { + return { + foo, + bar, + baz, + }; +} + +// Again just more wide characters for padding. +// +// 良ã„対策ã®ãŸã‚ã«ã„ãã¤ã‹ã®ãƒ¦ãƒ‹ã‚³ãƒ¼ãƒ‰æ–‡å­—を投ã’る。 +export function complex( + foo: string, + bar: string, + baz: string, +): Complex { + return dependency( + foo, + bar, + baz, + ); +} + +// And yet again for good measure. +// 更多用於填充的字元。 +export function unused( + foo: string, + bar: string, + baz: string, +): Complex { + return complex( + foo, + bar, + baz, + ); +} + +// Using a non-ascii name again to ensure that the byte offsets match up +// correctly. +export const Ï€ = Math.PI; + +// And same applies for this one, this one is unused and will show up in +// lacking coverage. +export function Æ’(): number { + return ( + 0 + ); +} + +// This arrow function should also show up as uncovered. +console.log("%s", () => 1); diff --git a/cli/tests/testdata/coverage/complex_test.ts b/cli/tests/testdata/coverage/complex_test.ts new file mode 100644 index 000000000..fda948bc3 --- /dev/null +++ b/cli/tests/testdata/coverage/complex_test.ts @@ -0,0 +1,5 @@ +import { complex } from "./complex.ts"; + +Deno.test("complex", function () { + complex("foo", "bar", "baz"); +}); diff --git a/cli/tests/testdata/coverage/expected_branch.lcov b/cli/tests/testdata/coverage/expected_branch.lcov new file mode 100644 index 000000000..07e29cca5 --- /dev/null +++ b/cli/tests/testdata/coverage/expected_branch.lcov @@ -0,0 +1,27 @@ +SF:[WILDCARD]branch.ts +FN:2,branch +FN:10,unused +FNDA:1,branch +FNDA:0,unused +FNF:2 +FNH:1 +BRDA:4,1,0,0 +BRF:1 +BRH:0 +DA:1,1 +DA:2,2 +DA:3,2 +DA:4,0 +DA:5,0 +DA:6,0 +DA:7,1 +DA:9,0 +DA:10,0 +DA:11,0 +DA:12,0 +DA:13,0 +DA:14,0 +DA:15,0 +LH:4 +LF:14 +end_of_record diff --git a/cli/tests/testdata/coverage/expected_branch.out b/cli/tests/testdata/coverage/expected_branch.out new file mode 100644 index 000000000..630ea93b2 --- /dev/null +++ b/cli/tests/testdata/coverage/expected_branch.out @@ -0,0 +1,12 @@ +cover [WILDCARD]/coverage/branch.ts ... 28.571% (4/14) + 4 | } else { + 5 | return false; + 6 | } +-----|----- + 9 | export function unused(condition: boolean): boolean { + 10 | if (condition) { + 11 | return false; + 12 | } else { + 13 | return true; + 14 | } + 15 | } diff --git a/cli/tests/testdata/coverage/expected_complex.lcov b/cli/tests/testdata/coverage/expected_complex.lcov new file mode 100644 index 000000000..962ebee96 --- /dev/null +++ b/cli/tests/testdata/coverage/expected_complex.lcov @@ -0,0 +1,53 @@ +SF:[WILDCARD]complex.ts +FN:22,dependency +FN:37,complex +FN:51,unused +FN:65,Æ’ +FNDA:1,dependency +FNDA:1,complex +FNDA:0,unused +FNDA:0,Æ’ +FNF:4 +FNH:2 +BRF:0 +BRH:0 +DA:17,2 +DA:18,2 +DA:19,2 +DA:20,2 +DA:22,2 +DA:23,2 +DA:24,2 +DA:25,2 +DA:26,2 +DA:27,1 +DA:32,1 +DA:33,1 +DA:34,1 +DA:35,1 +DA:37,2 +DA:38,2 +DA:39,2 +DA:40,2 +DA:41,2 +DA:42,1 +DA:46,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:51,0 +DA:52,0 +DA:53,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:60,1 +DA:64,0 +DA:65,0 +DA:66,0 +DA:67,0 +DA:68,1 +DA:71,0 +LH:22 +LF:37 +end_of_record diff --git a/cli/tests/testdata/coverage/expected_complex.out b/cli/tests/testdata/coverage/expected_complex.out new file mode 100644 index 000000000..e9f9a453f --- /dev/null +++ b/cli/tests/testdata/coverage/expected_complex.out @@ -0,0 +1,19 @@ +cover [WILDCARD]/coverage/complex.ts ... 59.459% (22/37) + 46 | export function unused( + 47 | foo: string, + 48 | bar: string, + 49 | baz: string, +-----|----- + 51 | return complex( + 52 | foo, + 53 | bar, + 54 | baz, + 55 | ); + 56 | } +-----|----- + 64 | export function Æ’(): number { + 65 | return ( + 66 | 0 + 67 | ); +-----|----- + 71 | console.log("%s", () => 1); diff --git a/cli/tests/testdata/delayed_error.ts b/cli/tests/testdata/delayed_error.ts new file mode 100644 index 000000000..76057e627 --- /dev/null +++ b/cli/tests/testdata/delayed_error.ts @@ -0,0 +1,2 @@ +await new Promise((r) => setTimeout(r, 100)); +throw new Error("foo"); diff --git a/cli/tests/testdata/deno_doc.out b/cli/tests/testdata/deno_doc.out new file mode 100644 index 000000000..86a77a9cc --- /dev/null +++ b/cli/tests/testdata/deno_doc.out @@ -0,0 +1,2 @@ +[WILDCARD] +function foo[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/deno_doc.ts b/cli/tests/testdata/deno_doc.ts new file mode 100644 index 000000000..fb3c50957 --- /dev/null +++ b/cli/tests/testdata/deno_doc.ts @@ -0,0 +1,3 @@ +/** Some JSDoc */ +export function foo() { +} diff --git a/cli/tests/testdata/deno_doc_builtin.out b/cli/tests/testdata/deno_doc_builtin.out new file mode 100644 index 000000000..b4a90d6bc --- /dev/null +++ b/cli/tests/testdata/deno_doc_builtin.out @@ -0,0 +1,3 @@ +[WILDCARD] +namespace Deno +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/deno_dom_0.1.3-alpha2.wasm b/cli/tests/testdata/deno_dom_0.1.3-alpha2.wasm new file mode 100644 index 000000000..6dd9d0e91 Binary files /dev/null and b/cli/tests/testdata/deno_dom_0.1.3-alpha2.wasm differ diff --git a/cli/tests/testdata/deno_land_unsafe_ssl.ts b/cli/tests/testdata/deno_land_unsafe_ssl.ts new file mode 100644 index 000000000..f5e8dcc80 --- /dev/null +++ b/cli/tests/testdata/deno_land_unsafe_ssl.ts @@ -0,0 +1,2 @@ +const r = await fetch("https://google.com"); +console.log(r.status); diff --git a/cli/tests/testdata/deno_land_unsafe_ssl.ts.out b/cli/tests/testdata/deno_land_unsafe_ssl.ts.out new file mode 100644 index 000000000..cbf52b076 --- /dev/null +++ b/cli/tests/testdata/deno_land_unsafe_ssl.ts.out @@ -0,0 +1,2 @@ +DANGER: TLS certificate validation is disabled for: deno.land +200 diff --git a/cli/tests/testdata/disallow_http_from_https.js b/cli/tests/testdata/disallow_http_from_https.js new file mode 100644 index 000000000..bff407b5e --- /dev/null +++ b/cli/tests/testdata/disallow_http_from_https.js @@ -0,0 +1,2 @@ +// Trying to import "http://", while this file is accessed by "https://" +import "http://localhost:4545/001_hello.js"; diff --git a/cli/tests/testdata/disallow_http_from_https.ts b/cli/tests/testdata/disallow_http_from_https.ts new file mode 100644 index 000000000..bff407b5e --- /dev/null +++ b/cli/tests/testdata/disallow_http_from_https.ts @@ -0,0 +1,2 @@ +// Trying to import "http://", while this file is accessed by "https://" +import "http://localhost:4545/001_hello.js"; diff --git a/cli/tests/testdata/disallow_http_from_https_js.out b/cli/tests/testdata/disallow_http_from_https_js.out new file mode 100644 index 000000000..3219b7d35 --- /dev/null +++ b/cli/tests/testdata/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/001_hello.js + at https://localhost:5545/disallow_http_from_https.js:2:0 diff --git a/cli/tests/testdata/disallow_http_from_https_ts.out b/cli/tests/testdata/disallow_http_from_https_ts.out new file mode 100644 index 000000000..d1ab64394 --- /dev/null +++ b/cli/tests/testdata/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/001_hello.js + at https://localhost:5545/disallow_http_from_https.ts:2:0 diff --git a/cli/tests/testdata/doc/import_map.json b/cli/tests/testdata/doc/import_map.json new file mode 100644 index 000000000..244a30296 --- /dev/null +++ b/cli/tests/testdata/doc/import_map.json @@ -0,0 +1,5 @@ +{ + "imports": { + "rex/": "./module/" + } +} diff --git a/cli/tests/testdata/doc/invalid_url.out b/cli/tests/testdata/doc/invalid_url.out new file mode 100644 index 000000000..8be787e90 --- /dev/null +++ b/cli/tests/testdata/doc/invalid_url.out @@ -0,0 +1,4 @@ +error: invalid URL: invalid domain character + +Caused by: + invalid domain character diff --git a/cli/tests/testdata/doc/module/fun.js b/cli/tests/testdata/doc/module/fun.js new file mode 100644 index 000000000..28901d945 --- /dev/null +++ b/cli/tests/testdata/doc/module/fun.js @@ -0,0 +1,2 @@ +/** This is some documentation */ +export function fun(_a, _b) {} diff --git a/cli/tests/testdata/doc/types_header.out b/cli/tests/testdata/doc/types_header.out new file mode 100644 index 000000000..ccff1a373 --- /dev/null +++ b/cli/tests/testdata/doc/types_header.out @@ -0,0 +1,6 @@ +Download http://127.0.0.1:4545/xTypeScriptTypes.js +Download http://127.0.0.1:4545/xTypeScriptTypes.d.ts +Defined in http://127.0.0.1:4545/xTypeScriptTypes.d.ts:1:0 + +const foo: "foo" + diff --git a/cli/tests/testdata/doc/types_header.ts b/cli/tests/testdata/doc/types_header.ts new file mode 100644 index 000000000..b64c8d000 --- /dev/null +++ b/cli/tests/testdata/doc/types_header.ts @@ -0,0 +1 @@ +export * from "http://127.0.0.1:4545/xTypeScriptTypes.js"; diff --git a/cli/tests/testdata/doc/types_hint.out b/cli/tests/testdata/doc/types_hint.out new file mode 100644 index 000000000..7eb05faed --- /dev/null +++ b/cli/tests/testdata/doc/types_hint.out @@ -0,0 +1,5 @@ +Defined in [WILDCARD]/type_definitions/foo.d.ts:2:0 + +const foo: string + An exported value. + diff --git a/cli/tests/testdata/doc/types_hint.ts b/cli/tests/testdata/doc/types_hint.ts new file mode 100644 index 000000000..bacea46db --- /dev/null +++ b/cli/tests/testdata/doc/types_hint.ts @@ -0,0 +1,2 @@ +// @deno-types="../type_definitions/foo.d.ts" +export * from "../type_definitions/foo.js"; diff --git a/cli/tests/testdata/doc/types_ref.js b/cli/tests/testdata/doc/types_ref.js new file mode 100644 index 000000000..03d8b5570 --- /dev/null +++ b/cli/tests/testdata/doc/types_ref.js @@ -0,0 +1,2 @@ +/// +export const foo = "foo"; diff --git a/cli/tests/testdata/doc/types_ref.out b/cli/tests/testdata/doc/types_ref.out new file mode 100644 index 000000000..7eb05faed --- /dev/null +++ b/cli/tests/testdata/doc/types_ref.out @@ -0,0 +1,5 @@ +Defined in [WILDCARD]/type_definitions/foo.d.ts:2:0 + +const foo: string + An exported value. + diff --git a/cli/tests/testdata/doc/use_import_map.js b/cli/tests/testdata/doc/use_import_map.js new file mode 100644 index 000000000..672a7a7bd --- /dev/null +++ b/cli/tests/testdata/doc/use_import_map.js @@ -0,0 +1 @@ +export { fun } from "rex/fun.js"; diff --git a/cli/tests/testdata/doc/use_import_map.out b/cli/tests/testdata/doc/use_import_map.out new file mode 100644 index 000000000..0b27ccf18 --- /dev/null +++ b/cli/tests/testdata/doc/use_import_map.out @@ -0,0 +1,5 @@ +Defined in [WILDCARD]/doc/module/fun.js:2:0 + +function fun(_a, _b) + This is some documentation + diff --git a/cli/tests/testdata/dynamic_import/b.js b/cli/tests/testdata/dynamic_import/b.js new file mode 100644 index 000000000..6ea50d360 --- /dev/null +++ b/cli/tests/testdata/dynamic_import/b.js @@ -0,0 +1,2 @@ +import "./bad.mjs"; +export default () => "error"; diff --git a/cli/tests/testdata/dynamic_import/c.js b/cli/tests/testdata/dynamic_import/c.js new file mode 100644 index 000000000..20546455e --- /dev/null +++ b/cli/tests/testdata/dynamic_import/c.js @@ -0,0 +1,2 @@ +await import("./bad2.mjs"); +export default () => "error"; diff --git a/cli/tests/testdata/dynamic_import/permissions_blob_local.ts b/cli/tests/testdata/dynamic_import/permissions_blob_local.ts new file mode 100644 index 000000000..9ef4158ce --- /dev/null +++ b/cli/tests/testdata/dynamic_import/permissions_blob_local.ts @@ -0,0 +1,6 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +const code = `import "file:///${ + Deno.build.os == "windows" ? "C:/" : "" +}local_file.ts";`; +const blob = new Blob([code]); +await import(URL.createObjectURL(blob)); diff --git a/cli/tests/testdata/dynamic_import/permissions_blob_local.ts.out b/cli/tests/testdata/dynamic_import/permissions_blob_local.ts.out new file mode 100644 index 000000000..6dfa8e527 --- /dev/null +++ b/cli/tests/testdata/dynamic_import/permissions_blob_local.ts.out @@ -0,0 +1,5 @@ +error: Uncaught (in promise) TypeError: Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag + at blob:null/[WILDCARD]:1:0 +await import(URL.createObjectURL(blob)); +^ + at async file:///[WILDCARD]/dynamic_import/permissions_blob_local.ts:6:1 diff --git a/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts b/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts new file mode 100644 index 000000000..1e2c8c21a --- /dev/null +++ b/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts @@ -0,0 +1,4 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +const code = `import "https://example.com/some/file.ts";`; +const blob = new Blob([code]); +await import(URL.createObjectURL(blob)); diff --git a/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts.out b/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts.out new file mode 100644 index 000000000..60d71ed6d --- /dev/null +++ b/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts.out @@ -0,0 +1,5 @@ +error: Uncaught (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag + at blob:null/[WILDCARD]:1:0 +await import(URL.createObjectURL(blob)); +^ + at async file:///[WILDCARD]/dynamic_import/permissions_blob_remote.ts:4:1 diff --git a/cli/tests/testdata/dynamic_import/permissions_data_local.ts b/cli/tests/testdata/dynamic_import/permissions_data_local.ts new file mode 100644 index 000000000..be4fc1c34 --- /dev/null +++ b/cli/tests/testdata/dynamic_import/permissions_data_local.ts @@ -0,0 +1,5 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +const code = `import "file:///${ + Deno.build.os == "windows" ? "C:/" : "" +}local_file.ts";`; +await import(`data:application/javascript;base64,${btoa(code)}`); diff --git a/cli/tests/testdata/dynamic_import/permissions_data_local.ts.out b/cli/tests/testdata/dynamic_import/permissions_data_local.ts.out new file mode 100644 index 000000000..c9fcb0a17 --- /dev/null +++ b/cli/tests/testdata/dynamic_import/permissions_data_local.ts.out @@ -0,0 +1,5 @@ +error: Uncaught (in promise) TypeError: Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag + at data:application/javascript;base64,[WILDCARD]:1:0 +await import(`data:application/javascript;base64,${btoa(code)}`); +^ + at async file:///[WILDCARD]/dynamic_import/permissions_data_local.ts:5:1 diff --git a/cli/tests/testdata/dynamic_import/permissions_data_remote.ts b/cli/tests/testdata/dynamic_import/permissions_data_remote.ts new file mode 100644 index 000000000..b0a9540c3 --- /dev/null +++ b/cli/tests/testdata/dynamic_import/permissions_data_remote.ts @@ -0,0 +1,3 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +const code = `import "https://example.com/some/file.ts";`; +await import(`data:application/javascript;base64,${btoa(code)}`); diff --git a/cli/tests/testdata/dynamic_import/permissions_data_remote.ts.out b/cli/tests/testdata/dynamic_import/permissions_data_remote.ts.out new file mode 100644 index 000000000..772f0b51e --- /dev/null +++ b/cli/tests/testdata/dynamic_import/permissions_data_remote.ts.out @@ -0,0 +1,5 @@ +error: Uncaught (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag + at data:application/javascript;base64,aW1wb3J0ICJodHRwczovL2V4YW1wbGUuY29tL3NvbWUvZmlsZS50cyI7:1:0 +await import(`data:application/javascript;base64,${btoa(code)}`); +^ + at async file:///[WILDCARD]/dynamic_import/permissions_data_remote.ts:3:1 diff --git a/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts b/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts new file mode 100644 index 000000000..0033bcccc --- /dev/null +++ b/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts @@ -0,0 +1,3 @@ +await import( + "http://localhost:4545/dynamic_import/static_remote.ts" +); diff --git a/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts.out b/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts.out new file mode 100644 index 000000000..cd7f58bb9 --- /dev/null +++ b/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts.out @@ -0,0 +1,5 @@ +error: Uncaught (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag + at http://localhost:4545/dynamic_import/static_remote.ts:2:0 +await import( +^ + at async file:///[WILDCARD]/dynamic_import/permissions_remote_remote.ts:1:1 diff --git a/cli/tests/testdata/dynamic_import/static_remote.ts b/cli/tests/testdata/dynamic_import/static_remote.ts new file mode 100644 index 000000000..2d6e820fd --- /dev/null +++ b/cli/tests/testdata/dynamic_import/static_remote.ts @@ -0,0 +1,2 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +import "https://example.com/some/file.ts"; diff --git a/cli/tests/testdata/dynamic_import_conditional.js b/cli/tests/testdata/dynamic_import_conditional.js new file mode 100644 index 000000000..1b4193e3e --- /dev/null +++ b/cli/tests/testdata/dynamic_import_conditional.js @@ -0,0 +1,3 @@ +const Worker = globalThis.Worker ?? (await import("worker_threads")).Worker; + +console.log(!!Worker); diff --git a/cli/tests/testdata/dynamic_import_conditional.js.out b/cli/tests/testdata/dynamic_import_conditional.js.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/testdata/dynamic_import_conditional.js.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/testdata/echo.ts b/cli/tests/testdata/echo.ts new file mode 100644 index 000000000..84a645433 --- /dev/null +++ b/cli/tests/testdata/echo.ts @@ -0,0 +1,6 @@ +function echo(args: string[]) { + const msg = args.join(", "); + Deno.stdout.write(new TextEncoder().encode(msg)); +} + +echo(Deno.args); diff --git a/cli/tests/testdata/echo_server.ts b/cli/tests/testdata/echo_server.ts new file mode 100644 index 000000000..b23867cdd --- /dev/null +++ b/cli/tests/testdata/echo_server.ts @@ -0,0 +1,12 @@ +import { copy } from "../../../test_util/std/io/util.ts"; +const addr = Deno.args[0] || "0.0.0.0:4544"; +const [hostname, port] = addr.split(":"); +const listener = Deno.listen({ hostname, port: Number(port) }); +console.log("listening on", addr); +listener.accept().then( + async (conn) => { + console.log("received bytes:", await copy(conn, conn)); + conn.close(); + listener.close(); + }, +); diff --git a/cli/tests/testdata/encoding/utf-16be.ts b/cli/tests/testdata/encoding/utf-16be.ts new file mode 100644 index 000000000..3d0144d7c Binary files /dev/null and b/cli/tests/testdata/encoding/utf-16be.ts differ diff --git a/cli/tests/testdata/encoding/utf-16le.ts b/cli/tests/testdata/encoding/utf-16le.ts new file mode 100644 index 000000000..6f0e415f2 Binary files /dev/null and b/cli/tests/testdata/encoding/utf-16le.ts differ diff --git a/cli/tests/testdata/encoding/utf-8.ts b/cli/tests/testdata/encoding/utf-8.ts new file mode 100644 index 000000000..bf889aeb7 --- /dev/null +++ b/cli/tests/testdata/encoding/utf-8.ts @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/cli/tests/testdata/encoding/windows-1255 b/cli/tests/testdata/encoding/windows-1255 new file mode 100644 index 000000000..ec5cad7fd --- /dev/null +++ b/cli/tests/testdata/encoding/windows-1255 @@ -0,0 +1 @@ +console.log("ùìåí òåìí"); diff --git a/cli/tests/testdata/error_001.ts b/cli/tests/testdata/error_001.ts new file mode 100644 index 000000000..b01068bc0 --- /dev/null +++ b/cli/tests/testdata/error_001.ts @@ -0,0 +1,9 @@ +function foo(): never { + throw Error("bad"); +} + +function bar() { + foo(); +} + +bar(); diff --git a/cli/tests/testdata/error_001.ts.out b/cli/tests/testdata/error_001.ts.out new file mode 100644 index 000000000..25664a9a4 --- /dev/null +++ b/cli/tests/testdata/error_001.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught Error: bad + throw Error("bad"); + ^ + at foo ([WILDCARD]/error_001.ts:2:9) + at bar ([WILDCARD]/error_001.ts:6:3) + at [WILDCARD]/error_001.ts:9:1 diff --git a/cli/tests/testdata/error_002.ts b/cli/tests/testdata/error_002.ts new file mode 100644 index 000000000..6aa0fcc3b --- /dev/null +++ b/cli/tests/testdata/error_002.ts @@ -0,0 +1,7 @@ +import { throwsError } from "./subdir/mod1.ts"; + +function foo() { + throwsError(); +} + +foo(); diff --git a/cli/tests/testdata/error_002.ts.out b/cli/tests/testdata/error_002.ts.out new file mode 100644 index 000000000..96b9e602a --- /dev/null +++ b/cli/tests/testdata/error_002.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught Error: exception from mod1 + throw Error("exception from mod1"); + ^ + at throwsError ([WILDCARD]/subdir/mod1.ts:16:9) + at foo ([WILDCARD]/error_002.ts:4:3) + at [WILDCARD]/error_002.ts:7:1 diff --git a/cli/tests/testdata/error_003_typescript.ts b/cli/tests/testdata/error_003_typescript.ts new file mode 100644 index 000000000..e1f882123 --- /dev/null +++ b/cli/tests/testdata/error_003_typescript.ts @@ -0,0 +1,20 @@ +// deno-lint-ignore-file +let x = { + a: { + b: { + c() { + return { d: "hello" }; + }, + }, + }, +}; +let y = { + a: { + b: { + c() { + return { d: 1234 }; + }, + }, + }, +}; +x = y; diff --git a/cli/tests/testdata/error_003_typescript.ts.out b/cli/tests/testdata/error_003_typescript.ts.out new file mode 100644 index 000000000..bbb2ec470 --- /dev/null +++ b/cli/tests/testdata/error_003_typescript.ts.out @@ -0,0 +1,7 @@ +[WILDCARD] +error: TS2322 [ERROR]: Type '{ a: { b: { c(): { d: number; }; }; }; }' is not assignable to type '{ a: { b: { c(): { d: string; }; }; }; }'. + The types of 'a.b.c().d' are incompatible between these types. + Type 'number' is not assignable to type 'string'. +x = y; +^ + at [WILDCARD]/error_003_typescript.ts:20:1 diff --git a/cli/tests/testdata/error_004_missing_module.ts b/cli/tests/testdata/error_004_missing_module.ts new file mode 100644 index 000000000..82b281181 --- /dev/null +++ b/cli/tests/testdata/error_004_missing_module.ts @@ -0,0 +1,3 @@ +import * as badModule from "./bad-module.ts"; + +console.log(badModule); diff --git a/cli/tests/testdata/error_004_missing_module.ts.out b/cli/tests/testdata/error_004_missing_module.ts.out new file mode 100644 index 000000000..8521f4424 --- /dev/null +++ b/cli/tests/testdata/error_004_missing_module.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Cannot resolve module "file:///[WILDCARD]/bad-module.ts" from "file:///[WILDCARD]/error_004_missing_module.ts". + at file:///[WILDCARD]/error_004_missing_module.ts:1:0 diff --git a/cli/tests/testdata/error_005_missing_dynamic_import.ts b/cli/tests/testdata/error_005_missing_dynamic_import.ts new file mode 100644 index 000000000..8ea8ff94e --- /dev/null +++ b/cli/tests/testdata/error_005_missing_dynamic_import.ts @@ -0,0 +1,3 @@ +(async () => { + const _badModule = await import("./bad-module.ts"); +})(); diff --git a/cli/tests/testdata/error_005_missing_dynamic_import.ts.out b/cli/tests/testdata/error_005_missing_dynamic_import.ts.out new file mode 100644 index 000000000..e8647a44e --- /dev/null +++ b/cli/tests/testdata/error_005_missing_dynamic_import.ts.out @@ -0,0 +1,4 @@ +error: Uncaught (in promise) TypeError: Cannot resolve module "[WILDCARD]/bad-module.ts". + const _badModule = await import("./bad-module.ts"); + ^ + at async file://[WILDCARD]/error_005_missing_dynamic_import.ts:2:22 diff --git a/cli/tests/testdata/error_006_import_ext_failure.ts b/cli/tests/testdata/error_006_import_ext_failure.ts new file mode 100644 index 000000000..3c32303a3 --- /dev/null +++ b/cli/tests/testdata/error_006_import_ext_failure.ts @@ -0,0 +1 @@ +import "./non-existent"; diff --git a/cli/tests/testdata/error_006_import_ext_failure.ts.out b/cli/tests/testdata/error_006_import_ext_failure.ts.out new file mode 100644 index 000000000..24d819e5d --- /dev/null +++ b/cli/tests/testdata/error_006_import_ext_failure.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Cannot resolve module "[WILDCARD]/non-existent" from "[WILDCARD]/error_006_import_ext_failure.ts". + at file:///[WILDCARD]/error_006_import_ext_failure.ts:1:0 diff --git a/cli/tests/testdata/error_007_any.ts b/cli/tests/testdata/error_007_any.ts new file mode 100644 index 000000000..778886fcb --- /dev/null +++ b/cli/tests/testdata/error_007_any.ts @@ -0,0 +1 @@ +throw {}; diff --git a/cli/tests/testdata/error_007_any.ts.out b/cli/tests/testdata/error_007_any.ts.out new file mode 100644 index 000000000..45dbffd04 --- /dev/null +++ b/cli/tests/testdata/error_007_any.ts.out @@ -0,0 +1 @@ +[WILDCARD]error: Uncaught # diff --git a/cli/tests/testdata/error_008_checkjs.js b/cli/tests/testdata/error_008_checkjs.js new file mode 100644 index 000000000..f0856d94c --- /dev/null +++ b/cli/tests/testdata/error_008_checkjs.js @@ -0,0 +1,5 @@ +// console.log intentionally misspelled to trigger a type error +consol.log("hello world!"); + +// the following error should be ignored and not output to the console +const foo = new Foo(); diff --git a/cli/tests/testdata/error_008_checkjs.js.out b/cli/tests/testdata/error_008_checkjs.js.out new file mode 100644 index 000000000..e43187382 --- /dev/null +++ b/cli/tests/testdata/error_008_checkjs.js.out @@ -0,0 +1,4 @@ +[WILDCARD]error: Uncaught ReferenceError: consol is not defined +consol.log("hello world!"); +^ + at [WILDCARD]/error_008_checkjs.js:2:1 diff --git a/cli/tests/testdata/error_009_extensions_error.js b/cli/tests/testdata/error_009_extensions_error.js new file mode 100644 index 000000000..01b97ea38 --- /dev/null +++ b/cli/tests/testdata/error_009_extensions_error.js @@ -0,0 +1,2 @@ +// Missing arg. +new Event(); diff --git a/cli/tests/testdata/error_009_extensions_error.js.out b/cli/tests/testdata/error_009_extensions_error.js.out new file mode 100644 index 000000000..8510980f6 --- /dev/null +++ b/cli/tests/testdata/error_009_extensions_error.js.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught TypeError: Failed to construct 'Event': 1 argument required, but only 0 present. +new Event(); +^ + at [WILDCARD] + at new Event (deno:ext/web/[WILDCARD]) + at [WILDCARD] diff --git a/cli/tests/testdata/error_009_missing_js_module.disabled b/cli/tests/testdata/error_009_missing_js_module.disabled new file mode 100644 index 000000000..3156fc94b --- /dev/null +++ b/cli/tests/testdata/error_009_missing_js_module.disabled @@ -0,0 +1,4 @@ +args: tests/error_009_missing_js_module.js +check_stderr: true +exit_code: 1 +output: tests/error_009_missing_js_module.js.out diff --git a/cli/tests/testdata/error_009_missing_js_module.js b/cli/tests/testdata/error_009_missing_js_module.js new file mode 100644 index 000000000..e6ca88934 --- /dev/null +++ b/cli/tests/testdata/error_009_missing_js_module.js @@ -0,0 +1 @@ +import "./bad-module.js"; diff --git a/cli/tests/testdata/error_009_missing_js_module.js.out b/cli/tests/testdata/error_009_missing_js_module.js.out new file mode 100644 index 000000000..edb08da1c --- /dev/null +++ b/cli/tests/testdata/error_009_missing_js_module.js.out @@ -0,0 +1 @@ +Cannot resolve module "./bad-module.js" from "[WILDCARD]error_009_missing_js_module.js" diff --git a/cli/tests/testdata/error_010_nonexistent_arg.disabled b/cli/tests/testdata/error_010_nonexistent_arg.disabled new file mode 100644 index 000000000..9d183107c --- /dev/null +++ b/cli/tests/testdata/error_010_nonexistent_arg.disabled @@ -0,0 +1,4 @@ +args: not-a-valid-filename.ts +output: tests/error_010_nonexistent_arg.out +exit_code: 1 +check_stderr: true diff --git a/cli/tests/testdata/error_010_nonexistent_arg.out b/cli/tests/testdata/error_010_nonexistent_arg.out new file mode 100644 index 000000000..ef4f7b041 --- /dev/null +++ b/cli/tests/testdata/error_010_nonexistent_arg.out @@ -0,0 +1 @@ +[WILDCARD]Cannot resolve module "file:[WILDCARD]not-a-valid-filename.ts" from "." diff --git a/cli/tests/testdata/error_011_bad_module_specifier.ts b/cli/tests/testdata/error_011_bad_module_specifier.ts new file mode 100644 index 000000000..1c57e37a5 --- /dev/null +++ b/cli/tests/testdata/error_011_bad_module_specifier.ts @@ -0,0 +1,3 @@ +import * as badModule from "bad-module.ts"; + +console.log(badModule); diff --git a/cli/tests/testdata/error_011_bad_module_specifier.ts.out b/cli/tests/testdata/error_011_bad_module_specifier.ts.out new file mode 100644 index 000000000..713072191 --- /dev/null +++ b/cli/tests/testdata/error_011_bad_module_specifier.ts.out @@ -0,0 +1 @@ +[WILDCARD]error: Relative import path "bad-module.ts" not prefixed with / or ./ or ../ from "[WILDCARD]/error_011_bad_module_specifier.ts" diff --git a/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts b/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts new file mode 100644 index 000000000..5f39f407c --- /dev/null +++ b/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts @@ -0,0 +1,3 @@ +(async () => { + const _badModule = await import("bad-module.ts"); +})(); diff --git a/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts.out b/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts.out new file mode 100644 index 000000000..0d0b168a4 --- /dev/null +++ b/cli/tests/testdata/error_012_bad_dynamic_import_specifier.ts.out @@ -0,0 +1,5 @@ +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 ../ from "[WILDCARD]/error_012_bad_dynamic_import_specifier.ts" + const _badModule = await import("bad-module.ts"); + ^ + at async file:///[WILDCARD]/error_012_bad_dynamic_import_specifier.ts:2:22 diff --git a/cli/tests/testdata/error_013_missing_script.out b/cli/tests/testdata/error_013_missing_script.out new file mode 100644 index 000000000..d1c257bdb --- /dev/null +++ b/cli/tests/testdata/error_013_missing_script.out @@ -0,0 +1 @@ +error: Cannot resolve module "[WILDCARD]missing_file_name". diff --git a/cli/tests/testdata/error_014_catch_dynamic_import_error.js b/cli/tests/testdata/error_014_catch_dynamic_import_error.js new file mode 100644 index 000000000..483be7b1a --- /dev/null +++ b/cli/tests/testdata/error_014_catch_dynamic_import_error.js @@ -0,0 +1,31 @@ +(async () => { + try { + await import("does not exist"); + } catch (err) { + console.log("Caught direct dynamic import error."); + console.log(err); + } + + try { + await import("./subdir/indirect_import_error.js"); + } catch (err) { + console.log("Caught indirect direct dynamic import error."); + console.log(err); + } + + try { + await import("./subdir/throws.js"); + } catch (err) { + console.log("Caught error thrown by dynamically imported module."); + console.log(err); + } + + try { + await import("./subdir/indirect_throws.js"); + } catch (err) { + console.log( + "Caught error thrown indirectly by dynamically imported module.", + ); + console.log(err); + } +})(); diff --git a/cli/tests/testdata/error_014_catch_dynamic_import_error.js.out b/cli/tests/testdata/error_014_catch_dynamic_import_error.js.out new file mode 100644 index 000000000..8f2d695f7 --- /dev/null +++ b/cli/tests/testdata/error_014_catch_dynamic_import_error.js.out @@ -0,0 +1,12 @@ +Caught direct dynamic import error. +TypeError: Relative import path "does not exist" not prefixed with / or ./ or ../ from "[WILDCARD]/error_014_catch_dynamic_import_error.js" + at async file:///[WILDCARD]/error_014_catch_dynamic_import_error.js:3:5 +Caught indirect direct dynamic import error. +TypeError: Relative import path "does not exist either" not prefixed with / or ./ or ../ from "[WILDCARD]/indirect_import_error.js" + at async file:///[WILDCARD]/error_014_catch_dynamic_import_error.js:10:5 +Caught error thrown by dynamically imported module. +Error: An error + at file:///[WILDCARD]/subdir/throws.js:6:7 +Caught error thrown indirectly by dynamically imported module. +Error: An error + at file:///[WILDCARD]/subdir/throws.js:6:7 diff --git a/cli/tests/testdata/error_015_dynamic_import_permissions.js b/cli/tests/testdata/error_015_dynamic_import_permissions.js new file mode 100644 index 000000000..73da56fd8 --- /dev/null +++ b/cli/tests/testdata/error_015_dynamic_import_permissions.js @@ -0,0 +1,3 @@ +(async () => { + await import("http://localhost:4545/subdir/mod4.js"); +})(); diff --git a/cli/tests/testdata/error_015_dynamic_import_permissions.out b/cli/tests/testdata/error_015_dynamic_import_permissions.out new file mode 100644 index 000000000..a509cfdab --- /dev/null +++ b/cli/tests/testdata/error_015_dynamic_import_permissions.out @@ -0,0 +1,4 @@ +error: Uncaught (in promise) TypeError: Requires net access to "localhost:4545", run again with the --allow-net flag + await import("http://localhost:4545/subdir/mod4.js"); + ^ + at async file:///[WILDCARD]/error_015_dynamic_import_permissions.js:2:3 diff --git a/cli/tests/testdata/error_016_dynamic_import_permissions2.js b/cli/tests/testdata/error_016_dynamic_import_permissions2.js new file mode 100644 index 000000000..f018d4a2e --- /dev/null +++ b/cli/tests/testdata/error_016_dynamic_import_permissions2.js @@ -0,0 +1,5 @@ +// If this is executed with --allow-net but not --allow-read the following +// import should cause a permission denied error. +(async () => { + await import("http://localhost:4545/subdir/evil_remote_import.js"); +})(); diff --git a/cli/tests/testdata/error_016_dynamic_import_permissions2.out b/cli/tests/testdata/error_016_dynamic_import_permissions2.out new file mode 100644 index 000000000..0b43c5b91 --- /dev/null +++ b/cli/tests/testdata/error_016_dynamic_import_permissions2.out @@ -0,0 +1,4 @@ +[WILDCARD] +error: 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:0 diff --git a/cli/tests/testdata/error_017_hide_long_source_ts.ts b/cli/tests/testdata/error_017_hide_long_source_ts.ts new file mode 100644 index 000000000..d61cb1277 --- /dev/null +++ b/cli/tests/testdata/error_017_hide_long_source_ts.ts @@ -0,0 +1,3 @@ +// deno-fmt-ignore-file +const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; +LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; diff --git a/cli/tests/testdata/error_017_hide_long_source_ts.ts.out b/cli/tests/testdata/error_017_hide_long_source_ts.ts.out new file mode 100644 index 000000000..917061ab9 --- /dev/null +++ b/cli/tests/testdata/error_017_hide_long_source_ts.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +error: TS2532 [ERROR]: Object is possibly 'undefined'. + at [WILDCARD]/error_017_hide_long_source_ts.ts:3:1 diff --git a/cli/tests/testdata/error_018_hide_long_source_js.js b/cli/tests/testdata/error_018_hide_long_source_js.js new file mode 100644 index 000000000..d61cb1277 --- /dev/null +++ b/cli/tests/testdata/error_018_hide_long_source_js.js @@ -0,0 +1,3 @@ +// deno-fmt-ignore-file +const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; +LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; diff --git a/cli/tests/testdata/error_018_hide_long_source_js.js.out b/cli/tests/testdata/error_018_hide_long_source_js.js.out new file mode 100644 index 000000000..cc98669a7 --- /dev/null +++ b/cli/tests/testdata/error_018_hide_long_source_js.js.out @@ -0,0 +1,2 @@ +error: Uncaught TypeError: Cannot read properties of undefined (reading 'a') + at file:///[WILDCARD]/error_018_hide_long_source_js.js:3:206 diff --git a/cli/tests/testdata/error_019_stack_function.ts b/cli/tests/testdata/error_019_stack_function.ts new file mode 100644 index 000000000..c5eeae8f4 --- /dev/null +++ b/cli/tests/testdata/error_019_stack_function.ts @@ -0,0 +1,10 @@ +function foo(): never { + throw new Error("function"); +} + +try { + foo(); +} catch (error) { + console.log(error.stack); + throw error; +} diff --git a/cli/tests/testdata/error_019_stack_function.ts.out b/cli/tests/testdata/error_019_stack_function.ts.out new file mode 100644 index 000000000..03967d12b --- /dev/null +++ b/cli/tests/testdata/error_019_stack_function.ts.out @@ -0,0 +1,8 @@ +[WILDCARD]Error: function + at foo ([WILDCARD]/error_019_stack_function.ts:[WILDCARD]) + at [WILDCARD]/error_019_stack_function.ts:[WILDCARD] +error: Uncaught Error: function + throw new Error("function"); + ^ + at foo ([WILDCARD]/error_019_stack_function.ts:[WILDCARD]) + at [WILDCARD]/error_019_stack_function.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_020_stack_constructor.ts b/cli/tests/testdata/error_020_stack_constructor.ts new file mode 100644 index 000000000..49988280b --- /dev/null +++ b/cli/tests/testdata/error_020_stack_constructor.ts @@ -0,0 +1,12 @@ +class A { + constructor() { + throw new Error("constructor"); + } +} + +try { + new A(); +} catch (error) { + console.log(error.stack); + throw error; +} diff --git a/cli/tests/testdata/error_020_stack_constructor.ts.out b/cli/tests/testdata/error_020_stack_constructor.ts.out new file mode 100644 index 000000000..01fdfb3c4 --- /dev/null +++ b/cli/tests/testdata/error_020_stack_constructor.ts.out @@ -0,0 +1,8 @@ +[WILDCARD]Error: constructor + at new A ([WILDCARD]/error_020_stack_constructor.ts:[WILDCARD]) + at [WILDCARD]/error_020_stack_constructor.ts:[WILDCARD] +error: Uncaught Error: constructor + throw new Error("constructor"); + ^ + at new A ([WILDCARD]/error_020_stack_constructor.ts:[WILDCARD]) + at [WILDCARD]/error_020_stack_constructor.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_021_stack_method.ts b/cli/tests/testdata/error_021_stack_method.ts new file mode 100644 index 000000000..a52d00deb --- /dev/null +++ b/cli/tests/testdata/error_021_stack_method.ts @@ -0,0 +1,12 @@ +class A { + m(): never { + throw new Error("method"); + } +} + +try { + new A().m(); +} catch (error) { + console.log(error.stack); + throw error; +} diff --git a/cli/tests/testdata/error_021_stack_method.ts.out b/cli/tests/testdata/error_021_stack_method.ts.out new file mode 100644 index 000000000..999f0aaa0 --- /dev/null +++ b/cli/tests/testdata/error_021_stack_method.ts.out @@ -0,0 +1,8 @@ +[WILDCARD]Error: method + at A.m ([WILDCARD]/error_021_stack_method.ts:[WILDCARD]) + at [WILDCARD]/error_021_stack_method.ts:[WILDCARD] +error: Uncaught Error: method + throw new Error("method"); + ^ + at A.m ([WILDCARD]/error_021_stack_method.ts:[WILDCARD]) + at [WILDCARD]/error_021_stack_method.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_022_stack_custom_error.ts b/cli/tests/testdata/error_022_stack_custom_error.ts new file mode 100644 index 000000000..b95743503 --- /dev/null +++ b/cli/tests/testdata/error_022_stack_custom_error.ts @@ -0,0 +1,14 @@ +class CustomError extends Error { + constructor() { + super(); + this.name = "CustomError"; + } + + get message(): string { + return "custom error"; + } +} + +const error = new CustomError(); +console.log(error.stack); +throw error; diff --git a/cli/tests/testdata/error_022_stack_custom_error.ts.out b/cli/tests/testdata/error_022_stack_custom_error.ts.out new file mode 100644 index 000000000..78b0dcaea --- /dev/null +++ b/cli/tests/testdata/error_022_stack_custom_error.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]CustomError: custom error + at [WILDCARD]/error_022_stack_custom_error.ts:[WILDCARD] +error: Uncaught CustomError: custom error +const error = new CustomError(); + ^ + at [WILDCARD]/error_022_stack_custom_error.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_023_stack_async.ts b/cli/tests/testdata/error_023_stack_async.ts new file mode 100644 index 000000000..99e676e26 --- /dev/null +++ b/cli/tests/testdata/error_023_stack_async.ts @@ -0,0 +1,12 @@ +const p = (async () => { + await Promise.resolve().then((): never => { + throw new Error("async"); + }); +})(); + +try { + await p; +} catch (error) { + console.log(error.stack); + throw error; +} diff --git a/cli/tests/testdata/error_023_stack_async.ts.out b/cli/tests/testdata/error_023_stack_async.ts.out new file mode 100644 index 000000000..95f0eae64 --- /dev/null +++ b/cli/tests/testdata/error_023_stack_async.ts.out @@ -0,0 +1,10 @@ +[WILDCARD]Error: async + at [WILDCARD]/error_023_stack_async.ts:[WILDCARD] + at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] + at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] +error: Uncaught Error: async + throw new Error("async"); + ^ + at [WILDCARD]/error_023_stack_async.ts:[WILDCARD] + at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] + at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_024_stack_promise_all.ts b/cli/tests/testdata/error_024_stack_promise_all.ts new file mode 100644 index 000000000..ddaf0dbaa --- /dev/null +++ b/cli/tests/testdata/error_024_stack_promise_all.ts @@ -0,0 +1,14 @@ +const p = Promise.all([ + Promise.resolve(), + (async (): Promise => { + await Promise.resolve(); + throw new Error("Promise.all()"); + })(), +]); + +try { + await p; +} catch (error) { + console.log(error.stack); + throw error; +} diff --git a/cli/tests/testdata/error_024_stack_promise_all.ts.out b/cli/tests/testdata/error_024_stack_promise_all.ts.out new file mode 100644 index 000000000..6cd88715c --- /dev/null +++ b/cli/tests/testdata/error_024_stack_promise_all.ts.out @@ -0,0 +1,10 @@ +[WILDCARD]Error: Promise.all() + at [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] + at async Promise.all (index 1) + at async [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] +error: Uncaught Error: Promise.all() + throw new Error("Promise.all()"); + ^ + at [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] + at async Promise.all (index 1) + at async [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD] diff --git a/cli/tests/testdata/error_025_tab_indent b/cli/tests/testdata/error_025_tab_indent new file mode 100644 index 000000000..35a25bcea --- /dev/null +++ b/cli/tests/testdata/error_025_tab_indent @@ -0,0 +1,9 @@ +function foo() { + throw Error("bad"); +} + +function bar() { + foo(); +} + +bar(); diff --git a/cli/tests/testdata/error_025_tab_indent.out b/cli/tests/testdata/error_025_tab_indent.out new file mode 100644 index 000000000..f1466ce3f --- /dev/null +++ b/cli/tests/testdata/error_025_tab_indent.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught Error: bad + throw Error("bad"); + ^ + at foo ([WILDCARD]/error_025_tab_indent:2:8) + at bar ([WILDCARD]/error_025_tab_indent:6:2) + at [WILDCARD]/error_025_tab_indent:9:1 diff --git a/cli/tests/testdata/error_026_remote_import_error.ts b/cli/tests/testdata/error_026_remote_import_error.ts new file mode 100644 index 000000000..2718e768a --- /dev/null +++ b/cli/tests/testdata/error_026_remote_import_error.ts @@ -0,0 +1 @@ +import "http://localhost:4545/error_001.ts"; diff --git a/cli/tests/testdata/error_026_remote_import_error.ts.out b/cli/tests/testdata/error_026_remote_import_error.ts.out new file mode 100644 index 000000000..bec0cf1c5 --- /dev/null +++ b/cli/tests/testdata/error_026_remote_import_error.ts.out @@ -0,0 +1,7 @@ +[WILDCARD]error: Uncaught Error: bad + throw Error("bad"); + ^ + at foo (http://localhost:4545/error_001.ts:2:9) + at bar (http://localhost:4545/error_001.ts:6:3) + at http://localhost:4545/error_001.ts:9:1 +[WILDCARD] diff --git a/cli/tests/testdata/error_027_bundle_with_bare_import.ts b/cli/tests/testdata/error_027_bundle_with_bare_import.ts new file mode 100644 index 000000000..c0748305d --- /dev/null +++ b/cli/tests/testdata/error_027_bundle_with_bare_import.ts @@ -0,0 +1 @@ +import "foo"; diff --git a/cli/tests/testdata/error_027_bundle_with_bare_import.ts.out b/cli/tests/testdata/error_027_bundle_with_bare_import.ts.out new file mode 100644 index 000000000..3aa4a42a2 --- /dev/null +++ b/cli/tests/testdata/error_027_bundle_with_bare_import.ts.out @@ -0,0 +1 @@ +[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ from "file:///[WILDCARD]/error_027_bundle_with_bare_import.ts" diff --git a/cli/tests/testdata/error_import_map_unable_to_load.out b/cli/tests/testdata/error_import_map_unable_to_load.out new file mode 100644 index 000000000..50760e438 --- /dev/null +++ b/cli/tests/testdata/error_import_map_unable_to_load.out @@ -0,0 +1,4 @@ +error: Unable to load '[WILDCARD]' import map + +Caused by: + [WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/error_local_static_import_from_remote.js b/cli/tests/testdata/error_local_static_import_from_remote.js new file mode 100644 index 000000000..eb7fd23ba --- /dev/null +++ b/cli/tests/testdata/error_local_static_import_from_remote.js @@ -0,0 +1 @@ +import "file:///some/dir/file.js"; diff --git a/cli/tests/testdata/error_local_static_import_from_remote.js.out b/cli/tests/testdata/error_local_static_import_from_remote.js.out new file mode 100644 index 000000000..44b676532 --- /dev/null +++ b/cli/tests/testdata/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/error_local_static_import_from_remote.js:1:0 diff --git a/cli/tests/testdata/error_local_static_import_from_remote.ts b/cli/tests/testdata/error_local_static_import_from_remote.ts new file mode 100644 index 000000000..a831db0c4 --- /dev/null +++ b/cli/tests/testdata/error_local_static_import_from_remote.ts @@ -0,0 +1 @@ +import "file:///some/dir/file.ts"; diff --git a/cli/tests/testdata/error_local_static_import_from_remote.ts.out b/cli/tests/testdata/error_local_static_import_from_remote.ts.out new file mode 100644 index 000000000..f8f409de0 --- /dev/null +++ b/cli/tests/testdata/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/error_local_static_import_from_remote.ts:1:0 diff --git a/cli/tests/testdata/error_missing_module_named_import.ts b/cli/tests/testdata/error_missing_module_named_import.ts new file mode 100644 index 000000000..9eb5239ff --- /dev/null +++ b/cli/tests/testdata/error_missing_module_named_import.ts @@ -0,0 +1,3 @@ +import { a } from "./does_not_exist.js"; + +console.log(a); diff --git a/cli/tests/testdata/error_missing_module_named_import.ts.out b/cli/tests/testdata/error_missing_module_named_import.ts.out new file mode 100644 index 000000000..6f09f0c0d --- /dev/null +++ b/cli/tests/testdata/error_missing_module_named_import.ts.out @@ -0,0 +1,2 @@ +error: Cannot resolve module "[WILDCARD]/does_not_exist.js" from "[WILDCARD]/error_missing_module_named_import.ts". + at [WILDCARD]/error_missing_module_named_import.ts:1:0 diff --git a/cli/tests/testdata/error_no_check.ts b/cli/tests/testdata/error_no_check.ts new file mode 100644 index 000000000..db9257a1d --- /dev/null +++ b/cli/tests/testdata/error_no_check.ts @@ -0,0 +1 @@ +export { AnInterface, isAnInterface } from "./subdir/type_and_code.ts"; diff --git a/cli/tests/testdata/error_no_check.ts.out b/cli/tests/testdata/error_no_check.ts.out new file mode 100644 index 000000000..cac1367ba --- /dev/null +++ b/cli/tests/testdata/error_no_check.ts.out @@ -0,0 +1,2 @@ +error: Uncaught SyntaxError: The requested module './subdir/type_and_code.ts' does not provide an export named 'AnInterface' +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/error_syntax.js b/cli/tests/testdata/error_syntax.js new file mode 100644 index 000000000..c0414c356 --- /dev/null +++ b/cli/tests/testdata/error_syntax.js @@ -0,0 +1,3 @@ + +// deno-fmt-ignore-file +(the following is a syntax error ^^ ! ) diff --git a/cli/tests/testdata/error_syntax.js.out b/cli/tests/testdata/error_syntax.js.out new file mode 100644 index 000000000..4c2a007f1 --- /dev/null +++ b/cli/tests/testdata/error_syntax.js.out @@ -0,0 +1 @@ +error: Expected ,, got following at [WILDCARD]/error_syntax.js:3:5 diff --git a/cli/tests/testdata/error_syntax_empty_trailing_line.mjs b/cli/tests/testdata/error_syntax_empty_trailing_line.mjs new file mode 100644 index 000000000..864dfb0c7 --- /dev/null +++ b/cli/tests/testdata/error_syntax_empty_trailing_line.mjs @@ -0,0 +1,2 @@ +// Deliberately using .mjs to avoid triggering dprint +setTimeout(() => {}), diff --git a/cli/tests/testdata/error_syntax_empty_trailing_line.mjs.out b/cli/tests/testdata/error_syntax_empty_trailing_line.mjs.out new file mode 100644 index 000000000..daa37818d --- /dev/null +++ b/cli/tests/testdata/error_syntax_empty_trailing_line.mjs.out @@ -0,0 +1 @@ +error: Unexpected eof at [WILDCARD]/error_syntax_empty_trailing_line.mjs:2:21 diff --git a/cli/tests/testdata/error_type_definitions.ts b/cli/tests/testdata/error_type_definitions.ts new file mode 100644 index 000000000..ceb11787e --- /dev/null +++ b/cli/tests/testdata/error_type_definitions.ts @@ -0,0 +1,5 @@ +// @deno-types="./type_definitions/bar.d.ts" +import { Bar } from "./type_definitions/bar.js"; + +const bar = new Bar(); +console.log(bar); diff --git a/cli/tests/testdata/error_type_definitions.ts.out b/cli/tests/testdata/error_type_definitions.ts.out new file mode 100644 index 000000000..304ec1bdf --- /dev/null +++ b/cli/tests/testdata/error_type_definitions.ts.out @@ -0,0 +1 @@ +[WILDCARD]error: Relative import path "baz" not prefixed with / or ./ or ../ from "[WILDCARD]/type_definitions/bar.d.ts" diff --git a/cli/tests/testdata/error_worker_permissions_local.ts b/cli/tests/testdata/error_worker_permissions_local.ts new file mode 100644 index 000000000..b43c8fe94 --- /dev/null +++ b/cli/tests/testdata/error_worker_permissions_local.ts @@ -0,0 +1,4 @@ +new Worker( + new URL("./subdeb/worker_types.ts", import.meta.url).toString(), + { type: "module" }, +); diff --git a/cli/tests/testdata/error_worker_permissions_local.ts.out b/cli/tests/testdata/error_worker_permissions_local.ts.out new file mode 100644 index 000000000..e6404e8e3 --- /dev/null +++ b/cli/tests/testdata/error_worker_permissions_local.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +error: Uncaught (in worker "") Requires read access to "[WILDCARD]worker_types.ts", run again with the --allow-read flag +[WILDCARD] diff --git a/cli/tests/testdata/error_worker_permissions_remote.ts b/cli/tests/testdata/error_worker_permissions_remote.ts new file mode 100644 index 000000000..878c7080a --- /dev/null +++ b/cli/tests/testdata/error_worker_permissions_remote.ts @@ -0,0 +1,4 @@ +new Worker( + "http://localhost:4545/subdir/worker_types.ts", + { type: "module" }, +); diff --git a/cli/tests/testdata/error_worker_permissions_remote.ts.out b/cli/tests/testdata/error_worker_permissions_remote.ts.out new file mode 100644 index 000000000..74c7c3974 --- /dev/null +++ b/cli/tests/testdata/error_worker_permissions_remote.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +error: Uncaught (in worker "") Requires net access to "localhost:4545", run again with the --allow-net flag +[WILDCARD] diff --git a/cli/tests/testdata/es_private_fields.js b/cli/tests/testdata/es_private_fields.js new file mode 100644 index 000000000..b5f83e39c --- /dev/null +++ b/cli/tests/testdata/es_private_fields.js @@ -0,0 +1,15 @@ +class Foo { + #field = "field"; + + setValue(val) { + this.#field = val; + } + + getValue() { + return this.#field; + } +} + +const bar = new Foo(); +bar.setValue("PRIVATE"); +console.log(bar.getValue()); diff --git a/cli/tests/testdata/es_private_fields.js.out b/cli/tests/testdata/es_private_fields.js.out new file mode 100644 index 000000000..be1970b05 --- /dev/null +++ b/cli/tests/testdata/es_private_fields.js.out @@ -0,0 +1 @@ +PRIVATE diff --git a/cli/tests/testdata/esm_imports_a.js b/cli/tests/testdata/esm_imports_a.js new file mode 100644 index 000000000..673cd9aa3 --- /dev/null +++ b/cli/tests/testdata/esm_imports_a.js @@ -0,0 +1,3 @@ +import { retb } from "./esm_imports_b.js"; + +if (retb() != "b") throw Error(); diff --git a/cli/tests/testdata/esm_imports_b.js b/cli/tests/testdata/esm_imports_b.js new file mode 100644 index 000000000..840121368 --- /dev/null +++ b/cli/tests/testdata/esm_imports_b.js @@ -0,0 +1,4 @@ +// deno-lint-ignore-file +export function retb() { + return "b"; +} diff --git a/cli/tests/testdata/exec_path.ts b/cli/tests/testdata/exec_path.ts new file mode 100644 index 000000000..b70b23237 --- /dev/null +++ b/cli/tests/testdata/exec_path.ts @@ -0,0 +1 @@ +console.log(Deno.execPath()); diff --git a/cli/tests/testdata/exit_error42.ts b/cli/tests/testdata/exit_error42.ts new file mode 100644 index 000000000..e4db41f3a --- /dev/null +++ b/cli/tests/testdata/exit_error42.ts @@ -0,0 +1,3 @@ +console.log("before"); +Deno.exit(42); +console.log("after"); diff --git a/cli/tests/testdata/exit_error42.ts.out b/cli/tests/testdata/exit_error42.ts.out new file mode 100644 index 000000000..90be1f305 --- /dev/null +++ b/cli/tests/testdata/exit_error42.ts.out @@ -0,0 +1 @@ +before diff --git a/cli/tests/testdata/export_type_def.ts b/cli/tests/testdata/export_type_def.ts new file mode 100644 index 000000000..e33b70a64 --- /dev/null +++ b/cli/tests/testdata/export_type_def.ts @@ -0,0 +1,2 @@ +// @deno-types="./type_definitions/foo.d.ts" +export { foo } from "./type_definitions/foo.js"; diff --git a/cli/tests/testdata/fetch/hello.txt b/cli/tests/testdata/fetch/hello.txt new file mode 100644 index 000000000..af5626b4a --- /dev/null +++ b/cli/tests/testdata/fetch/hello.txt @@ -0,0 +1 @@ +Hello, world! diff --git a/cli/tests/testdata/fetch/other.ts b/cli/tests/testdata/fetch/other.ts new file mode 100644 index 000000000..91fe376b3 --- /dev/null +++ b/cli/tests/testdata/fetch/other.ts @@ -0,0 +1 @@ +import "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; diff --git a/cli/tests/testdata/fetch/test.ts b/cli/tests/testdata/fetch/test.ts new file mode 100644 index 000000000..baa52775d --- /dev/null +++ b/cli/tests/testdata/fetch/test.ts @@ -0,0 +1 @@ +import "http://localhost:4545/subdir/mod2.ts"; diff --git a/cli/tests/testdata/fetch_response_finalization.js b/cli/tests/testdata/fetch_response_finalization.js new file mode 100644 index 000000000..dd7c355eb --- /dev/null +++ b/cli/tests/testdata/fetch_response_finalization.js @@ -0,0 +1,16 @@ +async function doAFetch() { + const resp = await fetch("http://localhost:4545/README.md"); + console.log(Deno.resources()); // print the current resources + const _resp = resp; + // at this point resp can be GC'ed +} + +await doAFetch(); // create a resource + +globalThis.gc(); // force GC + +// It is very important that there is a yield here, otherwise the finalizer for +// the response body is not called and the resource is not closed. +await new Promise((resolve) => setTimeout(resolve, 0)); + +console.log(Deno.resources()); // print the current resources diff --git a/cli/tests/testdata/fetch_response_finalization.js.out b/cli/tests/testdata/fetch_response_finalization.js.out new file mode 100644 index 000000000..844a4e4b2 --- /dev/null +++ b/cli/tests/testdata/fetch_response_finalization.js.out @@ -0,0 +1,2 @@ +{ "0": "stdin", "1": "stdout", "2": "stderr", "5": "fetchResponseBody" } +{ "0": "stdin", "1": "stdout", "2": "stderr" } diff --git a/cli/tests/testdata/file_exists.ts b/cli/tests/testdata/file_exists.ts new file mode 100644 index 000000000..20de4d4f2 --- /dev/null +++ b/cli/tests/testdata/file_exists.ts @@ -0,0 +1,6 @@ +try { + await Deno.open(Deno.args[0]); + Deno.exit(0); +} catch (_e) { + Deno.exit(1); +} diff --git a/cli/tests/testdata/finalization_registry.js b/cli/tests/testdata/finalization_registry.js new file mode 100644 index 000000000..f75979358 --- /dev/null +++ b/cli/tests/testdata/finalization_registry.js @@ -0,0 +1,20 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +"use strict"; + +function assertEquals(a, b) { + if (a === b) return; + throw a + " does not equal " + b; +} + +const registry = new FinalizationRegistry((value) => { + assertEquals(value, "called!"); + Deno.core.print("FinalizationRegistry called!\n"); +}); + +(function () { + let x = {}; + registry.register(x, "called!"); + x = null; +})(); + +gc(); diff --git a/cli/tests/testdata/finalization_registry.js.out b/cli/tests/testdata/finalization_registry.js.out new file mode 100644 index 000000000..fee61413a --- /dev/null +++ b/cli/tests/testdata/finalization_registry.js.out @@ -0,0 +1 @@ +FinalizationRegistry called! diff --git a/cli/tests/testdata/fix_dynamic_import_errors.js b/cli/tests/testdata/fix_dynamic_import_errors.js new file mode 100644 index 000000000..317047ccb --- /dev/null +++ b/cli/tests/testdata/fix_dynamic_import_errors.js @@ -0,0 +1,7 @@ +import("./dynamic_import/b.js").catch(() => { + console.log("caught import error from b.js"); +}); + +import("./dynamic_import/c.js").catch(() => { + console.log("caught import error from c.js"); +}); diff --git a/cli/tests/testdata/fix_dynamic_import_errors.js.out b/cli/tests/testdata/fix_dynamic_import_errors.js.out new file mode 100644 index 000000000..e7856fb9c --- /dev/null +++ b/cli/tests/testdata/fix_dynamic_import_errors.js.out @@ -0,0 +1,2 @@ +caught import error from [WILDCARD].js +caught import error from [WILDCARD].js diff --git a/cli/tests/testdata/fix_emittable_skipped.js b/cli/tests/testdata/fix_emittable_skipped.js new file mode 100644 index 000000000..f61907b06 --- /dev/null +++ b/cli/tests/testdata/fix_emittable_skipped.js @@ -0,0 +1,7 @@ +/// + +import "./subdir/polyfill.ts"; + +export const a = "a"; + +console.log(globalThis.polyfill); diff --git a/cli/tests/testdata/fix_emittable_skipped.ts.out b/cli/tests/testdata/fix_emittable_skipped.ts.out new file mode 100644 index 000000000..108c2d67f --- /dev/null +++ b/cli/tests/testdata/fix_emittable_skipped.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +[Function] diff --git a/cli/tests/testdata/fix_exotic_specifiers.ts b/cli/tests/testdata/fix_exotic_specifiers.ts new file mode 100644 index 000000000..101667b2a --- /dev/null +++ b/cli/tests/testdata/fix_exotic_specifiers.ts @@ -0,0 +1,3 @@ +import clone from "https://jspm.dev/lodash@4/clone"; + +console.log(clone); diff --git a/cli/tests/testdata/fix_exotic_specifiers.ts.out b/cli/tests/testdata/fix_exotic_specifiers.ts.out new file mode 100644 index 000000000..7afdb808d --- /dev/null +++ b/cli/tests/testdata/fix_exotic_specifiers.ts.out @@ -0,0 +1 @@ +[Function: clone] diff --git a/cli/tests/testdata/fix_js_import_js.ts b/cli/tests/testdata/fix_js_import_js.ts new file mode 100644 index 000000000..c9f341748 --- /dev/null +++ b/cli/tests/testdata/fix_js_import_js.ts @@ -0,0 +1,3 @@ +import { isMod4 } from "./subdir/mod6.js"; + +console.log(isMod4); diff --git a/cli/tests/testdata/fix_js_import_js.ts.out b/cli/tests/testdata/fix_js_import_js.ts.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/testdata/fix_js_import_js.ts.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/testdata/fix_js_imports.ts b/cli/tests/testdata/fix_js_imports.ts new file mode 100644 index 000000000..4770b1ab6 --- /dev/null +++ b/cli/tests/testdata/fix_js_imports.ts @@ -0,0 +1,3 @@ +import * as amdLike from "./subdir/amd_like.js"; + +console.log(amdLike); diff --git a/cli/tests/testdata/fix_js_imports.ts.out b/cli/tests/testdata/fix_js_imports.ts.out new file mode 100644 index 000000000..5e45122de --- /dev/null +++ b/cli/tests/testdata/fix_js_imports.ts.out @@ -0,0 +1 @@ +Module {} diff --git a/cli/tests/testdata/fix_tsc_file_exists.out b/cli/tests/testdata/fix_tsc_file_exists.out new file mode 100644 index 000000000..ce0136250 --- /dev/null +++ b/cli/tests/testdata/fix_tsc_file_exists.out @@ -0,0 +1 @@ +hello diff --git a/cli/tests/testdata/fix_worker_dispatchevent.ts b/cli/tests/testdata/fix_worker_dispatchevent.ts new file mode 100644 index 000000000..1b73b52dc --- /dev/null +++ b/cli/tests/testdata/fix_worker_dispatchevent.ts @@ -0,0 +1,43 @@ +const code = ` +addEventListener("message", () => { + postMessage("pong"); +}); + +const context = new EventTarget(); + +Object.defineProperty(globalThis, "dispatchEvent", { + value: context.dispatchEvent.bind(context), + writable: true, + enumerable: true, + configurable: true, +}); + +postMessage("start"); +`; + +const blob = new Blob([code], { type: "application/javascript" }); + +const url = URL.createObjectURL(blob); + +const worker = new Worker(url, { type: "module" }); + +let terminated = false; + +worker.addEventListener("message", (evt) => { + if (evt.data === "start") { + worker.postMessage("ping"); + } else if (evt.data === "pong") { + worker.terminate(); + terminated = true; + console.log("success"); + } else { + throw new Error("unexpected message from worker"); + } +}); + +setTimeout(() => { + if (!terminated) { + worker.terminate(); + throw new Error("did not receive message from worker in time"); + } +}, 2000); diff --git a/cli/tests/testdata/fix_worker_dispatchevent.ts.out b/cli/tests/testdata/fix_worker_dispatchevent.ts.out new file mode 100644 index 000000000..2e9ba477f --- /dev/null +++ b/cli/tests/testdata/fix_worker_dispatchevent.ts.out @@ -0,0 +1 @@ +success diff --git a/cli/tests/testdata/fixture.json b/cli/tests/testdata/fixture.json new file mode 100644 index 000000000..56e056b6a --- /dev/null +++ b/cli/tests/testdata/fixture.json @@ -0,0 +1,14 @@ +{ + "name": "deno", + "private": true, + "devDependencies": { + "@types/prettier": "1.16.1", + "@typescript-eslint/eslint-plugin": "2.5.0", + "@typescript-eslint/parser": "2.5.0", + "eslint": "5.15.1", + "eslint-config-prettier": "4.1.0", + "magic-string": "0.25.2", + "prettier": "1.17.1", + "typescript": "3.6.3" + } +} diff --git a/cli/tests/testdata/fmt/expected_fmt_check_formatted_files.out b/cli/tests/testdata/fmt/expected_fmt_check_formatted_files.out new file mode 100644 index 000000000..5a4833dd4 --- /dev/null +++ b/cli/tests/testdata/fmt/expected_fmt_check_formatted_files.out @@ -0,0 +1 @@ +Checked 4 files diff --git a/cli/tests/testdata/fmt/expected_fmt_check_ignore.out b/cli/tests/testdata/fmt/expected_fmt_check_ignore.out new file mode 100644 index 000000000..7c1e471b9 --- /dev/null +++ b/cli/tests/testdata/fmt/expected_fmt_check_ignore.out @@ -0,0 +1 @@ +Checked 3 files diff --git a/cli/tests/testdata/fmt/expected_fmt_check_tests_dir.out b/cli/tests/testdata/fmt/expected_fmt_check_tests_dir.out new file mode 100644 index 000000000..e2dc2b4ae --- /dev/null +++ b/cli/tests/testdata/fmt/expected_fmt_check_tests_dir.out @@ -0,0 +1,2 @@ +[WILDCARD] +error: Found 6 not formatted files in [WILDCARD] files diff --git a/cli/tests/testdata/fmt/expected_fmt_check_verbose_formatted_files.out b/cli/tests/testdata/fmt/expected_fmt_check_verbose_formatted_files.out new file mode 100644 index 000000000..158c556c2 --- /dev/null +++ b/cli/tests/testdata/fmt/expected_fmt_check_verbose_formatted_files.out @@ -0,0 +1 @@ +Checked 2 files diff --git a/cli/tests/testdata/fmt/expected_fmt_check_verbose_tests_dir.out b/cli/tests/testdata/fmt/expected_fmt_check_verbose_tests_dir.out new file mode 100644 index 000000000..04cd5ec64 --- /dev/null +++ b/cli/tests/testdata/fmt/expected_fmt_check_verbose_tests_dir.out @@ -0,0 +1,2 @@ +[WILDCARD] +error: Found 1 not formatted file in [WILDCARD] files diff --git a/cli/tests/testdata/fmt/formatted1.js b/cli/tests/testdata/fmt/formatted1.js new file mode 100644 index 000000000..587aa5b96 --- /dev/null +++ b/cli/tests/testdata/fmt/formatted1.js @@ -0,0 +1,5 @@ +function foo() { + return 42; +} + +foo(); diff --git a/cli/tests/testdata/fmt/formatted2.ts b/cli/tests/testdata/fmt/formatted2.ts new file mode 100644 index 000000000..4a8036806 --- /dev/null +++ b/cli/tests/testdata/fmt/formatted2.ts @@ -0,0 +1,5 @@ +function bar(): number { + return 42; +} + +bar(); diff --git a/cli/tests/testdata/fmt/formatted3.md b/cli/tests/testdata/fmt/formatted3.md new file mode 100644 index 000000000..e6e616584 --- /dev/null +++ b/cli/tests/testdata/fmt/formatted3.md @@ -0,0 +1,17 @@ +# Hello + +```js +function foo() { + return 42; +} + +foo(); +``` + +```ts +function bar(): number { + return 42; +} + +bar(); +``` diff --git a/cli/tests/testdata/fmt/formatted4.jsonc b/cli/tests/testdata/fmt/formatted4.jsonc new file mode 100644 index 000000000..f0f72a6ed --- /dev/null +++ b/cli/tests/testdata/fmt/formatted4.jsonc @@ -0,0 +1,4 @@ +{ + // Comment + "key": "value" +} diff --git a/cli/tests/testdata/heapstats.js b/cli/tests/testdata/heapstats.js new file mode 100644 index 000000000..675fac2d6 --- /dev/null +++ b/cli/tests/testdata/heapstats.js @@ -0,0 +1,37 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +"use strict"; + +function allocTest(alloc, allocAssert, deallocAssert) { + // Helper func that GCs then returns memory usage + const sample = () => { + // deno-lint-ignore no-undef + gc(); + return Deno.memoryUsage(); + }; + const delta = (t1, t2) => t2.heapUsed - t1.heapUsed; + + // Sample "clean" heap usage + const t1 = sample(); + + // Alloc + // deno-lint-ignore no-unused-vars + let x = alloc(); + const t2 = sample(); + allocAssert(delta(t1, t2)); + + // Free + x = null; + const t3 = sample(); + deallocAssert(delta(t2, t3)); +} + +function main() { + // Large-array test, 1M slot array consumes ~4MB (4B per slot) + allocTest( + () => new Array(1e6), + (delta) => console.log("Allocated:", Math.round(delta / 1e6) + "MB"), + (delta) => console.log("Freed:", Math.round(delta / 1e6) + "MB"), + ); +} + +main(); diff --git a/cli/tests/testdata/heapstats.js.out b/cli/tests/testdata/heapstats.js.out new file mode 100644 index 000000000..b75a755f8 --- /dev/null +++ b/cli/tests/testdata/heapstats.js.out @@ -0,0 +1,2 @@ +Allocated: 4MB +Freed: -4MB diff --git a/cli/tests/testdata/hello.txt b/cli/tests/testdata/hello.txt new file mode 100644 index 000000000..6769dd60b --- /dev/null +++ b/cli/tests/testdata/hello.txt @@ -0,0 +1 @@ +Hello world! \ No newline at end of file diff --git a/cli/tests/testdata/https_import.ts b/cli/tests/testdata/https_import.ts new file mode 100644 index 000000000..3bcc90326 --- /dev/null +++ b/cli/tests/testdata/https_import.ts @@ -0,0 +1,3 @@ +import { printHello } from "https://localhost:5545/subdir/print_hello.ts"; + +printHello(); diff --git a/cli/tests/testdata/https_import.ts.out b/cli/tests/testdata/https_import.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/https_import.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/if_main.ts b/cli/tests/testdata/if_main.ts new file mode 100644 index 000000000..4dcfecea0 --- /dev/null +++ b/cli/tests/testdata/if_main.ts @@ -0,0 +1,6 @@ +if (import.meta.main) { + console.log("main"); +} else { + console.log("import.meta.url", import.meta.url); + throw Error("not main"); +} diff --git a/cli/tests/testdata/if_main.ts.out b/cli/tests/testdata/if_main.ts.out new file mode 100644 index 000000000..ba2906d06 --- /dev/null +++ b/cli/tests/testdata/if_main.ts.out @@ -0,0 +1 @@ +main diff --git a/cli/tests/testdata/ignore_require.js b/cli/tests/testdata/ignore_require.js new file mode 100644 index 000000000..a8ef15021 --- /dev/null +++ b/cli/tests/testdata/ignore_require.js @@ -0,0 +1,2 @@ +// deno-lint-ignore-file +require("invalid module specifier"); diff --git a/cli/tests/testdata/import_blob_url.ts b/cli/tests/testdata/import_blob_url.ts new file mode 100644 index 000000000..86bb634e1 --- /dev/null +++ b/cli/tests/testdata/import_blob_url.ts @@ -0,0 +1,13 @@ +const blob = new Blob( + ['export const a = "a";\n\nexport enum A {\n A,\n B,\n C,\n}\n'], + { + type: "application/typescript", + }, +); +const url = URL.createObjectURL(blob); + +const a = await import(url); + +console.log(a.a); +console.log(a.A); +console.log(a.A.A); diff --git a/cli/tests/testdata/import_blob_url.ts.out b/cli/tests/testdata/import_blob_url.ts.out new file mode 100644 index 000000000..bfa0b9d94 --- /dev/null +++ b/cli/tests/testdata/import_blob_url.ts.out @@ -0,0 +1,3 @@ +a +{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } +0 diff --git a/cli/tests/testdata/import_blob_url_error_stack.ts b/cli/tests/testdata/import_blob_url_error_stack.ts new file mode 100644 index 000000000..f9c4f2e9d --- /dev/null +++ b/cli/tests/testdata/import_blob_url_error_stack.ts @@ -0,0 +1,13 @@ +const blob = new Blob( + [ + "enum A {\n A,\n B,\n C,\n }\n \n export function a() {\n throw new Error(`Hello ${A.C}`);\n }\n ", + ], + { + type: "application/typescript", + }, +); +const url = URL.createObjectURL(blob); + +const { a } = await import(url); + +a(); diff --git a/cli/tests/testdata/import_blob_url_error_stack.ts.out b/cli/tests/testdata/import_blob_url_error_stack.ts.out new file mode 100644 index 000000000..52b76fd5c --- /dev/null +++ b/cli/tests/testdata/import_blob_url_error_stack.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught (in promise) Error: Hello 2 + throw new Error(`Hello ${A.C}`); + ^ + at a (blob:null/[WILDCARD]:8:10) + at file:///[WILDCARD]/import_blob_url_error_stack.ts:13:1 +[WILDCARD] diff --git a/cli/tests/testdata/import_blob_url_import_relative.ts b/cli/tests/testdata/import_blob_url_import_relative.ts new file mode 100644 index 000000000..ad130bdac --- /dev/null +++ b/cli/tests/testdata/import_blob_url_import_relative.ts @@ -0,0 +1,8 @@ +const blob = new Blob(['export { a } from "./a.ts";'], { + type: "application/javascript", +}); +const url = URL.createObjectURL(blob); + +const a = await import(url); + +console.log(a); diff --git a/cli/tests/testdata/import_blob_url_import_relative.ts.out b/cli/tests/testdata/import_blob_url_import_relative.ts.out new file mode 100644 index 000000000..77f399763 --- /dev/null +++ b/cli/tests/testdata/import_blob_url_import_relative.ts.out @@ -0,0 +1,4 @@ +error: Uncaught (in promise) TypeError: invalid URL: relative URL with a cannot-be-a-base base +const a = await import(url); + ^ + at async file://[WILDCARD]/import_blob_url_import_relative.ts:6:11 diff --git a/cli/tests/testdata/import_blob_url_imports.ts b/cli/tests/testdata/import_blob_url_imports.ts new file mode 100644 index 000000000..a7c639152 --- /dev/null +++ b/cli/tests/testdata/import_blob_url_imports.ts @@ -0,0 +1,11 @@ +const blob = new Blob( + [ + 'export { printHello } from "http://localhost:4545/subdir/mod2.ts"', + ], + { type: "application/javascript" }, +); +const url = URL.createObjectURL(blob); + +const { printHello } = await import(url); + +printHello(); diff --git a/cli/tests/testdata/import_blob_url_imports.ts.out b/cli/tests/testdata/import_blob_url_imports.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/import_blob_url_imports.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/import_blob_url_jsx.ts b/cli/tests/testdata/import_blob_url_jsx.ts new file mode 100644 index 000000000..8d645796a --- /dev/null +++ b/cli/tests/testdata/import_blob_url_jsx.ts @@ -0,0 +1,16 @@ +const blob = new Blob( + ["export default function() {\n return
Hello Deno!
\n}\n"], + { type: "text/jsx" }, +); +const url = URL.createObjectURL(blob); + +const { default: render } = await import(url); + +// deno-lint-ignore no-explicit-any +(globalThis as any).React = { + createElement(...args: unknown[]) { + console.log(...args); + }, +}; + +render(); diff --git a/cli/tests/testdata/import_blob_url_jsx.ts.out b/cli/tests/testdata/import_blob_url_jsx.ts.out new file mode 100644 index 000000000..c1c85f250 --- /dev/null +++ b/cli/tests/testdata/import_blob_url_jsx.ts.out @@ -0,0 +1 @@ +div null Hello Deno! diff --git a/cli/tests/testdata/import_data_url.ts b/cli/tests/testdata/import_data_url.ts new file mode 100644 index 000000000..258514a5e --- /dev/null +++ b/cli/tests/testdata/import_data_url.ts @@ -0,0 +1,12 @@ +// export const a = "a"; + +// export enum A { +// A, +// B, +// C, +// } +import * as a from "data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo="; + +console.log(a.a); +console.log(a.A); +console.log(a.A.A); diff --git a/cli/tests/testdata/import_data_url.ts.out b/cli/tests/testdata/import_data_url.ts.out new file mode 100644 index 000000000..bfa0b9d94 --- /dev/null +++ b/cli/tests/testdata/import_data_url.ts.out @@ -0,0 +1,3 @@ +a +{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } +0 diff --git a/cli/tests/testdata/import_data_url_error_stack.ts b/cli/tests/testdata/import_data_url_error_stack.ts new file mode 100644 index 000000000..022e49fe1 --- /dev/null +++ b/cli/tests/testdata/import_data_url_error_stack.ts @@ -0,0 +1,3 @@ +import { a } from "data:application/typescript;base64,ZW51bSBBIHsKICBBLAogIEIsCiAgQywKIH0KIAogZXhwb3J0IGZ1bmN0aW9uIGEoKSB7CiAgIHRocm93IG5ldyBFcnJvcihgSGVsbG8gJHtBLkN9YCk7CiB9CiA="; + +a(); diff --git a/cli/tests/testdata/import_data_url_error_stack.ts.out b/cli/tests/testdata/import_data_url_error_stack.ts.out new file mode 100644 index 000000000..d456ad0ea --- /dev/null +++ b/cli/tests/testdata/import_data_url_error_stack.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]error: Uncaught Error: Hello 2 + throw new Error(`Hello ${A.C}`); + ^ + at a (data:application/typescript;base64,ZW51bSBBIHsKICBBLAogIEIsCiAgQywKIH0KIAogZXhwb3J0IGZ1bmN0aW9uIGEoKSB7CiAgIHRocm93IG5ldyBFcnJvcihgSGVsbG8gJHtBLkN9YCk7CiB9CiA=:8:10) + at file:///[WILDCARD]/import_data_url_error_stack.ts:3:1 +[WILDCARD] diff --git a/cli/tests/testdata/import_data_url_import_relative.ts b/cli/tests/testdata/import_data_url_import_relative.ts new file mode 100644 index 000000000..23947fe60 --- /dev/null +++ b/cli/tests/testdata/import_data_url_import_relative.ts @@ -0,0 +1,4 @@ +// export { a } from "./a.ts"; +import * as a from "data:application/javascript;base64,ZXhwb3J0IHsgYSB9IGZyb20gIi4vYS50cyI7Cg=="; + +console.log(a); diff --git a/cli/tests/testdata/import_data_url_import_relative.ts.out b/cli/tests/testdata/import_data_url_import_relative.ts.out new file mode 100644 index 000000000..1f4f3e9ef --- /dev/null +++ b/cli/tests/testdata/import_data_url_import_relative.ts.out @@ -0,0 +1,4 @@ +error: invalid URL: relative URL with a cannot-be-a-base base + +Caused by: + relative URL with a cannot-be-a-base base diff --git a/cli/tests/testdata/import_data_url_imports.ts b/cli/tests/testdata/import_data_url_imports.ts new file mode 100644 index 000000000..df7dae727 --- /dev/null +++ b/cli/tests/testdata/import_data_url_imports.ts @@ -0,0 +1,4 @@ +// export { printHello } from "http://localhost:4545/subdir/mod2.ts"; +import { printHello } from "data:application/typescript;base64,ZXhwb3J0IHsgcHJpbnRIZWxsbyB9IGZyb20gImh0dHA6Ly9sb2NhbGhvc3Q6NDU0NS9zdWJkaXIvbW9kMi50cyI7"; + +printHello(); diff --git a/cli/tests/testdata/import_data_url_imports.ts.out b/cli/tests/testdata/import_data_url_imports.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/cli/tests/testdata/import_data_url_imports.ts.out @@ -0,0 +1 @@ +Hello diff --git a/cli/tests/testdata/import_data_url_jsx.ts b/cli/tests/testdata/import_data_url_jsx.ts new file mode 100644 index 000000000..1881211f9 --- /dev/null +++ b/cli/tests/testdata/import_data_url_jsx.ts @@ -0,0 +1,10 @@ +import render from "data:text/jsx;base64,ZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24oKSB7CiAgcmV0dXJuIDxkaXY+SGVsbG8gRGVubyE8L2Rpdj4KfQo="; + +// deno-lint-ignore no-explicit-any +(globalThis as any).React = { + createElement(...args: unknown[]) { + console.log(...args); + }, +}; + +render(); diff --git a/cli/tests/testdata/import_data_url_jsx.ts.out b/cli/tests/testdata/import_data_url_jsx.ts.out new file mode 100644 index 000000000..c1c85f250 --- /dev/null +++ b/cli/tests/testdata/import_data_url_jsx.ts.out @@ -0,0 +1 @@ +div null Hello Deno! diff --git a/cli/tests/testdata/import_dynamic_data_url.ts b/cli/tests/testdata/import_dynamic_data_url.ts new file mode 100644 index 000000000..53a0fbcd3 --- /dev/null +++ b/cli/tests/testdata/import_dynamic_data_url.ts @@ -0,0 +1,14 @@ +// export const a = "a"; + +// export enum A { +// A, +// B, +// C, +// } +const a = await import( + "data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=" +); + +console.log(a.a); +console.log(a.A); +console.log(a.A.A); diff --git a/cli/tests/testdata/import_dynamic_data_url.ts.out b/cli/tests/testdata/import_dynamic_data_url.ts.out new file mode 100644 index 000000000..bfa0b9d94 --- /dev/null +++ b/cli/tests/testdata/import_dynamic_data_url.ts.out @@ -0,0 +1,3 @@ +a +{ "0": "A", "1": "B", "2": "C", A: 0, B: 1, C: 2 } +0 diff --git a/cli/tests/testdata/import_file_with_colon.ts b/cli/tests/testdata/import_file_with_colon.ts new file mode 100644 index 000000000..619bdd66d --- /dev/null +++ b/cli/tests/testdata/import_file_with_colon.ts @@ -0,0 +1 @@ +import "http://localhost:4545/subdir/file_with_:_in_name.ts"; diff --git a/cli/tests/testdata/import_file_with_colon.ts.out b/cli/tests/testdata/import_file_with_colon.ts.out new file mode 100644 index 000000000..f60bbf4b1 --- /dev/null +++ b/cli/tests/testdata/import_file_with_colon.ts.out @@ -0,0 +1 @@ +Hello from file_with_:_in_name.ts diff --git a/cli/tests/testdata/import_maps/import_map.json b/cli/tests/testdata/import_maps/import_map.json new file mode 100644 index 000000000..601874aab --- /dev/null +++ b/cli/tests/testdata/import_maps/import_map.json @@ -0,0 +1,14 @@ +{ + "imports": { + "moment": "./moment/moment.ts", + "moment/": "./moment/", + "lodash": "./lodash/lodash.ts", + "lodash/": "./lodash/", + "https://www.unpkg.com/vue/dist/vue.runtime.esm.js": "./vue.ts" + }, + "scopes": { + "scope/": { + "moment": "./scoped_moment.ts" + } + } +} diff --git a/cli/tests/testdata/import_maps/import_map_remote.json b/cli/tests/testdata/import_maps/import_map_remote.json new file mode 100644 index 000000000..51f90f69c --- /dev/null +++ b/cli/tests/testdata/import_maps/import_map_remote.json @@ -0,0 +1,9 @@ +{ + "imports": { + "moment": "./moment/moment.ts", + "moment/": "./moment/", + "lodash": "./lodash/lodash.ts", + "lodash/": "./lodash/", + "https://www.unpkg.com/vue/dist/vue.runtime.esm.js": "./vue.ts" + } +} diff --git a/cli/tests/testdata/import_maps/lodash/lodash.ts b/cli/tests/testdata/import_maps/lodash/lodash.ts new file mode 100644 index 000000000..2ec04ed3c --- /dev/null +++ b/cli/tests/testdata/import_maps/lodash/lodash.ts @@ -0,0 +1 @@ +console.log("Hello from remapped lodash!"); diff --git a/cli/tests/testdata/import_maps/lodash/other_file.ts b/cli/tests/testdata/import_maps/lodash/other_file.ts new file mode 100644 index 000000000..714adae3f --- /dev/null +++ b/cli/tests/testdata/import_maps/lodash/other_file.ts @@ -0,0 +1 @@ +console.log("Hello from remapped lodash dir!"); diff --git a/cli/tests/testdata/import_maps/moment/moment.ts b/cli/tests/testdata/import_maps/moment/moment.ts new file mode 100644 index 000000000..2b54a431e --- /dev/null +++ b/cli/tests/testdata/import_maps/moment/moment.ts @@ -0,0 +1 @@ +console.log("Hello from remapped moment!"); diff --git a/cli/tests/testdata/import_maps/moment/other_file.ts b/cli/tests/testdata/import_maps/moment/other_file.ts new file mode 100644 index 000000000..24f3a0226 --- /dev/null +++ b/cli/tests/testdata/import_maps/moment/other_file.ts @@ -0,0 +1 @@ +console.log("Hello from remapped moment dir!"); diff --git a/cli/tests/testdata/import_maps/scope/scoped.ts b/cli/tests/testdata/import_maps/scope/scoped.ts new file mode 100644 index 000000000..9a0b5d8e3 --- /dev/null +++ b/cli/tests/testdata/import_maps/scope/scoped.ts @@ -0,0 +1,2 @@ +import "moment"; +console.log("Hello from scoped!"); diff --git a/cli/tests/testdata/import_maps/scoped_moment.ts b/cli/tests/testdata/import_maps/scoped_moment.ts new file mode 100644 index 000000000..9f67f88d4 --- /dev/null +++ b/cli/tests/testdata/import_maps/scoped_moment.ts @@ -0,0 +1 @@ +console.log("Hello from scoped moment!"); diff --git a/cli/tests/testdata/import_maps/test.ts b/cli/tests/testdata/import_maps/test.ts new file mode 100644 index 000000000..9b09e9953 --- /dev/null +++ b/cli/tests/testdata/import_maps/test.ts @@ -0,0 +1,6 @@ +import "moment"; +import "moment/other_file.ts"; +import "lodash"; +import "lodash/other_file.ts"; +import "https://www.unpkg.com/vue/dist/vue.runtime.esm.js"; +import "./scope/scoped.ts"; diff --git a/cli/tests/testdata/import_maps/test_remote.ts b/cli/tests/testdata/import_maps/test_remote.ts new file mode 100644 index 000000000..206bdbd5f --- /dev/null +++ b/cli/tests/testdata/import_maps/test_remote.ts @@ -0,0 +1,5 @@ +import "moment"; +import "moment/other_file.ts"; +import "lodash"; +import "lodash/other_file.ts"; +import "https://www.unpkg.com/vue/dist/vue.runtime.esm.js"; diff --git a/cli/tests/testdata/import_maps/vue.ts b/cli/tests/testdata/import_maps/vue.ts new file mode 100644 index 000000000..76dbe1917 --- /dev/null +++ b/cli/tests/testdata/import_maps/vue.ts @@ -0,0 +1 @@ +console.log("Hello from remapped Vue!"); diff --git a/cli/tests/testdata/import_meta.ts b/cli/tests/testdata/import_meta.ts new file mode 100644 index 000000000..d111059ea --- /dev/null +++ b/cli/tests/testdata/import_meta.ts @@ -0,0 +1,3 @@ +console.log("import_meta", import.meta.url, import.meta.main); + +import "./import_meta2.ts"; diff --git a/cli/tests/testdata/import_meta.ts.out b/cli/tests/testdata/import_meta.ts.out new file mode 100644 index 000000000..f38aa98ea --- /dev/null +++ b/cli/tests/testdata/import_meta.ts.out @@ -0,0 +1,2 @@ +import_meta2 [WILDCARD]import_meta2.ts false +import_meta [WILDCARD]import_meta.ts true diff --git a/cli/tests/testdata/import_meta2.ts b/cli/tests/testdata/import_meta2.ts new file mode 100644 index 000000000..7f59a5a46 --- /dev/null +++ b/cli/tests/testdata/import_meta2.ts @@ -0,0 +1 @@ +console.log("import_meta2", import.meta.url, import.meta.main); diff --git a/cli/tests/testdata/info/data_null_error/data_null_error.out b/cli/tests/testdata/info/data_null_error/data_null_error.out new file mode 100644 index 000000000..89961be65 --- /dev/null +++ b/cli/tests/testdata/info/data_null_error/data_null_error.out @@ -0,0 +1,6 @@ +local: [WILDCARD]mod.ts +type: TypeScript +dependencies: 1 unique (total [WILDCARD]) + +file://[WILDCARD]/mod.ts ([WILDCARD]) +└── file://[WILDCARD]/types.d.ts ([WILDCARD]) diff --git a/cli/tests/testdata/info/data_null_error/mod.ts b/cli/tests/testdata/info/data_null_error/mod.ts new file mode 100644 index 000000000..6e3e99bd4 --- /dev/null +++ b/cli/tests/testdata/info/data_null_error/mod.ts @@ -0,0 +1 @@ +/// diff --git a/cli/tests/testdata/info/data_null_error/types.d.ts b/cli/tests/testdata/info/data_null_error/types.d.ts new file mode 100644 index 000000000..6ecc85676 --- /dev/null +++ b/cli/tests/testdata/info/data_null_error/types.d.ts @@ -0,0 +1 @@ +declare class Test {} diff --git a/cli/tests/testdata/info/types_header.out b/cli/tests/testdata/info/types_header.out new file mode 100644 index 000000000..d3b6e8c4e --- /dev/null +++ b/cli/tests/testdata/info/types_header.out @@ -0,0 +1,8 @@ +[WILDCARD] +local: [WILDCARD]type_directives_01.ts +type: TypeScript +dependencies: 2 unique (total [WILDCARD]) + +[WILDCARD]/type_directives_01.ts ([WILDCARD]) +└─┬ http://127.0.0.1:4545/xTypeScriptTypes.js ([WILDCARD]) + └── http://127.0.0.1:4545/xTypeScriptTypes.d.ts ([WILDCARD]) diff --git a/cli/tests/testdata/info_json.out b/cli/tests/testdata/info_json.out new file mode 100644 index 000000000..4ba5a95f4 --- /dev/null +++ b/cli/tests/testdata/info_json.out @@ -0,0 +1,7 @@ +{ + "denoDir": "[WILDCARD]", + "modulesCache": "[WILDCARD]deps", + "typescriptCache": "[WILDCARD]gen", + "registryCache": "[WILDCARD]registries", + "originStorage": "[WILDCARD]location_data" +} diff --git a/cli/tests/testdata/info_json_location.out b/cli/tests/testdata/info_json_location.out new file mode 100644 index 000000000..6c4cddefb --- /dev/null +++ b/cli/tests/testdata/info_json_location.out @@ -0,0 +1,8 @@ +{ + "denoDir": "[WILDCARD]", + "modulesCache": "[WILDCARD]deps", + "typescriptCache": "[WILDCARD]gen", + "registryCache": "[WILDCARD]registries", + "originStorage": "[WILDCARD]location_data[WILDCARD]", + "localStorage": "[WILDCARD]location_data[WILDCARD]local_storage" +} diff --git a/cli/tests/testdata/info_missing_module.out b/cli/tests/testdata/info_missing_module.out new file mode 100644 index 000000000..75b077407 --- /dev/null +++ b/cli/tests/testdata/info_missing_module.out @@ -0,0 +1,6 @@ +local: [WILDCARD]error_009_missing_js_module.js +type: JavaScript +dependencies: 1 unique (total 26B) + +file://[WILDCARD]/error_009_missing_js_module.js (26B) +└── file://[WILDCARD]/bad-module.js (error) diff --git a/cli/tests/testdata/info_recursive_imports_test.out b/cli/tests/testdata/info_recursive_imports_test.out new file mode 100644 index 000000000..10ee54534 --- /dev/null +++ b/cli/tests/testdata/info_recursive_imports_test.out @@ -0,0 +1,12 @@ +local: [WILDCARD]info_recursive_imports_test.ts +type: TypeScript +dependencies: 4 unique (total [WILDCARD]) + +file://[WILDCARD]/info_recursive_imports_test.ts ([WILDCARD]) +└─┬ file://[WILDCARD]/recursive_imports/A.ts ([WILDCARD]) + ├─┬ file://[WILDCARD]/recursive_imports/B.ts ([WILDCARD]) + │ ├─┬ file://[WILDCARD]/recursive_imports/C.ts ([WILDCARD]) + │ │ ├── file://[WILDCARD]/recursive_imports/A.ts * + │ │ └── file://[WILDCARD]/recursive_imports/common.ts ([WILDCARD]) + │ └── file://[WILDCARD]/recursive_imports/common.ts * + └── file://[WILDCARD]/recursive_imports/common.ts * diff --git a/cli/tests/testdata/info_recursive_imports_test.ts b/cli/tests/testdata/info_recursive_imports_test.ts new file mode 100644 index 000000000..c9ba44755 --- /dev/null +++ b/cli/tests/testdata/info_recursive_imports_test.ts @@ -0,0 +1,5 @@ +import { A } from "./recursive_imports/A.ts"; + +export function test() { + A(); +} diff --git a/cli/tests/testdata/info_type_import.out b/cli/tests/testdata/info_type_import.out new file mode 100644 index 000000000..6b9869f1f --- /dev/null +++ b/cli/tests/testdata/info_type_import.out @@ -0,0 +1,5 @@ +local: [WILDCARD]info_type_import.ts +type: TypeScript +dependencies: 1 unique (total [WILDCARD]) +[WILDCARD]info_type_import.ts ([WILDCARD]) +└── [WILDCARD]type_and_code.ts ([WILDCARD]) diff --git a/cli/tests/testdata/info_type_import.ts b/cli/tests/testdata/info_type_import.ts new file mode 100644 index 000000000..eeef46c89 --- /dev/null +++ b/cli/tests/testdata/info_type_import.ts @@ -0,0 +1,3 @@ +import { AnInterface as _, isAnInterface } from "./subdir/type_and_code.ts"; + +isAnInterface({}); diff --git a/cli/tests/testdata/inline_js_source_map.ts b/cli/tests/testdata/inline_js_source_map.ts new file mode 100644 index 000000000..5ae7c226a --- /dev/null +++ b/cli/tests/testdata/inline_js_source_map.ts @@ -0,0 +1,6 @@ +1 + 1; +interface Test { + hello: string; +} + +// throw new Error("Hello world!" as string); diff --git a/cli/tests/testdata/inline_js_source_map_2.js b/cli/tests/testdata/inline_js_source_map_2.js new file mode 100644 index 000000000..036f351b9 --- /dev/null +++ b/cli/tests/testdata/inline_js_source_map_2.js @@ -0,0 +1,4 @@ +"use strict"; +1 + 1; +throw new Error("Hello world!"); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2lubGluZV9qc19zb3VyY2VfbWFwXzIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLENBQUMsR0FBQyxDQUFDLENBQUM7QUFLSixNQUFNLElBQUksS0FBSyxDQUFDLGNBQStCLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/cli/tests/testdata/inline_js_source_map_2.js.out b/cli/tests/testdata/inline_js_source_map_2.js.out new file mode 100644 index 000000000..4f9127da6 --- /dev/null +++ b/cli/tests/testdata/inline_js_source_map_2.js.out @@ -0,0 +1,2 @@ +error: Uncaught Error: Hello world! + at http://localhost:4545/inline_js_source_map_2.ts:6:7 diff --git a/cli/tests/testdata/inline_js_source_map_2.ts b/cli/tests/testdata/inline_js_source_map_2.ts new file mode 100644 index 000000000..fa50586e6 --- /dev/null +++ b/cli/tests/testdata/inline_js_source_map_2.ts @@ -0,0 +1,6 @@ +1 + 1; +interface Test { + hello: string; +} + +throw new Error("Hello world!" as unknown as string); diff --git a/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js b/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js new file mode 100644 index 000000000..5bea615b8 --- /dev/null +++ b/cli/tests/testdata/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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2lubGluZV9qc19zb3VyY2VfbWFwXzIudHMiXSwic291cmNlc0NvbnRlbnQiOlsiMSsxO1xuaW50ZXJmYWNlIFRlc3Qge1xuICBoZWxsbzogc3RyaW5nO1xufVxuXG50aHJvdyBuZXcgRXJyb3IoXCJIZWxsbyB3b3JsZCFcIiBhcyB1bmtub3duIGFzIHN0cmluZyk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLENBQUMsR0FBQyxDQUFDLENBQUM7QUFLSixNQUFNLElBQUksS0FBSyxDQUFDLGNBQStCLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out b/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out new file mode 100644 index 000000000..9280361f7 --- /dev/null +++ b/cli/tests/testdata/inline_js_source_map_2_with_inline_contents.js.out @@ -0,0 +1,4 @@ +error: Uncaught Error: Hello world! +throw new Error("Hello world!" as unknown as string); + ^ + at http://localhost:4545/inline_js_source_map_2.ts:6:7 diff --git a/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js b/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js new file mode 100644 index 000000000..decf47bdc --- /dev/null +++ b/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js @@ -0,0 +1,4 @@ +"use strict"; +import "http://localhost:4545/inline_js_source_map.ts"; +throw new Error("Hello world!"); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2lubGluZV9qc19zb3VyY2VfbWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js.out b/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js.out new file mode 100644 index 000000000..7304fc5f6 --- /dev/null +++ b/cli/tests/testdata/inline_js_source_map_with_contents_from_graph.js.out @@ -0,0 +1,4 @@ +error: Uncaught Error: Hello world! +// throw new Error("Hello world!" as string); + ^ + at http://localhost:4545/inline_js_source_map.ts:6:7 diff --git a/cli/tests/testdata/inspector1.js b/cli/tests/testdata/inspector1.js new file mode 100644 index 000000000..5cb059def --- /dev/null +++ b/cli/tests/testdata/inspector1.js @@ -0,0 +1,3 @@ +setInterval(() => { + console.log("hello"); +}, 1000); diff --git a/cli/tests/testdata/inspector2.js b/cli/tests/testdata/inspector2.js new file mode 100644 index 000000000..57f80ef94 --- /dev/null +++ b/cli/tests/testdata/inspector2.js @@ -0,0 +1,4 @@ +console.log("hello from the script"); + +// This process will be killed before the timeout is over. +await new Promise((res, _) => setTimeout(res, 1000)); diff --git a/cli/tests/testdata/inspector3.js b/cli/tests/testdata/inspector3.js new file mode 100644 index 000000000..b1b00b5a0 --- /dev/null +++ b/cli/tests/testdata/inspector3.js @@ -0,0 +1,7 @@ +// deno-lint-ignore-file +for (let i = 0; i < 128; i++) { + console.log(i); + debugger; +} +await new Promise((res, _) => setTimeout(res, 100)); +console.log("done"); diff --git a/cli/tests/testdata/inspector4.js b/cli/tests/testdata/inspector4.js new file mode 100644 index 000000000..1bf419650 --- /dev/null +++ b/cli/tests/testdata/inspector4.js @@ -0,0 +1,5 @@ +console.log("hello"); + +setInterval(() => { + console.log("hello from interval"); +}, 1000); diff --git a/cli/tests/testdata/js_import_detect.ts b/cli/tests/testdata/js_import_detect.ts new file mode 100644 index 000000000..751741996 --- /dev/null +++ b/cli/tests/testdata/js_import_detect.ts @@ -0,0 +1,3 @@ +function define(_foo: string[]) {} +define(["long"]); +console.log("ok"); diff --git a/cli/tests/testdata/js_import_detect.ts.out b/cli/tests/testdata/js_import_detect.ts.out new file mode 100644 index 000000000..9766475a4 --- /dev/null +++ b/cli/tests/testdata/js_import_detect.ts.out @@ -0,0 +1 @@ +ok diff --git a/cli/tests/testdata/jsx_import_from_ts.App.jsx b/cli/tests/testdata/jsx_import_from_ts.App.jsx new file mode 100644 index 000000000..649230613 --- /dev/null +++ b/cli/tests/testdata/jsx_import_from_ts.App.jsx @@ -0,0 +1,11 @@ +const React = { + createElement() {}, +}; + +export default function app() { + return ( +
+

asdf

+
+ ); +} diff --git a/cli/tests/testdata/jsx_import_from_ts.ts b/cli/tests/testdata/jsx_import_from_ts.ts new file mode 100644 index 000000000..3cc916698 --- /dev/null +++ b/cli/tests/testdata/jsx_import_from_ts.ts @@ -0,0 +1,3 @@ +import app from "./jsx_import_from_ts.App.jsx"; + +console.log(app); diff --git a/cli/tests/testdata/jsx_import_from_ts.ts.out b/cli/tests/testdata/jsx_import_from_ts.ts.out new file mode 100644 index 000000000..d449b8c9a --- /dev/null +++ b/cli/tests/testdata/jsx_import_from_ts.ts.out @@ -0,0 +1 @@ +[Function: app] diff --git a/cli/tests/testdata/lib_dom_asynciterable.ts b/cli/tests/testdata/lib_dom_asynciterable.ts new file mode 100644 index 000000000..d932011f4 --- /dev/null +++ b/cli/tests/testdata/lib_dom_asynciterable.ts @@ -0,0 +1,23 @@ +const { diagnostics, files } = await Deno.emit("/main.ts", { + compilerOptions: { + target: "esnext", + lib: ["esnext", "dom", "dom.iterable", "dom.asynciterable"], + }, + sources: { + "/main.ts": `const rs = new ReadableStream({ + start(c) { + c.enqueue("hello"); + c.enqueue("deno"); + c.close(); + } + }); + + for await (const s of rs) { + console.log("s"); + } + `, + }, +}); + +console.log(diagnostics); +console.log(Object.keys(files).sort()); diff --git a/cli/tests/testdata/lib_dom_asynciterable.ts.out b/cli/tests/testdata/lib_dom_asynciterable.ts.out new file mode 100644 index 000000000..8b5e7adb6 --- /dev/null +++ b/cli/tests/testdata/lib_dom_asynciterable.ts.out @@ -0,0 +1,2 @@ +[] +[ "[WILDCARD]/main.ts.js", "[WILDCARD]/main.ts.js.map" ] diff --git a/cli/tests/testdata/lib_ref.ts b/cli/tests/testdata/lib_ref.ts new file mode 100644 index 000000000..2454f8b5d --- /dev/null +++ b/cli/tests/testdata/lib_ref.ts @@ -0,0 +1,16 @@ +const { diagnostics, files } = await Deno.emit( + "/main.ts", + { + sources: { + "/main.ts": + `/// \n\ndocument.getElementById("foo");\nDeno.args;`, + }, + compilerOptions: { + target: "es2018", + lib: ["es2018", "deno.ns"], + }, + }, +); + +console.log(diagnostics); +console.log(Object.keys(files).sort()); diff --git a/cli/tests/testdata/lib_ref.ts.out b/cli/tests/testdata/lib_ref.ts.out new file mode 100644 index 000000000..4e0f933fc --- /dev/null +++ b/cli/tests/testdata/lib_ref.ts.out @@ -0,0 +1,2 @@ +[] +[ "file:///[WILDCARD]main.ts.js", "file:///[WILDCARD]main.ts.js.map" ] diff --git a/cli/tests/testdata/lib_runtime_api.ts b/cli/tests/testdata/lib_runtime_api.ts new file mode 100644 index 000000000..450d9480b --- /dev/null +++ b/cli/tests/testdata/lib_runtime_api.ts @@ -0,0 +1,14 @@ +const { diagnostics, files } = await Deno.emit( + "/main.ts", + { + sources: { + "/main.ts": `document.getElementById("foo");`, + }, + compilerOptions: { + lib: ["dom", "esnext"], + }, + }, +); + +console.log(diagnostics); +console.log(Object.keys(files).sort()); diff --git a/cli/tests/testdata/lib_runtime_api.ts.out b/cli/tests/testdata/lib_runtime_api.ts.out new file mode 100644 index 000000000..4e0f933fc --- /dev/null +++ b/cli/tests/testdata/lib_runtime_api.ts.out @@ -0,0 +1,2 @@ +[] +[ "file:///[WILDCARD]main.ts.js", "file:///[WILDCARD]main.ts.js.map" ] diff --git a/cli/tests/testdata/lint/expected.out b/cli/tests/testdata/lint/expected.out new file mode 100644 index 000000000..eb8a2651a --- /dev/null +++ b/cli/tests/testdata/lint/expected.out @@ -0,0 +1,3 @@ +[WILDCARD] +Found 3 problems +Checked 3 files diff --git a/cli/tests/testdata/lint/expected_from_stdin.out b/cli/tests/testdata/lint/expected_from_stdin.out new file mode 100644 index 000000000..90f455fdc --- /dev/null +++ b/cli/tests/testdata/lint/expected_from_stdin.out @@ -0,0 +1,3 @@ +[WILDCARD] +Found 1 problem +Checked 1 file diff --git a/cli/tests/testdata/lint/expected_from_stdin_json.out b/cli/tests/testdata/lint/expected_from_stdin_json.out new file mode 100644 index 000000000..7ea40e957 --- /dev/null +++ b/cli/tests/testdata/lint/expected_from_stdin_json.out @@ -0,0 +1,23 @@ +{ + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "col": 8, + "bytePos": 8 + }, + "end": { + "line": 1, + "col": 11, + "bytePos": 11 + } + }, + "filename": "_stdin.ts", + "message": "`any` type is not allowed", + "code": "no-explicit-any", + "hint": [WILDCARD] + } + ], + "errors": [] +} diff --git a/cli/tests/testdata/lint/expected_glob.out b/cli/tests/testdata/lint/expected_glob.out new file mode 100644 index 000000000..eb8a2651a --- /dev/null +++ b/cli/tests/testdata/lint/expected_glob.out @@ -0,0 +1,3 @@ +[WILDCARD] +Found 3 problems +Checked 3 files diff --git a/cli/tests/testdata/lint/expected_ignore.out b/cli/tests/testdata/lint/expected_ignore.out new file mode 100644 index 000000000..b5f78ee04 --- /dev/null +++ b/cli/tests/testdata/lint/expected_ignore.out @@ -0,0 +1,3 @@ +[WILDCARD] +Found 1 problem +Checked 2 files diff --git a/cli/tests/testdata/lint/expected_json.out b/cli/tests/testdata/lint/expected_json.out new file mode 100644 index 000000000..dbeb8039b --- /dev/null +++ b/cli/tests/testdata/lint/expected_json.out @@ -0,0 +1,64 @@ +{ + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "col": 0, + "bytePos": 0 + }, + "end": { + "line": 1, + "col": 19, + "bytePos": 19 + } + }, + "filename": "[WILDCARD]file1.js", + "message": "Ignore directive requires lint rule name(s)", + "code": "ban-untagged-ignore", + "hint": [WILDCARD] + }, + { + "range": { + "start": { + "line": 2, + "col": 14, + "bytePos": 34 + }, + "end": { + "line": 2, + "col": 16, + "bytePos": 36 + } + }, + "filename": "[WILDCARD]file1.js", + "message": "Empty block statement", + "code": "no-empty", + "hint": [WILDCARD] + }, + { + "range": { + "start": { + "line": 3, + "col": 13, + "bytePos": 57 + }, + "end": { + "line": 3, + "col": 15, + "bytePos": 59 + } + }, + "filename": "[WILDCARD]file2.ts", + "message": "Empty block statement", + "code": "no-empty", + "hint": [WILDCARD] + } + ], + "errors": [ + { + "file_path": "[WILDCARD]malformed.js", + "message": "Expected }, got at [WILDCARD]malformed.js:4:15" + } + ] +} diff --git a/cli/tests/testdata/lint/expected_quiet.out b/cli/tests/testdata/lint/expected_quiet.out new file mode 100644 index 000000000..d7c9d7bb9 --- /dev/null +++ b/cli/tests/testdata/lint/expected_quiet.out @@ -0,0 +1,14 @@ +(ban-untagged-ignore) Ignore directive requires lint rule name(s) +// deno-lint-ignore +^^^^^^^^^^^^^^^^^^^ + at [WILDCARD]file1.js:1:0 + + hint: [WILDCARD] + +(no-empty) Empty block statement +while (false) {} + ^^ + at [WILDCARD]file1.js:2:14 + + hint: [WILDCARD] + diff --git a/cli/tests/testdata/lint/expected_rules.out b/cli/tests/testdata/lint/expected_rules.out new file mode 100644 index 000000000..4afab7b9b --- /dev/null +++ b/cli/tests/testdata/lint/expected_rules.out @@ -0,0 +1,2 @@ +Available rules: +[WILDCARD] diff --git a/cli/tests/testdata/lint/expected_verbose.out b/cli/tests/testdata/lint/expected_verbose.out new file mode 100644 index 000000000..eb8a2651a --- /dev/null +++ b/cli/tests/testdata/lint/expected_verbose.out @@ -0,0 +1,3 @@ +[WILDCARD] +Found 3 problems +Checked 3 files diff --git a/cli/tests/testdata/lint/file1.js b/cli/tests/testdata/lint/file1.js new file mode 100644 index 000000000..737f26818 --- /dev/null +++ b/cli/tests/testdata/lint/file1.js @@ -0,0 +1,2 @@ +// deno-lint-ignore +while (false) {} diff --git a/cli/tests/testdata/lint/file2.ts b/cli/tests/testdata/lint/file2.ts new file mode 100644 index 000000000..73c612c35 --- /dev/null +++ b/cli/tests/testdata/lint/file2.ts @@ -0,0 +1,6 @@ +try { + await Deno.open("./some/file.txt"); +} catch (_e) {} + +// deno-lint-ignore no-explicit-any +function _foo(): any {} diff --git a/cli/tests/testdata/lint/ignored_file.ts b/cli/tests/testdata/lint/ignored_file.ts new file mode 100644 index 000000000..97befafa3 --- /dev/null +++ b/cli/tests/testdata/lint/ignored_file.ts @@ -0,0 +1,3 @@ +// deno-lint-ignore-file + +function foo(): any {} diff --git a/cli/tests/testdata/lint/malformed.js b/cli/tests/testdata/lint/malformed.js new file mode 100644 index 000000000..5ad4650d6 --- /dev/null +++ b/cli/tests/testdata/lint/malformed.js @@ -0,0 +1,4 @@ +// deno-fmt-ignore-file + +// intentionally malformed file +export class A { \ No newline at end of file diff --git a/cli/tests/testdata/listen_tls_alpn.ts b/cli/tests/testdata/listen_tls_alpn.ts new file mode 100644 index 000000000..5d58065d9 --- /dev/null +++ b/cli/tests/testdata/listen_tls_alpn.ts @@ -0,0 +1,12 @@ +const listener = Deno.listenTls({ + port: Number(Deno.args[0]), + certFile: "./tls/localhost.crt", + keyFile: "./tls/localhost.key", + alpnProtocols: ["h2", "http/1.1", "foobar"], +}); + +console.log("READY"); + +for await (const conn of listener) { + conn.close(); +} diff --git a/cli/tests/testdata/localhost_unsafe_ssl.ts.out b/cli/tests/testdata/localhost_unsafe_ssl.ts.out new file mode 100644 index 000000000..c482bd81c --- /dev/null +++ b/cli/tests/testdata/localhost_unsafe_ssl.ts.out @@ -0,0 +1,3 @@ +DANGER: TLS certificate validation is disabled for: deno.land +error: error sending request for url (https://localhost:5545/subdir/mod2.ts): error trying to connect: invalid certificate: UnknownIssuer + at [WILDCARD]/cafile_url_imports.ts:1:0 diff --git a/cli/tests/testdata/lock_check_err.json b/cli/tests/testdata/lock_check_err.json new file mode 100644 index 000000000..9bf52adca --- /dev/null +++ b/cli/tests/testdata/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/003_relative_import.ts": "bad" +} diff --git a/cli/tests/testdata/lock_check_err.out b/cli/tests/testdata/lock_check_err.out new file mode 100644 index 000000000..3c5eceb8c --- /dev/null +++ b/cli/tests/testdata/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/003_relative_import.ts + Lock file: lock_check_err.json diff --git a/cli/tests/testdata/lock_check_err2.json b/cli/tests/testdata/lock_check_err2.json new file mode 100644 index 000000000..a59cbc9e3 --- /dev/null +++ b/cli/tests/testdata/lock_check_err2.json @@ -0,0 +1,10 @@ +{ + "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "bad", + "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" +} diff --git a/cli/tests/testdata/lock_check_err2.out b/cli/tests/testdata/lock_check_err2.out new file mode 100644 index 000000000..958c01654 --- /dev/null +++ b/cli/tests/testdata/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: lock_check_err2.json diff --git a/cli/tests/testdata/lock_check_err_with_bundle.json b/cli/tests/testdata/lock_check_err_with_bundle.json new file mode 100644 index 000000000..a218d7000 --- /dev/null +++ b/cli/tests/testdata/lock_check_err_with_bundle.json @@ -0,0 +1,5 @@ +{ + "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" +} diff --git a/cli/tests/testdata/lock_check_err_with_bundle.out b/cli/tests/testdata/lock_check_err_with_bundle.out new file mode 100644 index 000000000..a47cbc606 --- /dev/null +++ b/cli/tests/testdata/lock_check_err_with_bundle.out @@ -0,0 +1,4 @@ +[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/subdir/subdir2/mod2.ts + Lock file: lock_check_err_with_bundle.json diff --git a/cli/tests/testdata/lock_check_ok.json b/cli/tests/testdata/lock_check_ok.json new file mode 100644 index 000000000..9dd5b0548 --- /dev/null +++ b/cli/tests/testdata/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/003_relative_import.ts": "aa9e16de824f81871a1c7164d5bd6857df7db2e18621750bd66b0bde4df07f21" +} diff --git a/cli/tests/testdata/lock_check_ok2.json b/cli/tests/testdata/lock_check_ok2.json new file mode 100644 index 000000000..162c755e2 --- /dev/null +++ b/cli/tests/testdata/lock_check_ok2.json @@ -0,0 +1,10 @@ +{ + "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" +} diff --git a/cli/tests/testdata/lock_dynamic_imports.json b/cli/tests/testdata/lock_dynamic_imports.json new file mode 100644 index 000000000..57263bc85 --- /dev/null +++ b/cli/tests/testdata/lock_dynamic_imports.json @@ -0,0 +1,6 @@ +{ + "http://127.0.0.1:4545/013_dynamic_import.ts": "f0d2d108c100e769cda9f26b74326f21e44cab81611aa7f6cd2b731d4cbc1995", + "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" +} diff --git a/cli/tests/testdata/lock_dynamic_imports.out b/cli/tests/testdata/lock_dynamic_imports.out new file mode 100644 index 000000000..e5c76c8f0 --- /dev/null +++ b/cli/tests/testdata/lock_dynamic_imports.out @@ -0,0 +1,4 @@ +[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/subdir/subdir2/mod2.ts + Lock file: lock_dynamic_imports.json diff --git a/cli/tests/testdata/lock_write_fetch.ts b/cli/tests/testdata/lock_write_fetch.ts new file mode 100644 index 000000000..b6ecf4747 --- /dev/null +++ b/cli/tests/testdata/lock_write_fetch.ts @@ -0,0 +1,58 @@ +try { + Deno.removeSync("./lock_write_fetch.json"); +} catch { + // pass +} + +const fetchProc = Deno.run({ + stdout: "null", + stderr: "null", + cmd: [ + Deno.execPath(), + "cache", + "--reload", + "--lock=lock_write_fetch.json", + "--lock-write", + "--cert=tls/RootCA.pem", + "https_import.ts", + ], +}); + +const fetchCode = (await fetchProc.status()).code; +console.log(`fetch code: ${fetchCode}`); + +const fetchCheckProc = Deno.run({ + stdout: "null", + stderr: "null", + cmd: [ + Deno.execPath(), + "cache", + "--lock=lock_write_fetch.json", + "--cert=tls/RootCA.pem", + "https_import.ts", + ], +}); + +const fetchCheckProcCode = (await fetchCheckProc.status()).code; +console.log(`fetch check code: ${fetchCheckProcCode}`); + +Deno.removeSync("./lock_write_fetch.json"); + +const runProc = Deno.run({ + stdout: "null", + stderr: "null", + cmd: [ + Deno.execPath(), + "run", + "--lock=lock_write_fetch.json", + "--lock-write", + "--allow-read", + "file_exists.ts", + "lock_write_fetch.json", + ], +}); + +const runCode = (await runProc.status()).code; +console.log(`run code: ${runCode}`); + +Deno.removeSync("./lock_write_fetch.json"); diff --git a/cli/tests/testdata/lock_write_fetch.ts.out b/cli/tests/testdata/lock_write_fetch.ts.out new file mode 100644 index 000000000..bfdb952f9 --- /dev/null +++ b/cli/tests/testdata/lock_write_fetch.ts.out @@ -0,0 +1,3 @@ +fetch code: 0 +fetch check code: 0 +run code: 0 diff --git a/cli/tests/testdata/lock_write_requires_lock.out b/cli/tests/testdata/lock_write_requires_lock.out new file mode 100644 index 000000000..7cc5906f6 --- /dev/null +++ b/cli/tests/testdata/lock_write_requires_lock.out @@ -0,0 +1,3 @@ +error: The following required arguments were not provided: + --lock +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/lsp/a.d.ts b/cli/tests/testdata/lsp/a.d.ts new file mode 100644 index 000000000..7f587e144 --- /dev/null +++ b/cli/tests/testdata/lsp/a.d.ts @@ -0,0 +1 @@ +declare var a: string; diff --git a/cli/tests/testdata/lsp/b.d.ts b/cli/tests/testdata/lsp/b.d.ts new file mode 100644 index 000000000..9d4b96cb8 --- /dev/null +++ b/cli/tests/testdata/lsp/b.d.ts @@ -0,0 +1 @@ +declare var b: string; diff --git a/cli/tests/testdata/lsp/code_action_ignore_lint_params.json b/cli/tests/testdata/lsp/code_action_ignore_lint_params.json new file mode 100644 index 000000000..7711812fd --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_ignore_lint_params.json @@ -0,0 +1,39 @@ +{ + "textDocument": { + "uri": "file:///a/file.ts" + }, + "range": { + "start": { + "line": 1, + "character": 5 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "context": { + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 5 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "severity": 1, + "code": "prefer-const", + "source": "deno-lint", + "message": "'message' is never reassigned\nUse 'const' instead", + "relatedInformation": [] + } + ], + "only": [ + "quickfix" + ] + } +} diff --git a/cli/tests/testdata/lsp/code_action_ignore_lint_response.json b/cli/tests/testdata/lsp/code_action_ignore_lint_response.json new file mode 100644 index 000000000..f5c24ec21 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_ignore_lint_response.json @@ -0,0 +1,62 @@ +[ + { + "title": "Disable prefer-const for this line", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { "line": 1, "character": 5 }, + "end": { "line": 1, "character": 12 } + }, + "severity": 1, + "code": "prefer-const", + "source": "deno-lint", + "message": "'message' is never reassigned\nUse 'const' instead", + "relatedInformation": [] + } + ], + "edit": { + "changes": { + "file:///a/file.ts": [ + { + "range": { + "start": { "line": 1, "character": 0 }, + "end": { "line": 1, "character": 0 } + }, + "newText": "// deno-lint-ignore prefer-const\n" + } + ] + } + } + }, + { + "title": "Ignore lint errors for the entire file", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { "line": 1, "character": 5 }, + "end": { "line": 1, "character": 12 } + }, + "severity": 1, + "code": "prefer-const", + "source": "deno-lint", + "message": "'message' is never reassigned\nUse 'const' instead", + "relatedInformation": [] + } + ], + "edit": { + "changes": { + "file:///a/file.ts": [ + { + "range": { + "start": { "line": 0, "character": 0 }, + "end": { "line": 0, "character": 0 } + }, + "newText": "// deno-lint-ignore-file\n" + } + ] + } + } + } +] diff --git a/cli/tests/testdata/lsp/code_action_params.json b/cli/tests/testdata/lsp/code_action_params.json new file mode 100644 index 000000000..d026d61f6 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_params.json @@ -0,0 +1,39 @@ +{ + "textDocument": { + "uri": "file:///a/file.ts" + }, + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "context": { + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "severity": 1, + "code": 1308, + "source": "deno-ts", + "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", + "relatedInformation": [] + } + ], + "only": [ + "quickfix" + ] + } +} diff --git a/cli/tests/testdata/lsp/code_action_params_cache.json b/cli/tests/testdata/lsp/code_action_params_cache.json new file mode 100644 index 000000000..61ae555a3 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_params_cache.json @@ -0,0 +1,41 @@ +{ + "textDocument": { + "uri": "file:///a/file.ts" + }, + "range": { + "start": { + "line": 0, + "character": 19 + }, + "end": { + "line": 0, + "character": 49 + } + }, + "context": { + "diagnostics": [ + { + "range": { + "start": { + "line": 0, + "character": 19 + }, + "end": { + "line": 0, + "character": 49 + } + }, + "severity": 1, + "code": "no-cache", + "source": "deno", + "message": "Unable to load the remote module: \"https://deno.land/x/a/mod.ts\".", + "data": { + "specifier": "https://deno.land/x/a/mod.ts" + } + } + ], + "only": [ + "quickfix" + ] + } +} diff --git a/cli/tests/testdata/lsp/code_action_params_deadlock.json b/cli/tests/testdata/lsp/code_action_params_deadlock.json new file mode 100644 index 000000000..be0e317e1 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_params_deadlock.json @@ -0,0 +1,38 @@ +{ + "textDocument": { + "uri": "file:///a/file.ts" + }, + "range": { + "start": { + "line": 441, + "character": 33 + }, + "end": { + "line": 441, + "character": 42 + } + }, + "context": { + "diagnostics": [ + { + "range": { + "start": { + "line": 441, + "character": 33 + }, + "end": { + "line": 441, + "character": 42 + } + }, + "severity": 1, + "code": 7031, + "source": "deno-ts", + "message": "Binding element 'debugFlag' implicitly has an 'any' type." + } + ], + "only": [ + "quickfix" + ] + } +} diff --git a/cli/tests/testdata/lsp/code_action_params_imports.json b/cli/tests/testdata/lsp/code_action_params_imports.json new file mode 100644 index 000000000..7a5824923 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_params_imports.json @@ -0,0 +1,54 @@ +{ + "textDocument": { + "uri": "file:///a/file01.ts" + }, + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "context": { + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'abc'." + }, + { + "range": { + "start": { + "line": 2, + "character": 12 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'def'." + } + ], + "only": [ + "quickfix" + ] + } +} diff --git a/cli/tests/testdata/lsp/code_action_params_refactor.json b/cli/tests/testdata/lsp/code_action_params_refactor.json new file mode 100644 index 000000000..121c400ed --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_params_refactor.json @@ -0,0 +1,21 @@ +{ + "textDocument": { + "uri": "file:///a/file.ts" + }, + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "context": { + "diagnostics": [], + "only": [ + "refactor" + ] + } +} diff --git a/cli/tests/testdata/lsp/code_action_resolve_params.json b/cli/tests/testdata/lsp/code_action_resolve_params.json new file mode 100644 index 000000000..50c1f9a43 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_resolve_params.json @@ -0,0 +1,27 @@ +{ + "title": "Add all missing 'async' modifiers", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "severity": 1, + "code": 1308, + "source": "deno-ts", + "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", + "relatedInformation": [] + } + ], + "data": { + "specifier": "file:///a/file.ts", + "fixId": "fixAwaitInSyncFunction" + } +} diff --git a/cli/tests/testdata/lsp/code_action_resolve_params_imports.json b/cli/tests/testdata/lsp/code_action_resolve_params_imports.json new file mode 100644 index 000000000..60178bbfe --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_resolve_params_imports.json @@ -0,0 +1,26 @@ +{ + "title": "Add all missing imports", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'abc'." + } + ], + "data": { + "specifier": "file:///a/file01.ts", + "fixId": "fixMissingImport" + } +} diff --git a/cli/tests/testdata/lsp/code_action_resolve_params_refactor.json b/cli/tests/testdata/lsp/code_action_resolve_params_refactor.json new file mode 100644 index 000000000..d4bb3bd81 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_resolve_params_refactor.json @@ -0,0 +1,20 @@ +{ + "title": "Extract to interface", + "kind": "refactor.extract.interface", + "isPreferred": true, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 33 + } + }, + "refactorName": "Extract type", + "actionName": "Extract to interface" + } +} diff --git a/cli/tests/testdata/lsp/code_action_resolve_response.json b/cli/tests/testdata/lsp/code_action_resolve_response.json new file mode 100644 index 000000000..e3f5b3f0e --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_resolve_response.json @@ -0,0 +1,91 @@ +{ + "title": "Add all missing 'async' modifiers", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "severity": 1, + "code": 1308, + "source": "deno-ts", + "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", + "relatedInformation": [] + } + ], + "edit": { + "documentChanges": [ + { + "textDocument": { + "uri": "file:///a/file.ts", + "version": 1 + }, + "edits": [ + { + "range": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "newText": "async " + }, + { + "range": { + "start": { + "line": 0, + "character": 21 + }, + "end": { + "line": 0, + "character": 25 + } + }, + "newText": "Promise" + }, + { + "range": { + "start": { + "line": 4, + "character": 7 + }, + "end": { + "line": 4, + "character": 7 + } + }, + "newText": "async " + }, + { + "range": { + "start": { + "line": 4, + "character": 21 + }, + "end": { + "line": 4, + "character": 25 + } + }, + "newText": "Promise" + } + ] + } + ] + }, + "data": { + "specifier": "file:///a/file.ts", + "fixId": "fixAwaitInSyncFunction" + } +} diff --git a/cli/tests/testdata/lsp/code_action_resolve_response_imports.json b/cli/tests/testdata/lsp/code_action_resolve_response_imports.json new file mode 100644 index 000000000..6621c501f --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_resolve_response_imports.json @@ -0,0 +1,51 @@ +{ + "title": "Add all missing imports", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'abc'." + } + ], + "edit": { + "documentChanges": [ + { + "textDocument": { + "uri": "file:///a/file01.ts", + "version": 1 + }, + "edits": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "import { abc,def } from \"./file00.ts\";\n" + } + ] + } + ] + }, + "data": { + "specifier": "file:///a/file01.ts", + "fixId": "fixMissingImport" + } +} diff --git a/cli/tests/testdata/lsp/code_action_resolve_response_refactor.json b/cli/tests/testdata/lsp/code_action_resolve_response_refactor.json new file mode 100644 index 000000000..721a76a6b --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_resolve_response_refactor.json @@ -0,0 +1,58 @@ +{ + "title": "Extract to interface", + "kind": "refactor.extract.interface", + "edit": { + "documentChanges": [ + { + "textDocument": { + "uri": "file:///a/file.ts", + "version": 1 + }, + "edits": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "interface NewType {\n a?: number;\n b?: string;\n}\n\n" + }, + { + "range": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 33 + } + }, + "newText": "NewType" + } + ] + } + ] + }, + "isPreferred": true, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 33 + } + }, + "refactorName": "Extract type", + "actionName": "Extract to interface" + } +} diff --git a/cli/tests/testdata/lsp/code_action_response.json b/cli/tests/testdata/lsp/code_action_response.json new file mode 100644 index 000000000..ab30898f8 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_response.json @@ -0,0 +1,90 @@ +[ + { + "title": "Add async modifier to containing function", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "severity": 1, + "code": 1308, + "source": "deno-ts", + "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", + "relatedInformation": [] + } + ], + "edit": { + "documentChanges": [ + { + "textDocument": { + "uri": "file:///a/file.ts", + "version": 1 + }, + "edits": [ + { + "range": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "newText": "async " + }, + { + "range": { + "start": { + "line": 0, + "character": 21 + }, + "end": { + "line": 0, + "character": 25 + } + }, + "newText": "Promise" + } + ] + } + ] + } + }, + { + "title": "Add all missing 'async' modifiers", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "severity": 1, + "code": 1308, + "source": "deno-ts", + "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", + "relatedInformation": [] + } + ], + "data": { + "specifier": "file:///a/file.ts", + "fixId": "fixAwaitInSyncFunction" + } + } +] diff --git a/cli/tests/testdata/lsp/code_action_response_cache.json b/cli/tests/testdata/lsp/code_action_response_cache.json new file mode 100644 index 000000000..c56b35023 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_response_cache.json @@ -0,0 +1,36 @@ +[ + { + "title": "Cache \"https://deno.land/x/a/mod.ts\" and its dependencies.", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 0, + "character": 19 + }, + "end": { + "line": 0, + "character": 49 + } + }, + "severity": 1, + "code": "no-cache", + "source": "deno", + "message": "Unable to load the remote module: \"https://deno.land/x/a/mod.ts\".", + "data": { + "specifier": "https://deno.land/x/a/mod.ts" + } + } + ], + "command": { + "title": "", + "command": "deno.cache", + "arguments": [ + [ + "https://deno.land/x/a/mod.ts" + ] + ] + } + } +] diff --git a/cli/tests/testdata/lsp/code_action_response_imports.json b/cli/tests/testdata/lsp/code_action_response_imports.json new file mode 100644 index 000000000..e4d926bdd --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_response_imports.json @@ -0,0 +1,242 @@ +[ + { + "title": "Import 'abc' from module \"./file00.ts\"", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'abc'." + } + ], + "edit": { + "documentChanges": [ + { + "textDocument": { + "uri": "file:///a/file01.ts", + "version": 1 + }, + "edits": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "import { abc } from \"./file00.ts\";\n" + } + ] + } + ] + } + }, + { + "title": "Add all missing imports", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'abc'." + } + ], + "data": { + "specifier": "file:///a/file01.ts", + "fixId": "fixMissingImport" + } + }, + { + "title": "Add missing function declaration 'abc'", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'abc'." + } + ], + "edit": { + "documentChanges": [ + { + "textDocument": { + "uri": "file:///a/file01.ts", + "version": 1 + }, + "edits": [ + { + "range": { + "start": { + "line": 3, + "character": 0 + }, + "end": { + "line": 3, + "character": 0 + } + }, + "newText": "\nfunction abc(abc: any) {\nthrow new Error(\"Function not implemented.\");\n}\n" + } + ] + } + ] + } + }, + { + "title": "Import 'def' from module \"./file00.ts\"", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 2, + "character": 12 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'def'." + } + ], + "edit": { + "documentChanges": [ + { + "textDocument": { + "uri": "file:///a/file01.ts", + "version": 1 + }, + "edits": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "import { def } from \"./file00.ts\";\n" + } + ] + } + ] + } + }, + { + "title": "Add missing function declaration 'def'", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 2, + "character": 12 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'def'." + } + ], + "edit": { + "documentChanges": [ + { + "textDocument": { + "uri": "file:///a/file01.ts", + "version": 1 + }, + "edits": [ + { + "range": { + "start": { + "line": 3, + "character": 0 + }, + "end": { + "line": 3, + "character": 0 + } + }, + "newText": "\nfunction def(def: any) {\nthrow new Error(\"Function not implemented.\");\n}\n" + } + ] + } + ] + } + }, + { + "title": "Add all missing function declarations", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'abc'." + } + ], + "data": { + "specifier": "file:///a/file01.ts", + "fixId": "fixMissingFunctionDeclaration" + } + } +] diff --git a/cli/tests/testdata/lsp/code_action_response_no_disabled.json b/cli/tests/testdata/lsp/code_action_response_no_disabled.json new file mode 100644 index 000000000..c69bd1120 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_response_no_disabled.json @@ -0,0 +1,22 @@ +[ + { + "title": "Move to a new file", + "kind": "refactor.move.newFile", + "isPreferred": false, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 14, + "character": 0 + } + }, + "refactorName": "Move to a new file", + "actionName": "Move to a new file" + } + } +] diff --git a/cli/tests/testdata/lsp/code_action_response_refactor.json b/cli/tests/testdata/lsp/code_action_response_refactor.json new file mode 100644 index 000000000..a9fbd2827 --- /dev/null +++ b/cli/tests/testdata/lsp/code_action_response_refactor.json @@ -0,0 +1,177 @@ +[ + { + "title": "Extract to function in global scope", + "kind": "refactor.extract.function", + "isPreferred": false, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "refactorName": "Extract Symbol", + "actionName": "function_scope_0" + } + }, + { + "title": "Extract to constant in enclosing scope", + "kind": "refactor.extract.constant", + "isPreferred": false, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "refactorName": "Extract Symbol", + "actionName": "constant_scope_0" + } + }, + { + "title": "Move to a new file", + "kind": "refactor.move.newFile", + "isPreferred": false, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "refactorName": "Move to a new file", + "actionName": "Move to a new file" + } + }, + { + "title": "Convert default export to named export", + "kind": "refactor.rewrite.export.named", + "isPreferred": false, + "disabled": { + "reason": "This file already has a default export" + }, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "refactorName": "Convert export", + "actionName": "Convert default export to named export" + } + }, + { + "title": "Convert named export to default export", + "kind": "refactor.rewrite.export.default", + "isPreferred": false, + "disabled": { + "reason": "This file already has a default export" + }, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "refactorName": "Convert export", + "actionName": "Convert named export to default export" + } + }, + { + "title": "Convert namespace import to named imports", + "kind": "refactor.rewrite.import.named", + "isPreferred": false, + "disabled": { + "reason": "Selection is not an import declaration." + }, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "refactorName": "Convert import", + "actionName": "Convert namespace import to named imports" + } + }, + { + "title": "Convert named imports to namespace import", + "kind": "refactor.rewrite.import.namespace", + "isPreferred": false, + "disabled": { + "reason": "Selection is not an import declaration." + }, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "refactorName": "Convert import", + "actionName": "Convert named imports to namespace import" + } + }, + { + "title": "Convert to optional chain expression", + "kind": "refactor.rewrite.expression.optionalChain", + "isPreferred": false, + "disabled": { + "reason": "Could not find convertible access expression" + }, + "data": { + "specifier": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "refactorName": "Convert to optional chain expression", + "actionName": "Convert to optional chain expression" + } + } +] diff --git a/cli/tests/testdata/lsp/code_lens_resolve_response.json b/cli/tests/testdata/lsp/code_lens_resolve_response.json new file mode 100644 index 000000000..1400eb4e6 --- /dev/null +++ b/cli/tests/testdata/lsp/code_lens_resolve_response.json @@ -0,0 +1,38 @@ +{ + "range": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "command": { + "title": "1 reference", + "command": "deno.showReferences", + "arguments": [ + "file:///a/file.ts", + { + "line": 0, + "character": 6 + }, + [ + { + "uri": "file:///a/file.ts", + "range": { + "start": { + "line": 12, + "character": 14 + }, + "end": { + "line": 12, + "character": 15 + } + } + } + ] + ] + } +} diff --git a/cli/tests/testdata/lsp/code_lens_resolve_response_impl.json b/cli/tests/testdata/lsp/code_lens_resolve_response_impl.json new file mode 100644 index 000000000..cabf2f833 --- /dev/null +++ b/cli/tests/testdata/lsp/code_lens_resolve_response_impl.json @@ -0,0 +1,38 @@ +{ + "range": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 11 + } + }, + "command": { + "title": "1 implementation", + "command": "deno.showReferences", + "arguments": [ + "file:///a/file.ts", + { + "line": 0, + "character": 10 + }, + [ + { + "uri": "file:///a/file.ts", + "range": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 7 + } + } + } + ] + ] + } +} diff --git a/cli/tests/testdata/lsp/code_lens_response.json b/cli/tests/testdata/lsp/code_lens_response.json new file mode 100644 index 000000000..e3a87e4be --- /dev/null +++ b/cli/tests/testdata/lsp/code_lens_response.json @@ -0,0 +1,34 @@ +[ + { + "range": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "references" + } + }, + { + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 3 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "references" + } + } +] diff --git a/cli/tests/testdata/lsp/code_lens_response_changed.json b/cli/tests/testdata/lsp/code_lens_response_changed.json new file mode 100644 index 000000000..b0073a23f --- /dev/null +++ b/cli/tests/testdata/lsp/code_lens_response_changed.json @@ -0,0 +1,50 @@ +[ + { + "range": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 11 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "implementations" + } + }, + { + "range": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 11 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "references" + } + }, + { + "range": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 7 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "references" + } + } +] diff --git a/cli/tests/testdata/lsp/code_lens_response_impl.json b/cli/tests/testdata/lsp/code_lens_response_impl.json new file mode 100644 index 000000000..c6e5bd92d --- /dev/null +++ b/cli/tests/testdata/lsp/code_lens_response_impl.json @@ -0,0 +1,98 @@ +[ + { + "range": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 11 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "implementations" + } + }, + { + "range": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 11 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "references" + } + }, + { + "range": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 7 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "references" + } + }, + { + "range": { + "start": { + "line": 10, + "character": 10 + }, + "end": { + "line": 10, + "character": 11 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "implementations" + } + }, + { + "range": { + "start": { + "line": 10, + "character": 10 + }, + "end": { + "line": 10, + "character": 11 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "references" + } + }, + { + "range": { + "start": { + "line": 11, + "character": 2 + }, + "end": { + "line": 11, + "character": 3 + } + }, + "data": { + "specifier": "file:///a/file.ts", + "source": "references" + } + } +] diff --git a/cli/tests/testdata/lsp/code_lens_response_test.json b/cli/tests/testdata/lsp/code_lens_response_test.json new file mode 100644 index 000000000..b2cb4588a --- /dev/null +++ b/cli/tests/testdata/lsp/code_lens_response_test.json @@ -0,0 +1,162 @@ +[ + { + "range": { + "start": { + "line": 4, + "character": 5 + }, + "end": { + "line": 4, + "character": 9 + } + }, + "command": { + "title": "▶︎ Run Test", + "command": "deno.test", + "arguments": [ + "file:///a/file.ts", + "test a" + ] + } + }, + { + "range": { + "start": { + "line": 5, + "character": 5 + }, + "end": { + "line": 5, + "character": 9 + } + }, + "command": { + "title": "▶︎ Run Test", + "command": "deno.test", + "arguments": [ + "file:///a/file.ts", + "test b" + ] + } + }, + { + "range": { + "start": { + "line": 9, + "character": 0 + }, + "end": { + "line": 9, + "character": 4 + } + }, + "command": { + "title": "▶︎ Run Test", + "command": "deno.test", + "arguments": [ + "file:///a/file.ts", + "test c" + ] + } + }, + { + "range": { + "start": { + "line": 13, + "character": 0 + }, + "end": { + "line": 13, + "character": 4 + } + }, + "command": { + "title": "▶︎ Run Test", + "command": "deno.test", + "arguments": [ + "file:///a/file.ts", + "test d" + ] + } + }, + { + "range": { + "start": { + "line": 14, + "character": 0 + }, + "end": { + "line": 14, + "character": 5 + } + }, + "command": { + "title": "▶︎ Run Test", + "command": "deno.test", + "arguments": [ + "file:///a/file.ts", + "test e" + ] + } + }, + { + "range": { + "start": { + "line": 18, + "character": 0 + }, + "end": { + "line": 18, + "character": 5 + } + }, + "command": { + "title": "▶︎ Run Test", + "command": "deno.test", + "arguments": [ + "file:///a/file.ts", + "test f" + ] + } + }, + { + "range": { + "start": { + "line": 19, + "character": 0 + }, + "end": { + "line": 19, + "character": 5 + } + }, + "command": { + "title": "▶︎ Run Test", + "command": "deno.test", + "arguments": [ + "file:///a/file.ts", + "test g" + ] + } + }, + { + "range": { + "start": { + "line": 23, + "character": 0 + }, + "end": { + "line": 23, + "character": 5 + } + }, + "command": { + "title": "▶︎ Run Test", + "command": "deno.test", + "arguments": [ + "file:///a/file.ts", + "test h" + ] + } + } +] diff --git a/cli/tests/testdata/lsp/completion_request_params_optional.json b/cli/tests/testdata/lsp/completion_request_params_optional.json new file mode 100644 index 000000000..1f3c079c7 --- /dev/null +++ b/cli/tests/testdata/lsp/completion_request_params_optional.json @@ -0,0 +1,13 @@ +{ + "textDocument": { + "uri": "file:///a/file.ts" + }, + "position": { + "line": 8, + "character": 4 + }, + "context": { + "triggerKind": 2, + "triggerCharacter": "." + } +} diff --git a/cli/tests/testdata/lsp/completion_request_response_empty.json b/cli/tests/testdata/lsp/completion_request_response_empty.json new file mode 100644 index 000000000..272dfb475 --- /dev/null +++ b/cli/tests/testdata/lsp/completion_request_response_empty.json @@ -0,0 +1,38 @@ +{ + "isIncomplete": false, + "items": [ + { + "label": ".", + "kind": 19, + "detail": "(local)", + "sortText": "1", + "insertText": "." + }, + { + "label": "..", + "kind": 19, + "detail": "(local)", + "sortText": "1", + "insertText": ".." + }, + { + "label": "http://localhost:4545", + "kind": 19, + "detail": "(registry)", + "sortText": "2", + "textEdit": { + "range": { + "start": { + "line": 0, + "character": 20 + }, + "end": { + "line": 0, + "character": 20 + } + }, + "newText": "http://localhost:4545" + } + } + ] +} diff --git a/cli/tests/testdata/lsp/completion_resolve_params.json b/cli/tests/testdata/lsp/completion_resolve_params.json new file mode 100644 index 000000000..26231036d --- /dev/null +++ b/cli/tests/testdata/lsp/completion_resolve_params.json @@ -0,0 +1,14 @@ +{ + "label": "build", + "kind": 6, + "sortText": "1", + "insertTextFormat": 1, + "data": { + "tsc": { + "specifier": "file:///a/file.ts", + "position": 5, + "name": "build", + "useCodeSnippet": false + } + } +} diff --git a/cli/tests/testdata/lsp/completion_resolve_params_optional.json b/cli/tests/testdata/lsp/completion_resolve_params_optional.json new file mode 100644 index 000000000..cb99bf960 --- /dev/null +++ b/cli/tests/testdata/lsp/completion_resolve_params_optional.json @@ -0,0 +1,15 @@ +{ + "label": "b?", + "kind": 5, + "sortText": "1", + "filterText": "b", + "insertText": "b", + "data": { + "tsc": { + "specifier": "file:///a/file.ts", + "position": 79, + "name": "b", + "useCodeSnippet": false + } + } +} diff --git a/cli/tests/testdata/lsp/completion_resolve_params_registry.json b/cli/tests/testdata/lsp/completion_resolve_params_registry.json new file mode 100644 index 000000000..99a4a048e --- /dev/null +++ b/cli/tests/testdata/lsp/completion_resolve_params_registry.json @@ -0,0 +1,20 @@ +{ + "label": "v2.0.0", + "kind": 19, + "detail": "(version)", + "sortText": "0000000003", + "filterText": "http://localhost:4545/x/a@v2.0.0", + "textEdit": { + "range": { + "start": { + "line": 0, + "character": 20 + }, + "end": { + "line": 0, + "character": 46 + } + }, + "newText": "http://localhost:4545/x/a@v2.0.0" + } +} diff --git a/cli/tests/testdata/lsp/completion_resolve_response.json b/cli/tests/testdata/lsp/completion_resolve_response.json new file mode 100644 index 000000000..0edbc14ef --- /dev/null +++ b/cli/tests/testdata/lsp/completion_resolve_response.json @@ -0,0 +1,11 @@ +{ + "label": "build", + "kind": 6, + "detail": "const Deno.build: {\n target: string;\n arch: \"x86_64\" | \"aarch64\";\n os: \"darwin\" | \"linux\" | \"windows\";\n vendor: string;\n env?: string | undefined;\n}", + "documentation": { + "kind": "markdown", + "value": "Build related information." + }, + "sortText": "1", + "insertTextFormat": 1 +} diff --git a/cli/tests/testdata/lsp/completion_resolve_response_registry.json b/cli/tests/testdata/lsp/completion_resolve_response_registry.json new file mode 100644 index 000000000..99a4a048e --- /dev/null +++ b/cli/tests/testdata/lsp/completion_resolve_response_registry.json @@ -0,0 +1,20 @@ +{ + "label": "v2.0.0", + "kind": 19, + "detail": "(version)", + "sortText": "0000000003", + "filterText": "http://localhost:4545/x/a@v2.0.0", + "textEdit": { + "range": { + "start": { + "line": 0, + "character": 20 + }, + "end": { + "line": 0, + "character": 46 + } + }, + "newText": "http://localhost:4545/x/a@v2.0.0" + } +} diff --git a/cli/tests/testdata/lsp/diagnostics_deno_deps.json b/cli/tests/testdata/lsp/diagnostics_deno_deps.json new file mode 100644 index 000000000..ec6cc4f51 --- /dev/null +++ b/cli/tests/testdata/lsp/diagnostics_deno_deps.json @@ -0,0 +1,25 @@ +{ + "uri": "file:///a/file.ts", + "diagnostics": [ + { + "range": { + "start": { + "line": 0, + "character": 19 + }, + "end": { + "line": 0, + "character": 49 + } + }, + "severity": 1, + "code": "no-cache", + "source": "deno", + "message": "Uncached or missing remote URL: \"https://deno.land/x/a/mod.ts\".", + "data": { + "specifier": "https://deno.land/x/a/mod.ts" + } + } + ], + "version": 1 +} diff --git a/cli/tests/testdata/lsp/diagnostics_deno_types.json b/cli/tests/testdata/lsp/diagnostics_deno_types.json new file mode 100644 index 000000000..f33945a59 --- /dev/null +++ b/cli/tests/testdata/lsp/diagnostics_deno_types.json @@ -0,0 +1,101 @@ +{ + "uri": "file:///a/file.ts", + "diagnostics": [ + { + "range": { + "start": { + "line": 0, + "character": 21 + }, + "end": { + "line": 0, + "character": 51 + } + }, + "severity": 1, + "code": "no-cache", + "source": "deno", + "message": "Uncached or missing remote URL: \"https://example.com/a/b.d.ts\".", + "data": { + "specifier": "https://example.com/a/b.d.ts" + } + }, + { + "range": { + "start": { + "line": 7, + "character": 19 + }, + "end": { + "line": 7, + "character": 47 + } + }, + "severity": 1, + "code": "no-cache", + "source": "deno", + "message": "Uncached or missing remote URL: \"https://example.com/a/e.js\".", + "data": { + "specifier": "https://example.com/a/e.js" + } + }, + { + "range": { + "start": { + "line": 6, + "character": 16 + }, + "end": { + "line": 6, + "character": 44 + } + }, + "severity": 1, + "code": "no-cache", + "source": "deno", + "message": "Uncached or missing remote URL: \"https://example.com/a/e.d.ts\".", + "data": { + "specifier": "https://example.com/a/e.d.ts" + } + }, + { + "range": { + "start": { + "line": 4, + "character": 19 + }, + "end": { + "line": 4, + "character": 47 + } + }, + "severity": 1, + "code": "no-cache", + "source": "deno", + "message": "Uncached or missing remote URL: \"https://example.com/a/d.js\".", + "data": { + "specifier": "https://example.com/a/d.js" + } + }, + { + "range": { + "start": { + "line": 3, + "character": 15 + }, + "end": { + "line": 3, + "character": 43 + } + }, + "severity": 1, + "code": "no-cache", + "source": "deno", + "message": "Uncached or missing remote URL: \"https://example.com/a/d.d.ts\".", + "data": { + "specifier": "https://example.com/a/d.d.ts" + } + } + ], + "version": 1 +} diff --git a/cli/tests/testdata/lsp/did_open_params_deno_types.json b/cli/tests/testdata/lsp/did_open_params_deno_types.json new file mode 100644 index 000000000..6f085d045 --- /dev/null +++ b/cli/tests/testdata/lsp/did_open_params_deno_types.json @@ -0,0 +1,8 @@ +{ + "textDocument": { + "uri": "file:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": "/// \n/// \n// deno-lint-ignore-file no-undef\n\n// This module is the entry point for \"compiler\" isolate, ie. the one\n// that is created when Deno needs to type check TypeScript, and in some\n// instances convert TypeScript to JavaScript.\n\n// Removes the `__proto__` for security reasons. This intentionally makes\n// Deno non compliant with ECMA-262 Annex B.2.2.1\ndelete Object.prototype.__proto__;\n\n((window) => {\n /** @type {DenoCore} */\n const core = window.Deno.core;\n\n let logDebug = false;\n let logSource = \"JS\";\n\n function setLogDebug(debug, source) {\n logDebug = debug;\n if (source) {\n logSource = source;\n }\n }\n\n function debug(...args) {\n if (logDebug) {\n const stringifiedArgs = args.map((arg) =>\n typeof arg === \"string\" ? arg : JSON.stringify(arg)\n ).join(\" \");\n // adding a non-zero integer value to the end of the debug string causes\n // the message to be printed to stderr instead of stdout, which is better\n // aligned to the behaviour of debug messages\n core.print(`DEBUG ${logSource} - ${stringifiedArgs}\\n`, 1);\n }\n }\n\n function error(...args) {\n const stringifiedArgs = args.map((arg) =>\n typeof arg === \"string\" || arg instanceof Error\n ? String(arg)\n : JSON.stringify(arg)\n ).join(\" \");\n core.print(`ERROR ${logSource} = ${stringifiedArgs}\\n`, 1);\n }\n\n class AssertionError extends Error {\n constructor(msg) {\n super(msg);\n this.name = \"AssertionError\";\n }\n }\n\n function assert(cond, msg = \"Assertion failed.\") {\n if (!cond) {\n throw new AssertionError(msg);\n }\n }\n\n /** @type {Map} */\n const sourceFileCache = new Map();\n\n /** @param {ts.DiagnosticRelatedInformation} diagnostic */\n function fromRelatedInformation({\n start,\n length,\n file,\n messageText: msgText,\n ...ri\n }) {\n let messageText;\n let messageChain;\n if (typeof msgText === \"object\") {\n messageChain = msgText;\n } else {\n messageText = msgText;\n }\n if (start !== undefined && length !== undefined && file) {\n const startPos = file.getLineAndCharacterOfPosition(start);\n const sourceLine = file.getFullText().split(\"\\n\")[startPos.line];\n const fileName = file.fileName;\n return {\n start: startPos,\n end: file.getLineAndCharacterOfPosition(start + length),\n fileName,\n messageChain,\n messageText,\n sourceLine,\n ...ri,\n };\n } else {\n return {\n messageChain,\n messageText,\n ...ri,\n };\n }\n }\n\n /** @param {ts.Diagnostic[]} diagnostics */\n function fromTypeScriptDiagnostic(diagnostics) {\n return diagnostics.map(({ relatedInformation: ri, source, ...diag }) => {\n /** @type {any} */\n const value = fromRelatedInformation(diag);\n value.relatedInformation = ri\n ? ri.map(fromRelatedInformation)\n : undefined;\n value.source = source;\n return value;\n });\n }\n\n // Using incremental compile APIs requires that all\n // paths must be either relative or absolute. Since\n // analysis in Rust operates on fully resolved URLs,\n // it makes sense to use the same scheme here.\n const ASSETS = \"asset:///\";\n const CACHE = \"cache:///\";\n\n /** Diagnostics that are intentionally ignored when compiling TypeScript in\n * Deno, as they provide misleading or incorrect information. */\n const IGNORED_DIAGNOSTICS = [\n // TS1208: All files must be modules when the '--isolatedModules' flag is\n // provided. We can ignore because we guarantee that all files are\n // modules.\n 1208,\n // TS1375: 'await' expressions are only allowed at the top level of a file\n // when that file is a module, but this file has no imports or exports.\n // Consider adding an empty 'export {}' to make this file a module.\n 1375,\n // TS1103: 'for-await-of' statement is only allowed within an async function\n // or async generator.\n 1103,\n // TS2306: File 'file:///Users/rld/src/deno/subdir/amd_like.js' is\n // not a module.\n 2306,\n // TS2691: An import path cannot end with a '.ts' extension. Consider\n // importing 'bad-module' instead.\n 2691,\n // TS2792: Cannot find module. Did you mean to set the 'moduleResolution'\n // option to 'node', or to add aliases to the 'paths' option?\n 2792,\n // TS5009: Cannot find the common subdirectory path for the input files.\n 5009,\n // TS5055: Cannot write file\n // 'http://localhost:4545/subdir/mt_application_x_javascript.j4.js'\n // because it would overwrite input file.\n 5055,\n // TypeScript is overly opinionated that only CommonJS modules kinds can\n // support JSON imports. Allegedly this was fixed in\n // Microsoft/TypeScript#26825 but that doesn't seem to be working here,\n // so we will ignore complaints about this compiler setting.\n 5070,\n // TS7016: Could not find a declaration file for module '...'. '...'\n // implicitly has an 'any' type. This is due to `allowJs` being off by\n // default but importing of a JavaScript module.\n 7016,\n ];\n\n const SNAPSHOT_COMPILE_OPTIONS = {\n esModuleInterop: true,\n jsx: ts.JsxEmit.React,\n module: ts.ModuleKind.ESNext,\n noEmit: true,\n strict: true,\n target: ts.ScriptTarget.ESNext,\n };\n\n class ScriptSnapshot {\n /** @type {string} */\n specifier;\n /** @type {string} */\n version;\n /**\n * @param {string} specifier\n * @param {string} version \n */\n constructor(specifier, version) {\n this.specifier = specifier;\n this.version = version;\n }\n /**\n * @param {number} start \n * @param {number} end \n * @returns {string}\n */\n getText(start, end) {\n const { specifier, version } = this;\n debug(\n `snapshot.getText(${start}, ${end}) specifier: ${specifier} version: ${version}`,\n );\n return core.jsonOpSync(\"op_get_text\", { specifier, version, start, end });\n }\n /**\n * @returns {number}\n */\n getLength() {\n const { specifier, version } = this;\n debug(`snapshot.getLength() specifier: ${specifier} version: ${version}`);\n return core.jsonOpSync(\"op_get_length\", { specifier, version });\n }\n /**\n * @param {ScriptSnapshot} oldSnapshot\n * @returns {ts.TextChangeRange | undefined}\n */\n getChangeRange(oldSnapshot) {\n const { specifier, version } = this;\n const { version: oldVersion } = oldSnapshot;\n const oldLength = oldSnapshot.getLength();\n debug(\n `snapshot.getLength() specifier: ${specifier} oldVersion: ${oldVersion} version: ${version}`,\n );\n return core.jsonOpSync(\n \"op_get_change_range\",\n { specifier, oldLength, oldVersion, version },\n );\n }\n dispose() {\n const { specifier, version } = this;\n debug(`snapshot.dispose() specifier: ${specifier} version: ${version}`);\n core.jsonOpSync(\"op_dispose\", { specifier, version });\n }\n }\n\n /** @type {ts.CompilerOptions} */\n let compilationSettings = {};\n\n /** @type {ts.LanguageService} */\n let languageService;\n\n /** An object literal of the incremental compiler host, which provides the\n * specific \"bindings\" to the Deno environment that tsc needs to work.\n *\n * @type {ts.CompilerHost & ts.LanguageServiceHost} */\n const host = {\n fileExists(fileName) {\n debug(`host.fileExists(\"${fileName}\")`);\n return false;\n },\n readFile(specifier) {\n debug(`host.readFile(\"${specifier}\")`);\n return core.jsonOpSync(\"op_load\", { specifier }).data;\n },\n getSourceFile(\n specifier,\n languageVersion,\n _onError,\n _shouldCreateNewSourceFile,\n ) {\n debug(\n `host.getSourceFile(\"${specifier}\", ${\n ts.ScriptTarget[languageVersion]\n })`,\n );\n let sourceFile = sourceFileCache.get(specifier);\n if (sourceFile) {\n return sourceFile;\n }\n\n /** @type {{ data: string; hash?: string; scriptKind: ts.ScriptKind }} */\n const { data, hash, scriptKind } = core.jsonOpSync(\n \"op_load\",\n { specifier },\n );\n assert(\n data != null,\n `\"data\" is unexpectedly null for \"${specifier}\".`,\n );\n sourceFile = ts.createSourceFile(\n specifier,\n data,\n languageVersion,\n false,\n scriptKind,\n );\n sourceFile.moduleName = specifier;\n sourceFile.version = hash;\n sourceFileCache.set(specifier, sourceFile);\n return sourceFile;\n },\n getDefaultLibFileName() {\n return `${ASSETS}/lib.esnext.d.ts`;\n },\n getDefaultLibLocation() {\n return ASSETS;\n },\n writeFile(fileName, data, _writeByteOrderMark, _onError, sourceFiles) {\n debug(`host.writeFile(\"${fileName}\")`);\n let maybeSpecifiers;\n if (sourceFiles) {\n maybeSpecifiers = sourceFiles.map((sf) => sf.moduleName);\n }\n return core.jsonOpSync(\n \"op_emit\",\n { maybeSpecifiers, fileName, data },\n );\n },\n getCurrentDirectory() {\n return CACHE;\n },\n getCanonicalFileName(fileName) {\n return fileName;\n },\n useCaseSensitiveFileNames() {\n return true;\n },\n getNewLine() {\n return \"\\n\";\n },\n resolveModuleNames(specifiers, base) {\n debug(`host.resolveModuleNames()`);\n debug(` base: ${base}`);\n debug(` specifiers: ${specifiers.join(\", \")}`);\n /** @type {Array<[string, ts.Extension] | undefined>} */\n const resolved = core.jsonOpSync(\"op_resolve\", {\n specifiers,\n base,\n });\n if (resolved) {\n const result = resolved.map((item) => {\n if (item) {\n const [resolvedFileName, extension] = item;\n return {\n resolvedFileName,\n extension,\n isExternalLibraryImport: false,\n };\n }\n return undefined;\n });\n result.length = specifiers.length;\n return result;\n } else {\n return new Array(specifiers.length);\n }\n },\n createHash(data) {\n return core.jsonOpSync(\"op_create_hash\", { data }).hash;\n },\n\n // LanguageServiceHost\n getCompilationSettings() {\n debug(\"host.getCompilationSettings()\");\n return compilationSettings;\n },\n getScriptFileNames() {\n debug(\"host.getScriptFileNames()\");\n return core.jsonOpSync(\"op_script_names\", undefined);\n },\n getScriptVersion(specifier) {\n debug(`host.getScriptVersion(\"${specifier}\")`);\n const sourceFile = sourceFileCache.get(specifier);\n if (sourceFile) {\n return sourceFile.version ?? \"1\";\n }\n return core.jsonOpSync(\"op_script_version\", { specifier });\n },\n getScriptSnapshot(specifier) {\n debug(`host.getScriptSnapshot(\"${specifier}\")`);\n const sourceFile = sourceFileCache.get(specifier);\n if (sourceFile) {\n return {\n getText(start, end) {\n return sourceFile.text.substring(start, end);\n },\n getLength() {\n return sourceFile.text.length;\n },\n getChangeRange() {\n return undefined;\n },\n };\n }\n /** @type {string | undefined} */\n const version = core.jsonOpSync(\"op_script_version\", { specifier });\n if (version != null) {\n return new ScriptSnapshot(specifier, version);\n }\n return undefined;\n },\n };\n\n /** @type {Array<[string, number]>} */\n const stats = [];\n let statsStart = 0;\n\n function performanceStart() {\n stats.length = 0;\n statsStart = Date.now();\n ts.performance.enable();\n }\n\n /**\n * @param {{ program: ts.Program | ts.EmitAndSemanticDiagnosticsBuilderProgram, fileCount?: number }} options \n */\n function performanceProgram({ program, fileCount }) {\n if (program) {\n if (\"getProgram\" in program) {\n program = program.getProgram();\n }\n stats.push([\"Files\", program.getSourceFiles().length]);\n stats.push([\"Nodes\", program.getNodeCount()]);\n stats.push([\"Identifiers\", program.getIdentifierCount()]);\n stats.push([\"Symbols\", program.getSymbolCount()]);\n stats.push([\"Types\", program.getTypeCount()]);\n stats.push([\"Instantiations\", program.getInstantiationCount()]);\n } else if (fileCount != null) {\n stats.push([\"Files\", fileCount]);\n }\n const programTime = ts.performance.getDuration(\"Program\");\n const bindTime = ts.performance.getDuration(\"Bind\");\n const checkTime = ts.performance.getDuration(\"Check\");\n const emitTime = ts.performance.getDuration(\"Emit\");\n stats.push([\"Parse time\", programTime]);\n stats.push([\"Bind time\", bindTime]);\n stats.push([\"Check time\", checkTime]);\n stats.push([\"Emit time\", emitTime]);\n stats.push(\n [\"Total TS time\", programTime + bindTime + checkTime + emitTime],\n );\n }\n\n function performanceEnd() {\n const duration = Date.now() - statsStart;\n stats.push([\"Compile time\", duration]);\n return stats;\n }\n\n /**\n * @typedef {object} Request\n * @property {Record} config\n * @property {boolean} debug\n * @property {string[]} rootNames\n */\n\n /** The API that is called by Rust when executing a request.\n * @param {Request} request\n */\n function exec({ config, debug: debugFlag, rootNames }) {\n setLogDebug(debugFlag, \"TS\");\n performanceStart();\n debug(\">>> exec start\", { rootNames });\n debug(config);\n\n const { options, errors: configFileParsingDiagnostics } = ts\n .convertCompilerOptionsFromJson(config, \"\");\n // The `allowNonTsExtensions` is a \"hidden\" compiler option used in VSCode\n // which is not allowed to be passed in JSON, we need it to allow special\n // URLs which Deno supports. So we need to either ignore the diagnostic, or\n // inject it ourselves.\n Object.assign(options, { allowNonTsExtensions: true });\n const program = ts.createIncrementalProgram({\n rootNames,\n options,\n host,\n configFileParsingDiagnostics,\n });\n\n const { diagnostics: emitDiagnostics } = program.emit();\n\n const diagnostics = [\n ...program.getConfigFileParsingDiagnostics(),\n ...program.getSyntacticDiagnostics(),\n ...program.getOptionsDiagnostics(),\n ...program.getGlobalDiagnostics(),\n ...program.getSemanticDiagnostics(),\n ...emitDiagnostics,\n ].filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code));\n performanceProgram({ program });\n\n core.jsonOpSync(\"op_respond\", {\n diagnostics: fromTypeScriptDiagnostic(diagnostics),\n stats: performanceEnd(),\n });\n debug(\"<<< exec stop\");\n }\n\n /**\n * @param {number} id \n * @param {any} data \n */\n function respond(id, data = null) {\n core.jsonOpSync(\"op_respond\", { id, data });\n }\n\n /**\n * @param {LanguageServerRequest} request \n */\n function serverRequest({ id, ...request }) {\n debug(`serverRequest()`, { id, ...request });\n switch (request.method) {\n case \"configure\": {\n const { options, errors } = ts\n .convertCompilerOptionsFromJson(request.compilerOptions, \"\");\n Object.assign(options, { allowNonTsExtensions: true });\n if (errors.length) {\n debug(ts.formatDiagnostics(errors, host));\n }\n compilationSettings = options;\n return respond(id, true);\n }\n case \"getAsset\": {\n const sourceFile = host.getSourceFile(\n request.specifier,\n ts.ScriptTarget.ESNext,\n );\n return respond(id, sourceFile && sourceFile.text);\n }\n case \"getDiagnostics\": {\n try {\n /** @type {Record} */\n const diagnosticMap = {};\n for (const specifier of request.specifiers) {\n diagnosticMap[specifier] = fromTypeScriptDiagnostic([\n ...languageService.getSemanticDiagnostics(specifier),\n ...languageService.getSuggestionDiagnostics(specifier),\n ...languageService.getSyntacticDiagnostics(specifier),\n ].filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code)));\n }\n return respond(id, diagnosticMap);\n } catch (e) {\n if (\"stack\" in e) {\n error(e.stack);\n } else {\n error(e);\n }\n return respond(id, {});\n }\n }\n case \"getQuickInfo\": {\n return respond(\n id,\n languageService.getQuickInfoAtPosition(\n request.specifier,\n request.position,\n ),\n );\n }\n case \"getCompletions\": {\n return respond(\n id,\n languageService.getCompletionsAtPosition(\n request.specifier,\n request.position,\n request.preferences,\n ),\n );\n }\n case \"getDocumentHighlights\": {\n return respond(\n id,\n languageService.getDocumentHighlights(\n request.specifier,\n request.position,\n request.filesToSearch,\n ),\n );\n }\n case \"getReferences\": {\n return respond(\n id,\n languageService.getReferencesAtPosition(\n request.specifier,\n request.position,\n ),\n );\n }\n case \"getDefinition\": {\n return respond(\n id,\n languageService.getDefinitionAndBoundSpan(\n request.specifier,\n request.position,\n ),\n );\n }\n case \"getImplementation\": {\n return respond(\n id,\n languageService.getImplementationAtPosition(\n request.specifier,\n request.position,\n ),\n );\n }\n case \"findRenameLocations\": {\n return respond(\n id,\n languageService.findRenameLocations(\n request.specifier,\n request.position,\n request.findInStrings,\n request.findInComments,\n request.providePrefixAndSuffixTextForRename,\n ),\n );\n }\n default:\n throw new TypeError(\n // @ts-ignore exhausted case statement sets type to never\n `Invalid request method for request: \"${request.method}\" (${id})`,\n );\n }\n }\n\n /** @param {{ debug: boolean; }} init */\n function serverInit({ debug: debugFlag }) {\n if (hasStarted) {\n throw new Error(\"The language server has already been initialized.\");\n }\n hasStarted = true;\n languageService = ts.createLanguageService(host);\n core.ops();\n setLogDebug(debugFlag, \"TSLS\");\n debug(\"serverInit()\");\n }\n\n let hasStarted = false;\n\n /** Startup the runtime environment, setting various flags.\n * @param {{ debugFlag?: boolean; legacyFlag?: boolean; }} msg\n */\n function startup({ debugFlag = false }) {\n if (hasStarted) {\n throw new Error(\"The compiler runtime already started.\");\n }\n hasStarted = true;\n core.ops();\n setLogDebug(!!debugFlag, \"TS\");\n }\n\n // Setup the compiler runtime during the build process.\n core.ops();\n core.registerErrorClass(\"Error\", Error);\n\n // A build time only op that provides some setup information that is used to\n // ensure the snapshot is setup properly.\n /** @type {{ buildSpecifier: string; libs: string[] }} */\n const { buildSpecifier, libs } = core.jsonOpSync(\"op_build_info\", {});\n for (const lib of libs) {\n const specifier = `lib.${lib}.d.ts`;\n // we are using internal APIs here to \"inject\" our custom libraries into\n // tsc, so things like `\"lib\": [ \"deno.ns\" ]` are supported.\n if (!ts.libs.includes(lib)) {\n ts.libs.push(lib);\n ts.libMap.set(lib, `lib.${lib}.d.ts`);\n }\n // we are caching in memory common type libraries that will be re-used by\n // tsc on when the snapshot is restored\n assert(\n host.getSourceFile(`${ASSETS}${specifier}`, ts.ScriptTarget.ESNext),\n );\n }\n // this helps ensure as much as possible is in memory that is re-usable\n // before the snapshotting is done, which helps unsure fast \"startup\" for\n // subsequent uses of tsc in Deno.\n const TS_SNAPSHOT_PROGRAM = ts.createProgram({\n rootNames: [buildSpecifier],\n options: SNAPSHOT_COMPILE_OPTIONS,\n host,\n });\n ts.getPreEmitDiagnostics(TS_SNAPSHOT_PROGRAM);\n\n // exposes the two functions that are called by `tsc::exec()` when type\n // checking TypeScript.\n globalThis.startup = startup;\n globalThis.exec = exec;\n\n // exposes the functions that are called when the compiler is used as a\n // language service.\n globalThis.serverInit = serverInit;\n globalThis.serverRequest = serverRequest;\n})(this);\n" + } +} diff --git a/cli/tests/testdata/lsp/did_open_params_semantic_tokens.json b/cli/tests/testdata/lsp/did_open_params_semantic_tokens.json new file mode 100644 index 000000000..5cf48ae05 --- /dev/null +++ b/cli/tests/testdata/lsp/did_open_params_semantic_tokens.json @@ -0,0 +1,8 @@ +{ + "textDocument": { + "uri": "file:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": "enum Values { value1, value2 }\n\nasync function baz(s: string): Promise {\n const r = s.slice(0);\n return r;\n}\n\ninterface IFoo {\n readonly x: number;\n foo(): boolean;\n}\n\nclass Bar implements IFoo {\n constructor(public readonly x: number) { }\n foo() { return true; }\n static staticBar = new Bar(0);\n private static getStaticBar() { return Bar.staticBar; }\n}\n" + } +} diff --git a/cli/tests/testdata/lsp/did_open_params_test_code_lens.json b/cli/tests/testdata/lsp/did_open_params_test_code_lens.json new file mode 100644 index 000000000..dcb9e11f3 --- /dev/null +++ b/cli/tests/testdata/lsp/did_open_params_test_code_lens.json @@ -0,0 +1,8 @@ +{ + "textDocument": { + "uri": "file:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": "const { test } = Deno;\nconst { test: test2 } = Deno;\nconst test3 = Deno.test;\n\nDeno.test(\"test a\", () => {});\nDeno.test({\n name: \"test b\",\n fn() {},\n});\ntest({\n name: \"test c\",\n fn() {},\n});\ntest(\"test d\", () => {});\ntest2({\n name: \"test e\",\n fn() {},\n});\ntest2(\"test f\", () => {});\ntest3({\n name: \"test g\",\n fn() {},\n});\ntest3(\"test h\", () => {});\n" + } +} diff --git a/cli/tests/testdata/lsp/document_symbol_response.json b/cli/tests/testdata/lsp/document_symbol_response.json new file mode 100644 index 000000000..89d56ef70 --- /dev/null +++ b/cli/tests/testdata/lsp/document_symbol_response.json @@ -0,0 +1,371 @@ +[ + { + "name": "bar", + "kind": 13, + "range": { + "start": { + "line": 17, + "character": 4 + }, + "end": { + "line": 17, + "character": 26 + } + }, + "selectionRange": { + "start": { + "line": 17, + "character": 4 + }, + "end": { + "line": 17, + "character": 7 + } + } + }, + { + "name": "Bar", + "kind": 5, + "range": { + "start": { + "line": 4, + "character": 0 + }, + "end": { + "line": 13, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 9 + } + }, + "children": [ + { + "name": "constructor", + "kind": 9, + "range": { + "start": { + "line": 5, + "character": 2 + }, + "end": { + "line": 5, + "character": 35 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 2 + }, + "end": { + "line": 5, + "character": 35 + } + } + }, + { + "name": "baz", + "kind": 6, + "tags": [ + 1 + ], + "range": { + "start": { + "line": 8, + "character": 2 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 2 + }, + "end": { + "line": 8, + "character": 5 + } + } + }, + { + "name": "foo", + "kind": 6, + "range": { + "start": { + "line": 6, + "character": 2 + }, + "end": { + "line": 6, + "character": 24 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 2 + }, + "end": { + "line": 6, + "character": 5 + } + } + }, + { + "name": "getStaticBar", + "kind": 6, + "range": { + "start": { + "line": 12, + "character": 2 + }, + "end": { + "line": 12, + "character": 57 + } + }, + "selectionRange": { + "start": { + "line": 12, + "character": 17 + }, + "end": { + "line": 12, + "character": 29 + } + } + }, + { + "name": "staticBar", + "kind": 7, + "range": { + "start": { + "line": 11, + "character": 2 + }, + "end": { + "line": 11, + "character": 32 + } + }, + "selectionRange": { + "start": { + "line": 11, + "character": 9 + }, + "end": { + "line": 11, + "character": 18 + } + } + }, + { + "name": "value", + "kind": 7, + "range": { + "start": { + "line": 9, + "character": 2 + }, + "end": { + "line": 9, + "character": 35 + } + }, + "selectionRange": { + "start": { + "line": 9, + "character": 6 + }, + "end": { + "line": 9, + "character": 11 + } + } + }, + { + "name": "value", + "kind": 7, + "range": { + "start": { + "line": 10, + "character": 2 + }, + "end": { + "line": 10, + "character": 42 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 6 + }, + "end": { + "line": 10, + "character": 11 + } + } + }, + { + "name": "x", + "kind": 7, + "range": { + "start": { + "line": 5, + "character": 14 + }, + "end": { + "line": 5, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 21 + }, + "end": { + "line": 5, + "character": 22 + } + } + } + ] + }, + { + "name": "IFoo", + "kind": 11, + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 2, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 14 + } + }, + "children": [ + { + "name": "foo", + "kind": 6, + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 5 + } + } + } + ] + }, + { + "name": "Values", + "kind": 10, + "range": { + "start": { + "line": 15, + "character": 0 + }, + "end": { + "line": 15, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 15, + "character": 5 + }, + "end": { + "line": 15, + "character": 11 + } + }, + "children": [ + { + "name": "value1", + "kind": 13, + "range": { + "start": { + "line": 15, + "character": 14 + }, + "end": { + "line": 15, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 15, + "character": 14 + }, + "end": { + "line": 15, + "character": 20 + } + } + }, + { + "name": "value2", + "kind": 13, + "range": { + "start": { + "line": 15, + "character": 22 + }, + "end": { + "line": 15, + "character": 28 + } + }, + "selectionRange": { + "start": { + "line": 15, + "character": 22 + }, + "end": { + "line": 15, + "character": 28 + } + } + } + ] + } +] diff --git a/cli/tests/testdata/lsp/formatting_mbc_response.json b/cli/tests/testdata/lsp/formatting_mbc_response.json new file mode 100644 index 000000000..1c0b9f8e8 --- /dev/null +++ b/cli/tests/testdata/lsp/formatting_mbc_response.json @@ -0,0 +1,54 @@ +[ + { + "range": { + "start": { + "line": 0, + "character": 12 + }, + "end": { + "line": 0, + "character": 13 + } + }, + "newText": "\"" + }, + { + "range": { + "start": { + "line": 0, + "character": 21 + }, + "end": { + "line": 0, + "character": 22 + } + }, + "newText": "\";" + }, + { + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 13 + } + }, + "newText": "\"" + }, + { + "range": { + "start": { + "line": 1, + "character": 23 + }, + "end": { + "line": 1, + "character": 25 + } + }, + "newText": "\");" + } +] diff --git a/cli/tests/testdata/lsp/import-map.json b/cli/tests/testdata/lsp/import-map.json new file mode 100644 index 000000000..75d5d0849 --- /dev/null +++ b/cli/tests/testdata/lsp/import-map.json @@ -0,0 +1,5 @@ +{ + "imports": { + "/~/": "./lib/" + } +} diff --git a/cli/tests/testdata/lsp/incoming_calls_params.json b/cli/tests/testdata/lsp/incoming_calls_params.json new file mode 100644 index 000000000..6b38d26ee --- /dev/null +++ b/cli/tests/testdata/lsp/incoming_calls_params.json @@ -0,0 +1,28 @@ +{ + "item": { + "name": "baz", + "kind": 6, + "detail": "Bar", + "uri": "file:///a/file.ts", + "range": { + "start": { + "line": 5, + "character": 2 + }, + "end": { + "line": 7, + "character": 3 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 2 + }, + "end": { + "line": 5, + "character": 5 + } + } + } +} diff --git a/cli/tests/testdata/lsp/incoming_calls_response.json b/cli/tests/testdata/lsp/incoming_calls_response.json new file mode 100644 index 000000000..231919a8c --- /dev/null +++ b/cli/tests/testdata/lsp/incoming_calls_response.json @@ -0,0 +1,42 @@ +[ + { + "from": { + "name": "main", + "kind": 12, + "detail": "", + "uri": "file:///a/file.ts", + "range": { + "start": { + "line": 10, + "character": 0 + }, + "end": { + "line": 13, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 9 + }, + "end": { + "line": 10, + "character": 13 + } + } + }, + "fromRanges": [ + { + "start": { + "line": 12, + "character": 6 + }, + "end": { + "line": 12, + "character": 9 + } + } + ] + } +] diff --git a/cli/tests/testdata/lsp/initialize_params.json b/cli/tests/testdata/lsp/initialize_params.json new file mode 100644 index 000000000..3b99be4f0 --- /dev/null +++ b/cli/tests/testdata/lsp/initialize_params.json @@ -0,0 +1,65 @@ +{ + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": true, + "cache": null, + "codeLens": { + "implementations": true, + "references": true, + "test": true + }, + "config": "", + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": {} + } + }, + "unstable": false + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix", + "refactor" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "disabledSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + }, + "workspace": { + "configuration": true, + "workspaceFolders": true + } + } +} diff --git a/cli/tests/testdata/lsp/initialize_params_bad_config_option.json b/cli/tests/testdata/lsp/initialize_params_bad_config_option.json new file mode 100644 index 000000000..053cb70f3 --- /dev/null +++ b/cli/tests/testdata/lsp/initialize_params_bad_config_option.json @@ -0,0 +1,65 @@ +{ + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": true, + "cache": null, + "codeLens": { + "implementations": true, + "references": true, + "test": true + }, + "config": "bad_tsconfig.json", + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": {} + } + }, + "unstable": false + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix", + "refactor" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "disabledSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + }, + "workspace": { + "configuration": true, + "workspaceFolders": true + } + } +} diff --git a/cli/tests/testdata/lsp/initialize_params_ca_no_disabled.json b/cli/tests/testdata/lsp/initialize_params_ca_no_disabled.json new file mode 100644 index 000000000..3df87aded --- /dev/null +++ b/cli/tests/testdata/lsp/initialize_params_ca_no_disabled.json @@ -0,0 +1,64 @@ +{ + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": true, + "cache": null, + "codeLens": { + "implementations": true, + "references": true, + "test": true + }, + "config": "", + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": {} + } + }, + "unstable": false + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix", + "refactor" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + }, + "workspace": { + "configuration": true, + "workspaceFolders": true + } + } +} diff --git a/cli/tests/testdata/lsp/initialize_params_code_lens_test.json b/cli/tests/testdata/lsp/initialize_params_code_lens_test.json new file mode 100644 index 000000000..bdd01bfca --- /dev/null +++ b/cli/tests/testdata/lsp/initialize_params_code_lens_test.json @@ -0,0 +1,59 @@ +{ + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": true, + "cache": null, + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": {} + } + }, + "unstable": false + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix", + "refactor" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "disabledSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + }, + "workspace": { + "configuration": true, + "workspaceFolders": true + } + } +} diff --git a/cli/tests/testdata/lsp/initialize_params_code_lens_test_disabled.json b/cli/tests/testdata/lsp/initialize_params_code_lens_test_disabled.json new file mode 100644 index 000000000..1d18934ae --- /dev/null +++ b/cli/tests/testdata/lsp/initialize_params_code_lens_test_disabled.json @@ -0,0 +1,64 @@ +{ + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": true, + "cache": null, + "codeLens": { + "implementations": true, + "references": true, + "test": false + }, + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": {} + } + }, + "unstable": false + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix", + "refactor" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "disabledSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + }, + "workspace": { + "configuration": true, + "workspaceFolders": true + } + } +} diff --git a/cli/tests/testdata/lsp/initialize_params_did_config_change.json b/cli/tests/testdata/lsp/initialize_params_did_config_change.json new file mode 100644 index 000000000..870ad6e0f --- /dev/null +++ b/cli/tests/testdata/lsp/initialize_params_did_config_change.json @@ -0,0 +1,65 @@ +{ + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": true, + "cache": null, + "codeLens": { + "implementations": true, + "references": true + }, + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": { + "http://localhost:4545/": false + } + } + }, + "unstable": false + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix", + "refactor" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "disabledSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + }, + "workspace": { + "configuration": true, + "workspaceFolders": true + } + } +} diff --git a/cli/tests/testdata/lsp/initialize_params_disabled.json b/cli/tests/testdata/lsp/initialize_params_disabled.json new file mode 100644 index 000000000..879b1181c --- /dev/null +++ b/cli/tests/testdata/lsp/initialize_params_disabled.json @@ -0,0 +1,63 @@ +{ + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": false, + "cache": null, + "codeLens": { + "implementations": true, + "references": true + }, + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": {} + } + }, + "unstable": false + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix", + "refactor" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "disabledSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + }, + "workspace": { + "configuration": true, + "workspaceFolders": true + } + } +} diff --git a/cli/tests/testdata/lsp/initialize_params_registry.json b/cli/tests/testdata/lsp/initialize_params_registry.json new file mode 100644 index 000000000..67559ebb3 --- /dev/null +++ b/cli/tests/testdata/lsp/initialize_params_registry.json @@ -0,0 +1,65 @@ +{ + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": true, + "cache": null, + "codeLens": { + "implementations": true, + "references": true + }, + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": { + "http://localhost:4545/": true + } + } + }, + "unstable": false + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix", + "refactor" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "disabledSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + }, + "workspace": { + "configuration": true, + "workspaceFolders": true + } + } +} diff --git a/cli/tests/testdata/lsp/initialize_params_unstable.json b/cli/tests/testdata/lsp/initialize_params_unstable.json new file mode 100644 index 000000000..104db16f2 --- /dev/null +++ b/cli/tests/testdata/lsp/initialize_params_unstable.json @@ -0,0 +1,63 @@ +{ + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": true, + "cache": null, + "codeLens": { + "implementations": true, + "references": true + }, + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": {} + } + }, + "unstable": true + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix", + "refactor" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "disabledSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + }, + "workspace": { + "configuration": true, + "workspaceFolders": true + } + } +} diff --git a/cli/tests/testdata/lsp/lib.tsconfig.json b/cli/tests/testdata/lsp/lib.tsconfig.json new file mode 100644 index 000000000..8d2ae8a8b --- /dev/null +++ b/cli/tests/testdata/lsp/lib.tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "lib": ["deno.ns", "deno.unstable", "dom"] + } +} diff --git a/cli/tests/testdata/lsp/outgoing_calls_params.json b/cli/tests/testdata/lsp/outgoing_calls_params.json new file mode 100644 index 000000000..6b38d26ee --- /dev/null +++ b/cli/tests/testdata/lsp/outgoing_calls_params.json @@ -0,0 +1,28 @@ +{ + "item": { + "name": "baz", + "kind": 6, + "detail": "Bar", + "uri": "file:///a/file.ts", + "range": { + "start": { + "line": 5, + "character": 2 + }, + "end": { + "line": 7, + "character": 3 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 2 + }, + "end": { + "line": 5, + "character": 5 + } + } + } +} diff --git a/cli/tests/testdata/lsp/outgoing_calls_response.json b/cli/tests/testdata/lsp/outgoing_calls_response.json new file mode 100644 index 000000000..c7cf85cf8 --- /dev/null +++ b/cli/tests/testdata/lsp/outgoing_calls_response.json @@ -0,0 +1,42 @@ +[ + { + "to": { + "name": "foo", + "kind": 12, + "detail": "", + "uri": "file:///a/file.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 2, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 12 + } + } + }, + "fromRanges": [ + { + "start": { + "line": 6, + "character": 11 + }, + "end": { + "line": 6, + "character": 14 + } + } + ] + } +] diff --git a/cli/tests/testdata/lsp/prepare_call_hierarchy_response.json b/cli/tests/testdata/lsp/prepare_call_hierarchy_response.json new file mode 100644 index 000000000..93a7d4f1b --- /dev/null +++ b/cli/tests/testdata/lsp/prepare_call_hierarchy_response.json @@ -0,0 +1,28 @@ +[ + { + "name": "baz", + "kind": 6, + "detail": "Bar", + "uri": "file:///a/file.ts", + "range": { + "start": { + "line": 5, + "character": 2 + }, + "end": { + "line": 7, + "character": 3 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 2 + }, + "end": { + "line": 5, + "character": 5 + } + } + } +] diff --git a/cli/tests/testdata/lsp/registries/a_latest.json b/cli/tests/testdata/lsp/registries/a_latest.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/testdata/lsp/registries/a_latest.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/testdata/lsp/registries/a_v1.0.0.json b/cli/tests/testdata/lsp/registries/a_v1.0.0.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/testdata/lsp/registries/a_v1.0.0.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/testdata/lsp/registries/a_v1.0.1.json b/cli/tests/testdata/lsp/registries/a_v1.0.1.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/testdata/lsp/registries/a_v1.0.1.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/testdata/lsp/registries/a_v2.0.0.json b/cli/tests/testdata/lsp/registries/a_v2.0.0.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/testdata/lsp/registries/a_v2.0.0.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/testdata/lsp/registries/a_versions.json b/cli/tests/testdata/lsp/registries/a_versions.json new file mode 100644 index 000000000..930e38323 --- /dev/null +++ b/cli/tests/testdata/lsp/registries/a_versions.json @@ -0,0 +1,5 @@ +[ + "v1.0.0", + "v1.0.1", + "v2.0.0" +] diff --git a/cli/tests/testdata/lsp/registries/b_latest.json b/cli/tests/testdata/lsp/registries/b_latest.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/testdata/lsp/registries/b_latest.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/testdata/lsp/registries/b_v0.0.1.json b/cli/tests/testdata/lsp/registries/b_v0.0.1.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/testdata/lsp/registries/b_v0.0.1.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/testdata/lsp/registries/b_v0.0.2.json b/cli/tests/testdata/lsp/registries/b_v0.0.2.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/testdata/lsp/registries/b_v0.0.2.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/testdata/lsp/registries/b_v0.0.3.json b/cli/tests/testdata/lsp/registries/b_v0.0.3.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/testdata/lsp/registries/b_v0.0.3.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/testdata/lsp/registries/b_versions.json b/cli/tests/testdata/lsp/registries/b_versions.json new file mode 100644 index 000000000..9532fbb85 --- /dev/null +++ b/cli/tests/testdata/lsp/registries/b_versions.json @@ -0,0 +1,5 @@ +[ + "v0.0.1", + "v0.0.2", + "v0.0.3" +] diff --git a/cli/tests/testdata/lsp/registries/deno-import-intellisense.json b/cli/tests/testdata/lsp/registries/deno-import-intellisense.json new file mode 100644 index 000000000..8aa4a4eca --- /dev/null +++ b/cli/tests/testdata/lsp/registries/deno-import-intellisense.json @@ -0,0 +1,35 @@ +{ + "version": 1, + "registries": [ + { + "schema": "/x/:module([a-z0-9_]*)@:version?/:path*", + "variables": [ + { + "key": "module", + "url": "http://localhost:4545/lsp/registries/modules.json" + }, + { + "key": "version", + "url": "http://localhost:4545/lsp/registries/${module}_versions.json" + }, + { + "key": "path", + "url": "http://localhost:4545/lsp/registries/${module}_${{version}}.json" + } + ] + }, + { + "schema": "/x/:module([a-z0-9_]*)/:path*", + "variables": [ + { + "key": "module", + "url": "http://localhost:4545/lsp/registries/modules.json" + }, + { + "key": "path", + "url": "http://localhost:4545/lsp/registries/${module}_latest.json" + } + ] + } + ] +} diff --git a/cli/tests/testdata/lsp/registries/modules.json b/cli/tests/testdata/lsp/registries/modules.json new file mode 100644 index 000000000..517c9d68e --- /dev/null +++ b/cli/tests/testdata/lsp/registries/modules.json @@ -0,0 +1,4 @@ +[ + "a", + "b" +] diff --git a/cli/tests/testdata/lsp/rename_response.json b/cli/tests/testdata/lsp/rename_response.json new file mode 100644 index 000000000..5e0e28e4c --- /dev/null +++ b/cli/tests/testdata/lsp/rename_response.json @@ -0,0 +1,38 @@ +{ + "documentChanges": [ + { + "textDocument": { + "uri": "file:///a/file.ts", + "version": 1 + }, + "edits": [ + { + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 12 + } + }, + "newText": "variable_modified" + }, + { + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 20 + } + }, + "newText": "variable_modified" + } + ] + } + ] +} diff --git a/cli/tests/testdata/lsp/selection_range_response.json b/cli/tests/testdata/lsp/selection_range_response.json new file mode 100644 index 000000000..b5eef5ddc --- /dev/null +++ b/cli/tests/testdata/lsp/selection_range_response.json @@ -0,0 +1,86 @@ +[ + { + "range": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 9 + } + }, + "parent": { + "range": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "parent": { + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 4, + "character": 5 + } + }, + "parent": { + "range": { + "start": { + "line": 1, + "character": 13 + }, + "end": { + "line": 6, + "character": 2 + } + }, + "parent": { + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 6, + "character": 3 + } + }, + "parent": { + "range": { + "start": { + "line": 0, + "character": 11 + }, + "end": { + "line": 7, + "character": 0 + } + }, + "parent": { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 7, + "character": 1 + } + } + } + } + } + } + } + } + } +] diff --git a/cli/tests/testdata/lsp/types.tsconfig.json b/cli/tests/testdata/lsp/types.tsconfig.json new file mode 100644 index 000000000..ba7f3344d --- /dev/null +++ b/cli/tests/testdata/lsp/types.tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "types": [ + "./a.d.ts" + ] + } +} diff --git a/cli/tests/testdata/main_module.ts b/cli/tests/testdata/main_module.ts new file mode 100644 index 000000000..19988f4bf --- /dev/null +++ b/cli/tests/testdata/main_module.ts @@ -0,0 +1,3 @@ +console.log("main_module", Deno.mainModule); + +import "./main_module2.ts"; diff --git a/cli/tests/testdata/main_module.ts.out b/cli/tests/testdata/main_module.ts.out new file mode 100644 index 000000000..817bb6b8c --- /dev/null +++ b/cli/tests/testdata/main_module.ts.out @@ -0,0 +1,2 @@ +main_module2 [WILDCARD]/main_module.ts +main_module [WILDCARD]/main_module.ts diff --git a/cli/tests/testdata/main_module2.ts b/cli/tests/testdata/main_module2.ts new file mode 100644 index 000000000..585615c7f --- /dev/null +++ b/cli/tests/testdata/main_module2.ts @@ -0,0 +1 @@ +console.log("main_module2", Deno.mainModule); diff --git a/cli/tests/testdata/module_graph/file_tests-a.mjs b/cli/tests/testdata/module_graph/file_tests-a.mjs new file mode 100644 index 000000000..72b3a67bc --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-a.mjs @@ -0,0 +1,3 @@ +import * as b from "./b.ts"; + +console.log(b); diff --git a/cli/tests/testdata/module_graph/file_tests-b-mod.js b/cli/tests/testdata/module_graph/file_tests-b-mod.js new file mode 100644 index 000000000..59d168993 --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-b-mod.js @@ -0,0 +1 @@ +export const b = "b"; diff --git a/cli/tests/testdata/module_graph/file_tests-b.ts b/cli/tests/testdata/module_graph/file_tests-b.ts new file mode 100644 index 000000000..59d168993 --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-b.ts @@ -0,0 +1 @@ +export const b = "b"; diff --git a/cli/tests/testdata/module_graph/file_tests-c-mod.ts b/cli/tests/testdata/module_graph/file_tests-c-mod.ts new file mode 100644 index 000000000..7f2cfac77 --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-c-mod.ts @@ -0,0 +1 @@ +export const c = "c"; diff --git a/cli/tests/testdata/module_graph/file_tests-checkwithconfig.ts b/cli/tests/testdata/module_graph/file_tests-checkwithconfig.ts new file mode 100644 index 000000000..e7af5fa19 --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-checkwithconfig.ts @@ -0,0 +1,5 @@ +import { ServerRequest } from "https://deno.land/std/http/server.ts"; + +export default (req: ServerRequest) => { + req.respond({ body: `Hello, from Deno v${Deno.version.deno}!` }); +}; diff --git a/cli/tests/testdata/module_graph/file_tests-diag.ts b/cli/tests/testdata/module_graph/file_tests-diag.ts new file mode 100644 index 000000000..ba365234a --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-diag.ts @@ -0,0 +1,4 @@ +import * as c from "./c/mod.ts"; + +// deno-lint-ignore no-undef +consol.log(c); diff --git a/cli/tests/testdata/module_graph/file_tests-dynamicimport.ts b/cli/tests/testdata/module_graph/file_tests-dynamicimport.ts new file mode 100644 index 000000000..b5c9f080f --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-dynamicimport.ts @@ -0,0 +1,5 @@ +try { + await import("bare_module_specifier"); +} catch (err) { + console.log(err); +} diff --git a/cli/tests/testdata/module_graph/file_tests-importjson.ts b/cli/tests/testdata/module_graph/file_tests-importjson.ts new file mode 100644 index 000000000..c2bc2bca7 --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-importjson.ts @@ -0,0 +1,3 @@ +import * as config from "./some.json"; + +console.log(config); diff --git a/cli/tests/testdata/module_graph/file_tests-importremap.ts b/cli/tests/testdata/module_graph/file_tests-importremap.ts new file mode 100644 index 000000000..17f012673 --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-importremap.ts @@ -0,0 +1,3 @@ +import * as a from "https://deno.land/x/a/mod.ts"; + +console.log(a); diff --git a/cli/tests/testdata/module_graph/file_tests-main.ts b/cli/tests/testdata/module_graph/file_tests-main.ts new file mode 100644 index 000000000..aa8eef1b8 --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-main.ts @@ -0,0 +1,4 @@ +// @deno-types="https://deno.land/x/lib/mod.d.ts" +import * as lib from "https://deno.land/x/lib/mod.js"; + +console.log(lib); diff --git a/cli/tests/testdata/module_graph/file_tests-some.json b/cli/tests/testdata/module_graph/file_tests-some.json new file mode 100644 index 000000000..567c4ba21 --- /dev/null +++ b/cli/tests/testdata/module_graph/file_tests-some.json @@ -0,0 +1,5 @@ +{ + "config": { + "debug": true + } +} diff --git a/cli/tests/testdata/module_graph/file_typesref.d.ts b/cli/tests/testdata/module_graph/file_typesref.d.ts new file mode 100644 index 000000000..8ae31dde3 --- /dev/null +++ b/cli/tests/testdata/module_graph/file_typesref.d.ts @@ -0,0 +1 @@ +export const a: "a"; diff --git a/cli/tests/testdata/module_graph/file_typesref.js b/cli/tests/testdata/module_graph/file_typesref.js new file mode 100644 index 000000000..79da24cae --- /dev/null +++ b/cli/tests/testdata/module_graph/file_typesref.js @@ -0,0 +1,3 @@ +/// + +export const a = "a"; diff --git a/cli/tests/testdata/module_graph/https_deno.land-std-http-server.ts b/cli/tests/testdata/module_graph/https_deno.land-std-http-server.ts new file mode 100644 index 000000000..0b3c995ec --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-std-http-server.ts @@ -0,0 +1,5 @@ +export class ServerRequest { + respond(value: { body: string }) { + console.log(value); + } +} diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-a-mod.ts b/cli/tests/testdata/module_graph/https_deno.land-x-a-mod.ts new file mode 100644 index 000000000..1e334d399 --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-a-mod.ts @@ -0,0 +1 @@ +export * as b from "../b/mod.js"; diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-a.ts b/cli/tests/testdata/module_graph/https_deno.land-x-a.ts new file mode 100644 index 000000000..a6e3cea80 --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-a.ts @@ -0,0 +1 @@ +export const a = "hello"; diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-import_map.ts b/cli/tests/testdata/module_graph/https_deno.land-x-import_map.ts new file mode 100644 index 000000000..e285d863a --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-import_map.ts @@ -0,0 +1,4 @@ +import * as $ from "jquery"; +import * as _ from "lodash"; + +console.log($, _); diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-jquery.js b/cli/tests/testdata/module_graph/https_deno.land-x-jquery.js new file mode 100644 index 000000000..71896157a --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-jquery.js @@ -0,0 +1,3 @@ +const $ = {}; + +export default $; diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-lib-a.ts b/cli/tests/testdata/module_graph/https_deno.land-x-lib-a.ts new file mode 100644 index 000000000..a0a6f8e94 --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-lib-a.ts @@ -0,0 +1 @@ +export const a: string[] = []; diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-lib-b.js b/cli/tests/testdata/module_graph/https_deno.land-x-lib-b.js new file mode 100644 index 000000000..13cacdd8b --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-lib-b.js @@ -0,0 +1 @@ +export const b = []; diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-lib-c.d.ts b/cli/tests/testdata/module_graph/https_deno.land-x-lib-c.d.ts new file mode 100644 index 000000000..fac988e49 --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-lib-c.d.ts @@ -0,0 +1 @@ +export const c: string[]; diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-lib-c.js b/cli/tests/testdata/module_graph/https_deno.land-x-lib-c.js new file mode 100644 index 000000000..620ca0b66 --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-lib-c.js @@ -0,0 +1,3 @@ +/// + +export const c = []; diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-lib-mod.d.ts b/cli/tests/testdata/module_graph/https_deno.land-x-lib-mod.d.ts new file mode 100644 index 000000000..76ed81df0 --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-lib-mod.d.ts @@ -0,0 +1,9 @@ +export * as a from "./a.ts"; +export * as b from "./b.js"; +export * as c from "./c.js"; + +export interface A { + a: string; +} + +export const mod: A[]; diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-lib-mod.js b/cli/tests/testdata/module_graph/https_deno.land-x-lib-mod.js new file mode 100644 index 000000000..505162094 --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-lib-mod.js @@ -0,0 +1,5 @@ +export * as a from "./a.ts"; +export * as b from "./b.js"; +export * as c from "./c.js"; + +export const mod = []; diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-mod.ts b/cli/tests/testdata/module_graph/https_deno.land-x-mod.ts new file mode 100644 index 000000000..35d76ef75 --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-mod.ts @@ -0,0 +1,3 @@ +import * as a from "./a.ts"; + +console.log(a); diff --git a/cli/tests/testdata/module_graph/https_deno.land-x-transpile.tsx b/cli/tests/testdata/module_graph/https_deno.land-x-transpile.tsx new file mode 100644 index 000000000..02955bad8 --- /dev/null +++ b/cli/tests/testdata/module_graph/https_deno.land-x-transpile.tsx @@ -0,0 +1,5 @@ +export default class A { + render() { + return
Hello world!
; + } +} diff --git a/cli/tests/testdata/module_graph/https_unpkg.com-lodash-index.js b/cli/tests/testdata/module_graph/https_unpkg.com-lodash-index.js new file mode 100644 index 000000000..d16c126a6 --- /dev/null +++ b/cli/tests/testdata/module_graph/https_unpkg.com-lodash-index.js @@ -0,0 +1,3 @@ +const _ = {}; + +export default _; diff --git a/cli/tests/testdata/module_graph/lockfile.json b/cli/tests/testdata/module_graph/lockfile.json new file mode 100644 index 000000000..03cfe1185 --- /dev/null +++ b/cli/tests/testdata/module_graph/lockfile.json @@ -0,0 +1,8 @@ +{ + "https://deno.land/x/lib/a.ts": "4437fee72a750d9540a9575ea6426761d0aa1beedfa308fb1bc38701d97011b8", + "https://deno.land/x/lib/b.js": "093cc4164ca7a9adb11597ad291e021634f0b2d8c048137f7e9fb0d709499028", + "https://deno.land/x/lib/c.d.ts": "a95647377477cc663559f5e857bf318c584622ed1295a8ccb0c091d06bee0456", + "https://deno.land/x/lib/c.js": "4ff934f4b3b06f320c3130326376d9f2435e2ecedd582940ca90938137d004e1", + "https://deno.land/x/lib/mod.d.ts": "e54b994fbf63cb7f01076ea54f2ed67b185f2a48e8ff71d74bd9c8180a338eb7", + "https://deno.land/x/lib/mod.js": "3f6fcb8ef83ed6c66e71774d5079d14d22a6948dc6e5358ac30e0ab55e1a6404" +} diff --git a/cli/tests/testdata/module_graph/lockfile_fail.json b/cli/tests/testdata/module_graph/lockfile_fail.json new file mode 100644 index 000000000..c0019fba4 --- /dev/null +++ b/cli/tests/testdata/module_graph/lockfile_fail.json @@ -0,0 +1,8 @@ +{ + "https://deno.land/x/lib/a.ts": "4437fee72a750d9540a9575ea6426761d0aa1beedfa308fb1bc38701d97011b8", + "https://deno.land/x/lib/b.js": "093cc4164ca7a9adb11597ad291e021634f0b2d8c048137f7e9fb0d709499028", + "https://deno.land/x/lib/c.d.ts": "a95647377477cc663559f5e857bf318c584622ed1295a8ccb0c091d06bee0456", + "https://deno.land/x/lib/c.js": "4ff934f4b3b06f320c3130326376d9f2435e2ecedd582940ca90938137d004e1", + "https://deno.land/x/lib/mod.d.ts": "e54b994fbf63cb7f01076ea54f2ed67b185f2a48e8ff71d74bd9c8180a338eb7", + "https://deno.land/x/lib/mod.js": "3f6fcb8ef83fd6c66e71774d5079d14d22a6948dc6e5358ac30e0ab55e1a6404" +} diff --git a/cli/tests/testdata/module_graph/tsconfig.json b/cli/tests/testdata/module_graph/tsconfig.json new file mode 100644 index 000000000..a4c5f4f33 --- /dev/null +++ b/cli/tests/testdata/module_graph/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "target": "ES5", + "jsx": "preserve" + } +} diff --git a/cli/tests/testdata/module_graph/tsconfig_01.json b/cli/tests/testdata/module_graph/tsconfig_01.json new file mode 100644 index 000000000..f7496d475 --- /dev/null +++ b/cli/tests/testdata/module_graph/tsconfig_01.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "strict": false, + "noImplicitAny": false, + "noImplicitThis": false, + "alwaysStrict": false, + "strictNullChecks": false, + "strictFunctionTypes": true, + "strictPropertyInitialization": false, + "experimentalDecorators": true, + "emitDecoratorMetadata": true + } +} diff --git a/cli/tests/testdata/no_check_decorators.ts b/cli/tests/testdata/no_check_decorators.ts new file mode 100644 index 000000000..9f7ec550d --- /dev/null +++ b/cli/tests/testdata/no_check_decorators.ts @@ -0,0 +1,21 @@ +// deno-lint-ignore-file +function a() { + console.log("a(): evaluated"); + return ( + _target: any, + _propertyKey: string, + _descriptor: PropertyDescriptor, + ) => { + console.log("a(): called"); + }; +} + +class B { + @a() + method() { + console.log("method"); + } +} + +const b = new B(); +b.method(); diff --git a/cli/tests/testdata/no_check_decorators.ts.out b/cli/tests/testdata/no_check_decorators.ts.out new file mode 100644 index 000000000..015f7076e --- /dev/null +++ b/cli/tests/testdata/no_check_decorators.ts.out @@ -0,0 +1,3 @@ +a(): evaluated +a(): called +method diff --git a/cli/tests/testdata/no_color.js b/cli/tests/testdata/no_color.js new file mode 100644 index 000000000..cea11a52f --- /dev/null +++ b/cli/tests/testdata/no_color.js @@ -0,0 +1 @@ +console.log("noColor", Deno.noColor); diff --git a/cli/tests/testdata/no_mem_cache.js b/cli/tests/testdata/no_mem_cache.js new file mode 100644 index 000000000..a486732b6 --- /dev/null +++ b/cli/tests/testdata/no_mem_cache.js @@ -0,0 +1,33 @@ +const fixtureFile = await Deno.makeTempFile(); +let prefix = "file://"; +if (Deno.build.os == "windows") { + prefix += "/"; +} +const fixtureUrl = new URL(`${prefix}${fixtureFile}`); +let resolve; + +let p = new Promise((res) => resolve = res); + +await Deno.writeTextFile(fixtureUrl, `self.postMessage("hello");\n`); + +const workerA = new Worker(fixtureUrl.href, { type: "module" }); +workerA.onmessage = (msg) => { + console.log(msg.data); + resolve(); +}; + +await p; +workerA.terminate(); + +p = new Promise((res) => resolve = res); + +await Deno.writeTextFile(fixtureUrl, `self.postMessage("goodbye");\n`); + +const workerB = new Worker(fixtureUrl.href, { type: "module" }); +workerB.onmessage = (msg) => { + console.log(msg.data); + resolve(); +}; + +await p; +workerB.terminate(); diff --git a/cli/tests/testdata/no_mem_cache.js.out b/cli/tests/testdata/no_mem_cache.js.out new file mode 100644 index 000000000..a32119c8a --- /dev/null +++ b/cli/tests/testdata/no_mem_cache.js.out @@ -0,0 +1,2 @@ +hello +goodbye diff --git a/cli/tests/testdata/no_validate_asm.js b/cli/tests/testdata/no_validate_asm.js new file mode 100644 index 000000000..ef999e080 --- /dev/null +++ b/cli/tests/testdata/no_validate_asm.js @@ -0,0 +1,20 @@ +// V8 logs any asmjs validation errors to stdout, but it shows line numbers that +// are non-existent in the source. + +const _asmJsModule = function () { + "use asm"; + + function func( + x, + ) { + x = +x; // cast to float + + ~x; + // asmjs error: `~` is only valid on integers + // should not log to stdout with --no-validate-asm + } + + return { + f: func, + }; +}(); diff --git a/cli/tests/testdata/performance_stats.out b/cli/tests/testdata/performance_stats.out new file mode 100644 index 000000000..141829ee6 --- /dev/null +++ b/cli/tests/testdata/performance_stats.out @@ -0,0 +1,16 @@ +[WILDCARD] +DEBUG RS - [WILDCARD] - Compilation statistics: + Files: [WILDCARD] + Nodes: [WILDCARD] + Identifiers: [WILDCARD] + Symbols: [WILDCARD] + Types: [WILDCARD] + Instantiations: [WILDCARD] + Parse time: [WILDCARD] + Bind time: [WILDCARD] + Check time: [WILDCARD] + Emit time: [WILDCARD] + Total TS time: [WILDCARD] + Compile time: [WILDCARD] + +[WILDCARD] diff --git a/cli/tests/testdata/permission_test.ts b/cli/tests/testdata/permission_test.ts new file mode 100644 index 000000000..a3a38f2a0 --- /dev/null +++ b/cli/tests/testdata/permission_test.ts @@ -0,0 +1,33 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +const name = Deno.args[0]; +// deno-lint-ignore no-explicit-any +const test: { [key: string]: (...args: any[]) => void | Promise } = { + readRequired() { + Deno.readFileSync("hello.txt"); + return Promise.resolve(); + }, + writeRequired() { + Deno.makeTempDirSync(); + }, + envRequired() { + Deno.env.get("home"); + }, + netRequired() { + Deno.listen({ transport: "tcp", port: 4541 }); + }, + runRequired() { + const p = Deno.run({ + cmd: Deno.build.os === "windows" + ? ["cmd.exe", "/c", "echo hello"] + : ["printf", "hello"], + }); + p.close(); + }, +}; + +if (!test[name]) { + console.log("Unknown test:", name); + Deno.exit(1); +} + +test[name](); diff --git a/cli/tests/testdata/preserve_imports.tsconfig.json b/cli/tests/testdata/preserve_imports.tsconfig.json new file mode 100644 index 000000000..9b19291aa --- /dev/null +++ b/cli/tests/testdata/preserve_imports.tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "importsNotUsedAsValues": "preserve" + } +} diff --git a/cli/tests/testdata/proto_exploit.js b/cli/tests/testdata/proto_exploit.js new file mode 100644 index 000000000..8bd22cfe5 --- /dev/null +++ b/cli/tests/testdata/proto_exploit.js @@ -0,0 +1,5 @@ +const payload = `{ "__proto__": null }`; +const obj = {}; +console.log("Before: " + obj); +Object.assign(obj, JSON.parse(payload)); +console.log("After: " + obj); diff --git a/cli/tests/testdata/proto_exploit.js.out b/cli/tests/testdata/proto_exploit.js.out new file mode 100644 index 000000000..fde881dc5 --- /dev/null +++ b/cli/tests/testdata/proto_exploit.js.out @@ -0,0 +1,2 @@ +Before: [object Object] +After: [object Object] diff --git a/cli/tests/testdata/raw_mode.ts b/cli/tests/testdata/raw_mode.ts new file mode 100644 index 000000000..87502e7d9 --- /dev/null +++ b/cli/tests/testdata/raw_mode.ts @@ -0,0 +1,18 @@ +Deno.setRaw(0, true); +Deno.setRaw(0, true); // Can be called multiple times + +Deno.stdout.writeSync(new TextEncoder().encode("S")); + +const buf = new Uint8Array(3); +for (let i = 0; i < 3; i++) { + const nread = await Deno.stdin.read(buf); + if (nread === null) { + break; + } else { + const data = new TextDecoder().decode(buf.subarray(0, nread)); + Deno.stdout.writeSync(new TextEncoder().encode(data.toUpperCase())); + } +} + +Deno.setRaw(0, false); // restores old mode. +Deno.setRaw(0, false); // Can be safely called multiple times diff --git a/cli/tests/testdata/raw_mode_cbreak.ts b/cli/tests/testdata/raw_mode_cbreak.ts new file mode 100644 index 000000000..b1c6d324b --- /dev/null +++ b/cli/tests/testdata/raw_mode_cbreak.ts @@ -0,0 +1,17 @@ +Deno.setRaw(0, true); +Deno.setRaw(0, true, { cbreak: true }); // Can be called multiple times + +const signal = Deno.signals.interrupt(); + +Deno.stdout.writeSync(new TextEncoder().encode("S")); + +signal.then(() => { + Deno.stdout.writeSync(new TextEncoder().encode("A")); + + signal.dispose(); + + Deno.setRaw(0, false); // restores old mode. + Deno.setRaw(0, false); // Can be safely called multiple times +}); + +setTimeout(() => {}, 10000); // Keep the program running diff --git a/cli/tests/testdata/recursive_imports/A.ts b/cli/tests/testdata/recursive_imports/A.ts new file mode 100644 index 000000000..43ecdbe5e --- /dev/null +++ b/cli/tests/testdata/recursive_imports/A.ts @@ -0,0 +1,7 @@ +import { B } from "./B.ts"; +import { thing } from "./common.ts"; + +export function A() { + thing(); + B(); +} diff --git a/cli/tests/testdata/recursive_imports/B.ts b/cli/tests/testdata/recursive_imports/B.ts new file mode 100644 index 000000000..9fff0fdc9 --- /dev/null +++ b/cli/tests/testdata/recursive_imports/B.ts @@ -0,0 +1,7 @@ +import { C } from "./C.ts"; +import { thing } from "./common.ts"; + +export function B() { + thing(); + C(); +} diff --git a/cli/tests/testdata/recursive_imports/C.ts b/cli/tests/testdata/recursive_imports/C.ts new file mode 100644 index 000000000..e47e77b41 --- /dev/null +++ b/cli/tests/testdata/recursive_imports/C.ts @@ -0,0 +1,8 @@ +import { A } from "./A.ts"; +import { thing } from "./common.ts"; + +export function C() { + if (A != null) { + thing(); + } +} diff --git a/cli/tests/testdata/recursive_imports/common.ts b/cli/tests/testdata/recursive_imports/common.ts new file mode 100644 index 000000000..2b16a7bf1 --- /dev/null +++ b/cli/tests/testdata/recursive_imports/common.ts @@ -0,0 +1,2 @@ +export function thing() { +} diff --git a/cli/tests/testdata/redirect_cache.out b/cli/tests/testdata/redirect_cache.out new file mode 100644 index 000000000..8905c4529 --- /dev/null +++ b/cli/tests/testdata/redirect_cache.out @@ -0,0 +1,5 @@ +Download http://localhost:4548/subdir/redirects/a.ts +Download http://localhost:4546/subdir/redirects/a.ts +Download http://localhost:4545/subdir/redirects/a.ts +Download http://localhost:4545/subdir/redirects/b.ts +Check http://localhost:4548/subdir/redirects/a.ts diff --git a/cli/tests/testdata/reference_types.ts b/cli/tests/testdata/reference_types.ts new file mode 100644 index 000000000..105e23b37 --- /dev/null +++ b/cli/tests/testdata/reference_types.ts @@ -0,0 +1,3 @@ +/// + +console.log(globalThis.a); diff --git a/cli/tests/testdata/reference_types.ts.out b/cli/tests/testdata/reference_types.ts.out new file mode 100644 index 000000000..417b7b537 --- /dev/null +++ b/cli/tests/testdata/reference_types.ts.out @@ -0,0 +1 @@ +undefined diff --git a/cli/tests/testdata/reference_types_remote.ts b/cli/tests/testdata/reference_types_remote.ts new file mode 100644 index 000000000..e7fa81b2c --- /dev/null +++ b/cli/tests/testdata/reference_types_remote.ts @@ -0,0 +1,3 @@ +/// + +console.log(globalThis.a); diff --git a/cli/tests/testdata/reference_types_remote.ts.out b/cli/tests/testdata/reference_types_remote.ts.out new file mode 100644 index 000000000..417b7b537 --- /dev/null +++ b/cli/tests/testdata/reference_types_remote.ts.out @@ -0,0 +1 @@ +undefined diff --git a/cli/tests/testdata/resolve_dns.ts b/cli/tests/testdata/resolve_dns.ts new file mode 100644 index 000000000..d765e0536 --- /dev/null +++ b/cli/tests/testdata/resolve_dns.ts @@ -0,0 +1,42 @@ +const nameServer = { nameServer: { ipAddr: "127.0.0.1", port: 4553 } }; + +const [a, aaaa, aname, cname, mx, ptr, 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("foo", "CNAME", nameServer), + Deno.resolveDns("www.example.com", "MX", nameServer), + Deno.resolveDns("5.6.7.8", "PTR", nameServer), + Deno.resolveDns("_Service._TCP.example.com", "SRV", nameServer), + Deno.resolveDns("www.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("CNAME"); +console.log(JSON.stringify(cname)); + +console.log("MX"); +console.log(JSON.stringify(mx)); + +console.log("PTR"); +console.log(JSON.stringify(ptr)); + +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 thrown for not-found-example.com"); +} diff --git a/cli/tests/testdata/resolve_dns.ts.out b/cli/tests/testdata/resolve_dns.ts.out new file mode 100644 index 000000000..78381e6c6 --- /dev/null +++ b/cli/tests/testdata/resolve_dns.ts.out @@ -0,0 +1,17 @@ +A +["1.2.3.4"] +AAAA +["1:2:3:4:5:6:7:8"] +ANAME +["aname.com."] +CNAME +["cname.com."] +MX +[{"preference":0,"exchange":"mx.com."}] +PTR +["ptr.com."] +SRV +[{"priority":0,"weight":100,"port":1234,"target":"srv.com."}] +TXT +[["foo","bar"]] +Error thrown for not-found-example.com diff --git a/cli/tests/testdata/runtime_decorators.ts b/cli/tests/testdata/runtime_decorators.ts new file mode 100644 index 000000000..5da109110 --- /dev/null +++ b/cli/tests/testdata/runtime_decorators.ts @@ -0,0 +1,42 @@ +// deno-lint-ignore-file +function A() { + console.log("@A evaluated"); + return function ( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor, + ) { + console.log("@A called"); + const fn = descriptor.value; + descriptor.value = function () { + console.log("fn() called from @A"); + fn(); + }; + }; +} + +function B() { + console.log("@B evaluated"); + return function ( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor, + ) { + console.log("@B called"); + const fn = descriptor.value; + descriptor.value = function () { + console.log("fn() called from @B"); + fn(); + }; + }; +} + +class C { + @A() + @B() + static test() { + console.log("C.test() called"); + } +} + +C.test(); diff --git a/cli/tests/testdata/runtime_decorators.ts.out b/cli/tests/testdata/runtime_decorators.ts.out new file mode 100644 index 000000000..0fc1d4590 --- /dev/null +++ b/cli/tests/testdata/runtime_decorators.ts.out @@ -0,0 +1,7 @@ +@A evaluated +@B evaluated +@B called +@A called +fn() called from @A +fn() called from @B +C.test() called diff --git a/cli/tests/testdata/seed_random.js b/cli/tests/testdata/seed_random.js new file mode 100644 index 000000000..7f6e336df --- /dev/null +++ b/cli/tests/testdata/seed_random.js @@ -0,0 +1,11 @@ +for (let i = 0; i < 10; ++i) { + console.log(Math.random()); +} + +const arr = new Uint8Array(32); + +crypto.getRandomValues(arr); +console.log(arr); + +crypto.getRandomValues(arr); +console.log(arr); diff --git a/cli/tests/testdata/seed_random.js.out b/cli/tests/testdata/seed_random.js.out new file mode 100644 index 000000000..4d1ebd081 --- /dev/null +++ b/cli/tests/testdata/seed_random.js.out @@ -0,0 +1,22 @@ +0.858562739044346 +0.8973397944553141 +0.15335012655691727 +0.36867387434349963 +0.3591039342838782 +0.7044499748617652 +0.7461423057751548 +0.3824611207183364 +0.5950178237266042 +0.22440633214343908 +Uint8Array(32) [ + 153, 221, 127, 193, 173, 88, 77, 155, + 23, 66, 117, 239, 157, 231, 189, 160, + 79, 198, 30, 56, 137, 159, 220, 226, + 47, 211, 26, 73, 243, 252, 71, 214 +] +Uint8Array(32) [ + 18, 98, 66, 131, 76, 87, 93, 76, + 205, 81, 250, 112, 129, 119, 92, 9, + 116, 99, 5, 171, 8, 137, 132, 79, + 255, 9, 194, 1, 138, 85, 72, 189 +] diff --git a/cli/tests/testdata/single_compile_with_reload.ts b/cli/tests/testdata/single_compile_with_reload.ts new file mode 100644 index 000000000..f84e91f2f --- /dev/null +++ b/cli/tests/testdata/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( + new URL("single_compile_with_reload_worker.ts", import.meta.url).href, + { type: "module" }, + ).onmessage = r +); +console.log("3"); +await new Promise((r) => + new Worker( + new URL("single_compile_with_reload_worker.ts", import.meta.url).href, + { type: "module" }, + ).onmessage = r +); +console.log("4"); diff --git a/cli/tests/testdata/single_compile_with_reload.ts.out b/cli/tests/testdata/single_compile_with_reload.ts.out new file mode 100644 index 000000000..b0b2fcaf1 --- /dev/null +++ b/cli/tests/testdata/single_compile_with_reload.ts.out @@ -0,0 +1,9 @@ +Check [WILDCARD]single_compile_with_reload.ts +Hello +1 +2 +Check [WILDCARD]single_compile_with_reload_worker.ts +Hello from worker +3 +Hello from worker +4 diff --git a/cli/tests/testdata/single_compile_with_reload_dyn.ts b/cli/tests/testdata/single_compile_with_reload_dyn.ts new file mode 100644 index 000000000..0266bf46c --- /dev/null +++ b/cli/tests/testdata/single_compile_with_reload_dyn.ts @@ -0,0 +1,11 @@ +import { printHello3, returnsFoo2, returnsHi } from "./subdir/mod1.ts"; + +printHello3(); + +if (returnsHi() !== "Hi") { + throw Error("Unexpected"); +} + +if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); +} diff --git a/cli/tests/testdata/single_compile_with_reload_worker.ts b/cli/tests/testdata/single_compile_with_reload_worker.ts new file mode 100644 index 000000000..103cafe20 --- /dev/null +++ b/cli/tests/testdata/single_compile_with_reload_worker.ts @@ -0,0 +1,3 @@ +console.log("Hello from worker"); +postMessage(null); +close(); diff --git a/cli/tests/testdata/standalone_compiler_ops.ts b/cli/tests/testdata/standalone_compiler_ops.ts new file mode 100644 index 000000000..b95e1222e --- /dev/null +++ b/cli/tests/testdata/standalone_compiler_ops.ts @@ -0,0 +1,12 @@ +const { files } = await Deno.emit("/mod.ts", { + bundle: "classic", + sources: { + "/mod.ts": `import { hello } from "/hello.ts"; console.log(hello);`, + "/hello.ts": `export const hello: string = "Hello, Compiler API!"`, + }, + compilerOptions: { + sourceMap: false, + }, +}); + +eval(files["deno:///bundle.js"]); diff --git a/cli/tests/testdata/standalone_error.ts b/cli/tests/testdata/standalone_error.ts new file mode 100644 index 000000000..279398113 --- /dev/null +++ b/cli/tests/testdata/standalone_error.ts @@ -0,0 +1,9 @@ +function boom() { + throw new Error("boom!"); +} + +function foo() { + boom(); +} + +foo(); diff --git a/cli/tests/testdata/standalone_import.ts b/cli/tests/testdata/standalone_import.ts new file mode 100644 index 000000000..804102a53 --- /dev/null +++ b/cli/tests/testdata/standalone_import.ts @@ -0,0 +1,2 @@ +console.log("start"); +await import("./001_hello.js"); diff --git a/cli/tests/testdata/standalone_import_datauri.ts b/cli/tests/testdata/standalone_import_datauri.ts new file mode 100644 index 000000000..68f348828 --- /dev/null +++ b/cli/tests/testdata/standalone_import_datauri.ts @@ -0,0 +1,4 @@ +const c = await import( + "data:text/javascript;base64,ZXhwb3J0IGRlZmF1bHQgJ0hlbGxvIERlbm8hJw==" +); +console.log(c.default); // Output: "Hello Deno!" diff --git a/cli/tests/testdata/standalone_runtime_flags.ts b/cli/tests/testdata/standalone_runtime_flags.ts new file mode 100644 index 000000000..0154c7f4e --- /dev/null +++ b/cli/tests/testdata/standalone_runtime_flags.ts @@ -0,0 +1,3 @@ +console.log(Math.random()); +await Deno.stat("."); +await Deno.create("foo.txt"); diff --git a/cli/tests/testdata/std_lint.out b/cli/tests/testdata/std_lint.out new file mode 100644 index 000000000..9d62fcc67 --- /dev/null +++ b/cli/tests/testdata/std_lint.out @@ -0,0 +1,3 @@ +[WILDCARD] + +Found [WILDCARD] problems \ No newline at end of file diff --git a/cli/tests/testdata/stdout_write_all.out b/cli/tests/testdata/stdout_write_all.out new file mode 100644 index 000000000..af5626b4a --- /dev/null +++ b/cli/tests/testdata/stdout_write_all.out @@ -0,0 +1 @@ +Hello, world! diff --git a/cli/tests/testdata/stdout_write_all.ts b/cli/tests/testdata/stdout_write_all.ts new file mode 100644 index 000000000..623bd8f53 --- /dev/null +++ b/cli/tests/testdata/stdout_write_all.ts @@ -0,0 +1,8 @@ +const encoder = new TextEncoder(); +const pending = [ + Deno.stdout.write(encoder.encode("Hello, ")), + Deno.stdout.write(encoder.encode("world!")), +]; + +await Promise.all(pending); +await Deno.stdout.write(encoder.encode("\n")); diff --git a/cli/tests/testdata/subdir/amd_like.js b/cli/tests/testdata/subdir/amd_like.js new file mode 100644 index 000000000..f27e505e4 --- /dev/null +++ b/cli/tests/testdata/subdir/amd_like.js @@ -0,0 +1,3 @@ +// looks like an AMD module, but isn't +const define = () => {}; +define(["fake_module"], () => {}); diff --git a/cli/tests/testdata/subdir/auto_print_hello.ts b/cli/tests/testdata/subdir/auto_print_hello.ts new file mode 100644 index 000000000..5efa72e03 --- /dev/null +++ b/cli/tests/testdata/subdir/auto_print_hello.ts @@ -0,0 +1,2 @@ +console.log("hello!"); +export default {}; diff --git a/cli/tests/testdata/subdir/circular1.ts b/cli/tests/testdata/subdir/circular1.ts new file mode 100644 index 000000000..06fdb3373 --- /dev/null +++ b/cli/tests/testdata/subdir/circular1.ts @@ -0,0 +1,7 @@ +import * as circular2 from "./circular2.ts"; + +export function f1() { + console.log("f1"); +} + +circular2.f2(); diff --git a/cli/tests/testdata/subdir/circular2.ts b/cli/tests/testdata/subdir/circular2.ts new file mode 100644 index 000000000..0864b7adf --- /dev/null +++ b/cli/tests/testdata/subdir/circular2.ts @@ -0,0 +1,7 @@ +import * as circular1 from "./circular1.ts"; + +export function f2() { + console.log("f2"); +} + +circular1.f1(); diff --git a/cli/tests/testdata/subdir/comment.ts b/cli/tests/testdata/subdir/comment.ts new file mode 100644 index 000000000..ea7e630c0 --- /dev/null +++ b/cli/tests/testdata/subdir/comment.ts @@ -0,0 +1,4 @@ +// This is a comment. +export function comment(): string { + return "comment"; +} diff --git a/cli/tests/testdata/subdir/config.json b/cli/tests/testdata/subdir/config.json new file mode 100644 index 000000000..01c3b5e79 --- /dev/null +++ b/cli/tests/testdata/subdir/config.json @@ -0,0 +1,6 @@ +{ + "foo": { + "bar": true, + "baz": ["qat", 1] + } +} diff --git a/cli/tests/testdata/subdir/emittable.d.ts b/cli/tests/testdata/subdir/emittable.d.ts new file mode 100644 index 000000000..425b80f24 --- /dev/null +++ b/cli/tests/testdata/subdir/emittable.d.ts @@ -0,0 +1 @@ +export const a: string; diff --git a/cli/tests/testdata/subdir/empty.ts b/cli/tests/testdata/subdir/empty.ts new file mode 100644 index 000000000..e69de29bb diff --git a/cli/tests/testdata/subdir/evil_remote_import.js b/cli/tests/testdata/subdir/evil_remote_import.js new file mode 100644 index 000000000..4ff7d1b97 --- /dev/null +++ b/cli/tests/testdata/subdir/evil_remote_import.js @@ -0,0 +1,4 @@ +// We expect to get a permission denied error if we dynamically +// import this module without --allow-read. +export * from "file:///c:/etc/passwd"; +console.log("Hello from evil_remote_import.js"); diff --git a/cli/tests/testdata/subdir/foo_types.d.ts b/cli/tests/testdata/subdir/foo_types.d.ts new file mode 100644 index 000000000..c489584b9 --- /dev/null +++ b/cli/tests/testdata/subdir/foo_types.d.ts @@ -0,0 +1,3 @@ +declare namespace Foo { + const bar: string; +} diff --git a/cli/tests/testdata/subdir/form_urlencoded.txt b/cli/tests/testdata/subdir/form_urlencoded.txt new file mode 100644 index 000000000..70e087c20 --- /dev/null +++ b/cli/tests/testdata/subdir/form_urlencoded.txt @@ -0,0 +1 @@ +field_1=Hi&field_2=%3CDeno%3E \ No newline at end of file diff --git a/cli/tests/testdata/subdir/indirect_import_error.js b/cli/tests/testdata/subdir/indirect_import_error.js new file mode 100644 index 000000000..84011d291 --- /dev/null +++ b/cli/tests/testdata/subdir/indirect_import_error.js @@ -0,0 +1 @@ +export * from "does not exist either"; diff --git a/cli/tests/testdata/subdir/indirect_throws.js b/cli/tests/testdata/subdir/indirect_throws.js new file mode 100644 index 000000000..e1810a66c --- /dev/null +++ b/cli/tests/testdata/subdir/indirect_throws.js @@ -0,0 +1 @@ +export * from "./throws.js"; diff --git a/cli/tests/testdata/subdir/json_1.json b/cli/tests/testdata/subdir/json_1.json new file mode 100644 index 000000000..754d16b84 --- /dev/null +++ b/cli/tests/testdata/subdir/json_1.json @@ -0,0 +1,5 @@ +{ + "$var": { "a": 123, "b": [1, 2, 3], "c": null }, + "with space": "invalid variable name", + "function": "reserved word" +} diff --git a/cli/tests/testdata/subdir/json_2.json b/cli/tests/testdata/subdir/json_2.json new file mode 100644 index 000000000..7deb8b173 --- /dev/null +++ b/cli/tests/testdata/subdir/json_2.json @@ -0,0 +1 @@ +"just a string" diff --git a/cli/tests/testdata/subdir/main.ts b/cli/tests/testdata/subdir/main.ts new file mode 100644 index 000000000..29acf42e0 --- /dev/null +++ b/cli/tests/testdata/subdir/main.ts @@ -0,0 +1,3 @@ +if (import.meta.main) { + console.log("Hello, world!"); +} diff --git a/cli/tests/testdata/subdir/mismatch_ext.ts b/cli/tests/testdata/subdir/mismatch_ext.ts new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/mismatch_ext.ts @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mod1.ts b/cli/tests/testdata/subdir/mod1.ts new file mode 100644 index 000000000..5e58f432e --- /dev/null +++ b/cli/tests/testdata/subdir/mod1.ts @@ -0,0 +1,17 @@ +import { printHello2, returnsFoo } from "./subdir2/mod2.ts"; + +export function returnsHi(): string { + return "Hi"; +} + +export function returnsFoo2(): string { + return returnsFoo(); +} + +export function printHello3() { + printHello2(); +} + +export function throwsError() { + throw Error("exception from mod1"); +} diff --git a/cli/tests/testdata/subdir/mod2.ts b/cli/tests/testdata/subdir/mod2.ts new file mode 100644 index 000000000..ce1adc0e8 --- /dev/null +++ b/cli/tests/testdata/subdir/mod2.ts @@ -0,0 +1 @@ +export { printHello } from "./print_hello.ts"; diff --git a/cli/tests/testdata/subdir/mod3.js b/cli/tests/testdata/subdir/mod3.js new file mode 100644 index 000000000..ce534f570 --- /dev/null +++ b/cli/tests/testdata/subdir/mod3.js @@ -0,0 +1 @@ +export const isTSFile = false; diff --git a/cli/tests/testdata/subdir/mod4.js b/cli/tests/testdata/subdir/mod4.js new file mode 100644 index 000000000..71332dbc4 --- /dev/null +++ b/cli/tests/testdata/subdir/mod4.js @@ -0,0 +1 @@ +export const isMod4 = true; diff --git a/cli/tests/testdata/subdir/mod5.mjs b/cli/tests/testdata/subdir/mod5.mjs new file mode 100644 index 000000000..f21d8862b --- /dev/null +++ b/cli/tests/testdata/subdir/mod5.mjs @@ -0,0 +1 @@ +export const isMod5 = true; diff --git a/cli/tests/testdata/subdir/mod6.js b/cli/tests/testdata/subdir/mod6.js new file mode 100644 index 000000000..5e17c9ee0 --- /dev/null +++ b/cli/tests/testdata/subdir/mod6.js @@ -0,0 +1 @@ +export { isMod4 } from "./mod4.js"; diff --git a/cli/tests/testdata/subdir/more_decorators.ts b/cli/tests/testdata/subdir/more_decorators.ts new file mode 100644 index 000000000..674705d56 --- /dev/null +++ b/cli/tests/testdata/subdir/more_decorators.ts @@ -0,0 +1,18 @@ +// deno-lint-ignore-file +function a() { + console.log("a(): evaluated"); + return ( + _target: any, + _propertyKey: string, + _descriptor: PropertyDescriptor, + ) => { + console.log("a(): called"); + }; +} + +export class B { + @a() + method() { + console.log("method"); + } +} diff --git a/cli/tests/testdata/subdir/mt_application_ecmascript.j2.js b/cli/tests/testdata/subdir/mt_application_ecmascript.j2.js new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_application_ecmascript.j2.js @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_application_ecmascript_jsx.j2.jsx b/cli/tests/testdata/subdir/mt_application_ecmascript_jsx.j2.jsx new file mode 100644 index 000000000..c5c27f9f9 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_application_ecmascript_jsx.j2.jsx @@ -0,0 +1,5 @@ +const React = { + createElement() {}, +}; +const temp =
; +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_application_x_javascript.j4.js b/cli/tests/testdata/subdir/mt_application_x_javascript.j4.js new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_application_x_javascript.j4.js @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_application_x_javascript_jsx.j4.jsx b/cli/tests/testdata/subdir/mt_application_x_javascript_jsx.j4.jsx new file mode 100644 index 000000000..c5c27f9f9 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_application_x_javascript_jsx.j4.jsx @@ -0,0 +1,5 @@ +const React = { + createElement() {}, +}; +const temp =
; +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_application_x_typescript.t4.ts b/cli/tests/testdata/subdir/mt_application_x_typescript.t4.ts new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_application_x_typescript.t4.ts @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_application_x_typescript_tsx.t4.tsx b/cli/tests/testdata/subdir/mt_application_x_typescript_tsx.t4.tsx new file mode 100644 index 000000000..c5c27f9f9 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_application_x_typescript_tsx.t4.tsx @@ -0,0 +1,5 @@ +const React = { + createElement() {}, +}; +const temp =
; +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_javascript.js b/cli/tests/testdata/subdir/mt_javascript.js new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_javascript.js @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_javascript_jsx.jsx b/cli/tests/testdata/subdir/mt_javascript_jsx.jsx new file mode 100644 index 000000000..c5c27f9f9 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_javascript_jsx.jsx @@ -0,0 +1,5 @@ +const React = { + createElement() {}, +}; +const temp =
; +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_text_ecmascript.j3.js b/cli/tests/testdata/subdir/mt_text_ecmascript.j3.js new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_text_ecmascript.j3.js @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_text_ecmascript_jsx.j3.jsx b/cli/tests/testdata/subdir/mt_text_ecmascript_jsx.j3.jsx new file mode 100644 index 000000000..c5c27f9f9 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_text_ecmascript_jsx.j3.jsx @@ -0,0 +1,5 @@ +const React = { + createElement() {}, +}; +const temp =
; +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_text_javascript.j1.js b/cli/tests/testdata/subdir/mt_text_javascript.j1.js new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_text_javascript.j1.js @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_text_javascript_jsx.j1.jsx b/cli/tests/testdata/subdir/mt_text_javascript_jsx.j1.jsx new file mode 100644 index 000000000..c5c27f9f9 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_text_javascript_jsx.j1.jsx @@ -0,0 +1,5 @@ +const React = { + createElement() {}, +}; +const temp =
; +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_text_typescript.t1.ts b/cli/tests/testdata/subdir/mt_text_typescript.t1.ts new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_text_typescript.t1.ts @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_text_typescript_tsx.t1.tsx b/cli/tests/testdata/subdir/mt_text_typescript_tsx.t1.tsx new file mode 100644 index 000000000..c5c27f9f9 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_text_typescript_tsx.t1.tsx @@ -0,0 +1,5 @@ +const React = { + createElement() {}, +}; +const temp =
; +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_video_mp2t.t3.ts b/cli/tests/testdata/subdir/mt_video_mp2t.t3.ts new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_video_mp2t.t3.ts @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_video_mp2t_tsx.t3.tsx b/cli/tests/testdata/subdir/mt_video_mp2t_tsx.t3.tsx new file mode 100644 index 000000000..c5c27f9f9 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_video_mp2t_tsx.t3.tsx @@ -0,0 +1,5 @@ +const React = { + createElement() {}, +}; +const temp =
; +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_video_vdn.t2.ts b/cli/tests/testdata/subdir/mt_video_vdn.t2.ts new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_video_vdn.t2.ts @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/mt_video_vdn_tsx.t2.tsx b/cli/tests/testdata/subdir/mt_video_vdn_tsx.t2.tsx new file mode 100644 index 000000000..c5c27f9f9 --- /dev/null +++ b/cli/tests/testdata/subdir/mt_video_vdn_tsx.t2.tsx @@ -0,0 +1,5 @@ +const React = { + createElement() {}, +}; +const temp =
; +export const loaded = true; diff --git a/cli/tests/testdata/subdir/no_ext b/cli/tests/testdata/subdir/no_ext new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/no_ext @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/subdir/no_js_ext b/cli/tests/testdata/subdir/no_js_ext new file mode 100644 index 000000000..8322a106f --- /dev/null +++ b/cli/tests/testdata/subdir/no_js_ext @@ -0,0 +1,3 @@ +// @ts-check +import { printHello } from "./mod2.ts"; +printHello(); diff --git a/cli/tests/testdata/subdir/polyfill.ts b/cli/tests/testdata/subdir/polyfill.ts new file mode 100644 index 000000000..e1cd923cb --- /dev/null +++ b/cli/tests/testdata/subdir/polyfill.ts @@ -0,0 +1,10 @@ +declare global { + const polyfill: () => void; +} + +export {}; + +// deno-lint-ignore no-explicit-any +(globalThis as any).polyfill = () => { + console.log("polyfill"); +}; diff --git a/cli/tests/testdata/subdir/print_hello.ts b/cli/tests/testdata/subdir/print_hello.ts new file mode 100644 index 000000000..b9c0ad527 --- /dev/null +++ b/cli/tests/testdata/subdir/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/cli/tests/testdata/subdir/redirects/a.ts b/cli/tests/testdata/subdir/redirects/a.ts new file mode 100644 index 000000000..071ee4728 --- /dev/null +++ b/cli/tests/testdata/subdir/redirects/a.ts @@ -0,0 +1,9 @@ +import { createA } from "./b.ts"; + +export class A { + private _a = "a"; +} + +export function start(): A { + return createA(); +} diff --git a/cli/tests/testdata/subdir/redirects/b.ts b/cli/tests/testdata/subdir/redirects/b.ts new file mode 100644 index 000000000..cdb71eaae --- /dev/null +++ b/cli/tests/testdata/subdir/redirects/b.ts @@ -0,0 +1,5 @@ +import { A } from "./a.ts"; + +export function createA(): A { + return new A(); +} diff --git a/cli/tests/testdata/subdir/redirects/redirect1.js b/cli/tests/testdata/subdir/redirects/redirect1.js new file mode 100644 index 000000000..d674be88c --- /dev/null +++ b/cli/tests/testdata/subdir/redirects/redirect1.js @@ -0,0 +1 @@ +export const redirect = 1; diff --git a/cli/tests/testdata/subdir/redirects/redirect1.ts b/cli/tests/testdata/subdir/redirects/redirect1.ts new file mode 100644 index 000000000..d674be88c --- /dev/null +++ b/cli/tests/testdata/subdir/redirects/redirect1.ts @@ -0,0 +1 @@ +export const redirect = 1; diff --git a/cli/tests/testdata/subdir/redirects/redirect2.js b/cli/tests/testdata/subdir/redirects/redirect2.js new file mode 100644 index 000000000..e4244f638 --- /dev/null +++ b/cli/tests/testdata/subdir/redirects/redirect2.js @@ -0,0 +1 @@ +import "./redirect1.js"; diff --git a/cli/tests/testdata/subdir/redirects/redirect3.js b/cli/tests/testdata/subdir/redirects/redirect3.js new file mode 100644 index 000000000..e24f2af32 --- /dev/null +++ b/cli/tests/testdata/subdir/redirects/redirect3.js @@ -0,0 +1,2 @@ +import { redirect } from "./redirect1.js"; +export const value = `3 imports ${redirect}`; diff --git a/cli/tests/testdata/subdir/redirects/redirect4.ts b/cli/tests/testdata/subdir/redirects/redirect4.ts new file mode 100644 index 000000000..45c65c5eb --- /dev/null +++ b/cli/tests/testdata/subdir/redirects/redirect4.ts @@ -0,0 +1,2 @@ +import { redirect } from "./redirect1.ts"; +export const value = `4 imports ${redirect}`; diff --git a/cli/tests/testdata/subdir/single_module.ts b/cli/tests/testdata/subdir/single_module.ts new file mode 100644 index 000000000..f41b0a4b5 --- /dev/null +++ b/cli/tests/testdata/subdir/single_module.ts @@ -0,0 +1,2 @@ +console.log("Hello world!"); +export {}; // TODO(ry) This shouldn't be necessary. diff --git a/cli/tests/testdata/subdir/subdir2/dynamic_import.ts b/cli/tests/testdata/subdir/subdir2/dynamic_import.ts new file mode 100644 index 000000000..573887b71 --- /dev/null +++ b/cli/tests/testdata/subdir/subdir2/dynamic_import.ts @@ -0,0 +1,6 @@ +(async () => { + const { printHello } = await import("../mod2.ts"); + printHello(); +})(); + +export {}; diff --git a/cli/tests/testdata/subdir/subdir2/mod2.ts b/cli/tests/testdata/subdir/subdir2/mod2.ts new file mode 100644 index 000000000..9071d0aeb --- /dev/null +++ b/cli/tests/testdata/subdir/subdir2/mod2.ts @@ -0,0 +1,9 @@ +import { printHello } from "../print_hello.ts"; + +export function returnsFoo(): string { + return "Foo"; +} + +export function printHello2() { + printHello(); +} diff --git a/cli/tests/testdata/subdir/test_worker_basic.js b/cli/tests/testdata/subdir/test_worker_basic.js new file mode 100644 index 000000000..b960128b4 --- /dev/null +++ b/cli/tests/testdata/subdir/test_worker_basic.js @@ -0,0 +1,14 @@ +console.log("hello from test_worker_basic.js"); + +if (self.name !== "jsWorker") { + throw Error(`Bad worker name: ${self.name}, expected jsWorker`); +} + +onmessage = function (e) { + postMessage(e.data); + close(); +}; + +onerror = function () { + return false; +}; diff --git a/cli/tests/testdata/subdir/throws.js b/cli/tests/testdata/subdir/throws.js new file mode 100644 index 000000000..abdf29156 --- /dev/null +++ b/cli/tests/testdata/subdir/throws.js @@ -0,0 +1,6 @@ +// deno-lint-ignore-file +export function boo() { + console.log("Boo!"); +} + +throw new Error("An error"); diff --git a/cli/tests/testdata/subdir/tla.ts b/cli/tests/testdata/subdir/tla.ts new file mode 100644 index 000000000..713dbfca0 --- /dev/null +++ b/cli/tests/testdata/subdir/tla.ts @@ -0,0 +1 @@ +export const foo = await Promise.resolve("Hello"); diff --git a/cli/tests/testdata/subdir/type_and_code.ts b/cli/tests/testdata/subdir/type_and_code.ts new file mode 100644 index 000000000..b14713419 --- /dev/null +++ b/cli/tests/testdata/subdir/type_and_code.ts @@ -0,0 +1,7 @@ +export interface AnInterface { + a: string; +} + +export function isAnInterface(value: unknown): value is AnInterface { + return value && typeof value === "object" && "a" in value; +} diff --git a/cli/tests/testdata/subdir/type_reference.d.ts b/cli/tests/testdata/subdir/type_reference.d.ts new file mode 100644 index 000000000..f9b8de5ed --- /dev/null +++ b/cli/tests/testdata/subdir/type_reference.d.ts @@ -0,0 +1 @@ +export const foo: "foo"; diff --git a/cli/tests/testdata/subdir/type_reference.js b/cli/tests/testdata/subdir/type_reference.js new file mode 100644 index 000000000..917d89198 --- /dev/null +++ b/cli/tests/testdata/subdir/type_reference.js @@ -0,0 +1,3 @@ +/// + +export const foo = "foo"; diff --git a/cli/tests/testdata/subdir/types.d.ts b/cli/tests/testdata/subdir/types.d.ts new file mode 100644 index 000000000..7f587e144 --- /dev/null +++ b/cli/tests/testdata/subdir/types.d.ts @@ -0,0 +1 @@ +declare var a: string; diff --git a/cli/tests/testdata/subdir/unknown_ext.deno b/cli/tests/testdata/subdir/unknown_ext.deno new file mode 100644 index 000000000..e67d2a017 --- /dev/null +++ b/cli/tests/testdata/subdir/unknown_ext.deno @@ -0,0 +1 @@ +export const loaded = true; diff --git a/cli/tests/testdata/swc_syntax_error.ts b/cli/tests/testdata/swc_syntax_error.ts new file mode 100644 index 000000000..991ca9214 --- /dev/null +++ b/cli/tests/testdata/swc_syntax_error.ts @@ -0,0 +1,4 @@ +// deno-fmt-ignore-file +for await (const req of s) { + let something: +} diff --git a/cli/tests/testdata/swc_syntax_error.ts.out b/cli/tests/testdata/swc_syntax_error.ts.out new file mode 100644 index 000000000..53ed29cb6 --- /dev/null +++ b/cli/tests/testdata/swc_syntax_error.ts.out @@ -0,0 +1 @@ +error: 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:0 diff --git a/cli/tests/testdata/symlink_to_subdir b/cli/tests/testdata/symlink_to_subdir new file mode 120000 index 000000000..fe0c45aa4 --- /dev/null +++ b/cli/tests/testdata/symlink_to_subdir @@ -0,0 +1 @@ +subdir/ \ No newline at end of file diff --git a/cli/tests/testdata/test/allow_all.out b/cli/tests/testdata/test/allow_all.out new file mode 100644 index 000000000..9b7367b94 --- /dev/null +++ b/cli/tests/testdata/test/allow_all.out @@ -0,0 +1,18 @@ +[WILDCARD] +running 14 tests from [WILDCARD] +test read false ... ok [WILDCARD] +test read true ... ok [WILDCARD] +test write false ... ok [WILDCARD] +test write true ... ok [WILDCARD] +test net false ... ok [WILDCARD] +test net true ... ok [WILDCARD] +test env false ... ok [WILDCARD] +test env true ... ok [WILDCARD] +test run false ... ok [WILDCARD] +test run true ... ok [WILDCARD] +test ffi false ... ok [WILDCARD] +test ffi true ... ok [WILDCARD] +test hrtime false ... ok [WILDCARD] +test hrtime true ... ok [WILDCARD] + +test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD] diff --git a/cli/tests/testdata/test/allow_all.ts b/cli/tests/testdata/test/allow_all.ts new file mode 100644 index 000000000..abe55a8d5 --- /dev/null +++ b/cli/tests/testdata/test/allow_all.ts @@ -0,0 +1,35 @@ +import { assertEquals } from "../../../../test_util/std/testing/asserts.ts"; + +const permissions: Deno.PermissionName[] = [ + "read", + "write", + "net", + "env", + "run", + "ffi", + "hrtime", +]; + +for (const name of permissions) { + Deno.test({ + name: `${name} false`, + permissions: { + [name]: false, + }, + async fn() { + const status = await Deno.permissions.query({ name }); + assertEquals(status.state, "denied"); + }, + }); + + Deno.test({ + name: `${name} true`, + permissions: { + [name]: true, + }, + async fn() { + const status = await Deno.permissions.query({ name }); + assertEquals(status.state, "granted"); + }, + }); +} diff --git a/cli/tests/testdata/test/allow_none.out b/cli/tests/testdata/test/allow_none.out new file mode 100644 index 000000000..b79c7e6bf --- /dev/null +++ b/cli/tests/testdata/test/allow_none.out @@ -0,0 +1,51 @@ +[WILDCARD] +running 7 tests from [WILDCARD] +test read ... FAILED [WILDCARD] +test write ... FAILED [WILDCARD] +test net ... FAILED [WILDCARD] +test env ... FAILED [WILDCARD] +test run ... FAILED [WILDCARD] +test ffi ... FAILED [WILDCARD] +test hrtime ... FAILED [WILDCARD] + +failures: + +read +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +write +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +net +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +env +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +run +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +ffi +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +hrtime +PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] + +failures: + + read + write + net + env + run + ffi + hrtime + +test result: FAILED. 0 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD] diff --git a/cli/tests/testdata/test/allow_none.ts b/cli/tests/testdata/test/allow_none.ts new file mode 100644 index 000000000..3153b9755 --- /dev/null +++ b/cli/tests/testdata/test/allow_none.ts @@ -0,0 +1,23 @@ +import { unreachable } from "../../../../test_util/std/testing/asserts.ts"; + +const permissions: Deno.PermissionName[] = [ + "read", + "write", + "net", + "env", + "run", + "ffi", + "hrtime", +]; + +for (const name of permissions) { + Deno.test({ + name, + permissions: { + [name]: true, + }, + fn() { + unreachable(); + }, + }); +} diff --git a/cli/tests/testdata/test/clear_timeout.out b/cli/tests/testdata/test/clear_timeout.out new file mode 100644 index 000000000..c9f459dbe --- /dev/null +++ b/cli/tests/testdata/test/clear_timeout.out @@ -0,0 +1,8 @@ +Check [WILDCARD]/test/clear_timeout.ts +running 3 tests from [WILDCARD]/test/clear_timeout.ts +test test 1 ... ok ([WILDCARD]) +test test 2 ... ok ([WILDCARD]) +test test 3 ... ok ([WILDCARD]) + +test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/clear_timeout.ts b/cli/tests/testdata/test/clear_timeout.ts new file mode 100644 index 000000000..00056e853 --- /dev/null +++ b/cli/tests/testdata/test/clear_timeout.ts @@ -0,0 +1,5 @@ +clearTimeout(setTimeout(() => {}, 1000)); + +Deno.test("test 1", () => {}); +Deno.test("test 2", () => {}); +Deno.test("test 3", () => {}); diff --git a/cli/tests/testdata/test/doc.out b/cli/tests/testdata/test/doc.out new file mode 100644 index 000000000..91ecbd4d4 --- /dev/null +++ b/cli/tests/testdata/test/doc.out @@ -0,0 +1,10 @@ +Check [WILDCARD]/doc.ts$2-5.ts +Check [WILDCARD]/doc.ts$6-9.js +Check [WILDCARD]/doc.ts$10-13.jsx +Check [WILDCARD]/doc.ts$14-17.ts +Check [WILDCARD]/doc.ts$18-21.tsx +Check [WILDCARD]/doc.ts$30-35.ts +error: TS2367 [ERROR]: This condition will always return 'false' since the types 'string' and 'number' have no overlap. +console.assert(check() == 42); + ~~~~~~~~~~~~~ + at [WILDCARD]/doc.ts$30-35.ts:3:16 diff --git a/cli/tests/testdata/test/doc.ts b/cli/tests/testdata/test/doc.ts new file mode 100644 index 000000000..52fe6bdf0 --- /dev/null +++ b/cli/tests/testdata/test/doc.ts @@ -0,0 +1,38 @@ +/** + * ``` + * import * as doc from "./doc.ts"; + * ``` + * + * ```js + * import * as doc from "./doc.ts"; + * ``` + * + * ```jsx + * import * as doc from "./doc.ts"; + * ``` + * + * ```ts + * import * as doc from "./doc.ts"; + * ``` + * + * ```tsx + * import * as doc from "./doc.ts"; + * ``` + * + * ```text + * import * as doc from "./doc.ts"; + * ``` + * + * @module doc + */ + +/** + * ``` + * import { check } from "./doc.ts"; + * + * console.assert(check() == 42); + * ``` + */ +export function check(): string { + return "check"; +} diff --git a/cli/tests/testdata/test/doc_markdown.out b/cli/tests/testdata/test/doc_markdown.out new file mode 100644 index 000000000..9d2c35974 --- /dev/null +++ b/cli/tests/testdata/test/doc_markdown.out @@ -0,0 +1,7 @@ +Check [WILDCARD]/test/doc_markdown/doc.md$11-14.js +Check [WILDCARD]/test/doc_markdown/doc.md$17-20.ts +Check [WILDCARD]/test/doc_markdown/doc.md$23-26.ts +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const a: string = 42; + ^ + at [WILDCARD]/test/doc_markdown/doc.md$23-26.ts:1:7 diff --git a/cli/tests/testdata/test/doc_markdown/doc.md b/cli/tests/testdata/test/doc_markdown/doc.md new file mode 100644 index 000000000..e5afb841b --- /dev/null +++ b/cli/tests/testdata/test/doc_markdown/doc.md @@ -0,0 +1,25 @@ +# Documentation + +The following block does not have a language attribute and should be ignored: + +``` +This is a fenced block without attributes, it's invalid and it should be ignored. +``` + +The following block should be given a js extension on extraction: + +```js +console.log("js"); +``` + +The following block should be given a ts extension on extraction: + +```ts +console.log("ts"); +``` + +The following example will trigger the type-checker to fail: + +```ts +const a: string = 42; +``` diff --git a/cli/tests/testdata/test/exit_sanitizer.out b/cli/tests/testdata/test/exit_sanitizer.out new file mode 100644 index 000000000..f331d7a70 --- /dev/null +++ b/cli/tests/testdata/test/exit_sanitizer.out @@ -0,0 +1,35 @@ +Check [WILDCARD]/test/exit_sanitizer.ts +running 3 tests from [WILDCARD]/test/exit_sanitizer.ts +test exit(0) ... FAILED ([WILDCARD]) +test exit(1) ... FAILED ([WILDCARD]) +test exit(2) ... FAILED ([WILDCARD]) + +failures: + +exit(0) +AssertionError: Test case attempted to exit with exit code: 0 + at [WILDCARD] + at [WILDCARD]/test/exit_sanitizer.ts:2:8 + at [WILDCARD] + +exit(1) +AssertionError: Test case attempted to exit with exit code: 1 + at [WILDCARD] + at [WILDCARD]/test/exit_sanitizer.ts:6:8 + at [WILDCARD] + +exit(2) +AssertionError: Test case attempted to exit with exit code: 2 + at [WILDCARD] + at [WILDCARD]/test/exit_sanitizer.ts:10:8 + at [WILDCARD] + +failures: + + exit(0) + exit(1) + exit(2) + +test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Test failed diff --git a/cli/tests/testdata/test/exit_sanitizer.ts b/cli/tests/testdata/test/exit_sanitizer.ts new file mode 100644 index 000000000..186406a9d --- /dev/null +++ b/cli/tests/testdata/test/exit_sanitizer.ts @@ -0,0 +1,11 @@ +Deno.test("exit(0)", function () { + Deno.exit(0); +}); + +Deno.test("exit(1)", function () { + Deno.exit(1); +}); + +Deno.test("exit(2)", function () { + Deno.exit(2); +}); diff --git a/cli/tests/testdata/test/fail.out b/cli/tests/testdata/test/fail.out new file mode 100644 index 000000000..66d471cdf --- /dev/null +++ b/cli/tests/testdata/test/fail.out @@ -0,0 +1,81 @@ +Check [WILDCARD]/test/fail.ts +running 10 tests from [WILDCARD]/test/fail.ts +test test 0 ... FAILED ([WILDCARD]) +test test 1 ... FAILED ([WILDCARD]) +test test 2 ... FAILED ([WILDCARD]) +test test 3 ... FAILED ([WILDCARD]) +test test 4 ... FAILED ([WILDCARD]) +test test 5 ... FAILED ([WILDCARD]) +test test 6 ... FAILED ([WILDCARD]) +test test 7 ... FAILED ([WILDCARD]) +test test 8 ... FAILED ([WILDCARD]) +test test 9 ... FAILED ([WILDCARD]) + +failures: + +test 0 +Error + at [WILDCARD]/test/fail.ts:2:9 + at [WILDCARD] + +test 1 +Error + at [WILDCARD]/test/fail.ts:5:9 + at [WILDCARD] + +test 2 +Error + at [WILDCARD]/test/fail.ts:8:9 + at [WILDCARD] + +test 3 +Error + at [WILDCARD]/test/fail.ts:11:9 + at [WILDCARD] + +test 4 +Error + at [WILDCARD]/test/fail.ts:14:9 + at [WILDCARD] + +test 5 +Error + at [WILDCARD]/test/fail.ts:17:9 + at [WILDCARD] + +test 6 +Error + at [WILDCARD]/test/fail.ts:20:9 + at [WILDCARD] + +test 7 +Error + at [WILDCARD]/test/fail.ts:23:9 + at [WILDCARD] + +test 8 +Error + at [WILDCARD]/test/fail.ts:26:9 + at [WILDCARD] + +test 9 +Error + at [WILDCARD]/test/fail.ts:29:9 + at [WILDCARD] + +failures: + + test 0 + test 1 + test 2 + test 3 + test 4 + test 5 + test 6 + test 7 + test 8 + test 9 + +test result: FAILED. 0 passed; 10 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Test failed diff --git a/cli/tests/testdata/test/fail.ts b/cli/tests/testdata/test/fail.ts new file mode 100644 index 000000000..9340db556 --- /dev/null +++ b/cli/tests/testdata/test/fail.ts @@ -0,0 +1,30 @@ +Deno.test("test 0", () => { + throw new Error(); +}); +Deno.test("test 1", () => { + throw new Error(); +}); +Deno.test("test 2", () => { + throw new Error(); +}); +Deno.test("test 3", () => { + throw new Error(); +}); +Deno.test("test 4", () => { + throw new Error(); +}); +Deno.test("test 5", () => { + throw new Error(); +}); +Deno.test("test 6", () => { + throw new Error(); +}); +Deno.test("test 7", () => { + throw new Error(); +}); +Deno.test("test 8", () => { + throw new Error(); +}); +Deno.test("test 9", () => { + throw new Error(); +}); diff --git a/cli/tests/testdata/test/fail_fast.out b/cli/tests/testdata/test/fail_fast.out new file mode 100644 index 000000000..c97f854fa --- /dev/null +++ b/cli/tests/testdata/test/fail_fast.out @@ -0,0 +1,18 @@ +Check [WILDCARD]/test/fail_fast.ts +running 10 tests from [WILDCARD]/test/fail_fast.ts +test test 1 ... FAILED ([WILDCARD]) + +failures: + +test 1 +Error + at [WILDCARD]/test/fail_fast.ts:2:9 + at [WILDCARD] + +failures: + + test 1 + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Test failed diff --git a/cli/tests/testdata/test/fail_fast.ts b/cli/tests/testdata/test/fail_fast.ts new file mode 100644 index 000000000..637e825ec --- /dev/null +++ b/cli/tests/testdata/test/fail_fast.ts @@ -0,0 +1,30 @@ +Deno.test("test 1", () => { + throw new Error(); +}); +Deno.test("test 2", () => { + throw new Error(); +}); +Deno.test("test 3", () => { + throw new Error(); +}); +Deno.test("test 4", () => { + throw new Error(); +}); +Deno.test("test 5", () => { + throw new Error(); +}); +Deno.test("test 6", () => { + throw new Error(); +}); +Deno.test("test 7", () => { + throw new Error(); +}); +Deno.test("test 8", () => { + throw new Error(); +}); +Deno.test("test 9", () => { + throw new Error(); +}); +Deno.test("test 0", () => { + throw new Error(); +}); diff --git a/cli/tests/testdata/test/fail_fast_with_val.out b/cli/tests/testdata/test/fail_fast_with_val.out new file mode 100644 index 000000000..a902e4c7b --- /dev/null +++ b/cli/tests/testdata/test/fail_fast_with_val.out @@ -0,0 +1,23 @@ +[WILDCARD] +running 10 tests from [WILDCARD]/test/fail_fast_with_val.ts +test test 1 ... FAILED ([WILDCARD]) +test test 2 ... FAILED ([WILDCARD]) + +failures: + +test 1 +Error + at [WILDCARD]/test/fail_fast_with_val.ts:2:9 + at [WILDCARD] + +test 2 +Error + at [WILDCARD]/test/fail_fast_with_val.ts:5:9 + at [WILDCARD] + +failures: + + test 1 + test 2 + +test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) diff --git a/cli/tests/testdata/test/fail_fast_with_val.ts b/cli/tests/testdata/test/fail_fast_with_val.ts new file mode 100644 index 000000000..637e825ec --- /dev/null +++ b/cli/tests/testdata/test/fail_fast_with_val.ts @@ -0,0 +1,30 @@ +Deno.test("test 1", () => { + throw new Error(); +}); +Deno.test("test 2", () => { + throw new Error(); +}); +Deno.test("test 3", () => { + throw new Error(); +}); +Deno.test("test 4", () => { + throw new Error(); +}); +Deno.test("test 5", () => { + throw new Error(); +}); +Deno.test("test 6", () => { + throw new Error(); +}); +Deno.test("test 7", () => { + throw new Error(); +}); +Deno.test("test 8", () => { + throw new Error(); +}); +Deno.test("test 9", () => { + throw new Error(); +}); +Deno.test("test 0", () => { + throw new Error(); +}); diff --git a/cli/tests/testdata/test/finally_timeout.out b/cli/tests/testdata/test/finally_timeout.out new file mode 100644 index 000000000..570e9108f --- /dev/null +++ b/cli/tests/testdata/test/finally_timeout.out @@ -0,0 +1,19 @@ +Check [WILDCARD]/test/finally_timeout.ts +running 2 tests from [WILDCARD]/test/finally_timeout.ts +test error ... FAILED ([WILDCARD]) +test success ... ok ([WILDCARD]) + +failures: + +error +Error: fail + at [WILDCARD]/test/finally_timeout.ts:4:11 + at [WILDCARD] + +failures: + + error + +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Test failed diff --git a/cli/tests/testdata/test/finally_timeout.ts b/cli/tests/testdata/test/finally_timeout.ts new file mode 100644 index 000000000..dcc0a4d64 --- /dev/null +++ b/cli/tests/testdata/test/finally_timeout.ts @@ -0,0 +1,11 @@ +Deno.test("error", function () { + const timer = setTimeout(() => null, 10000); + try { + throw new Error("fail"); + } finally { + clearTimeout(timer); + } +}); + +Deno.test("success", function () { +}); diff --git a/cli/tests/testdata/test/ignore.out b/cli/tests/testdata/test/ignore.out new file mode 100644 index 000000000..a7c68261d --- /dev/null +++ b/cli/tests/testdata/test/ignore.out @@ -0,0 +1,15 @@ +Check [WILDCARD]/test/ignore.ts +running 10 tests from [WILDCARD]/test/ignore.ts +test test 0 ... ignored ([WILDCARD]) +test test 1 ... ignored ([WILDCARD]) +test test 2 ... ignored ([WILDCARD]) +test test 3 ... ignored ([WILDCARD]) +test test 4 ... ignored ([WILDCARD]) +test test 5 ... ignored ([WILDCARD]) +test test 6 ... ignored ([WILDCARD]) +test test 7 ... ignored ([WILDCARD]) +test test 8 ... ignored ([WILDCARD]) +test test 9 ... ignored ([WILDCARD]) + +test result: ok. 0 passed; 0 failed; 10 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/ignore.ts b/cli/tests/testdata/test/ignore.ts new file mode 100644 index 000000000..01113a129 --- /dev/null +++ b/cli/tests/testdata/test/ignore.ts @@ -0,0 +1,9 @@ +for (let i = 0; i < 10; i++) { + Deno.test({ + name: `test ${i}`, + ignore: true, + fn() { + throw new Error("unreachable"); + }, + }); +} diff --git a/cli/tests/testdata/test/ignore_permissions.out b/cli/tests/testdata/test/ignore_permissions.out new file mode 100644 index 000000000..c4d273d8f --- /dev/null +++ b/cli/tests/testdata/test/ignore_permissions.out @@ -0,0 +1,6 @@ +Check [WILDCARD]/test/ignore_permissions.ts +running 1 test from [WILDCARD]/test/ignore_permissions.ts +test ignore ... ignored ([WILDCARD]) + +test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/ignore_permissions.ts b/cli/tests/testdata/test/ignore_permissions.ts new file mode 100644 index 000000000..ff3084441 --- /dev/null +++ b/cli/tests/testdata/test/ignore_permissions.ts @@ -0,0 +1,16 @@ +Deno.test({ + name: "ignore", + permissions: { + read: true, + write: true, + net: true, + env: true, + run: true, + ffi: true, + hrtime: true, + }, + ignore: true, + fn() { + throw new Error("unreachable"); + }, +}); diff --git a/cli/tests/testdata/test/meta.out b/cli/tests/testdata/test/meta.out new file mode 100644 index 000000000..a8c7acd63 --- /dev/null +++ b/cli/tests/testdata/test/meta.out @@ -0,0 +1,7 @@ +Check [WILDCARD]/test/meta.ts +import.meta.main: false +import.meta.url: [WILDCARD]/test/meta.ts +running 0 tests from [WILDCARD]/test/meta.ts + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/meta.ts b/cli/tests/testdata/test/meta.ts new file mode 100644 index 000000000..e32fdeea6 --- /dev/null +++ b/cli/tests/testdata/test/meta.ts @@ -0,0 +1,2 @@ +console.log("import.meta.main: %s", import.meta.main); +console.log("import.meta.url: %s", import.meta.url); diff --git a/cli/tests/testdata/test/no_check.out b/cli/tests/testdata/test/no_check.out new file mode 100644 index 000000000..9daab7ac4 --- /dev/null +++ b/cli/tests/testdata/test/no_check.out @@ -0,0 +1,8 @@ + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Uncaught TypeError: Cannot read properties of undefined (reading 'fn') +Deno.test(); + ^ + at [WILDCARD] + at [WILDCARD]/test/no_check.ts:1:6 diff --git a/cli/tests/testdata/test/no_check.ts b/cli/tests/testdata/test/no_check.ts new file mode 100644 index 000000000..79d75f989 --- /dev/null +++ b/cli/tests/testdata/test/no_check.ts @@ -0,0 +1 @@ +Deno.test(); diff --git a/cli/tests/testdata/test/no_color.ts b/cli/tests/testdata/test/no_color.ts new file mode 100644 index 000000000..38c531ee9 --- /dev/null +++ b/cli/tests/testdata/test/no_color.ts @@ -0,0 +1,17 @@ +Deno.test({ + name: "success", + fn() {}, +}); + +Deno.test({ + name: "fail", + fn() { + throw new Error("fail"); + }, +}); + +Deno.test({ + name: "ignored", + ignore: true, + fn() {}, +}); diff --git a/cli/tests/testdata/test/no_run.out b/cli/tests/testdata/test/no_run.out new file mode 100644 index 000000000..5edf03fe0 --- /dev/null +++ b/cli/tests/testdata/test/no_run.out @@ -0,0 +1,5 @@ +Check [WILDCARD]/test/no_run.ts +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const _value: string = 1; + ~~~~~~ + at [WILDCARD]/test/no_run.ts:1:7 diff --git a/cli/tests/testdata/test/no_run.ts b/cli/tests/testdata/test/no_run.ts new file mode 100644 index 000000000..b75915753 --- /dev/null +++ b/cli/tests/testdata/test/no_run.ts @@ -0,0 +1 @@ +const _value: string = 1; diff --git a/cli/tests/testdata/test/only.out b/cli/tests/testdata/test/only.out new file mode 100644 index 000000000..dc78cae80 --- /dev/null +++ b/cli/tests/testdata/test/only.out @@ -0,0 +1,7 @@ +Check [WILDCARD]/test/only.ts +running 1 test from [WILDCARD]/test/only.ts +test only ... ok ([WILDCARD]) + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out ([WILDCARD]) + +error: Test failed because the "only" option was used diff --git a/cli/tests/testdata/test/only.ts b/cli/tests/testdata/test/only.ts new file mode 100644 index 000000000..03c4dcac3 --- /dev/null +++ b/cli/tests/testdata/test/only.ts @@ -0,0 +1,15 @@ +Deno.test({ + name: "before", + fn() {}, +}); + +Deno.test({ + only: true, + name: "only", + fn() {}, +}); + +Deno.test({ + name: "after", + fn() {}, +}); diff --git a/cli/tests/testdata/test/pass.out b/cli/tests/testdata/test/pass.out new file mode 100644 index 000000000..cf81ac2e7 --- /dev/null +++ b/cli/tests/testdata/test/pass.out @@ -0,0 +1,15 @@ +Check [WILDCARD]/test/pass.ts +running 10 tests from [WILDCARD]/test/pass.ts +test test 0 ... ok ([WILDCARD]) +test test 1 ... ok ([WILDCARD]) +test test 2 ... ok ([WILDCARD]) +test test 3 ... ok ([WILDCARD]) +test test 4 ... ok ([WILDCARD]) +test test 5 ... ok ([WILDCARD]) +test test 6 ... ok ([WILDCARD]) +test test 7 ... ok ([WILDCARD]) +test test 8 ... ok ([WILDCARD]) +test test 9 ... ok ([WILDCARD]) + +test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/pass.ts b/cli/tests/testdata/test/pass.ts new file mode 100644 index 000000000..288cc7c83 --- /dev/null +++ b/cli/tests/testdata/test/pass.ts @@ -0,0 +1,10 @@ +Deno.test("test 0", () => {}); +Deno.test("test 1", () => {}); +Deno.test("test 2", () => {}); +Deno.test("test 3", () => {}); +Deno.test("test 4", () => {}); +Deno.test("test 5", () => {}); +Deno.test("test 6", () => {}); +Deno.test("test 7", () => {}); +Deno.test("test 8", () => {}); +Deno.test("test 9", () => {}); diff --git a/cli/tests/testdata/test/quiet.out b/cli/tests/testdata/test/quiet.out new file mode 100644 index 000000000..05302fb2c --- /dev/null +++ b/cli/tests/testdata/test/quiet.out @@ -0,0 +1,8 @@ +running 4 tests from [WILDCARD]/test/quiet.ts +test console.log ... ok ([WILDCARD]) +test console.error ... ok ([WILDCARD]) +test console.info ... ok ([WILDCARD]) +test console.warn ... ok ([WILDCARD]) + +test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/quiet.ts b/cli/tests/testdata/test/quiet.ts new file mode 100644 index 000000000..f40805bfb --- /dev/null +++ b/cli/tests/testdata/test/quiet.ts @@ -0,0 +1,15 @@ +Deno.test("console.log", function () { + console.log("log"); +}); + +Deno.test("console.error", function () { + console.error("error"); +}); + +Deno.test("console.info", function () { + console.info("info"); +}); + +Deno.test("console.warn", function () { + console.info("warn"); +}); diff --git a/cli/tests/testdata/test/shuffle.out b/cli/tests/testdata/test/shuffle.out new file mode 100644 index 000000000..04dd08ee2 --- /dev/null +++ b/cli/tests/testdata/test/shuffle.out @@ -0,0 +1,39 @@ +Check [WILDCARD]/test/shuffle/foo_test.ts +Check [WILDCARD]/test/shuffle/baz_test.ts +Check [WILDCARD]/test/shuffle/bar_test.ts +running 10 tests from [WILDCARD]/test/shuffle/foo_test.ts +test test 2 ... ok ([WILDCARD]) +test test 3 ... ok ([WILDCARD]) +test test 6 ... ok ([WILDCARD]) +test test 9 ... ok ([WILDCARD]) +test test 8 ... ok ([WILDCARD]) +test test 7 ... ok ([WILDCARD]) +test test 5 ... ok ([WILDCARD]) +test test 4 ... ok ([WILDCARD]) +test test 1 ... ok ([WILDCARD]) +test test 0 ... ok ([WILDCARD]) +running 10 tests from [WILDCARD]/test/shuffle/baz_test.ts +test test 2 ... ok ([WILDCARD]) +test test 3 ... ok ([WILDCARD]) +test test 6 ... ok ([WILDCARD]) +test test 9 ... ok ([WILDCARD]) +test test 8 ... ok ([WILDCARD]) +test test 7 ... ok ([WILDCARD]) +test test 5 ... ok ([WILDCARD]) +test test 4 ... ok ([WILDCARD]) +test test 1 ... ok ([WILDCARD]) +test test 0 ... ok ([WILDCARD]) +running 10 tests from [WILDCARD]/test/shuffle/bar_test.ts +test test 2 ... ok ([WILDCARD]) +test test 3 ... ok ([WILDCARD]) +test test 6 ... ok ([WILDCARD]) +test test 9 ... ok ([WILDCARD]) +test test 8 ... ok ([WILDCARD]) +test test 7 ... ok ([WILDCARD]) +test test 5 ... ok ([WILDCARD]) +test test 4 ... ok ([WILDCARD]) +test test 1 ... ok ([WILDCARD]) +test test 0 ... ok ([WILDCARD]) + +test result: ok. 30 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/testdata/test/shuffle/bar_test.ts b/cli/tests/testdata/test/shuffle/bar_test.ts new file mode 100644 index 000000000..ca118dc0d --- /dev/null +++ b/cli/tests/testdata/test/shuffle/bar_test.ts @@ -0,0 +1,3 @@ +for (let i = 0; i < 10; i++) { + Deno.test(`test ${i}`, () => {}); +} diff --git a/cli/tests/testdata/test/shuffle/baz_test.ts b/cli/tests/testdata/test/shuffle/baz_test.ts new file mode 100644 index 000000000..ca118dc0d --- /dev/null +++ b/cli/tests/testdata/test/shuffle/baz_test.ts @@ -0,0 +1,3 @@ +for (let i = 0; i < 10; i++) { + Deno.test(`test ${i}`, () => {}); +} diff --git a/cli/tests/testdata/test/shuffle/foo_test.ts b/cli/tests/testdata/test/shuffle/foo_test.ts new file mode 100644 index 000000000..ca118dc0d --- /dev/null +++ b/cli/tests/testdata/test/shuffle/foo_test.ts @@ -0,0 +1,3 @@ +for (let i = 0; i < 10; i++) { + Deno.test(`test ${i}`, () => {}); +} diff --git a/cli/tests/testdata/test/unhandled_rejection.out b/cli/tests/testdata/test/unhandled_rejection.out new file mode 100644 index 000000000..fae353a28 --- /dev/null +++ b/cli/tests/testdata/test/unhandled_rejection.out @@ -0,0 +1,10 @@ +Check [WILDCARD]/test/unhandled_rejection.ts + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Uncaught (in promise) Error: rejection + reject(new Error("rejection")); + ^ + at [WILDCARD]/test/unhandled_rejection.ts:2:10 + at new Promise () + at [WILDCARD]/test/unhandled_rejection.ts:1:1 diff --git a/cli/tests/testdata/test/unhandled_rejection.ts b/cli/tests/testdata/test/unhandled_rejection.ts new file mode 100644 index 000000000..32f3111ea --- /dev/null +++ b/cli/tests/testdata/test/unhandled_rejection.ts @@ -0,0 +1,3 @@ +new Promise((_resolve, reject) => { + reject(new Error("rejection")); +}); diff --git a/cli/tests/testdata/test/unresolved_promise.out b/cli/tests/testdata/test/unresolved_promise.out new file mode 100644 index 000000000..cd505bcbf --- /dev/null +++ b/cli/tests/testdata/test/unresolved_promise.out @@ -0,0 +1,6 @@ +Check [WILDCARD]/test/unresolved_promise.ts +running 2 tests from [WILDCARD]/test/unresolved_promise.ts +test unresolved promise ... +test result: FAILED. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promise. diff --git a/cli/tests/testdata/test/unresolved_promise.ts b/cli/tests/testdata/test/unresolved_promise.ts new file mode 100644 index 000000000..8f50e907a --- /dev/null +++ b/cli/tests/testdata/test/unresolved_promise.ts @@ -0,0 +1,11 @@ +Deno.test({ + name: "unresolved promise", + fn() { + return new Promise((_resolve, _reject) => {}); + }, +}); + +Deno.test({ + name: "ok", + fn() {}, +}); diff --git a/cli/tests/testdata/text_decoder_perf.js b/cli/tests/testdata/text_decoder_perf.js new file mode 100644 index 000000000..2e52b1f8b --- /dev/null +++ b/cli/tests/testdata/text_decoder_perf.js @@ -0,0 +1,38 @@ +const mixed = new TextEncoder().encode("@Ä€à¹ðŸ˜€"); + +function generateRandom(bytes) { + const result = new Uint8Array(bytes); + let i = 0; + while (i < bytes) { + const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); + switch (toAdd) { + case 0: + result[i] = mixed[0]; + i++; + break; + case 1: + result[i] = mixed[1]; + result[i + 1] = mixed[2]; + i += 2; + break; + case 2: + result[i] = mixed[3]; + result[i + 1] = mixed[4]; + result[i + 2] = mixed[5]; + i += 3; + break; + case 3: + result[i] = mixed[6]; + result[i + 1] = mixed[7]; + result[i + 2] = mixed[8]; + result[i + 3] = mixed[9]; + i += 4; + break; + } + } + return result; +} + +const randomData = generateRandom(1024); +const decoder = new TextDecoder(); +for (let i = 0; i < 10_000; i++) decoder.decode(randomData); diff --git a/cli/tests/testdata/text_encoder_into_perf.js b/cli/tests/testdata/text_encoder_into_perf.js new file mode 100644 index 000000000..8d60e9f00 --- /dev/null +++ b/cli/tests/testdata/text_encoder_into_perf.js @@ -0,0 +1,34 @@ +const mixed = "@Ä€à¹ðŸ˜€"; + +function generateRandom(bytes) { + let result = ""; + let i = 0; + while (i < bytes) { + const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); + switch (toAdd) { + case 0: + result += mixed[0]; + i++; + break; + case 1: + result += mixed[1]; + i++; + break; + case 2: + result += mixed[2]; + i++; + break; + case 3: + result += mixed[3]; + result += mixed[4]; + i += 2; + break; + } + } + return result; +} + +const randomData = generateRandom(1024); +const encoder = new TextEncoder(); +const targetBuffer = new Uint8Array(randomData.length * 4); +for (let i = 0; i < 10_000; i++) encoder.encodeInto(randomData, targetBuffer); diff --git a/cli/tests/testdata/text_encoder_perf.js b/cli/tests/testdata/text_encoder_perf.js new file mode 100644 index 000000000..6f61f019e --- /dev/null +++ b/cli/tests/testdata/text_encoder_perf.js @@ -0,0 +1,33 @@ +const mixed = "@Ä€à¹ðŸ˜€"; + +function generateRandom(bytes) { + let result = ""; + let i = 0; + while (i < bytes) { + const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); + switch (toAdd) { + case 0: + result += mixed[0]; + i++; + break; + case 1: + result += mixed[1]; + i++; + break; + case 2: + result += mixed[2]; + i++; + break; + case 3: + result += mixed[3]; + result += mixed[4]; + i += 2; + break; + } + } + return result; +} + +const randomData = generateRandom(1024); +const encoder = new TextEncoder(); +for (let i = 0; i < 10_000; i++) encoder.encode(randomData); diff --git a/cli/tests/testdata/tla/a.js b/cli/tests/testdata/tla/a.js new file mode 100644 index 000000000..c3ef3f7db --- /dev/null +++ b/cli/tests/testdata/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/cli/tests/testdata/tla/b.js b/cli/tests/testdata/tla/b.js new file mode 100644 index 000000000..3271c92d8 --- /dev/null +++ b/cli/tests/testdata/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/cli/tests/testdata/tla/c.js b/cli/tests/testdata/tla/c.js new file mode 100644 index 000000000..806eb0a8b --- /dev/null +++ b/cli/tests/testdata/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/cli/tests/testdata/tla/d.js b/cli/tests/testdata/tla/d.js new file mode 100644 index 000000000..283ebf817 --- /dev/null +++ b/cli/tests/testdata/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/cli/tests/testdata/tla/order.js b/cli/tests/testdata/tla/order.js new file mode 100644 index 000000000..f213a562c --- /dev/null +++ b/cli/tests/testdata/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/cli/tests/testdata/tla/parent.js b/cli/tests/testdata/tla/parent.js new file mode 100644 index 000000000..1ecc15463 --- /dev/null +++ b/cli/tests/testdata/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/cli/tests/testdata/tla2/a.js b/cli/tests/testdata/tla2/a.js new file mode 100644 index 000000000..d07bcb94d --- /dev/null +++ b/cli/tests/testdata/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/cli/tests/testdata/tla2/b.js b/cli/tests/testdata/tla2/b.js new file mode 100644 index 000000000..68e357c1e --- /dev/null +++ b/cli/tests/testdata/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/cli/tests/testdata/tla3/b.js b/cli/tests/testdata/tla3/b.js new file mode 100644 index 000000000..b74c659e4 --- /dev/null +++ b/cli/tests/testdata/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../top_level_await_circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/cli/tests/testdata/tla3/timeout_loop.js b/cli/tests/testdata/tla3/timeout_loop.js new file mode 100644 index 000000000..860e6cd2a --- /dev/null +++ b/cli/tests/testdata/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/cli/tests/testdata/tls.out b/cli/tests/testdata/tls.out new file mode 100644 index 000000000..c8e8a135c --- /dev/null +++ b/cli/tests/testdata/tls.out @@ -0,0 +1 @@ +DONE diff --git a/cli/tests/testdata/tls/README.md b/cli/tests/testdata/tls/README.md new file mode 100644 index 000000000..19bbaec35 --- /dev/null +++ b/cli/tests/testdata/tls/README.md @@ -0,0 +1,47 @@ +The certificates in this dir expire on Sept, 27th, 2118 + +Certificates generated using original instructions from this gist: +https://gist.github.com/cecilemuller/9492b848eb8fe46d462abeb26656c4f8 + +## Certificate authority (CA) + +Generate RootCA.pem, RootCA.key, RootCA.crt: + +```shell +openssl req -x509 -nodes -new -sha256 -days 36135 -newkey rsa:2048 -keyout RootCA.key -out RootCA.pem -subj "/C=US/CN=Example-Root-CA" +openssl x509 -outform pem -in RootCA.pem -out RootCA.crt +``` + +Note that Example-Root-CA is an example, you can customize the name. + +## Domain name certificate + +First, create a file domains.txt that lists all your local domains (here we only +list localhost): + +```shell +authorityKeyIdentifier=keyid,issuer +basicConstraints=CA:FALSE +keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment +subjectAltName = @alt_names +[alt_names] +DNS.1 = localhost +``` + +Generate localhost.key, localhost.csr, and localhost.crt: + +```shell +openssl req -new -nodes -newkey rsa:2048 -keyout localhost.key -out localhost.csr -subj "/C=US/ST=YourState/L=YourCity/O=Example-Certificates/CN=localhost.local" +openssl x509 -req -sha256 -days 36135 -in localhost.csr -CA RootCA.pem -CAkey RootCA.key -CAcreateserial -extfile domains.txt -out localhost.crt +``` + +Note that the country / state / city / name in the first command can be +customized. + +For testing purposes we need following files: + +- `RootCA.crt` +- `RootCA.key` +- `RootCA.pem` +- `localhost.crt` +- `localhost.key` diff --git a/cli/tests/testdata/tls/RootCA.crt b/cli/tests/testdata/tls/RootCA.crt new file mode 100644 index 000000000..c2f84ceeb --- /dev/null +++ b/cli/tests/testdata/tls/RootCA.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDIzCCAgugAwIBAgIJAMKPPW4tsOymMA0GCSqGSIb3DQEBCwUAMCcxCzAJBgNV +BAYTAlVTMRgwFgYDVQQDDA9FeGFtcGxlLVJvb3QtQ0EwIBcNMTkxMDIxMTYyODIy +WhgPMjExODA5MjcxNjI4MjJaMCcxCzAJBgNVBAYTAlVTMRgwFgYDVQQDDA9FeGFt +cGxlLVJvb3QtQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMH/IO +2qtHfyBKwANNPB4K0q5JVSg8XxZdRpTTlz0CwU0oRO3uHrI52raCCfVeiQutyZop +eFZTDWeXGudGAFA2B5m3orWt0s+touPi8MzjsG2TQ+WSI66QgbXTNDitDDBtTVcV +5G3Ic+3SppQAYiHSekLISnYWgXLl+k5CnEfTowg6cjqjVr0KjL03cTN3H7b+6+0S +ws4rYbW1j4ExR7K6BFNH6572yq5qR20E6GqlY+EcOZpw4CbCk9lS8/CWuXze/vMs +OfDcc6K+B625d27wyEGZHedBomT2vAD7sBjvO8hn/DP1Qb46a8uCHR6NSfnJ7bXO +G1igaIbgY1zXirNdAgMBAAGjUDBOMB0GA1UdDgQWBBTzut+pwwDfqmMYcI9KNWRD +hxcIpTAfBgNVHSMEGDAWgBTzut+pwwDfqmMYcI9KNWRDhxcIpTAMBgNVHRMEBTAD +AQH/MA0GCSqGSIb3DQEBCwUAA4IBAQB9AqSbZ+hEglAgSHxAMCqRFdhVu7MvaQM0 +P090mhGlOCt3yB7kdGfsIrUW6nQcTz7PPQFRaJMrFHPvFvPootkBUpTYR4hTkdce +H6RCRu2Jxl4Y9bY/uezd9YhGCYfUtfjA6/TH9FcuZfttmOOlxOt01XfNvVMIR6RM +z/AYhd+DeOXjr35F/VHeVpnk+55L0PYJsm1CdEbOs5Hy1ecR7ACuDkXnbM4fpz9I +kyIWJwk2zJReKcJMgi1aIinDM9ao/dca1G99PHOw8dnr4oyoTiv8ao6PWiSRHHMi +MNf4EgWfK+tZMnuqfpfO9740KzfcVoMNo4QJD4yn5YxroUOO/Azi +-----END CERTIFICATE----- diff --git a/cli/tests/testdata/tls/RootCA.key b/cli/tests/testdata/tls/RootCA.key new file mode 100644 index 000000000..98ce53b0b --- /dev/null +++ b/cli/tests/testdata/tls/RootCA.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDMH/IO2qtHfyBK +wANNPB4K0q5JVSg8XxZdRpTTlz0CwU0oRO3uHrI52raCCfVeiQutyZopeFZTDWeX +GudGAFA2B5m3orWt0s+touPi8MzjsG2TQ+WSI66QgbXTNDitDDBtTVcV5G3Ic+3S +ppQAYiHSekLISnYWgXLl+k5CnEfTowg6cjqjVr0KjL03cTN3H7b+6+0Sws4rYbW1 +j4ExR7K6BFNH6572yq5qR20E6GqlY+EcOZpw4CbCk9lS8/CWuXze/vMsOfDcc6K+ +B625d27wyEGZHedBomT2vAD7sBjvO8hn/DP1Qb46a8uCHR6NSfnJ7bXOG1igaIbg +Y1zXirNdAgMBAAECggEASvdsicILZ42ryWgtjj8G9Yick7gft9RgPU9/txnzQUDG +2oQ+Mda6M/88ShPoNpj0XhYNdS+J3KSup9MsnwvcaYtvC/9I5BbpSObq9NzlErYn ++A7WkE5kfRP2OCQUsJEqc+oUkqi7HQRekp+0+VMRAuD+B9s49VkDXq0H8vS8eF/e +J9nj6c/RTK+Er5ccG5jSLrSy3kiIjAN1a6OIU/YPjPx7qv8ZZ6TLeRtvc8PV++cH +wB1qapZg5cuKge9UEcg+WINCkD2n9iK1jKC1ULYsiuwUR6LX9YHLUwr6S5/Dwwqc +Vb9nmftqJtCz+McrqRCdfeqSNGi0tjVEX7i+DtfZrQKBgQD7firgBE7nb53VDirG +W8Leo6EhCS/hCZFo0QhSBUCeOpmSaMsCzUIlqqPIBIQXir0AtBno/qXYiIJ4HgUB +lScrK+7KUirEO8o4x6xC2hbPk/A7fTgf0G5Mvj2TRidiLGGIupuRHeyjigiGa0mG +yWLoil6MJX44usnE49qDVy77/wKBgQDPyHThAugFSsVedxy29NQx7Zp8s/htpGHZ +wYksbunz+NlO/xzRvSu2OAps/WD6F+3KhCB5fV2tESVs7u2oQPLcjmIpurDtATWE +DJAAvcBl1L+cpQGN4D8zUrrZO8rw01sUZSv+kAnfsC01exzZe64+VDl3a1cYZkDT +A9RmbF/AowKBgDTYVxQJc7cH6idZub1CjNkRkwsJDimARDC9M71gYyqcb6anJHlr +PgoCKDYgVM1Jlttt/L/Lunecf6XT0QN7HubgbWXQDDJ9yclSk6zcfMyTbnhhoIh2 +2KaBlxi6Ng5X+wqrA4NjwVS/7XipVKLg8EqiwKk8O6CaB0m7AzB0AmhrAoGAcGsi +YYNzCTn1IzEKxiocjI7jYMj2hkvD7U766qFvzuI6oLUCYLAa8FHNwj4ss+Mycrmd +4F1ly3dVamSzDK9nNtGKZs1tYC2hSLqLRvtjFzVOHnBgMOS9DQWbtmDVYgrYYmaC +sQ45aV8mdqMPbtOt6GclWGkpDDh2pjSSPIAyJkUCgYAHw7dKqYO/YQPKmswVZm5t +TelfdJJG6GCXnFryyqo4pmEMy/i5kzF1t9Cnchhx/WeU+wGxrWd3RMP/sqP7MW9q +6Ie9Jj2vk4lUBoeFKk+kLeBUr+TkLSdcVEI0DSOdX681AUmxkVzVjGKYeiNa+V6u +XmgzS8JEYoMbNEAKXYX2qg== +-----END PRIVATE KEY----- diff --git a/cli/tests/testdata/tls/RootCA.pem b/cli/tests/testdata/tls/RootCA.pem new file mode 100644 index 000000000..c2f84ceeb --- /dev/null +++ b/cli/tests/testdata/tls/RootCA.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDIzCCAgugAwIBAgIJAMKPPW4tsOymMA0GCSqGSIb3DQEBCwUAMCcxCzAJBgNV +BAYTAlVTMRgwFgYDVQQDDA9FeGFtcGxlLVJvb3QtQ0EwIBcNMTkxMDIxMTYyODIy +WhgPMjExODA5MjcxNjI4MjJaMCcxCzAJBgNVBAYTAlVTMRgwFgYDVQQDDA9FeGFt +cGxlLVJvb3QtQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMH/IO +2qtHfyBKwANNPB4K0q5JVSg8XxZdRpTTlz0CwU0oRO3uHrI52raCCfVeiQutyZop +eFZTDWeXGudGAFA2B5m3orWt0s+touPi8MzjsG2TQ+WSI66QgbXTNDitDDBtTVcV +5G3Ic+3SppQAYiHSekLISnYWgXLl+k5CnEfTowg6cjqjVr0KjL03cTN3H7b+6+0S +ws4rYbW1j4ExR7K6BFNH6572yq5qR20E6GqlY+EcOZpw4CbCk9lS8/CWuXze/vMs +OfDcc6K+B625d27wyEGZHedBomT2vAD7sBjvO8hn/DP1Qb46a8uCHR6NSfnJ7bXO +G1igaIbgY1zXirNdAgMBAAGjUDBOMB0GA1UdDgQWBBTzut+pwwDfqmMYcI9KNWRD +hxcIpTAfBgNVHSMEGDAWgBTzut+pwwDfqmMYcI9KNWRDhxcIpTAMBgNVHRMEBTAD +AQH/MA0GCSqGSIb3DQEBCwUAA4IBAQB9AqSbZ+hEglAgSHxAMCqRFdhVu7MvaQM0 +P090mhGlOCt3yB7kdGfsIrUW6nQcTz7PPQFRaJMrFHPvFvPootkBUpTYR4hTkdce +H6RCRu2Jxl4Y9bY/uezd9YhGCYfUtfjA6/TH9FcuZfttmOOlxOt01XfNvVMIR6RM +z/AYhd+DeOXjr35F/VHeVpnk+55L0PYJsm1CdEbOs5Hy1ecR7ACuDkXnbM4fpz9I +kyIWJwk2zJReKcJMgi1aIinDM9ao/dca1G99PHOw8dnr4oyoTiv8ao6PWiSRHHMi +MNf4EgWfK+tZMnuqfpfO9740KzfcVoMNo4QJD4yn5YxroUOO/Azi +-----END CERTIFICATE----- diff --git a/cli/tests/testdata/tls/domains.txt b/cli/tests/testdata/tls/domains.txt new file mode 100644 index 000000000..0bba95d33 --- /dev/null +++ b/cli/tests/testdata/tls/domains.txt @@ -0,0 +1,6 @@ +authorityKeyIdentifier=keyid,issuer +basicConstraints=CA:FALSE +keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment +subjectAltName = @alt_names +[alt_names] +DNS.1 = localhost diff --git a/cli/tests/testdata/tls/localhost.crt b/cli/tests/testdata/tls/localhost.crt new file mode 100644 index 000000000..a71ae9050 --- /dev/null +++ b/cli/tests/testdata/tls/localhost.crt @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDajCCAlKgAwIBAgIJAOPyQVdy/UpPMA0GCSqGSIb3DQEBCwUAMCcxCzAJBgNV +BAYTAlVTMRgwFgYDVQQDDA9FeGFtcGxlLVJvb3QtQ0EwIBcNMTkxMDIxMTYyODU4 +WhgPMjExODA5MjcxNjI4NThaMG0xCzAJBgNVBAYTAlVTMRIwEAYDVQQIDAlZb3Vy +U3RhdGUxETAPBgNVBAcMCFlvdXJDaXR5MR0wGwYDVQQKDBRFeGFtcGxlLUNlcnRp +ZmljYXRlczEYMBYGA1UEAwwPbG9jYWxob3N0LmxvY2FsMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEAz9svjVdf5jihUBtofd84XKdb8dEHQRJfDNKaJ4Ar +baqMHAdnqi/fWtlqEEMn8gweZ7+4hshECY5mnx4Hhy7IAbePDsTTbSm01dChhlxF +uvd9QuvzvrqSjSq+v4Jlau+pQIhUzzV12dF5bFvrIrGWxCZp+W7lLDZI6Pd6Su+y +ZIeiwrUaPMzdUePNf2hZI/IvWCUMCIyoqrrKHdHoPuvQCW17IyxsnFQJNbmN+Rtp +BQilhtwvBbggCBWhHxEdiqBaZHDw6Zl+bU7ejx1mu9A95wpQ9SCL2cRkAlz2LDOy +wznrTAwGcvqvFKxlV+3HsaD7rba4kCA1Ihp5mm/dS2k94QIDAQABo1EwTzAfBgNV +HSMEGDAWgBTzut+pwwDfqmMYcI9KNWRDhxcIpTAJBgNVHRMEAjAAMAsGA1UdDwQE +AwIE8DAUBgNVHREEDTALgglsb2NhbGhvc3QwDQYJKoZIhvcNAQELBQADggEBAKVu +vVpu5nPGAGn1SX4FQUcbn9Z5wgBkjnZxfJHJQX4sYIRlcirZviPHCZGPWex4VHC+ +lFMm+70YEN2uoe5jGrdgcugzx2Amc7/mLrsvvpMsaS0PlxNMcqhdM1WHbGjjdNln +XICVITSKnB1fSGH6uo9CMCWw5kgPS9o4QWrLLkxnds3hoz7gVEUyi/6V65mcfFNA +lof9iKcK9JsSHdBs35vpv7UKLX+96RM7Nm2Mu0yue5JiS79/zuMA/Kryxot4jv5z +ecdWFl0eIyQBZmBzMw2zPUqkxEnXLiKjV8jutEg/4qovTOB6YiA41qbARXdzNA2V +FYuchcTcWmnmVVRFyyU= +-----END CERTIFICATE----- diff --git a/cli/tests/testdata/tls/localhost.key b/cli/tests/testdata/tls/localhost.key new file mode 100644 index 000000000..42774c977 --- /dev/null +++ b/cli/tests/testdata/tls/localhost.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDP2y+NV1/mOKFQ +G2h93zhcp1vx0QdBEl8M0pongCttqowcB2eqL99a2WoQQyfyDB5nv7iGyEQJjmaf +HgeHLsgBt48OxNNtKbTV0KGGXEW6931C6/O+upKNKr6/gmVq76lAiFTPNXXZ0Xls +W+sisZbEJmn5buUsNkjo93pK77Jkh6LCtRo8zN1R481/aFkj8i9YJQwIjKiqusod +0eg+69AJbXsjLGycVAk1uY35G2kFCKWG3C8FuCAIFaEfER2KoFpkcPDpmX5tTt6P +HWa70D3nClD1IIvZxGQCXPYsM7LDOetMDAZy+q8UrGVX7cexoPuttriQIDUiGnma +b91LaT3hAgMBAAECggEBAJABfn+BQorBP1m9s3ZJmcXvmW7+7/SwYrQCkRS+4te2 +6h1dMAAj7K4HpUkhDeLPbJ1aoeCXjTPFuemRp4uL6Lvvzahgy059L7FXOyFYemMf +pmQgDx5cKr6tF7yc/eDJrExuZ7urgTvouiRNxqmhuh+psZBDuXkZHwhwtQSH7uNg +KBDKu0qWO73vFLcLckdGEU3+H9oIWs5xcvvOkWzyvHbRGFJSihgcRpPPHodF5xB9 +T/gZIoJHMmCbUMlWaSasUyNXTuvCnkvBDol8vXrMJCVzKZj9GpPDcIFdc08GSn4I +pTdSNwzUcHbdERzdVU28Xt+t6W5rvp/4FWrssi4IzkUCgYEA//ZcEcBguRD4OFrx +6wbSjzCcUW1NWhzA8uTOORZi4SvndcH1cU4S2wznuHNubU1XlrGwJX6PUGebmY/l +53B5PJvStbVtZCVIxllR+ZVzRuL8wLodRHzlYH8GOzHwoa4ivSupkzl72ij1u/tI +NMLGfYEKVdNd8zXIESUY88NszvsCgYEAz+MDp3xOhFaCe+CPv80A592cJcfzc8Al ++rahEOu+VdN2QBZf86PIf2Bfv/t0QvnRvs1z648TuH6h83YSggOAbmfHyd789jkq +UWlktIaXbVn+VaHmPTcBWTg3ZTlvG+fiFCbZXiYhm+UUf1MDqZHdiifAoyVIjV/Z +YhCNJo3q39MCgYEAknrpK5t9fstwUcfyA/9OhnVaL9suVjB4V0iLn+3ovlXCywgp +ryLv9X3IKi2c9144jtu3I23vFCOGz3WjKzSZnQ7LogNmy9XudNxu5jcZ1mpWHPEl +iKk1F2j6Juwoek5OQRX4oHFYKHwiTOa75r3Em9Q6Fu20KVgQ24bwZafj3/sCgYAy +k0AoVw2jFIjaKl/Ogclen4OFjYek+XJD9Hpq62964d866Dafx5DXrFKfGkXGpZBp +owI4pK5fjC9KU8dc6g0szwLEEgPowy+QbtuZL8VXTTWbD7A75E3nrs2LStXFLDzM +OkdXqF801h6Oe1vAvUPwgItVJZTpEBCK0wwD/TLPEQKBgQDRkhlTtAoHW7W6STd0 +A/OWc0dxhzMurpxg0bLgCqUjw1ESGrSCGhffFn0IWa8sv19VWsZuBhTgjNatZsYB +AhDs/6OosT/3nJoh2/t0hYDj1FBI0lPXWYD4pesuZ5yIMrmSaAOtIzp4BGY7ui8N +wOqcq/jdiHj/MKEdqOXy3YAJrA== +-----END PRIVATE KEY----- diff --git a/cli/tests/testdata/tls_connecttls.js b/cli/tests/testdata/tls_connecttls.js new file mode 100644 index 000000000..1e8cf320c --- /dev/null +++ b/cli/tests/testdata/tls_connecttls.js @@ -0,0 +1,70 @@ +import { deferred } from "../../../test_util/std/async/deferred.ts"; +import { + assert, + assertEquals, +} from "../../../test_util/std/testing/asserts.ts"; +import { BufReader, BufWriter } from "../../../test_util/std/io/bufio.ts"; +import { TextProtoReader } from "../../../test_util/std/textproto/mod.ts"; + +const encoder = new TextEncoder(); +const decoder = new TextDecoder(); + +const resolvable = deferred(); +const hostname = "localhost"; +const port = 3505; + +const listener = Deno.listenTls({ + hostname, + port, + certFile: "./tls/localhost.crt", + keyFile: "./tls/localhost.key", +}); + +const response = encoder.encode( + "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", +); + +listener.accept().then( + async (conn) => { + assert(conn.remoteAddr != null); + assert(conn.localAddr != null); + await conn.write(response); + // TODO(bartlomieju): this might be a bug + setTimeout(() => { + conn.close(); + resolvable.resolve(); + }, 0); + }, +); + +const conn = await Deno.connectTls({ + hostname, + port, +}); +assert(conn.rid > 0); +const w = new BufWriter(conn); +const r = new BufReader(conn); +const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`; +const writeResult = await w.write(encoder.encode(body)); +assertEquals(body.length, writeResult); +await w.flush(); +const tpr = new TextProtoReader(r); +const statusLine = await tpr.readLine(); +assert(statusLine !== null, `line must be read: ${String(statusLine)}`); +const m = statusLine.match(/^(.+?) (.+?) (.+?)$/); +assert(m !== null, "must be matched"); +const [_, proto, status, ok] = m; +assertEquals(proto, "HTTP/1.1"); +assertEquals(status, "200"); +assertEquals(ok, "OK"); +const headers = await tpr.readMIMEHeader(); +assert(headers !== null); +const contentLength = parseInt(headers.get("content-length")); +const bodyBuf = new Uint8Array(contentLength); +await r.readFull(bodyBuf); +assertEquals(decoder.decode(bodyBuf), "Hello World\n"); +conn.close(); +listener.close(); +await resolvable; + +console.log("DONE"); diff --git a/cli/tests/testdata/tls_starttls.js b/cli/tests/testdata/tls_starttls.js new file mode 100644 index 000000000..9b8767eaa --- /dev/null +++ b/cli/tests/testdata/tls_starttls.js @@ -0,0 +1,68 @@ +import { deferred } from "../../../test_util/std/async/deferred.ts"; +import { + assert, + assertEquals, +} from "../../../test_util/std/testing/asserts.ts"; +import { BufReader, BufWriter } from "../../../test_util/std/io/bufio.ts"; +import { TextProtoReader } from "../../../test_util/std/textproto/mod.ts"; + +const encoder = new TextEncoder(); +const decoder = new TextDecoder(); + +const resolvable = deferred(); +const hostname = "localhost"; +const port = 3504; + +const listener = Deno.listenTls({ + hostname, + port, + certFile: "./tls/localhost.crt", + keyFile: "./tls/localhost.key", +}); + +const response = encoder.encode( + "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", +); + +listener.accept().then( + async (conn) => { + assert(conn.remoteAddr != null); + assert(conn.localAddr != null); + await conn.write(response); + // TODO(bartlomieju): this might be a bug + setTimeout(() => { + conn.close(); + resolvable.resolve(); + }, 0); + }, +); + +let conn = await Deno.connect({ hostname, port }); +conn = await Deno.startTls(conn, { hostname }); +assert(conn.rid > 0); +const w = new BufWriter(conn); +const r = new BufReader(conn); +const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`; +const writeResult = await w.write(encoder.encode(body)); +assertEquals(body.length, writeResult); +await w.flush(); +const tpr = new TextProtoReader(r); +const statusLine = await tpr.readLine(); +assert(statusLine !== null, `line must be read: ${String(statusLine)}`); +const m = statusLine.match(/^(.+?) (.+?) (.+?)$/); +assert(m !== null, "must be matched"); +const [_, proto, status, ok] = m; +assertEquals(proto, "HTTP/1.1"); +assertEquals(status, "200"); +assertEquals(ok, "OK"); +const headers = await tpr.readMIMEHeader(); +assert(headers !== null); +const contentLength = parseInt(headers.get("content-length")); +const bodyBuf = new Uint8Array(contentLength); +await r.readFull(bodyBuf); +assertEquals(decoder.decode(bodyBuf), "Hello World\n"); +conn.close(); +listener.close(); +await resolvable; + +console.log("DONE"); diff --git a/cli/tests/testdata/top_level_await.js b/cli/tests/testdata/top_level_await.js new file mode 100644 index 000000000..af6fbd662 --- /dev/null +++ b/cli/tests/testdata/top_level_await.js @@ -0,0 +1,3 @@ +const buf = await Deno.readFile("hello.txt"); +const n = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/cli/tests/testdata/top_level_await.out b/cli/tests/testdata/top_level_await.out new file mode 100644 index 000000000..4b65d15fe --- /dev/null +++ b/cli/tests/testdata/top_level_await.out @@ -0,0 +1,3 @@ +Hello world! + +write 12 diff --git a/cli/tests/testdata/top_level_await.ts b/cli/tests/testdata/top_level_await.ts new file mode 100644 index 000000000..65de253ea --- /dev/null +++ b/cli/tests/testdata/top_level_await.ts @@ -0,0 +1,3 @@ +const buf: Uint8Array = await Deno.readFile("hello.txt"); +const n: number = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/cli/tests/testdata/top_level_await_circular.js b/cli/tests/testdata/top_level_await_circular.js new file mode 100644 index 000000000..ff2964b6a --- /dev/null +++ b/cli/tests/testdata/top_level_await_circular.js @@ -0,0 +1,8 @@ +import { foo } from "./tla3/timeout_loop.js"; + +export const collection = []; + +const mod = await import("./tla3/b.js"); + +console.log("foo in main", foo); +console.log("mod", mod); diff --git a/cli/tests/testdata/top_level_await_circular.out b/cli/tests/testdata/top_level_await_circular.out new file mode 100644 index 000000000..fcbc001c3 --- /dev/null +++ b/cli/tests/testdata/top_level_await_circular.out @@ -0,0 +1,9 @@ +timeout loop 0 +timeout loop 1 +timeout loop 2 +timeout loop 3 +timeout loop 4 +timeout loop 5 +error: Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promise. +Pending dynamic modules: +- [WILDCARD]/tla3/b.js diff --git a/cli/tests/testdata/top_level_await_loop.js b/cli/tests/testdata/top_level_await_loop.js new file mode 100644 index 000000000..384f8d0ed --- /dev/null +++ b/cli/tests/testdata/top_level_await_loop.js @@ -0,0 +1,18 @@ +const importsDir = Deno.readDirSync(Deno.realPathSync("./tla2")); + +const resolvedPaths = []; + +for (const { name } of importsDir) { + const filePath = Deno.realPathSync(`./tla2/${name}`); + resolvedPaths.push(filePath); +} + +resolvedPaths.sort(); + +for (const filePath of resolvedPaths) { + console.log("loading", filePath); + const mod = await import(`file://${filePath}`); + console.log("loaded", mod); +} + +console.log("all loaded"); diff --git a/cli/tests/testdata/top_level_await_loop.out b/cli/tests/testdata/top_level_await_loop.out new file mode 100644 index 000000000..70e621e45 --- /dev/null +++ b/cli/tests/testdata/top_level_await_loop.out @@ -0,0 +1,5 @@ +loading [WILDCARD]a.js +loaded Module { default: [Function: Foo] } +loading [WILDCARD]b.js +loaded Module { default: [Function: Bar] } +all loaded diff --git a/cli/tests/testdata/top_level_await_nested.out b/cli/tests/testdata/top_level_await_nested.out new file mode 100644 index 000000000..8a1218a10 --- /dev/null +++ b/cli/tests/testdata/top_level_await_nested.out @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/cli/tests/testdata/top_level_await_nested/a.js b/cli/tests/testdata/top_level_await_nested/a.js new file mode 100644 index 000000000..74837d4ba --- /dev/null +++ b/cli/tests/testdata/top_level_await_nested/a.js @@ -0,0 +1,3 @@ +console.log(2); +await import("./b.js"); +console.log(4); diff --git a/cli/tests/testdata/top_level_await_nested/b.js b/cli/tests/testdata/top_level_await_nested/b.js new file mode 100644 index 000000000..3bd241b50 --- /dev/null +++ b/cli/tests/testdata/top_level_await_nested/b.js @@ -0,0 +1 @@ +console.log(3); diff --git a/cli/tests/testdata/top_level_await_nested/main.js b/cli/tests/testdata/top_level_await_nested/main.js new file mode 100644 index 000000000..ed46a4717 --- /dev/null +++ b/cli/tests/testdata/top_level_await_nested/main.js @@ -0,0 +1,3 @@ +console.log(1); +await import("./a.js"); +console.log(5); diff --git a/cli/tests/testdata/top_level_await_order.js b/cli/tests/testdata/top_level_await_order.js new file mode 100644 index 000000000..30659cdfb --- /dev/null +++ b/cli/tests/testdata/top_level_await_order.js @@ -0,0 +1,21 @@ +// Ported from Node +// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs + +const { default: order } = await import("./tla/parent.js"); + +console.log("order", JSON.stringify(order)); + +if ( + !( + order[0] === "order" && + order[1] === "b" && + order[2] === "c" && + order[3] === "d" && + order[4] === "a" && + order[5] === "parent" + ) +) { + throw new Error("TLA wrong order"); +} + +console.log("TLA order correct"); diff --git a/cli/tests/testdata/top_level_await_order.out b/cli/tests/testdata/top_level_await_order.out new file mode 100644 index 000000000..4cc27858c --- /dev/null +++ b/cli/tests/testdata/top_level_await_order.out @@ -0,0 +1,2 @@ +order ["order","b","c","d","a","parent"] +TLA order correct diff --git a/cli/tests/testdata/top_level_await_unresolved.js b/cli/tests/testdata/top_level_await_unresolved.js new file mode 100644 index 000000000..231a8cd63 --- /dev/null +++ b/cli/tests/testdata/top_level_await_unresolved.js @@ -0,0 +1 @@ +await new Promise(() => {}); diff --git a/cli/tests/testdata/top_level_await_unresolved.out b/cli/tests/testdata/top_level_await_unresolved.out new file mode 100644 index 000000000..77395f5d0 --- /dev/null +++ b/cli/tests/testdata/top_level_await_unresolved.out @@ -0,0 +1 @@ +error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promise. diff --git a/cli/tests/testdata/top_level_for_await.js b/cli/tests/testdata/top_level_for_await.js new file mode 100644 index 000000000..a330f6c71 --- /dev/null +++ b/cli/tests/testdata/top_level_for_await.js @@ -0,0 +1,10 @@ +function* asyncGenerator() { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/cli/tests/testdata/top_level_for_await.out b/cli/tests/testdata/top_level_for_await.out new file mode 100644 index 000000000..4539bbf2d --- /dev/null +++ b/cli/tests/testdata/top_level_for_await.out @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/cli/tests/testdata/top_level_for_await.ts b/cli/tests/testdata/top_level_for_await.ts new file mode 100644 index 000000000..9179322d7 --- /dev/null +++ b/cli/tests/testdata/top_level_for_await.ts @@ -0,0 +1,10 @@ +async function* asyncGenerator(): AsyncIterableIterator { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/cli/tests/testdata/ts_decorators.ts b/cli/tests/testdata/ts_decorators.ts new file mode 100644 index 000000000..95fba6cd4 --- /dev/null +++ b/cli/tests/testdata/ts_decorators.ts @@ -0,0 +1,14 @@ +// deno-lint-ignore-file + +function Decorate() { + return function (constructor: any): any { + return class extends constructor { + protected someField: string = "asdf"; + }; + }; +} + +@Decorate() +class SomeClass {} + +console.log(new SomeClass()); diff --git a/cli/tests/testdata/ts_decorators.ts.out b/cli/tests/testdata/ts_decorators.ts.out new file mode 100644 index 000000000..381c7a809 --- /dev/null +++ b/cli/tests/testdata/ts_decorators.ts.out @@ -0,0 +1,2 @@ +Check [WILDCARD] +{ someField: "asdf" } diff --git a/cli/tests/testdata/ts_decorators_bundle.out b/cli/tests/testdata/ts_decorators_bundle.out new file mode 100644 index 000000000..a5b77b7bf --- /dev/null +++ b/cli/tests/testdata/ts_decorators_bundle.out @@ -0,0 +1,5 @@ +[WILDCARD] +function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { +[WILDCARD] +new SomeClass().test(); +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/ts_decorators_bundle.ts b/cli/tests/testdata/ts_decorators_bundle.ts new file mode 100644 index 000000000..72120b2ec --- /dev/null +++ b/cli/tests/testdata/ts_decorators_bundle.ts @@ -0,0 +1,25 @@ +// deno-lint-ignore-file + +import { B } from "./subdir/more_decorators.ts"; + +function Decorator() { + return function ( + target: Record, + propertyKey: string, + descriptor: TypedPropertyDescriptor, + ) { + const originalFn: Function = descriptor.value as Function; + descriptor.value = async function (...args: any[]) { + return await originalFn.apply(this, args); + }; + return descriptor; + }; +} + +class SomeClass { + @Decorator() + async test() {} +} + +new SomeClass().test(); +new B().method(); diff --git a/cli/tests/testdata/ts_import_from_js.deps.js b/cli/tests/testdata/ts_import_from_js.deps.js new file mode 100644 index 000000000..ef326c444 --- /dev/null +++ b/cli/tests/testdata/ts_import_from_js.deps.js @@ -0,0 +1,2 @@ +import "./005_more_imports.ts"; +export { printHello } from "http://localhost:4545/subdir/mod2.ts"; diff --git a/cli/tests/testdata/ts_import_from_js.js b/cli/tests/testdata/ts_import_from_js.js new file mode 100644 index 000000000..f912c2723 --- /dev/null +++ b/cli/tests/testdata/ts_import_from_js.js @@ -0,0 +1,3 @@ +import { printHello } from "./ts_import_from_js.deps.js"; +printHello(); +console.log("success"); diff --git a/cli/tests/testdata/ts_import_from_js.js.out b/cli/tests/testdata/ts_import_from_js.js.out new file mode 100644 index 000000000..e1d7a869f --- /dev/null +++ b/cli/tests/testdata/ts_import_from_js.js.out @@ -0,0 +1,3 @@ +Hello +Hello +success diff --git a/cli/tests/testdata/ts_type_imports.ts b/cli/tests/testdata/ts_type_imports.ts new file mode 100644 index 000000000..73c779156 --- /dev/null +++ b/cli/tests/testdata/ts_type_imports.ts @@ -0,0 +1,5 @@ +// deno-lint-ignore-file + +type Foo = import("./ts_type_imports_foo.ts").Foo; + +const foo: Foo = new Map(); diff --git a/cli/tests/testdata/ts_type_imports.ts.out b/cli/tests/testdata/ts_type_imports.ts.out new file mode 100644 index 000000000..3972d6a97 --- /dev/null +++ b/cli/tests/testdata/ts_type_imports.ts.out @@ -0,0 +1,6 @@ +Check [WILDCARD]ts_type_imports.ts +error: TS2322 [ERROR]: Type 'Map' is not assignable to type 'Foo'. + Type 'string' is not assignable to type 'number'. +const foo: Foo = new Map(); + ~~~ + at [WILDCARD]ts_type_imports.ts:5:7 diff --git a/cli/tests/testdata/ts_type_imports_foo.ts b/cli/tests/testdata/ts_type_imports_foo.ts new file mode 100644 index 000000000..db20773f6 --- /dev/null +++ b/cli/tests/testdata/ts_type_imports_foo.ts @@ -0,0 +1 @@ +export type Foo = Map; diff --git a/cli/tests/testdata/ts_type_only_import.d.ts b/cli/tests/testdata/ts_type_only_import.d.ts new file mode 100644 index 000000000..d48e4b48a --- /dev/null +++ b/cli/tests/testdata/ts_type_only_import.d.ts @@ -0,0 +1,3 @@ +export interface HelloWorld { + a: string; +} diff --git a/cli/tests/testdata/ts_type_only_import.ts b/cli/tests/testdata/ts_type_only_import.ts new file mode 100644 index 000000000..53e114373 --- /dev/null +++ b/cli/tests/testdata/ts_type_only_import.ts @@ -0,0 +1 @@ +export * from "./ts_type_only_import.d.ts"; diff --git a/cli/tests/testdata/ts_type_only_import.ts.out b/cli/tests/testdata/ts_type_only_import.ts.out new file mode 100644 index 000000000..f808ed21a --- /dev/null +++ b/cli/tests/testdata/ts_type_only_import.ts.out @@ -0,0 +1,4 @@ +Check [WILDCARD]ts_type_only_import.ts +warning: Compiled module not found "[WILDCARD]ts_type_only_import.d.ts" + From: [WILDCARD]ts_type_only_import.ts + If the source module contains only types, use `import type` and `export type` to import it instead. diff --git a/cli/tests/testdata/ts_with_generic.ts b/cli/tests/testdata/ts_with_generic.ts new file mode 100644 index 000000000..1e3591f40 --- /dev/null +++ b/cli/tests/testdata/ts_with_generic.ts @@ -0,0 +1,3 @@ +// deno-lint-ignore-file + +const foo = { delete() {} }; diff --git a/cli/tests/testdata/tsc/a.js b/cli/tests/testdata/tsc/a.js new file mode 100644 index 000000000..5a7b3ff93 --- /dev/null +++ b/cli/tests/testdata/tsc/a.js @@ -0,0 +1,2 @@ +import { v4 } from "./d.ts"; +export function a() {} diff --git a/cli/tests/testdata/tsc/d.ts b/cli/tests/testdata/tsc/d.ts new file mode 100644 index 000000000..3c74b8c83 --- /dev/null +++ b/cli/tests/testdata/tsc/d.ts @@ -0,0 +1,3 @@ +export function v4() { + return "hello"; +} diff --git a/cli/tests/testdata/tsc/node_modules/b.js b/cli/tests/testdata/tsc/node_modules/b.js new file mode 100644 index 000000000..191660935 --- /dev/null +++ b/cli/tests/testdata/tsc/node_modules/b.js @@ -0,0 +1,2 @@ +import c from "./c.js"; +export { c }; diff --git a/cli/tests/testdata/tsc/node_modules/c.js b/cli/tests/testdata/tsc/node_modules/c.js new file mode 100644 index 000000000..cff71c44a --- /dev/null +++ b/cli/tests/testdata/tsc/node_modules/c.js @@ -0,0 +1 @@ +export default function c() {} diff --git a/cli/tests/testdata/tsc/test.js b/cli/tests/testdata/tsc/test.js new file mode 100644 index 000000000..b7f46b351 --- /dev/null +++ b/cli/tests/testdata/tsc/test.js @@ -0,0 +1,4 @@ +import { a } from "./a.js"; +import { c } from "./node_modules/b.js"; + +console.log("hello"); diff --git a/cli/tests/testdata/tsc2/file_exportc.ts b/cli/tests/testdata/tsc2/file_exportc.ts new file mode 100644 index 000000000..efcc5bb46 --- /dev/null +++ b/cli/tests/testdata/tsc2/file_exportc.ts @@ -0,0 +1 @@ +export * as c from "https://deno.land/x/c.js"; diff --git a/cli/tests/testdata/tsc2/file_libref.ts b/cli/tests/testdata/tsc2/file_libref.ts new file mode 100644 index 000000000..6f37da139 --- /dev/null +++ b/cli/tests/testdata/tsc2/file_libref.ts @@ -0,0 +1,8 @@ +// deno-lint-ignore-file +/// +/// +/// + +export const div = document.createElement("div"); +div.innerHTML = `Hello World!`; +console.log(Deno.args); diff --git a/cli/tests/testdata/tsc2/file_main.ts b/cli/tests/testdata/tsc2/file_main.ts new file mode 100644 index 000000000..a45477fde --- /dev/null +++ b/cli/tests/testdata/tsc2/file_main.ts @@ -0,0 +1 @@ +console.log("hello deno"); diff --git a/cli/tests/testdata/tsc2/file_reexports.ts b/cli/tests/testdata/tsc2/file_reexports.ts new file mode 100644 index 000000000..b26297423 --- /dev/null +++ b/cli/tests/testdata/tsc2/file_reexports.ts @@ -0,0 +1,3 @@ +import * as c from "./exportc.ts"; + +console.log(c.c); diff --git a/cli/tests/testdata/tsc2/https_deno.land-x-a.ts b/cli/tests/testdata/tsc2/https_deno.land-x-a.ts new file mode 100644 index 000000000..72b3a67bc --- /dev/null +++ b/cli/tests/testdata/tsc2/https_deno.land-x-a.ts @@ -0,0 +1,3 @@ +import * as b from "./b.ts"; + +console.log(b); diff --git a/cli/tests/testdata/tsc2/https_deno.land-x-b.ts b/cli/tests/testdata/tsc2/https_deno.land-x-b.ts new file mode 100644 index 000000000..59d168993 --- /dev/null +++ b/cli/tests/testdata/tsc2/https_deno.land-x-b.ts @@ -0,0 +1 @@ +export const b = "b"; diff --git a/cli/tests/testdata/tsc2/https_deno.land-x-c.d.ts b/cli/tests/testdata/tsc2/https_deno.land-x-c.d.ts new file mode 100644 index 000000000..bf3a09240 --- /dev/null +++ b/cli/tests/testdata/tsc2/https_deno.land-x-c.d.ts @@ -0,0 +1 @@ +export const c: string; diff --git a/cli/tests/testdata/tsc2/https_deno.land-x-c.js b/cli/tests/testdata/tsc2/https_deno.land-x-c.js new file mode 100644 index 000000000..7f2cfac77 --- /dev/null +++ b/cli/tests/testdata/tsc2/https_deno.land-x-c.js @@ -0,0 +1 @@ +export const c = "c"; diff --git a/cli/tests/testdata/tsc2/https_deno.land-x-mod.ts b/cli/tests/testdata/tsc2/https_deno.land-x-mod.ts new file mode 100644 index 000000000..a45477fde --- /dev/null +++ b/cli/tests/testdata/tsc2/https_deno.land-x-mod.ts @@ -0,0 +1 @@ +console.log("hello deno"); diff --git a/cli/tests/testdata/tsconfig.decorators.json b/cli/tests/testdata/tsconfig.decorators.json new file mode 100644 index 000000000..504cd646e --- /dev/null +++ b/cli/tests/testdata/tsconfig.decorators.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "experimentalDecorators": true + } +} diff --git a/cli/tests/testdata/tsx_imports.ts b/cli/tests/testdata/tsx_imports.ts new file mode 100644 index 000000000..44ba10b7a --- /dev/null +++ b/cli/tests/testdata/tsx_imports.ts @@ -0,0 +1 @@ +import "./Component.tsx"; diff --git a/cli/tests/testdata/tsx_imports.ts.out b/cli/tests/testdata/tsx_imports.ts.out new file mode 100644 index 000000000..1f8b10d32 --- /dev/null +++ b/cli/tests/testdata/tsx_imports.ts.out @@ -0,0 +1,2 @@ +Check [WILDCARD]tsx_imports.ts +{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/testdata/type_definitions.ts b/cli/tests/testdata/type_definitions.ts new file mode 100644 index 000000000..a1bb37a65 --- /dev/null +++ b/cli/tests/testdata/type_definitions.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file + +// @deno-types="./type_definitions/foo.d.ts" +import { foo } from "./type_definitions/foo.js"; +// @deno-types="./type_definitions/fizz.d.ts" +import "./type_definitions/fizz.js"; + +import * as qat from "./type_definitions/qat.ts"; + +console.log(foo); +console.log(fizz); +console.log(qat.qat); diff --git a/cli/tests/testdata/type_definitions.ts.out b/cli/tests/testdata/type_definitions.ts.out new file mode 100644 index 000000000..b4fa88c50 --- /dev/null +++ b/cli/tests/testdata/type_definitions.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]foo +fizz +qat diff --git a/cli/tests/testdata/type_definitions/bar.d.ts b/cli/tests/testdata/type_definitions/bar.d.ts new file mode 100644 index 000000000..d43335dbb --- /dev/null +++ b/cli/tests/testdata/type_definitions/bar.d.ts @@ -0,0 +1,7 @@ +/// + +declare namespace bar { + export class Bar { + baz: string; + } +} diff --git a/cli/tests/testdata/type_definitions/bar.js b/cli/tests/testdata/type_definitions/bar.js new file mode 100644 index 000000000..e9c2e5193 --- /dev/null +++ b/cli/tests/testdata/type_definitions/bar.js @@ -0,0 +1,5 @@ +export class Bar { + constructor() { + this.baz = "baz"; + } +} diff --git a/cli/tests/testdata/type_definitions/fizz.d.ts b/cli/tests/testdata/type_definitions/fizz.d.ts new file mode 100644 index 000000000..34eb41b96 --- /dev/null +++ b/cli/tests/testdata/type_definitions/fizz.d.ts @@ -0,0 +1,2 @@ +/** A global value. */ +declare const fizz: string; diff --git a/cli/tests/testdata/type_definitions/fizz.js b/cli/tests/testdata/type_definitions/fizz.js new file mode 100644 index 000000000..852162c94 --- /dev/null +++ b/cli/tests/testdata/type_definitions/fizz.js @@ -0,0 +1 @@ +globalThis.fizz = "fizz"; diff --git a/cli/tests/testdata/type_definitions/foo.d.ts b/cli/tests/testdata/type_definitions/foo.d.ts new file mode 100644 index 000000000..ce39201e1 --- /dev/null +++ b/cli/tests/testdata/type_definitions/foo.d.ts @@ -0,0 +1,2 @@ +/** An exported value. */ +export const foo: string; diff --git a/cli/tests/testdata/type_definitions/foo.js b/cli/tests/testdata/type_definitions/foo.js new file mode 100644 index 000000000..61d366eb2 --- /dev/null +++ b/cli/tests/testdata/type_definitions/foo.js @@ -0,0 +1 @@ +export const foo = "foo"; diff --git a/cli/tests/testdata/type_definitions/qat.ts b/cli/tests/testdata/type_definitions/qat.ts new file mode 100644 index 000000000..6196c9d38 --- /dev/null +++ b/cli/tests/testdata/type_definitions/qat.ts @@ -0,0 +1 @@ +export const qat = "qat"; diff --git a/cli/tests/testdata/type_definitions_for_export.ts b/cli/tests/testdata/type_definitions_for_export.ts new file mode 100644 index 000000000..1f17b4962 --- /dev/null +++ b/cli/tests/testdata/type_definitions_for_export.ts @@ -0,0 +1,7 @@ +import { foo } from "./export_type_def.ts"; + +function bar(a: number) { + console.log(a); +} + +bar(foo); diff --git a/cli/tests/testdata/type_definitions_for_export.ts.out b/cli/tests/testdata/type_definitions_for_export.ts.out new file mode 100644 index 000000000..8f1240bc7 --- /dev/null +++ b/cli/tests/testdata/type_definitions_for_export.ts.out @@ -0,0 +1,5 @@ +Check [WILDCARD]type_definitions_for_export.ts +error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'number'. +bar(foo); + ~~~ + at [WILDCARD]type_definitions_for_export.ts:7:5 diff --git a/cli/tests/testdata/type_directives_01.ts b/cli/tests/testdata/type_directives_01.ts new file mode 100644 index 000000000..71305824c --- /dev/null +++ b/cli/tests/testdata/type_directives_01.ts @@ -0,0 +1,3 @@ +import * as foo from "http://127.0.0.1:4545/xTypeScriptTypes.js"; + +console.log(foo.foo); diff --git a/cli/tests/testdata/type_directives_01.ts.out b/cli/tests/testdata/type_directives_01.ts.out new file mode 100644 index 000000000..77ed3ae26 --- /dev/null +++ b/cli/tests/testdata/type_directives_01.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +DEBUG TS - host.getSourceFile("http://127.0.0.1:4545/xTypeScriptTypes.d.ts", Latest) +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/type_directives_02.ts b/cli/tests/testdata/type_directives_02.ts new file mode 100644 index 000000000..f7274bf26 --- /dev/null +++ b/cli/tests/testdata/type_directives_02.ts @@ -0,0 +1,3 @@ +import * as foo from "./subdir/type_reference.js"; + +console.log(foo.foo); diff --git a/cli/tests/testdata/type_directives_02.ts.out b/cli/tests/testdata/type_directives_02.ts.out new file mode 100644 index 000000000..b064483b4 --- /dev/null +++ b/cli/tests/testdata/type_directives_02.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +DEBUG TS - host.getSourceFile("file:///[WILDCARD]/subdir/type_reference.d.ts", Latest) +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/type_directives_js_main.js b/cli/tests/testdata/type_directives_js_main.js new file mode 100644 index 000000000..f7274bf26 --- /dev/null +++ b/cli/tests/testdata/type_directives_js_main.js @@ -0,0 +1,3 @@ +import * as foo from "./subdir/type_reference.js"; + +console.log(foo.foo); diff --git a/cli/tests/testdata/type_directives_js_main.js.out b/cli/tests/testdata/type_directives_js_main.js.out new file mode 100644 index 000000000..7bca837f0 --- /dev/null +++ b/cli/tests/testdata/type_directives_js_main.js.out @@ -0,0 +1,3 @@ +[WILDCARD] +DEBUG RS - [WILDCARD] - FileFetcher::fetch() - specifier: file:///[WILDCARD]/subdir/type_reference.d.ts +[WILDCARD] diff --git a/cli/tests/testdata/type_directives_redirect.ts b/cli/tests/testdata/type_directives_redirect.ts new file mode 100644 index 000000000..1756d5af9 --- /dev/null +++ b/cli/tests/testdata/type_directives_redirect.ts @@ -0,0 +1 @@ +import "http://localhost:4545/type_directives_redirect.js"; diff --git a/cli/tests/testdata/type_directives_redirect.ts.out b/cli/tests/testdata/type_directives_redirect.ts.out new file mode 100644 index 000000000..471d9c0b4 --- /dev/null +++ b/cli/tests/testdata/type_directives_redirect.ts.out @@ -0,0 +1,5 @@ +Download [WILDCARD]type_directives_redirect.js +Download [WILDCARD]xTypeScriptTypesRedirect.d.ts +Download [WILDCARD]xTypeScriptTypesRedirect.d.ts +Download [WILDCARD]xTypeScriptTypesRedirected.d.ts +Check [WILDCARD]type_directives_redirect.ts diff --git a/cli/tests/testdata/type_headers_deno_types.ts b/cli/tests/testdata/type_headers_deno_types.ts new file mode 100644 index 000000000..92391c666 --- /dev/null +++ b/cli/tests/testdata/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/type_headers_deno_types.foo.d.ts" +import { foo } from "http://127.0.0.1:4545/type_headers_deno_types.foo.js"; + +foo("hello"); diff --git a/cli/tests/testdata/type_headers_deno_types.ts.out b/cli/tests/testdata/type_headers_deno_types.ts.out new file mode 100644 index 000000000..f1e4ca1f8 --- /dev/null +++ b/cli/tests/testdata/type_headers_deno_types.ts.out @@ -0,0 +1,5 @@ +Download http://[WILDCARD]:4545/type_headers_deno_types.foo.js +Download http://[WILDCARD]:4545/type_headers_deno_types.foo.d.ts +Download http://[WILDCARD]:4545/type_headers_deno_types.d.ts +Check [WILDCARD]/type_headers_deno_types.ts +hello diff --git a/cli/tests/testdata/types.out b/cli/tests/testdata/types.out new file mode 100644 index 000000000..9cda650eb --- /dev/null +++ b/cli/tests/testdata/types.out @@ -0,0 +1,4 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +[WILDCARD] +declare namespace Deno [WILDCARD] +declare var window: Window [WILDCARD] diff --git a/cli/tests/testdata/unbuffered_stderr.ts b/cli/tests/testdata/unbuffered_stderr.ts new file mode 100644 index 000000000..0f1d2a999 --- /dev/null +++ b/cli/tests/testdata/unbuffered_stderr.ts @@ -0,0 +1 @@ +Deno.stderr.write(new TextEncoder().encode("x")); diff --git a/cli/tests/testdata/unbuffered_stderr.ts.out b/cli/tests/testdata/unbuffered_stderr.ts.out new file mode 100644 index 000000000..500019738 --- /dev/null +++ b/cli/tests/testdata/unbuffered_stderr.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +x \ No newline at end of file diff --git a/cli/tests/testdata/unbuffered_stdout.ts b/cli/tests/testdata/unbuffered_stdout.ts new file mode 100644 index 000000000..9f1e07a97 --- /dev/null +++ b/cli/tests/testdata/unbuffered_stdout.ts @@ -0,0 +1 @@ +Deno.stdout.write(new TextEncoder().encode("a")); diff --git a/cli/tests/testdata/unbuffered_stdout.ts.out b/cli/tests/testdata/unbuffered_stdout.ts.out new file mode 100644 index 000000000..2e65efe2a --- /dev/null +++ b/cli/tests/testdata/unbuffered_stdout.ts.out @@ -0,0 +1 @@ +a \ No newline at end of file diff --git a/cli/tests/testdata/unstable.js b/cli/tests/testdata/unstable.js new file mode 100644 index 000000000..a9894be3e --- /dev/null +++ b/cli/tests/testdata/unstable.js @@ -0,0 +1 @@ +console.log(Deno.loadavg); diff --git a/cli/tests/testdata/unstable.ts b/cli/tests/testdata/unstable.ts new file mode 100644 index 000000000..a9894be3e --- /dev/null +++ b/cli/tests/testdata/unstable.ts @@ -0,0 +1 @@ +console.log(Deno.loadavg); diff --git a/cli/tests/testdata/unstable_disabled.out b/cli/tests/testdata/unstable_disabled.out new file mode 100644 index 000000000..28659645d --- /dev/null +++ b/cli/tests/testdata/unstable_disabled.out @@ -0,0 +1,5 @@ +[WILDCARD] +error: TS2339 [ERROR]: Property 'loadavg' does not exist on type 'typeof Deno'. 'Deno.loadavg' is an unstable API. Did you forget to run with the '--unstable' flag? +console.log(Deno.loadavg); + ~~~~~~~ + at [WILDCARD]/unstable.ts:1:18 diff --git a/cli/tests/testdata/unstable_disabled_js.out b/cli/tests/testdata/unstable_disabled_js.out new file mode 100644 index 000000000..417b7b537 --- /dev/null +++ b/cli/tests/testdata/unstable_disabled_js.out @@ -0,0 +1 @@ +undefined diff --git a/cli/tests/testdata/unstable_enabled.out b/cli/tests/testdata/unstable_enabled.out new file mode 100644 index 000000000..b4cedce14 --- /dev/null +++ b/cli/tests/testdata/unstable_enabled.out @@ -0,0 +1 @@ +[Function: loadavg] diff --git a/cli/tests/testdata/unstable_enabled_js.out b/cli/tests/testdata/unstable_enabled_js.out new file mode 100644 index 000000000..b4cedce14 --- /dev/null +++ b/cli/tests/testdata/unstable_enabled_js.out @@ -0,0 +1 @@ +[Function: loadavg] diff --git a/cli/tests/testdata/unstable_worker.ts b/cli/tests/testdata/unstable_worker.ts new file mode 100644 index 000000000..429754dfe --- /dev/null +++ b/cli/tests/testdata/unstable_worker.ts @@ -0,0 +1,12 @@ +const w = new Worker( + new URL("workers/worker_unstable.ts", import.meta.url).href, + { + type: "module", + deno: { + namespace: true, + }, + name: "Unstable Worker", + }, +); + +w.postMessage({}); diff --git a/cli/tests/testdata/unstable_worker.ts.out b/cli/tests/testdata/unstable_worker.ts.out new file mode 100644 index 000000000..ece47de97 --- /dev/null +++ b/cli/tests/testdata/unstable_worker.ts.out @@ -0,0 +1,2 @@ +[Function: query] +[Function: emit] diff --git a/cli/tests/testdata/unsupported_dynamic_import_scheme.out b/cli/tests/testdata/unsupported_dynamic_import_scheme.out new file mode 100644 index 000000000..c708fced4 --- /dev/null +++ b/cli/tests/testdata/unsupported_dynamic_import_scheme.out @@ -0,0 +1,7 @@ +error: Uncaught (in promise) TypeError: Unsupported scheme "xxx" for module "xxx:". Supported schemes: [ + "data", + "blob", + "file", + "http", + "https", +] diff --git a/cli/tests/testdata/v8_flags.js b/cli/tests/testdata/v8_flags.js new file mode 100644 index 000000000..f7999c4af --- /dev/null +++ b/cli/tests/testdata/v8_flags.js @@ -0,0 +1 @@ +console.log(typeof gc); diff --git a/cli/tests/testdata/v8_flags.js.out b/cli/tests/testdata/v8_flags.js.out new file mode 100644 index 000000000..e2dbde096 --- /dev/null +++ b/cli/tests/testdata/v8_flags.js.out @@ -0,0 +1 @@ +function diff --git a/cli/tests/testdata/v8_flags_unrecognized.out b/cli/tests/testdata/v8_flags_unrecognized.out new file mode 100644 index 000000000..56e70f830 --- /dev/null +++ b/cli/tests/testdata/v8_flags_unrecognized.out @@ -0,0 +1,5 @@ +error: V8 did not recognize flag '--foo' +error: V8 did not recognize flag 'bar' +error: V8 did not recognize flag '-baz' + +For a list of V8 flags, use '--v8-flags=--help' diff --git a/cli/tests/testdata/v8_help.out b/cli/tests/testdata/v8_help.out new file mode 100644 index 000000000..006d73557 --- /dev/null +++ b/cli/tests/testdata/v8_help.out @@ -0,0 +1,4 @@ +[WILDCARD] +Options: +[WILDCARD] + --trace-gc [WILDCARD] diff --git a/cli/tests/testdata/wasm.ts b/cli/tests/testdata/wasm.ts new file mode 100644 index 000000000..96b5fdffc --- /dev/null +++ b/cli/tests/testdata/wasm.ts @@ -0,0 +1,16 @@ +// deno-fmt-ignore +const wasmCode = new Uint8Array([ + 0, 97, 115, 109, 1, 0, 0, 0, 1, 133, 128, 128, 128, 0, 1, 96, 0, 1, 127, + 3, 130, 128, 128, 128, 0, 1, 0, 4, 132, 128, 128, 128, 0, 1, 112, 0, 0, + 5, 131, 128, 128, 128, 0, 1, 0, 1, 6, 129, 128, 128, 128, 0, 0, 7, 145, + 128, 128, 128, 0, 2, 6, 109, 101, 109, 111, 114, 121, 2, 0, 4, 109, 97, + 105, 110, 0, 0, 10, 138, 128, 128, 128, 0, 1, 132, 128, 128, 128, 0, 0, + 65, 42, 11 + ]); + +const wasmModule = new WebAssembly.Module(wasmCode); + +const wasmInstance = new WebAssembly.Instance(wasmModule); + +const main = wasmInstance.exports.main as CallableFunction; +console.log(main().toString()); diff --git a/cli/tests/testdata/wasm.ts.out b/cli/tests/testdata/wasm.ts.out new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/cli/tests/testdata/wasm.ts.out @@ -0,0 +1 @@ +42 diff --git a/cli/tests/testdata/wasm_async.js b/cli/tests/testdata/wasm_async.js new file mode 100644 index 000000000..837460ae9 --- /dev/null +++ b/cli/tests/testdata/wasm_async.js @@ -0,0 +1,27 @@ +// The following blob can be created by taking the following s-expr and pass +// it through wat2wasm. +// (module +// (func $add (param $a i32) (param $b i32) (result i32) +// local.get $a +// local.get $b +// i32.add) +// (export "add" (func $add)) +// ) +// deno-fmt-ignore +const bytes = new Uint8Array([ + 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, 0x60, + 0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x07, 0x01, + 0x03, 0x61, 0x64, 0x64, 0x00, 0x00, 0x0a, 0x09, 0x01, 0x07, 0x00, 0x20, + 0x00, 0x20, 0x01, 0x6a, 0x0b +]); + +async function main() { + const wasm = await WebAssembly.instantiate(bytes); + const result = wasm.instance.exports.add(1, 3); + console.log("1 + 3 =", result); + if (result != 4) { + throw Error("bad"); + } +} + +main(); diff --git a/cli/tests/testdata/wasm_async.out b/cli/tests/testdata/wasm_async.out new file mode 100644 index 000000000..5cdf17de7 --- /dev/null +++ b/cli/tests/testdata/wasm_async.out @@ -0,0 +1 @@ +1 + 3 = 4 diff --git a/cli/tests/testdata/wasm_shared.out b/cli/tests/testdata/wasm_shared.out new file mode 100644 index 000000000..e69de29bb diff --git a/cli/tests/testdata/wasm_shared.ts b/cli/tests/testdata/wasm_shared.ts new file mode 100644 index 000000000..b713385d5 --- /dev/null +++ b/cli/tests/testdata/wasm_shared.ts @@ -0,0 +1,6 @@ +const memory = new WebAssembly.Memory({ + initial: 1, + maximum: 10, + shared: true, +}); +console.assert(memory.buffer instanceof SharedArrayBuffer); diff --git a/cli/tests/testdata/wasm_unreachable.js b/cli/tests/testdata/wasm_unreachable.js new file mode 100644 index 000000000..991ebcec8 --- /dev/null +++ b/cli/tests/testdata/wasm_unreachable.js @@ -0,0 +1,50 @@ +// WebAssembly module containing a single function with an unreachable instruction +const binary = Uint8Array.from([ + 0x00, + 0x61, + 0x73, + 0x6d, + 0x01, + 0x00, + 0x00, + 0x00, + 0x01, + 0x04, + 0x01, + 0x60, + 0x00, + 0x00, + 0x03, + 0x02, + 0x01, + 0x00, + 0x07, + 0x0f, + 0x01, + 0x0b, + 0x75, + 0x6e, + 0x72, + 0x65, + 0x61, + 0x63, + 0x68, + 0x61, + 0x62, + 0x6c, + 0x65, + 0x00, + 0x00, + 0x0a, + 0x05, + 0x01, + 0x03, + 0x00, + 0x00, + 0x0b, +]); + +const module = new WebAssembly.Module(binary); +const instance = new WebAssembly.Instance(module); + +instance.exports.unreachable(); diff --git a/cli/tests/testdata/wasm_unreachable.out b/cli/tests/testdata/wasm_unreachable.out new file mode 100644 index 000000000..28fe00de6 --- /dev/null +++ b/cli/tests/testdata/wasm_unreachable.out @@ -0,0 +1,3 @@ +error: Uncaught RuntimeError: unreachable + at (wasm://wasm/[WILDCARD]) + at [WILDCARD]/wasm_unreachable.js:[WILDCARD] diff --git a/cli/tests/testdata/weakref.ts b/cli/tests/testdata/weakref.ts new file mode 100644 index 000000000..47c3985fe --- /dev/null +++ b/cli/tests/testdata/weakref.ts @@ -0,0 +1 @@ +console.log(WeakRef, FinalizationRegistry); diff --git a/cli/tests/testdata/weakref.ts.out b/cli/tests/testdata/weakref.ts.out new file mode 100644 index 000000000..32bafcf2d --- /dev/null +++ b/cli/tests/testdata/weakref.ts.out @@ -0,0 +1 @@ +[Function: WeakRef] [Function: FinalizationRegistry] diff --git a/cli/tests/testdata/webgpu_computepass_shader.wgsl b/cli/tests/testdata/webgpu_computepass_shader.wgsl new file mode 100644 index 000000000..7d4748e2a --- /dev/null +++ b/cli/tests/testdata/webgpu_computepass_shader.wgsl @@ -0,0 +1,37 @@ +[[block]] +struct PrimeIndices { + data: [[stride(4)]] array; +}; // this is used as both input and output for convenience +[[group(0), binding(0)]] +var v_indices: [[access(read_write)]] PrimeIndices; +// The Collatz Conjecture states that for any integer n: +// If n is even, n = n/2 +// If n is odd, n = 3n+1 +// And repeat this process for each new n, you will always eventually reach 1. +// Though the conjecture has not been proven, no counterexample has ever been found. +// This function returns how many times this recurrence needs to be applied to reach 1. +fn collatz_iterations(n_base: u32) -> u32{ + var n: u32 = n_base; + var i: u32 = 0u; + loop { + if (n <= 1u) { + break; + } + if (n % 2u == 0u) { + n = n / 2u; + } + else { + // Overflow? (i.e. 3*n + 1 > 0xffffffffu?) + if (n >= 1431655765u) { // 0x55555555u + return 4294967295u; // 0xffffffffu + } + n = 3u * n + 1u; + } + i = i + 1u; + } + return i; +} +[[stage(compute), workgroup_size(1)]] +fn main([[builtin(global_invocation_id)]] global_id: vec3) { + v_indices.data[global_id.x] = collatz_iterations(v_indices.data[global_id.x]); +} diff --git a/cli/tests/testdata/webgpu_hellotriangle.out b/cli/tests/testdata/webgpu_hellotriangle.out new file mode 100644 index 000000000..91454dbfc Binary files /dev/null and b/cli/tests/testdata/webgpu_hellotriangle.out differ diff --git a/cli/tests/testdata/webgpu_hellotriangle_shader.wgsl b/cli/tests/testdata/webgpu_hellotriangle_shader.wgsl new file mode 100644 index 000000000..b8b2b69fc --- /dev/null +++ b/cli/tests/testdata/webgpu_hellotriangle_shader.wgsl @@ -0,0 +1,10 @@ +[[stage(vertex)]] +fn vs_main([[builtin(vertex_index)]] in_vertex_index: u32) -> [[builtin(position)]] vec4 { + let x = f32(i32(in_vertex_index) - 1); + let y = f32(i32(in_vertex_index & 1u) * 2 - 1); + return vec4(x, y, 0.0, 1.0); +} +[[stage(fragment)]] +fn fs_main() -> [[location(0)]] vec4 { + return vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/cli/tests/testdata/websocket_test.ts b/cli/tests/testdata/websocket_test.ts new file mode 100644 index 000000000..5229ad875 --- /dev/null +++ b/cli/tests/testdata/websocket_test.ts @@ -0,0 +1,308 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +import { + assert, + assertEquals, + assertThrows, + fail, +} from "../../../test_util/std/testing/asserts.ts"; +import { deferred } from "../../../test_util/std/async/deferred.ts"; + +Deno.test("invalid scheme", () => { + assertThrows(() => new WebSocket("foo://localhost:4242")); +}); + +Deno.test("fragment", () => { + assertThrows(() => new WebSocket("ws://localhost:4242/#")); + assertThrows(() => new WebSocket("ws://localhost:4242/#foo")); +}); + +Deno.test("duplicate protocols", () => { + assertThrows(() => new WebSocket("ws://localhost:4242", ["foo", "foo"])); +}); + +Deno.test("invalid server", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:2121"); + let err = false; + ws.onerror = () => { + err = true; + }; + ws.onclose = () => { + if (err) { + promise.resolve(); + } else { + fail(); + } + }; + ws.onopen = () => fail(); + await promise; +}); + +Deno.test("connect & close", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => { + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("connect & abort", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.close(); + let err = false; + ws.onerror = () => { + err = true; + }; + ws.onclose = () => { + if (err) { + promise.resolve(); + } else { + fail(); + } + }; + ws.onopen = () => fail(); + await promise; +}); + +Deno.test("connect & close custom valid code", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => ws.close(1000); + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("connect & close custom invalid code", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => { + assertThrows(() => ws.close(1001)); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("connect & close custom valid reason", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => ws.close(1000, "foo"); + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("connect & close custom invalid reason", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => { + assertThrows(() => ws.close(1000, "".padEnd(124, "o"))); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo string", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.onerror = () => fail(); + ws.onopen = () => ws.send("foo"); + ws.onmessage = (e) => { + assertEquals(e.data, "foo"); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo string tls", async () => { + const promise1 = deferred(); + const promise2 = deferred(); + const ws = new WebSocket("wss://localhost:4243"); + ws.onerror = () => fail(); + ws.onopen = () => ws.send("foo"); + ws.onmessage = (e) => { + assertEquals(e.data, "foo"); + ws.close(); + promise1.resolve(); + }; + ws.onclose = () => { + promise2.resolve(); + }; + await promise1; + await promise2; +}); + +Deno.test("websocket error", async () => { + const promise1 = deferred(); + const ws = new WebSocket("wss://localhost:4242"); + ws.onopen = () => fail(); + ws.onerror = (err) => { + assert(err instanceof ErrorEvent); + + // Error message got changed because we don't use warp in test_util + assertEquals(err.message, "UnexpectedEof: tls handshake eof"); + promise1.resolve(); + }; + await promise1; +}); + +Deno.test("echo blob with binaryType blob", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + const blob = new Blob(["foo"]); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(blob); + ws.onmessage = (e) => { + e.data.text().then((actual: string) => { + blob.text().then((expected) => { + assertEquals(actual, expected); + }); + }); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo blob with binaryType arraybuffer", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.binaryType = "arraybuffer"; + const blob = new Blob(["foo"]); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(blob); + ws.onmessage = (e) => { + blob.arrayBuffer().then((expected) => { + assertEquals(e.data, expected); + }); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo uint8array with binaryType blob", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + const uint = new Uint8Array([102, 111, 111]); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(uint); + ws.onmessage = (e) => { + e.data.arrayBuffer().then((actual: ArrayBuffer) => { + assertEquals(actual, uint.buffer); + }); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo uint8array with binaryType arraybuffer", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.binaryType = "arraybuffer"; + const uint = new Uint8Array([102, 111, 111]); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(uint); + ws.onmessage = (e) => { + assertEquals(e.data, uint.buffer); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo arraybuffer with binaryType blob", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + const buffer = new ArrayBuffer(3); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(buffer); + ws.onmessage = (e) => { + e.data.arrayBuffer().then((actual: ArrayBuffer) => { + assertEquals(actual, buffer); + }); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("echo arraybuffer with binaryType arraybuffer", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + ws.binaryType = "arraybuffer"; + const buffer = new ArrayBuffer(3); + ws.onerror = () => fail(); + ws.onopen = () => ws.send(buffer); + ws.onmessage = (e) => { + assertEquals(e.data, buffer); + ws.close(); + }; + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("Event Handlers order", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4242"); + const arr: number[] = []; + ws.onerror = () => fail(); + ws.addEventListener("message", () => arr.push(1)); + ws.onmessage = () => fail(); + ws.addEventListener("message", () => { + arr.push(3); + ws.close(); + assertEquals(arr, [1, 2, 3]); + }); + ws.onmessage = () => arr.push(2); + ws.onopen = () => ws.send("Echo"); + ws.onclose = () => { + promise.resolve(); + }; + await promise; +}); + +Deno.test("Close without frame", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4244"); + ws.onerror = () => fail(); + ws.onclose = (e) => { + assertEquals(e.code, 1005); + promise.resolve(); + }; + await promise; +}); diff --git a/cli/tests/testdata/websocketstream_test.ts b/cli/tests/testdata/websocketstream_test.ts new file mode 100644 index 000000000..aa809ba16 --- /dev/null +++ b/cli/tests/testdata/websocketstream_test.ts @@ -0,0 +1,82 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +import { + assertEquals, + assertThrows, + assertThrowsAsync, +} from "../../../test_util/std/testing/asserts.ts"; + +Deno.test("fragment", () => { + assertThrows(() => new WebSocketStream("ws://localhost:4242/#")); + assertThrows(() => new WebSocketStream("ws://localhost:4242/#foo")); +}); + +Deno.test("duplicate protocols", () => { + assertThrows(() => + new WebSocketStream("ws://localhost:4242", { + protocols: ["foo", "foo"], + }) + ); +}); + +Deno.test("connect & close custom valid code", async () => { + const ws = new WebSocketStream("ws://localhost:4242"); + await ws.connection; + ws.close({ code: 1000 }); + await ws.closed; +}); + +Deno.test("connect & close custom invalid reason", async () => { + const ws = new WebSocketStream("ws://localhost:4242"); + await ws.connection; + assertThrows(() => ws.close({ code: 1000, reason: "".padEnd(124, "o") })); + ws.close(); + await ws.closed; +}); + +Deno.test("echo string", async () => { + const ws = new WebSocketStream("ws://localhost:4242"); + const { readable, writable } = await ws.connection; + await writable.getWriter().write("foo"); + const res = await readable.getReader().read(); + assertEquals(res.value, "foo"); + ws.close(); + await ws.closed; +}); + +Deno.test("echo string tls", async () => { + const ws = new WebSocketStream("wss://localhost:4243"); + const { readable, writable } = await ws.connection; + await writable.getWriter().write("foo"); + const res = await readable.getReader().read(); + assertEquals(res.value, "foo"); + ws.close(); + await ws.closed; +}); + +Deno.test("websocket error", async () => { + const ws = new WebSocketStream("wss://localhost:4242"); + await Promise.all([ + assertThrowsAsync( + () => ws.connection, + Deno.errors.UnexpectedEof, + "tls handshake eof", + ), + assertThrowsAsync( + () => ws.closed, + Deno.errors.UnexpectedEof, + "tls handshake eof", + ), + ]); +}); + +Deno.test("echo uint8array", async () => { + const ws = new WebSocketStream("ws://localhost:4242"); + const { readable, writable } = await ws.connection; + const uint = new Uint8Array([102, 111, 111]); + await writable.getWriter().write(uint); + const res = await readable.getReader().read(); + assertEquals(res.value, uint); + ws.close(); + await ws.closed; +}); diff --git a/cli/tests/testdata/worker_close_race.js b/cli/tests/testdata/worker_close_race.js new file mode 100644 index 000000000..6d5bbe2c3 --- /dev/null +++ b/cli/tests/testdata/worker_close_race.js @@ -0,0 +1,14 @@ +// Copyright 2018-2021 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( + new URL("./workers/close_race_worker.js", import.meta.url), + { type: "module" }, +); + +worker.onmessage = () => { + worker.terminate(); +}; diff --git a/cli/tests/testdata/worker_close_race.js.out b/cli/tests/testdata/worker_close_race.js.out new file mode 100644 index 000000000..e69de29bb diff --git a/cli/tests/testdata/worker_event_handler_test.js b/cli/tests/testdata/worker_event_handler_test.js new file mode 100644 index 000000000..e0ce3d9f8 --- /dev/null +++ b/cli/tests/testdata/worker_event_handler_test.js @@ -0,0 +1,5 @@ +const w = new Worker( + new URL("./workers/worker_event_handlers.js", import.meta.url).href, + { type: "module" }, +); +w.postMessage({}); diff --git a/cli/tests/testdata/worker_event_handler_test.js.out b/cli/tests/testdata/worker_event_handler_test.js.out new file mode 100644 index 000000000..5556633b1 --- /dev/null +++ b/cli/tests/testdata/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: [ + "Some error message", + "", + 0, + 0, + Error: Some error message + at [WILDCARD] +] +Is event canceled?: true diff --git a/cli/tests/testdata/workers/bench_large_message.ts b/cli/tests/testdata/workers/bench_large_message.ts new file mode 100644 index 000000000..a89ea9a78 --- /dev/null +++ b/cli/tests/testdata/workers/bench_large_message.ts @@ -0,0 +1,31 @@ +// Copyright 2020 the Deno authors. All rights reserved. MIT license. + +function oneWorker(i: number) { + return new Promise((resolve) => { + let countDown = 10; + const worker = new Worker( + new URL("worker_large_message.js", import.meta.url).href, + { type: "module" }, + ); + worker.onmessage = (_e) => { + if (countDown > 0) { + countDown--; + return; + } + worker.terminate(); + resolve(); + }; + worker.postMessage("hi " + i); + }); +} + +function bench() { + const promises = []; + for (let i = 0; i < 50; i++) { + promises.push(oneWorker(i)); + } + + return Promise.all(promises); +} + +bench(); diff --git a/cli/tests/testdata/workers/bench_round_robin.ts b/cli/tests/testdata/workers/bench_round_robin.ts new file mode 100644 index 000000000..13afe286b --- /dev/null +++ b/cli/tests/testdata/workers/bench_round_robin.ts @@ -0,0 +1,68 @@ +// Benchmark measures time it takes to send a message to a group of workers one +// at a time and wait for a response from all of them. Just a general +// throughput and consistency benchmark. +const data = "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n"; +const workerCount = 4; +const cmdsPerWorker = 400; + +import { + Deferred, + deferred, +} from "../../../../test_util/std/async/deferred.ts"; + +function handleAsyncMsgFromWorker( + promiseTable: Map>, + msg: { cmdId: number; data: string }, +) { + const promise = promiseTable.get(msg.cmdId); + if (promise === null) { + throw new Error(`Failed to find promise: cmdId: ${msg.cmdId}, msg: ${msg}`); + } + promise?.resolve(data); +} + +async function main() { + const workers: Array<[Map>, Worker]> = []; + for (let i = 1; i <= workerCount; ++i) { + const worker = new Worker( + new URL("bench_worker.ts", import.meta.url).href, + { type: "module" }, + ); + const promise = deferred(); + worker.onmessage = (e) => { + if (e.data.cmdId === 0) promise.resolve(); + }; + worker.postMessage({ cmdId: 0, action: 2 }); + await promise; + workers.push([new Map(), worker]); + } + // assign callback function + for (const [promiseTable, worker] of workers) { + worker.onmessage = (e) => { + handleAsyncMsgFromWorker(promiseTable, e.data); + }; + } + for (const cmdId of Array(cmdsPerWorker).keys()) { + const promises: Array> = []; + for (const [promiseTable, worker] of workers) { + const promise = deferred(); + promiseTable.set(cmdId, promise); + worker.postMessage({ cmdId: cmdId, action: 1, data }); + promises.push(promise); + } + for (const promise of promises) { + await promise; + } + } + for (const [, worker] of workers) { + const promise = deferred(); + worker.onmessage = (e) => { + if (e.data.cmdId === 3) promise.resolve(); + }; + worker.postMessage({ action: 3 }); + await promise; + } + console.log("Finished!"); +} + +main(); diff --git a/cli/tests/testdata/workers/bench_startup.ts b/cli/tests/testdata/workers/bench_startup.ts new file mode 100644 index 000000000..bcf21ef44 --- /dev/null +++ b/cli/tests/testdata/workers/bench_startup.ts @@ -0,0 +1,33 @@ +// Benchmark measures time it takes to start and stop a number of workers. +const workerCount = 50; + +async function bench() { + const workers: Worker[] = []; + for (let i = 1; i <= workerCount; ++i) { + const worker = new Worker( + new URL("bench_worker.ts", import.meta.url).href, + { type: "module" }, + ); + const promise = new Promise((resolve) => { + worker.onmessage = (e) => { + if (e.data.cmdId === 0) resolve(); + }; + }); + worker.postMessage({ cmdId: 0, action: 2 }); + await promise; + workers.push(worker); + } + console.log("Done creating workers closing workers!"); + for (const worker of workers) { + const promise = new Promise((resolve) => { + worker.onmessage = (e) => { + if (e.data.cmdId === 3) resolve(); + }; + }); + worker.postMessage({ action: 3 }); + await promise; + } + console.log("Finished!"); +} + +bench(); diff --git a/cli/tests/testdata/workers/bench_worker.ts b/cli/tests/testdata/workers/bench_worker.ts new file mode 100644 index 000000000..1edd2750f --- /dev/null +++ b/cli/tests/testdata/workers/bench_worker.ts @@ -0,0 +1,21 @@ +onmessage = function (e) { + const { cmdId, action, data } = e.data; + switch (action) { + case 0: // Static response + postMessage({ + cmdId, + data: "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", + }); + break; + case 1: // Respond with request data + postMessage({ cmdId, data }); + break; + case 2: // Ping + postMessage({ cmdId }); + break; + case 3: // Close + postMessage({ cmdId: 3 }); + close(); + break; + } +}; diff --git a/cli/tests/testdata/workers/broadcast_channel.ts b/cli/tests/testdata/workers/broadcast_channel.ts new file mode 100644 index 000000000..5076e9eb7 --- /dev/null +++ b/cli/tests/testdata/workers/broadcast_channel.ts @@ -0,0 +1,5 @@ +new BroadcastChannel("intercom").onmessage = function (e) { + this.postMessage(e.data); +}; + +self.postMessage("go"); diff --git a/cli/tests/testdata/workers/busy_worker.js b/cli/tests/testdata/workers/busy_worker.js new file mode 100644 index 000000000..7deba0321 --- /dev/null +++ b/cli/tests/testdata/workers/busy_worker.js @@ -0,0 +1,8 @@ +self.onmessage = function (_evt) { + // infinite loop + for (let i = 0; true; i++) { + if (i % 1000 == 0) { + postMessage(i); + } + } +}; diff --git a/cli/tests/testdata/workers/close_race_worker.js b/cli/tests/testdata/workers/close_race_worker.js new file mode 100644 index 000000000..f582a0d99 --- /dev/null +++ b/cli/tests/testdata/workers/close_race_worker.js @@ -0,0 +1,6 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +setTimeout(() => { + self.postMessage(""); + self.close(); +}, 500); diff --git a/cli/tests/testdata/workers/deno_worker.ts b/cli/tests/testdata/workers/deno_worker.ts new file mode 100644 index 000000000..2a29c8c4d --- /dev/null +++ b/cli/tests/testdata/workers/deno_worker.ts @@ -0,0 +1,7 @@ +onmessage = function (e) { + if (typeof self.Deno === "undefined") { + throw new Error("Deno namespace not available in worker"); + } + + postMessage(e.data); +}; diff --git a/cli/tests/testdata/workers/dynamic_remote.ts b/cli/tests/testdata/workers/dynamic_remote.ts new file mode 100644 index 000000000..381c7f374 --- /dev/null +++ b/cli/tests/testdata/workers/dynamic_remote.ts @@ -0,0 +1,2 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +await import("https://example.com/some/file.ts"); diff --git a/cli/tests/testdata/workers/error.ts b/cli/tests/testdata/workers/error.ts new file mode 100644 index 000000000..495971090 --- /dev/null +++ b/cli/tests/testdata/workers/error.ts @@ -0,0 +1,5 @@ +function foo() { + throw new Error("foo"); +} + +foo(); diff --git a/cli/tests/testdata/workers/event_worker.js b/cli/tests/testdata/workers/event_worker.js new file mode 100644 index 000000000..849b6026c --- /dev/null +++ b/cli/tests/testdata/workers/event_worker.js @@ -0,0 +1,7 @@ +onmessage = function (e) { + if (e.data === "boom") { + throw new Error("boom error!"); + } + + postMessage(e.data); +}; diff --git a/cli/tests/testdata/workers/event_worker_scope.js b/cli/tests/testdata/workers/event_worker_scope.js new file mode 100644 index 000000000..0381801a8 --- /dev/null +++ b/cli/tests/testdata/workers/event_worker_scope.js @@ -0,0 +1,43 @@ +let messageHandlersCalled = 0; +let errorHandlersCalled = 0; + +onmessage = function (e) { + if (e.data === "boom") { + throw new Error("boom error!"); + } + messageHandlersCalled++; +}; + +self.addEventListener("message", (_e) => { + messageHandlersCalled++; +}); + +self.addEventListener("message", (_e) => { + messageHandlersCalled++; +}); + +self.addEventListener("message", (_e) => { + messageHandlersCalled++; + + postMessage({ + messageHandlersCalled, + errorHandlersCalled, + }); +}); + +onerror = function (_e) { + errorHandlersCalled++; +}; + +self.addEventListener("error", (_e) => { + errorHandlersCalled++; +}); + +self.addEventListener("error", (_e) => { + errorHandlersCalled++; +}); + +self.addEventListener("error", (e) => { + errorHandlersCalled++; + e.preventDefault(); +}); diff --git a/cli/tests/testdata/workers/fetching_worker.js b/cli/tests/testdata/workers/fetching_worker.js new file mode 100644 index 000000000..77ff471d7 --- /dev/null +++ b/cli/tests/testdata/workers/fetching_worker.js @@ -0,0 +1,6 @@ +const r = await fetch( + "http://localhost:4545/workers/fetching_worker.js", +); +await r.text(); +postMessage("Done!"); +close(); diff --git a/cli/tests/testdata/workers/http_worker.js b/cli/tests/testdata/workers/http_worker.js new file mode 100644 index 000000000..34603ed56 --- /dev/null +++ b/cli/tests/testdata/workers/http_worker.js @@ -0,0 +1,11 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +const listener = Deno.listen({ hostname: "127.0.0.1", port: 4506 }); +postMessage("ready"); +for await (const conn of listener) { + (async () => { + const requests = Deno.serveHttp(conn); + for await (const { respondWith } of requests) { + respondWith(new Response("Hello world")); + } + })(); +} diff --git a/cli/tests/testdata/workers/immediately_close_worker.js b/cli/tests/testdata/workers/immediately_close_worker.js new file mode 100644 index 000000000..8fd27343a --- /dev/null +++ b/cli/tests/testdata/workers/immediately_close_worker.js @@ -0,0 +1 @@ +self.close(); diff --git a/cli/tests/testdata/workers/message_port.ts b/cli/tests/testdata/workers/message_port.ts new file mode 100644 index 000000000..d78304a39 --- /dev/null +++ b/cli/tests/testdata/workers/message_port.ts @@ -0,0 +1,14 @@ +const channel = new MessageChannel(); + +channel.port2.onmessage = (e) => { + channel.port2.postMessage(e.data === "2"); + channel.port2.close(); +}; + +self.postMessage("1", [channel.port1]); + +self.onmessage = (e) => { + const port1 = e.ports[0]; + port1.postMessage(e.data === "3"); + port1.close(); +}; diff --git a/cli/tests/testdata/workers/nested_worker.js b/cli/tests/testdata/workers/nested_worker.js new file mode 100644 index 000000000..4b51b8763 --- /dev/null +++ b/cli/tests/testdata/workers/nested_worker.js @@ -0,0 +1,18 @@ +// Specifier should be resolved relative to current file +const jsWorker = new Worker( + new URL("sibling_worker.js", import.meta.url).href, + { type: "module", name: "sibling" }, +); + +jsWorker.onerror = (_e) => { + postMessage({ type: "error" }); +}; + +jsWorker.onmessage = (e) => { + postMessage({ type: "msg", text: e }); + close(); +}; + +onmessage = function (e) { + jsWorker.postMessage(e.data); +}; diff --git a/cli/tests/testdata/workers/no_permissions_worker.js b/cli/tests/testdata/workers/no_permissions_worker.js new file mode 100644 index 000000000..db0d911ac --- /dev/null +++ b/cli/tests/testdata/workers/no_permissions_worker.js @@ -0,0 +1,17 @@ +self.onmessage = async () => { + const hrtime = await Deno.permissions.query({ name: "hrtime" }); + const net = await Deno.permissions.query({ name: "net" }); + const ffi = await Deno.permissions.query({ name: "ffi" }); + const read = await Deno.permissions.query({ name: "read" }); + const run = await Deno.permissions.query({ name: "run" }); + const write = await Deno.permissions.query({ name: "write" }); + self.postMessage( + hrtime.state === "denied" && + net.state === "denied" && + ffi.state === "denied" && + read.state === "denied" && + run.state === "denied" && + write.state === "denied", + ); + self.close(); +}; diff --git a/cli/tests/testdata/workers/non_deno_worker.js b/cli/tests/testdata/workers/non_deno_worker.js new file mode 100644 index 000000000..773721560 --- /dev/null +++ b/cli/tests/testdata/workers/non_deno_worker.js @@ -0,0 +1,7 @@ +onmessage = function (e) { + if (typeof self.Deno !== "undefined") { + throw new Error("Deno namespace unexpectedly available in worker"); + } + + postMessage(e.data); +}; diff --git a/cli/tests/testdata/workers/nonexistent_worker.out b/cli/tests/testdata/workers/nonexistent_worker.out new file mode 100644 index 000000000..1651321bc --- /dev/null +++ b/cli/tests/testdata/workers/nonexistent_worker.out @@ -0,0 +1,3 @@ +[WILDCARD]error: Uncaught (in worker "") Cannot resolve module "file:///[WILDCARD]/workers/doesnt_exist.js". +error: Uncaught (in promise) Error: Unhandled error event reached main worker. + at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/testdata/workers/nonexistent_worker.ts b/cli/tests/testdata/workers/nonexistent_worker.ts new file mode 100644 index 000000000..8ebe29114 --- /dev/null +++ b/cli/tests/testdata/workers/nonexistent_worker.ts @@ -0,0 +1,5 @@ +const w = new Worker(new URL("doesnt_exist.js", import.meta.url).href, { + type: "module", +}); + +w.postMessage("hello"); diff --git a/cli/tests/testdata/workers/parent_read_check_granular_worker.js b/cli/tests/testdata/workers/parent_read_check_granular_worker.js new file mode 100644 index 000000000..1391190cd --- /dev/null +++ b/cli/tests/testdata/workers/parent_read_check_granular_worker.js @@ -0,0 +1,41 @@ +const worker = new Worker( + new URL("./read_check_granular_worker.js", import.meta.url).href, + { + type: "module", + deno: { + namespace: true, + permissions: { + read: [], + }, + }, + }, +); + +let received = 0; +const messages = []; + +worker.onmessage = ({ data: childResponse }) => { + received++; + postMessage({ + childHasPermission: childResponse.hasPermission, + index: childResponse.index, + parentHasPermission: messages[childResponse.index], + }); + if (received === messages.length) { + worker.terminate(); + } +}; + +onmessage = async ({ data }) => { + const { state } = await Deno.permissions.query({ + name: "read", + path: data.path, + }); + + messages[data.index] = state === "granted"; + + worker.postMessage({ + index: data.index, + route: data.route, + }); +}; diff --git a/cli/tests/testdata/workers/parent_read_check_worker.js b/cli/tests/testdata/workers/parent_read_check_worker.js new file mode 100644 index 000000000..ec92cca3f --- /dev/null +++ b/cli/tests/testdata/workers/parent_read_check_worker.js @@ -0,0 +1,27 @@ +onmessage = async () => { + const { state } = await Deno.permissions.query({ + name: "read", + }); + + const worker = new Worker( + new URL("./read_check_worker.js", import.meta.url).href, + { + type: "module", + deno: { + namespace: true, + permissions: { + read: false, + }, + }, + }, + ); + + worker.onmessage = ({ data: childHasPermission }) => { + postMessage({ + parentHasPermission: state === "granted", + childHasPermission, + }); + close(); + }; + worker.postMessage(null); +}; diff --git a/cli/tests/testdata/workers/permissions_blob_local.ts b/cli/tests/testdata/workers/permissions_blob_local.ts new file mode 100644 index 000000000..52f630bd8 --- /dev/null +++ b/cli/tests/testdata/workers/permissions_blob_local.ts @@ -0,0 +1,6 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +const code = `import "file:///${ + Deno.build.os == "windows" ? "C:/" : "" +}local_file.ts";`; +const blob = new Blob([code]); +new Worker(URL.createObjectURL(blob), { type: "module" }); diff --git a/cli/tests/testdata/workers/permissions_blob_local.ts.out b/cli/tests/testdata/workers/permissions_blob_local.ts.out new file mode 100644 index 000000000..0835777ec --- /dev/null +++ b/cli/tests/testdata/workers/permissions_blob_local.ts.out @@ -0,0 +1,4 @@ +error: Uncaught (in worker "") Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag + at blob:null/[WILDCARD]:1:0 +error: Uncaught (in promise) Error: Unhandled error event reached main worker. + at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/testdata/workers/permissions_blob_remote.ts b/cli/tests/testdata/workers/permissions_blob_remote.ts new file mode 100644 index 000000000..4808bc57b --- /dev/null +++ b/cli/tests/testdata/workers/permissions_blob_remote.ts @@ -0,0 +1,4 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +const code = `import "https://example.com/some/file.ts";`; +const blob = new Blob([code]); +new Worker(URL.createObjectURL(blob), { type: "module" }); diff --git a/cli/tests/testdata/workers/permissions_blob_remote.ts.out b/cli/tests/testdata/workers/permissions_blob_remote.ts.out new file mode 100644 index 000000000..2d01458ca --- /dev/null +++ b/cli/tests/testdata/workers/permissions_blob_remote.ts.out @@ -0,0 +1,4 @@ +error: Uncaught (in worker "") Requires net access to "example.com", run again with the --allow-net flag + at blob:null/[WILDCARD]:1:0 +error: Uncaught (in promise) Error: Unhandled error event reached main worker. + at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/testdata/workers/permissions_data_local.ts b/cli/tests/testdata/workers/permissions_data_local.ts new file mode 100644 index 000000000..cda80bed6 --- /dev/null +++ b/cli/tests/testdata/workers/permissions_data_local.ts @@ -0,0 +1,7 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +const code = `import "file:///${ + Deno.build.os == "windows" ? "C:/" : "" +}local_file.ts";`; +new Worker(`data:application/javascript;base64,${btoa(code)}`, { + type: "module", +}); diff --git a/cli/tests/testdata/workers/permissions_data_local.ts.out b/cli/tests/testdata/workers/permissions_data_local.ts.out new file mode 100644 index 000000000..2a6be2b57 --- /dev/null +++ b/cli/tests/testdata/workers/permissions_data_local.ts.out @@ -0,0 +1,4 @@ +error: Uncaught (in worker "") Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag + at data:application/javascript;base64,[WILDCARD]:1:0 +error: Uncaught (in promise) Error: Unhandled error event reached main worker. + at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/testdata/workers/permissions_data_remote.ts b/cli/tests/testdata/workers/permissions_data_remote.ts new file mode 100644 index 000000000..b37bd661d --- /dev/null +++ b/cli/tests/testdata/workers/permissions_data_remote.ts @@ -0,0 +1,5 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +const code = `import "https://example.com/some/file.ts";`; +new Worker(`data:application/javascript;base64,${btoa(code)}`, { + type: "module", +}); diff --git a/cli/tests/testdata/workers/permissions_data_remote.ts.out b/cli/tests/testdata/workers/permissions_data_remote.ts.out new file mode 100644 index 000000000..90677892a --- /dev/null +++ b/cli/tests/testdata/workers/permissions_data_remote.ts.out @@ -0,0 +1,4 @@ +error: Uncaught (in worker "") Requires net access to "example.com", run again with the --allow-net flag + at data:application/javascript;base64,aW1wb3J0ICJodHRwczovL2V4YW1wbGUuY29tL3NvbWUvZmlsZS50cyI7:1:0 +error: Uncaught (in promise) Error: Unhandled error event reached main worker. + at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/testdata/workers/permissions_dynamic_remote.ts b/cli/tests/testdata/workers/permissions_dynamic_remote.ts new file mode 100644 index 000000000..54a361bc0 --- /dev/null +++ b/cli/tests/testdata/workers/permissions_dynamic_remote.ts @@ -0,0 +1,11 @@ +new Worker( + "http://localhost:4545/workers/dynamic_remote.ts", + { + type: "module", + deno: { + permissions: { + net: false, + }, + }, + }, +); diff --git a/cli/tests/testdata/workers/permissions_dynamic_remote.ts.out b/cli/tests/testdata/workers/permissions_dynamic_remote.ts.out new file mode 100644 index 000000000..3c4523ce0 --- /dev/null +++ b/cli/tests/testdata/workers/permissions_dynamic_remote.ts.out @@ -0,0 +1,6 @@ +error: Uncaught (in worker "") (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag +await import("https://example.com/some/file.ts"); +^ + at async http://localhost:4545/workers/dynamic_remote.ts:2:1 +[WILDCARD]error: Uncaught (in promise) Error: Unhandled error event reached main worker. + at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/testdata/workers/permissions_remote_remote.ts b/cli/tests/testdata/workers/permissions_remote_remote.ts new file mode 100644 index 000000000..4df2a8a5d --- /dev/null +++ b/cli/tests/testdata/workers/permissions_remote_remote.ts @@ -0,0 +1,3 @@ +new Worker("http://localhost:4545/workers/static_remote.ts", { + type: "module", +}); diff --git a/cli/tests/testdata/workers/permissions_remote_remote.ts.out b/cli/tests/testdata/workers/permissions_remote_remote.ts.out new file mode 100644 index 000000000..94a92c72d --- /dev/null +++ b/cli/tests/testdata/workers/permissions_remote_remote.ts.out @@ -0,0 +1,4 @@ +error: Uncaught (in worker "") Requires net access to "example.com", run again with the --allow-net flag + at http://localhost:4545/workers/static_remote.ts:2:0 +error: Uncaught (in promise) Error: Unhandled error event reached main worker. + at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/testdata/workers/post_undefined.ts b/cli/tests/testdata/workers/post_undefined.ts new file mode 100644 index 000000000..1b9b8d6ca --- /dev/null +++ b/cli/tests/testdata/workers/post_undefined.ts @@ -0,0 +1,5 @@ +self.onmessage = (ev: MessageEvent) => { + console.log("received in worker", ev.data); + self.postMessage(undefined); + console.log("posted from worker"); +}; diff --git a/cli/tests/testdata/workers/racy_worker.js b/cli/tests/testdata/workers/racy_worker.js new file mode 100644 index 000000000..0f66c6278 --- /dev/null +++ b/cli/tests/testdata/workers/racy_worker.js @@ -0,0 +1,25 @@ +// See issue for details +// https://github.com/denoland/deno/issues/4080 +// +// After first received message, this worker schedules +// [assert(), close(), assert()] ops on the same turn of microtask queue +// All tasks after close should not make it + +onmessage = async function () { + let stage = 0; + await new Promise((_) => { + setTimeout(() => { + if (stage !== 0) throw "Unexpected stage"; + stage = 1; + }, 50); + setTimeout(() => { + if (stage !== 1) throw "Unexpected stage"; + stage = 2; + postMessage("DONE"); + close(); + }, 50); + setTimeout(() => { + throw "This should not be run"; + }, 50); + }); +}; diff --git a/cli/tests/testdata/workers/read_check_granular_worker.js b/cli/tests/testdata/workers/read_check_granular_worker.js new file mode 100644 index 000000000..25f2058b3 --- /dev/null +++ b/cli/tests/testdata/workers/read_check_granular_worker.js @@ -0,0 +1,11 @@ +onmessage = async ({ data }) => { + const { state } = await Deno.permissions.query({ + name: "read", + path: data.path, + }); + + postMessage({ + hasPermission: state === "granted", + index: data.index, + }); +}; diff --git a/cli/tests/testdata/workers/read_check_worker.js b/cli/tests/testdata/workers/read_check_worker.js new file mode 100644 index 000000000..2ad01bf5b --- /dev/null +++ b/cli/tests/testdata/workers/read_check_worker.js @@ -0,0 +1,7 @@ +onmessage = async () => { + const { state } = await Deno.permissions.query({ + name: "read", + }); + postMessage(state === "granted"); + close(); +}; diff --git a/cli/tests/testdata/workers/shared_array_buffer.ts b/cli/tests/testdata/workers/shared_array_buffer.ts new file mode 100644 index 000000000..4af95863a --- /dev/null +++ b/cli/tests/testdata/workers/shared_array_buffer.ts @@ -0,0 +1,9 @@ +self.postMessage("ready"); + +globalThis.addEventListener("message", (e) => { + const bytes1 = new Uint8Array(e.data[0]); + const bytes2 = new Uint8Array(e.data[1]); + bytes1[0] = 1; + bytes2[0] = 2; + self.postMessage("done"); +}); diff --git a/cli/tests/testdata/workers/sibling_worker.js b/cli/tests/testdata/workers/sibling_worker.js new file mode 100644 index 000000000..99707e5d6 --- /dev/null +++ b/cli/tests/testdata/workers/sibling_worker.js @@ -0,0 +1,4 @@ +onmessage = (e) => { + postMessage(e.data); + close(); +}; diff --git a/cli/tests/testdata/workers/static_remote.ts b/cli/tests/testdata/workers/static_remote.ts new file mode 100644 index 000000000..2d6e820fd --- /dev/null +++ b/cli/tests/testdata/workers/static_remote.ts @@ -0,0 +1,2 @@ +// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +import "https://example.com/some/file.ts"; diff --git a/cli/tests/testdata/workers/test.ts b/cli/tests/testdata/workers/test.ts new file mode 100644 index 000000000..9d3855fe1 --- /dev/null +++ b/cli/tests/testdata/workers/test.ts @@ -0,0 +1,852 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +// Requires to be run with `--allow-net` flag + +import { + assert, + assertEquals, + assertThrows, +} from "../../../../test_util/std/testing/asserts.ts"; +import { deferred } from "../../../../test_util/std/async/deferred.ts"; +import { fromFileUrl } from "../../../../test_util/std/path/mod.ts"; + +Deno.test({ + name: "worker terminate", + fn: async function () { + const promise = deferred(); + + const jsWorker = new Worker( + new URL("test_worker.js", import.meta.url).href, + { type: "module" }, + ); + const tsWorker = new Worker( + new URL("test_worker.ts", import.meta.url).href, + { type: "module", name: "tsWorker" }, + ); + + tsWorker.onmessage = (e) => { + assertEquals(e.data, "Hello World"); + promise.resolve(); + }; + + jsWorker.onmessage = (e) => { + assertEquals(e.data, "Hello World"); + tsWorker.postMessage("Hello World"); + }; + + jsWorker.onerror = (e: Event) => { + e.preventDefault(); + jsWorker.postMessage("Hello World"); + }; + + jsWorker.postMessage("Hello World"); + await promise; + tsWorker.terminate(); + jsWorker.terminate(); + }, +}); + +Deno.test({ + name: "worker from data url", + async fn() { + const promise = deferred(); + const tsWorker = new Worker( + "data:application/typescript;base64,aWYgKHNlbGYubmFtZSAhPT0gInRzV29ya2VyIikgewogIHRocm93IEVycm9yKGBJbnZhbGlkIHdvcmtlciBuYW1lOiAke3NlbGYubmFtZX0sIGV4cGVjdGVkIHRzV29ya2VyYCk7Cn0KCm9ubWVzc2FnZSA9IGZ1bmN0aW9uIChlKTogdm9pZCB7CiAgcG9zdE1lc3NhZ2UoZS5kYXRhKTsKICBjbG9zZSgpOwp9Owo=", + { type: "module", name: "tsWorker" }, + ); + + tsWorker.onmessage = (e) => { + assertEquals(e.data, "Hello World"); + promise.resolve(); + }; + + tsWorker.postMessage("Hello World"); + + await promise; + tsWorker.terminate(); + }, +}); + +Deno.test({ + name: "worker nested", + fn: async function () { + const promise = deferred(); + + const nestedWorker = new Worker( + new URL("nested_worker.js", import.meta.url).href, + { type: "module", name: "nested" }, + ); + + nestedWorker.onmessage = (e) => { + assert(e.data.type !== "error"); + promise.resolve(); + }; + + nestedWorker.postMessage("Hello World"); + await promise; + nestedWorker.terminate(); + }, +}); + +Deno.test({ + name: "worker throws when executing", + fn: async function () { + const promise = deferred(); + const throwingWorker = new Worker( + new URL("throwing_worker.js", import.meta.url).href, + { type: "module" }, + ); + + // deno-lint-ignore no-explicit-any + throwingWorker.onerror = (e: any) => { + e.preventDefault(); + assert(/Uncaught Error: Thrown error/.test(e.message)); + promise.resolve(); + }; + + await promise; + throwingWorker.terminate(); + }, +}); + +Deno.test({ + name: "worker globals", + fn: async function () { + const promise = deferred(); + const workerOptions: WorkerOptions = { type: "module" }; + const w = new Worker( + new URL("worker_globals.ts", import.meta.url).href, + workerOptions, + ); + w.onmessage = (e) => { + assertEquals(e.data, "true, true, true, true"); + promise.resolve(); + }; + w.postMessage("Hello, world!"); + await promise; + w.terminate(); + }, +}); + +Deno.test({ + name: "worker fetch API", + fn: async function () { + const promise = deferred(); + + const fetchingWorker = new Worker( + new URL("fetching_worker.js", import.meta.url).href, + { type: "module" }, + ); + + // deno-lint-ignore no-explicit-any + fetchingWorker.onerror = (e: any) => { + e.preventDefault(); + promise.reject(e.message); + }; + + // Defer promise.resolve() to allow worker to shut down + fetchingWorker.onmessage = (e) => { + assert(e.data === "Done!"); + promise.resolve(); + }; + + await promise; + fetchingWorker.terminate(); + }, +}); + +Deno.test({ + name: "worker terminate busy loop", + fn: async function () { + const promise = deferred(); + + const busyWorker = new Worker( + new URL("busy_worker.js", import.meta.url), + { type: "module" }, + ); + + let testResult = 0; + + busyWorker.onmessage = (e) => { + testResult = e.data; + if (testResult >= 10000) { + busyWorker.terminate(); + busyWorker.onmessage = (_e) => { + throw new Error("unreachable"); + }; + setTimeout(() => { + assertEquals(testResult, 10000); + promise.resolve(); + }, 100); + } + }; + + busyWorker.postMessage("ping"); + await promise; + }, +}); + +Deno.test({ + name: "worker race condition", + fn: async function () { + // See issue for details + // https://github.com/denoland/deno/issues/4080 + const promise = deferred(); + + const racyWorker = new Worker( + new URL("racy_worker.js", import.meta.url), + { type: "module" }, + ); + + racyWorker.onmessage = (_e) => { + setTimeout(() => { + promise.resolve(); + }, 100); + }; + + racyWorker.postMessage("START"); + await promise; + }, +}); + +Deno.test({ + name: "worker is event listener", + fn: async function () { + let messageHandlersCalled = 0; + let errorHandlersCalled = 0; + + const promise1 = deferred(); + const promise2 = deferred(); + + const worker = new Worker( + new URL("event_worker.js", import.meta.url), + { type: "module" }, + ); + + worker.onmessage = (_e: Event) => { + messageHandlersCalled++; + }; + worker.addEventListener("message", (_e: Event) => { + messageHandlersCalled++; + }); + worker.addEventListener("message", (_e: Event) => { + messageHandlersCalled++; + promise1.resolve(); + }); + + worker.onerror = (e) => { + errorHandlersCalled++; + e.preventDefault(); + }; + worker.addEventListener("error", (_e: Event) => { + errorHandlersCalled++; + }); + worker.addEventListener("error", (_e: Event) => { + errorHandlersCalled++; + promise2.resolve(); + }); + + worker.postMessage("ping"); + await promise1; + assertEquals(messageHandlersCalled, 3); + + worker.postMessage("boom"); + await promise2; + assertEquals(errorHandlersCalled, 3); + worker.terminate(); + }, +}); + +Deno.test({ + name: "worker scope is event listener", + fn: async function () { + const promise1 = deferred(); + + const worker = new Worker( + new URL("event_worker_scope.js", import.meta.url), + { type: "module" }, + ); + + worker.onmessage = (e: MessageEvent) => { + const { messageHandlersCalled, errorHandlersCalled } = e.data; + assertEquals(messageHandlersCalled, 4); + assertEquals(errorHandlersCalled, 4); + promise1.resolve(); + }; + + worker.onerror = (_e) => { + throw new Error("unreachable"); + }; + + worker.postMessage("boom"); + worker.postMessage("ping"); + await promise1; + worker.terminate(); + }, +}); + +Deno.test({ + name: "worker with Deno namespace", + fn: async function () { + const promise = deferred(); + const promise2 = deferred(); + + const regularWorker = new Worker( + new URL("non_deno_worker.js", import.meta.url), + { type: "module" }, + ); + const denoWorker = new Worker( + new URL("deno_worker.ts", import.meta.url), + { + type: "module", + deno: { + namespace: true, + permissions: "inherit", + }, + }, + ); + + regularWorker.onmessage = (e) => { + assertEquals(e.data, "Hello World"); + regularWorker.terminate(); + promise.resolve(); + }; + + denoWorker.onmessage = (e) => { + assertEquals(e.data, "Hello World"); + denoWorker.terminate(); + promise2.resolve(); + }; + + regularWorker.postMessage("Hello World"); + await promise; + denoWorker.postMessage("Hello World"); + await promise2; + }, +}); + +Deno.test({ + name: "worker with crypto in scope", + fn: async function () { + const promise = deferred(); + const w = new Worker( + new URL("worker_crypto.js", import.meta.url).href, + { type: "module" }, + ); + w.onmessage = (e) => { + assertEquals(e.data, true); + promise.resolve(); + }; + w.postMessage(null); + await promise; + w.terminate(); + }, +}); + +Deno.test({ + name: "Worker event handler order", + fn: async function () { + const promise = deferred(); + const w = new Worker( + new URL("test_worker.ts", import.meta.url).href, + { type: "module", name: "tsWorker" }, + ); + const arr: number[] = []; + w.addEventListener("message", () => arr.push(1)); + w.onmessage = (_e) => { + arr.push(2); + }; + w.addEventListener("message", () => arr.push(3)); + w.addEventListener("message", () => { + assertEquals(arr, [1, 2, 3]); + promise.resolve(); + }); + w.postMessage("Hello World"); + await promise; + w.terminate(); + }, +}); + +Deno.test({ + name: "Worker immediate close", + fn: async function () { + const promise = deferred(); + const w = new Worker( + new URL("./immediately_close_worker.js", import.meta.url).href, + { type: "module" }, + ); + setTimeout(() => { + promise.resolve(); + }, 1000); + await promise; + w.terminate(); + }, +}); + +Deno.test({ + name: "Worker post undefined", + fn: async function () { + const promise = deferred(); + const worker = new Worker( + new URL("./post_undefined.ts", import.meta.url).href, + { type: "module" }, + ); + + const handleWorkerMessage = (e: MessageEvent) => { + console.log("main <- worker:", e.data); + worker.terminate(); + promise.resolve(); + }; + + worker.addEventListener("messageerror", () => console.log("message error")); + worker.addEventListener("error", () => console.log("error")); + worker.addEventListener("message", handleWorkerMessage); + + console.log("\npost from parent"); + worker.postMessage(undefined); + await promise; + }, +}); + +Deno.test("Worker inherits permissions", async function () { + const promise = deferred(); + const worker = new Worker( + new URL("./read_check_worker.js", import.meta.url).href, + { + type: "module", + deno: { + namespace: true, + permissions: "inherit", + }, + }, + ); + + worker.onmessage = ({ data: hasPermission }) => { + assert(hasPermission); + promise.resolve(); + }; + + worker.postMessage(null); + + await promise; + worker.terminate(); +}); + +Deno.test("Worker limit children permissions", async function () { + const promise = deferred(); + const worker = new Worker( + new URL("./read_check_worker.js", import.meta.url).href, + { + type: "module", + deno: { + namespace: true, + permissions: { + read: false, + }, + }, + }, + ); + + worker.onmessage = ({ data: hasPermission }) => { + assert(!hasPermission); + promise.resolve(); + }; + + worker.postMessage(null); + + await promise; + worker.terminate(); +}); + +Deno.test("Worker limit children permissions granularly", async function () { + const promise = deferred(); + const worker = new Worker( + new URL("./read_check_granular_worker.js", import.meta.url).href, + { + type: "module", + deno: { + namespace: true, + permissions: { + read: [ + new URL("./read_check_worker.js", import.meta.url), + ], + }, + }, + }, + ); + + //Routes are relative to the spawned worker location + const routes = [ + { + permission: false, + path: fromFileUrl( + new URL("read_check_granular_worker.js", import.meta.url), + ), + }, + { + permission: true, + path: fromFileUrl(new URL("read_check_worker.js", import.meta.url)), + }, + ]; + + let checked = 0; + worker.onmessage = ({ data }) => { + checked++; + assertEquals(data.hasPermission, routes[data.index].permission); + routes.shift(); + if (checked === routes.length) { + promise.resolve(); + } + }; + + routes.forEach(({ path }, index) => + worker.postMessage({ + index, + path, + }) + ); + + await promise; + worker.terminate(); +}); + +Deno.test("Nested worker limit children permissions", async function () { + const promise = deferred(); + + /** This worker has read permissions but doesn't grant them to its children */ + const worker = new Worker( + new URL("./parent_read_check_worker.js", import.meta.url).href, + { + type: "module", + deno: { + namespace: true, + permissions: "inherit", + }, + }, + ); + + worker.onmessage = ({ data }) => { + assert(data.parentHasPermission); + assert(!data.childHasPermission); + promise.resolve(); + }; + + worker.postMessage(null); + + await promise; + worker.terminate(); +}); + +Deno.test("Nested worker limit children permissions granularly", async function () { + const promise = deferred(); + + /** This worker has read permissions but doesn't grant them to its children */ + const worker = new Worker( + new URL("./parent_read_check_granular_worker.js", import.meta.url) + .href, + { + type: "module", + deno: { + namespace: true, + permissions: { + read: [ + new URL("./read_check_granular_worker.js", import.meta.url), + ], + }, + }, + }, + ); + + //Routes are relative to the spawned worker location + const routes = [ + { + childHasPermission: false, + parentHasPermission: true, + path: fromFileUrl( + new URL("read_check_granular_worker.js", import.meta.url), + ), + }, + { + childHasPermission: false, + parentHasPermission: false, + path: fromFileUrl(new URL("read_check_worker.js", import.meta.url)), + }, + ]; + + let checked = 0; + worker.onmessage = ({ data }) => { + checked++; + assertEquals( + data.childHasPermission, + routes[data.index].childHasPermission, + ); + assertEquals( + data.parentHasPermission, + routes[data.index].parentHasPermission, + ); + if (checked === routes.length) { + promise.resolve(); + } + }; + + // Index needed cause requests will be handled asynchronously + routes.forEach(({ path }, index) => + worker.postMessage({ + index, + path, + }) + ); + + await promise; + worker.terminate(); +}); + +// This test relies on env permissions not being granted on main thread +Deno.test("Worker initialization throws on worker permissions greater than parent thread permissions", function () { + assertThrows( + () => { + const worker = new Worker( + new URL("./deno_worker.ts", import.meta.url).href, + { + type: "module", + deno: { + namespace: true, + permissions: { + env: true, + }, + }, + }, + ); + worker.terminate(); + }, + Deno.errors.PermissionDenied, + "Can't escalate parent thread permissions", + ); +}); + +Deno.test("Worker with disabled permissions", async function () { + const promise = deferred(); + + const worker = new Worker( + new URL("./no_permissions_worker.js", import.meta.url).href, + { + type: "module", + deno: { + namespace: true, + permissions: "none", + }, + }, + ); + + worker.onmessage = ({ data: sandboxed }) => { + assert(sandboxed); + promise.resolve(); + }; + + worker.postMessage(null); + await promise; + worker.terminate(); +}); + +Deno.test({ + name: "worker location", + fn: async function () { + const promise = deferred(); + const workerModuleHref = + new URL("worker_location.ts", import.meta.url).href; + const w = new Worker(workerModuleHref, { type: "module" }); + w.onmessage = (e) => { + assertEquals(e.data, `${workerModuleHref}, true`); + promise.resolve(); + }; + w.postMessage("Hello, world!"); + await promise; + w.terminate(); + }, +}); + +Deno.test({ + name: "worker with relative specifier", + fn: async function () { + assertEquals(location.href, "http://127.0.0.1:4545/"); + const promise = deferred(); + const w = new Worker( + "./workers/test_worker.ts", + { type: "module", name: "tsWorker" }, + ); + w.onmessage = (e) => { + assertEquals(e.data, "Hello, world!"); + promise.resolve(); + }; + w.postMessage("Hello, world!"); + await promise; + w.terminate(); + }, +}); + +Deno.test({ + name: "Worker with top-level-await", + fn: async function () { + const result = deferred(); + const worker = new Worker( + new URL("worker_with_top_level_await.ts", import.meta.url).href, + { type: "module" }, + ); + worker.onmessage = (e) => { + if (e.data == "ready") { + worker.postMessage("trigger worker handler"); + } else if (e.data == "triggered worker handler") { + result.resolve(); + } else { + result.reject(new Error("Handler didn't run during top-level delay.")); + } + }; + await result; + worker.terminate(); + }, +}); + +Deno.test({ + name: "Worker with native HTTP", + fn: async function () { + const result = deferred(); + const worker = new Worker( + new URL( + "./http_worker.js", + import.meta.url, + ).href, + { + type: "module", + deno: { + namespace: true, + permissions: "inherit", + }, + }, + ); + worker.onmessage = () => { + result.resolve(); + }; + await result; + + assert(worker); + const response = await fetch("http://localhost:4506"); + assert(await response.arrayBuffer()); + worker.terminate(); + }, +}); + +Deno.test({ + name: "structured cloning postMessage", + fn: async function () { + const result = deferred(); + const worker = new Worker( + new URL("worker_structured_cloning.ts", import.meta.url).href, + { type: "module" }, + ); + + worker.onmessage = (e) => { + // self field should reference itself (circular ref) + const value = e.data.self.self.self; + + // fields a and b refer to the same array + assertEquals(value.a, ["a", true, 432]); + assertEquals(value.a, ["a", true, 432]); + value.b[0] = "b"; + value.a[2] += 5; + assertEquals(value.a, ["b", true, 437]); + assertEquals(value.b, ["b", true, 437]); + + const len = value.c.size; + value.c.add(1); // This value is already in the set. + value.c.add(2); + assertEquals(len + 1, value.c.size); + + result.resolve(); + }; + + worker.postMessage("START"); + await result; + worker.terminate(); + }, +}); + +Deno.test({ + name: "worker with relative specifier", + fn: async function () { + assertEquals(location.href, "http://127.0.0.1:4545/"); + const promise = deferred(); + const w = new Worker( + "./workers/test_worker.ts", + { type: "module", name: "tsWorker" }, + ); + w.onmessage = (e) => { + assertEquals(e.data, "Hello, world!"); + promise.resolve(); + }; + w.postMessage("Hello, world!"); + await promise; + w.terminate(); + }, +}); + +Deno.test({ + name: "worker SharedArrayBuffer", + fn: async function () { + const promise = deferred(); + const workerOptions: WorkerOptions = { type: "module" }; + const w = new Worker( + new URL("shared_array_buffer.ts", import.meta.url).href, + workerOptions, + ); + const sab1 = new SharedArrayBuffer(1); + const sab2 = new SharedArrayBuffer(1); + const bytes1 = new Uint8Array(sab1); + const bytes2 = new Uint8Array(sab2); + assertEquals(bytes1[0], 0); + assertEquals(bytes2[0], 0); + w.onmessage = () => { + w.postMessage([sab1, sab2]); + w.onmessage = () => { + assertEquals(bytes1[0], 1); + assertEquals(bytes2[0], 2); + promise.resolve(); + }; + }; + await promise; + w.terminate(); + }, +}); + +Deno.test({ + name: "Send MessagePorts from / to workers", + fn: async function () { + const result = deferred(); + const worker = new Worker( + new URL("message_port.ts", import.meta.url).href, + { type: "module" }, + ); + + const channel = new MessageChannel(); + + worker.onmessage = (e) => { + assertEquals(e.data, "1"); + assertEquals(e.ports.length, 1); + const port1 = e.ports[0]; + port1.onmessage = (e) => { + assertEquals(e.data, true); + port1.close(); + worker.postMessage("3", [channel.port1]); + }; + port1.postMessage("2"); + }; + + channel.port2.onmessage = (e) => { + assertEquals(e.data, true); + channel.port2.close(); + result.resolve(); + }; + + await result; + worker.terminate(); + }, +}); diff --git a/cli/tests/testdata/workers/test.ts.out b/cli/tests/testdata/workers/test.ts.out new file mode 100644 index 000000000..1b4238a9b --- /dev/null +++ b/cli/tests/testdata/workers/test.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +test result: ok. [WILDCARD] passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]ms) + diff --git a/cli/tests/testdata/workers/test_worker.js b/cli/tests/testdata/workers/test_worker.js new file mode 100644 index 000000000..4260975a6 --- /dev/null +++ b/cli/tests/testdata/workers/test_worker.js @@ -0,0 +1,19 @@ +let thrown = false; + +if (self.name !== "") { + throw Error(`Bad worker name: ${self.name}, expected empty string.`); +} + +onmessage = function (e) { + if (thrown === false) { + thrown = true; + throw new SyntaxError("[test error]"); + } + + postMessage(e.data); + close(); +}; + +onerror = function () { + return false; +}; diff --git a/cli/tests/testdata/workers/test_worker.ts b/cli/tests/testdata/workers/test_worker.ts new file mode 100644 index 000000000..996476058 --- /dev/null +++ b/cli/tests/testdata/workers/test_worker.ts @@ -0,0 +1,8 @@ +if (self.name !== "tsWorker") { + throw Error(`Invalid worker name: ${self.name}, expected tsWorker`); +} + +onmessage = function (e) { + postMessage(e.data); + close(); +}; diff --git a/cli/tests/testdata/workers/throwing_worker.js b/cli/tests/testdata/workers/throwing_worker.js new file mode 100644 index 000000000..56ee4ff88 --- /dev/null +++ b/cli/tests/testdata/workers/throwing_worker.js @@ -0,0 +1,2 @@ +// This worker just throws error when it's being executed +throw Error("Thrown error"); diff --git a/cli/tests/testdata/workers/worker_crypto.js b/cli/tests/testdata/workers/worker_crypto.js new file mode 100644 index 000000000..4398ad068 --- /dev/null +++ b/cli/tests/testdata/workers/worker_crypto.js @@ -0,0 +1,5 @@ +self.crypto.getRandomValues(new Uint8Array(16)); + +onmessage = function () { + postMessage(!!self.crypto); +}; diff --git a/cli/tests/testdata/workers/worker_error.ts b/cli/tests/testdata/workers/worker_error.ts new file mode 100644 index 000000000..696680de8 --- /dev/null +++ b/cli/tests/testdata/workers/worker_error.ts @@ -0,0 +1,5 @@ +const worker = new Worker( + new URL("error.ts", import.meta.url).href, + { type: "module", name: "bar" }, +); +setTimeout(() => worker.terminate(), 30000); diff --git a/cli/tests/testdata/workers/worker_error.ts.out b/cli/tests/testdata/workers/worker_error.ts.out new file mode 100644 index 000000000..4a8e92f00 --- /dev/null +++ b/cli/tests/testdata/workers/worker_error.ts.out @@ -0,0 +1,5 @@ +[WILDCARD]error: Uncaught (in worker "bar") Error: foo[WILDCARD] + at foo ([WILDCARD]) + at [WILDCARD] +error: Uncaught (in promise) Error: Unhandled error event reached main worker. + at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/testdata/workers/worker_event_handlers.js b/cli/tests/testdata/workers/worker_event_handlers.js new file mode 100644 index 000000000..c8976f79e --- /dev/null +++ b/cli/tests/testdata/workers/worker_event_handlers.js @@ -0,0 +1,23 @@ +self.onmessage = (evt) => { + console.log("Target from self.onmessage:", String(evt.target)); +}; + +self.addEventListener("message", (evt) => { + console.log("Target from message event listener:", String(evt.target)); + + // Throw an error here so the global's error event will fire. + throw new Error("Some error message"); +}); + +self.onerror = (...args) => { + console.log("Arguments from self.onerror:", args); + return true; +}; + +self.addEventListener("error", (evt) => { + // Returning true from self.onerror means that subsequent event listeners + // should see the event as canceled. + console.log("Is event canceled?:", evt.defaultPrevented); + + self.close(); +}); diff --git a/cli/tests/testdata/workers/worker_globals.ts b/cli/tests/testdata/workers/worker_globals.ts new file mode 100644 index 000000000..90e369e41 --- /dev/null +++ b/cli/tests/testdata/workers/worker_globals.ts @@ -0,0 +1,13 @@ +onmessage = function () { + postMessage( + [ + self instanceof DedicatedWorkerGlobalScope, + self instanceof WorkerGlobalScope, + self instanceof EventTarget, + // TODO(nayeemrmn): Add `WorkerNavigator` to deno_lint globals. + // deno-lint-ignore no-undef + navigator instanceof WorkerNavigator, + ].join(", "), + ); + close(); +}; diff --git a/cli/tests/testdata/workers/worker_large_message.js b/cli/tests/testdata/workers/worker_large_message.js new file mode 100644 index 000000000..a1ddae4f9 --- /dev/null +++ b/cli/tests/testdata/workers/worker_large_message.js @@ -0,0 +1,14 @@ +// Copyright 2020 the Deno authors. All rights reserved. MIT license. + +const dataSmall = ""; +const dataLarge = "x".repeat(10 * 1024); + +onmessage = function (_e) { + for (let i = 0; i <= 10; i++) { + if (i % 2 == 0) { + postMessage(dataLarge); + } else { + postMessage(dataSmall); + } + } +}; diff --git a/cli/tests/testdata/workers/worker_location.ts b/cli/tests/testdata/workers/worker_location.ts new file mode 100644 index 000000000..c3c1bb26f --- /dev/null +++ b/cli/tests/testdata/workers/worker_location.ts @@ -0,0 +1,6 @@ +onmessage = function () { + postMessage( + `${location.href}, ${location instanceof WorkerLocation}`, + ); + close(); +}; diff --git a/cli/tests/testdata/workers/worker_nested_error.ts b/cli/tests/testdata/workers/worker_nested_error.ts new file mode 100644 index 000000000..aba2011be --- /dev/null +++ b/cli/tests/testdata/workers/worker_nested_error.ts @@ -0,0 +1,5 @@ +const worker = new Worker( + new URL("worker_error.ts", import.meta.url).href, + { type: "module", name: "baz" }, +); +setTimeout(() => worker.terminate(), 30000); diff --git a/cli/tests/testdata/workers/worker_nested_error.ts.out b/cli/tests/testdata/workers/worker_nested_error.ts.out new file mode 100644 index 000000000..4a8e92f00 --- /dev/null +++ b/cli/tests/testdata/workers/worker_nested_error.ts.out @@ -0,0 +1,5 @@ +[WILDCARD]error: Uncaught (in worker "bar") Error: foo[WILDCARD] + at foo ([WILDCARD]) + at [WILDCARD] +error: Uncaught (in promise) Error: Unhandled error event reached main worker. + at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/testdata/workers/worker_structured_cloning.ts b/cli/tests/testdata/workers/worker_structured_cloning.ts new file mode 100644 index 000000000..eb1719a9a --- /dev/null +++ b/cli/tests/testdata/workers/worker_structured_cloning.ts @@ -0,0 +1,15 @@ +// More info on structured cloning can be found here: +// https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm + +self.onmessage = () => { + const arr = ["a", true, 432]; + const set = new Set([1, 3, 5, 7, 9]); + const selfReference = { + a: arr, + b: arr, + c: set, + }; + // deno-lint-ignore no-explicit-any + (selfReference as any).self = selfReference; + self.postMessage(selfReference); +}; diff --git a/cli/tests/testdata/workers/worker_types.ts b/cli/tests/testdata/workers/worker_types.ts new file mode 100644 index 000000000..b67a3b782 --- /dev/null +++ b/cli/tests/testdata/workers/worker_types.ts @@ -0,0 +1,4 @@ +// deno-lint-ignore require-await +self.onmessage = async (_msg: MessageEvent) => { + self.postMessage("hello"); +}; diff --git a/cli/tests/testdata/workers/worker_unstable.ts b/cli/tests/testdata/workers/worker_unstable.ts new file mode 100644 index 000000000..a5b5f7ba2 --- /dev/null +++ b/cli/tests/testdata/workers/worker_unstable.ts @@ -0,0 +1,5 @@ +console.log(Deno.permissions.query); +console.log(Deno.emit); +self.onmessage = () => { + self.close(); +}; diff --git a/cli/tests/testdata/workers/worker_with_top_level_await.ts b/cli/tests/testdata/workers/worker_with_top_level_await.ts new file mode 100644 index 000000000..1d20bb736 --- /dev/null +++ b/cli/tests/testdata/workers/worker_with_top_level_await.ts @@ -0,0 +1,15 @@ +function delay(ms: number) { + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, ms); + }); +} + +onmessage = (_e: MessageEvent) => { + postMessage("triggered worker handler"); + close(); +}; +postMessage("ready"); +await delay(1000); +postMessage("never"); diff --git a/cli/tests/testdata/x_deno_warning.js b/cli/tests/testdata/x_deno_warning.js new file mode 100644 index 000000000..34b950566 --- /dev/null +++ b/cli/tests/testdata/x_deno_warning.js @@ -0,0 +1 @@ +console.log("testing x-deno-warning header"); diff --git a/cli/tests/text_decoder_perf.js b/cli/tests/text_decoder_perf.js deleted file mode 100644 index 2e52b1f8b..000000000 --- a/cli/tests/text_decoder_perf.js +++ /dev/null @@ -1,38 +0,0 @@ -const mixed = new TextEncoder().encode("@Ä€à¹ðŸ˜€"); - -function generateRandom(bytes) { - const result = new Uint8Array(bytes); - let i = 0; - while (i < bytes) { - const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); - switch (toAdd) { - case 0: - result[i] = mixed[0]; - i++; - break; - case 1: - result[i] = mixed[1]; - result[i + 1] = mixed[2]; - i += 2; - break; - case 2: - result[i] = mixed[3]; - result[i + 1] = mixed[4]; - result[i + 2] = mixed[5]; - i += 3; - break; - case 3: - result[i] = mixed[6]; - result[i + 1] = mixed[7]; - result[i + 2] = mixed[8]; - result[i + 3] = mixed[9]; - i += 4; - break; - } - } - return result; -} - -const randomData = generateRandom(1024); -const decoder = new TextDecoder(); -for (let i = 0; i < 10_000; i++) decoder.decode(randomData); diff --git a/cli/tests/text_encoder_into_perf.js b/cli/tests/text_encoder_into_perf.js deleted file mode 100644 index 8d60e9f00..000000000 --- a/cli/tests/text_encoder_into_perf.js +++ /dev/null @@ -1,34 +0,0 @@ -const mixed = "@Ä€à¹ðŸ˜€"; - -function generateRandom(bytes) { - let result = ""; - let i = 0; - while (i < bytes) { - const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); - switch (toAdd) { - case 0: - result += mixed[0]; - i++; - break; - case 1: - result += mixed[1]; - i++; - break; - case 2: - result += mixed[2]; - i++; - break; - case 3: - result += mixed[3]; - result += mixed[4]; - i += 2; - break; - } - } - return result; -} - -const randomData = generateRandom(1024); -const encoder = new TextEncoder(); -const targetBuffer = new Uint8Array(randomData.length * 4); -for (let i = 0; i < 10_000; i++) encoder.encodeInto(randomData, targetBuffer); diff --git a/cli/tests/text_encoder_perf.js b/cli/tests/text_encoder_perf.js deleted file mode 100644 index 6f61f019e..000000000 --- a/cli/tests/text_encoder_perf.js +++ /dev/null @@ -1,33 +0,0 @@ -const mixed = "@Ä€à¹ðŸ˜€"; - -function generateRandom(bytes) { - let result = ""; - let i = 0; - while (i < bytes) { - const toAdd = Math.floor(Math.random() * Math.min(4, bytes - i)); - switch (toAdd) { - case 0: - result += mixed[0]; - i++; - break; - case 1: - result += mixed[1]; - i++; - break; - case 2: - result += mixed[2]; - i++; - break; - case 3: - result += mixed[3]; - result += mixed[4]; - i += 2; - break; - } - } - return result; -} - -const randomData = generateRandom(1024); -const encoder = new TextEncoder(); -for (let i = 0; i < 10_000; i++) encoder.encode(randomData); diff --git a/cli/tests/tla/a.js b/cli/tests/tla/a.js deleted file mode 100644 index c3ef3f7db..000000000 --- a/cli/tests/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/cli/tests/tla/b.js b/cli/tests/tla/b.js deleted file mode 100644 index 3271c92d8..000000000 --- a/cli/tests/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/cli/tests/tla/c.js b/cli/tests/tla/c.js deleted file mode 100644 index 806eb0a8b..000000000 --- a/cli/tests/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/cli/tests/tla/d.js b/cli/tests/tla/d.js deleted file mode 100644 index 283ebf817..000000000 --- a/cli/tests/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/cli/tests/tla/order.js b/cli/tests/tla/order.js deleted file mode 100644 index f213a562c..000000000 --- a/cli/tests/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/cli/tests/tla/parent.js b/cli/tests/tla/parent.js deleted file mode 100644 index 1ecc15463..000000000 --- a/cli/tests/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/cli/tests/tla2/a.js b/cli/tests/tla2/a.js deleted file mode 100644 index d07bcb94d..000000000 --- a/cli/tests/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/cli/tests/tla2/b.js b/cli/tests/tla2/b.js deleted file mode 100644 index 68e357c1e..000000000 --- a/cli/tests/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/cli/tests/tla3/b.js b/cli/tests/tla3/b.js deleted file mode 100644 index b74c659e4..000000000 --- a/cli/tests/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../top_level_await_circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/cli/tests/tla3/timeout_loop.js b/cli/tests/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2a..000000000 --- a/cli/tests/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/cli/tests/tls.out b/cli/tests/tls.out deleted file mode 100644 index c8e8a135c..000000000 --- a/cli/tests/tls.out +++ /dev/null @@ -1 +0,0 @@ -DONE diff --git a/cli/tests/tls/README.md b/cli/tests/tls/README.md deleted file mode 100644 index 19bbaec35..000000000 --- a/cli/tests/tls/README.md +++ /dev/null @@ -1,47 +0,0 @@ -The certificates in this dir expire on Sept, 27th, 2118 - -Certificates generated using original instructions from this gist: -https://gist.github.com/cecilemuller/9492b848eb8fe46d462abeb26656c4f8 - -## Certificate authority (CA) - -Generate RootCA.pem, RootCA.key, RootCA.crt: - -```shell -openssl req -x509 -nodes -new -sha256 -days 36135 -newkey rsa:2048 -keyout RootCA.key -out RootCA.pem -subj "/C=US/CN=Example-Root-CA" -openssl x509 -outform pem -in RootCA.pem -out RootCA.crt -``` - -Note that Example-Root-CA is an example, you can customize the name. - -## Domain name certificate - -First, create a file domains.txt that lists all your local domains (here we only -list localhost): - -```shell -authorityKeyIdentifier=keyid,issuer -basicConstraints=CA:FALSE -keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment -subjectAltName = @alt_names -[alt_names] -DNS.1 = localhost -``` - -Generate localhost.key, localhost.csr, and localhost.crt: - -```shell -openssl req -new -nodes -newkey rsa:2048 -keyout localhost.key -out localhost.csr -subj "/C=US/ST=YourState/L=YourCity/O=Example-Certificates/CN=localhost.local" -openssl x509 -req -sha256 -days 36135 -in localhost.csr -CA RootCA.pem -CAkey RootCA.key -CAcreateserial -extfile domains.txt -out localhost.crt -``` - -Note that the country / state / city / name in the first command can be -customized. - -For testing purposes we need following files: - -- `RootCA.crt` -- `RootCA.key` -- `RootCA.pem` -- `localhost.crt` -- `localhost.key` diff --git a/cli/tests/tls/RootCA.crt b/cli/tests/tls/RootCA.crt deleted file mode 100644 index c2f84ceeb..000000000 --- a/cli/tests/tls/RootCA.crt +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDIzCCAgugAwIBAgIJAMKPPW4tsOymMA0GCSqGSIb3DQEBCwUAMCcxCzAJBgNV -BAYTAlVTMRgwFgYDVQQDDA9FeGFtcGxlLVJvb3QtQ0EwIBcNMTkxMDIxMTYyODIy -WhgPMjExODA5MjcxNjI4MjJaMCcxCzAJBgNVBAYTAlVTMRgwFgYDVQQDDA9FeGFt -cGxlLVJvb3QtQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMH/IO -2qtHfyBKwANNPB4K0q5JVSg8XxZdRpTTlz0CwU0oRO3uHrI52raCCfVeiQutyZop -eFZTDWeXGudGAFA2B5m3orWt0s+touPi8MzjsG2TQ+WSI66QgbXTNDitDDBtTVcV -5G3Ic+3SppQAYiHSekLISnYWgXLl+k5CnEfTowg6cjqjVr0KjL03cTN3H7b+6+0S -ws4rYbW1j4ExR7K6BFNH6572yq5qR20E6GqlY+EcOZpw4CbCk9lS8/CWuXze/vMs -OfDcc6K+B625d27wyEGZHedBomT2vAD7sBjvO8hn/DP1Qb46a8uCHR6NSfnJ7bXO -G1igaIbgY1zXirNdAgMBAAGjUDBOMB0GA1UdDgQWBBTzut+pwwDfqmMYcI9KNWRD -hxcIpTAfBgNVHSMEGDAWgBTzut+pwwDfqmMYcI9KNWRDhxcIpTAMBgNVHRMEBTAD -AQH/MA0GCSqGSIb3DQEBCwUAA4IBAQB9AqSbZ+hEglAgSHxAMCqRFdhVu7MvaQM0 -P090mhGlOCt3yB7kdGfsIrUW6nQcTz7PPQFRaJMrFHPvFvPootkBUpTYR4hTkdce -H6RCRu2Jxl4Y9bY/uezd9YhGCYfUtfjA6/TH9FcuZfttmOOlxOt01XfNvVMIR6RM -z/AYhd+DeOXjr35F/VHeVpnk+55L0PYJsm1CdEbOs5Hy1ecR7ACuDkXnbM4fpz9I -kyIWJwk2zJReKcJMgi1aIinDM9ao/dca1G99PHOw8dnr4oyoTiv8ao6PWiSRHHMi -MNf4EgWfK+tZMnuqfpfO9740KzfcVoMNo4QJD4yn5YxroUOO/Azi ------END CERTIFICATE----- diff --git a/cli/tests/tls/RootCA.key b/cli/tests/tls/RootCA.key deleted file mode 100644 index 98ce53b0b..000000000 --- a/cli/tests/tls/RootCA.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDMH/IO2qtHfyBK -wANNPB4K0q5JVSg8XxZdRpTTlz0CwU0oRO3uHrI52raCCfVeiQutyZopeFZTDWeX -GudGAFA2B5m3orWt0s+touPi8MzjsG2TQ+WSI66QgbXTNDitDDBtTVcV5G3Ic+3S -ppQAYiHSekLISnYWgXLl+k5CnEfTowg6cjqjVr0KjL03cTN3H7b+6+0Sws4rYbW1 -j4ExR7K6BFNH6572yq5qR20E6GqlY+EcOZpw4CbCk9lS8/CWuXze/vMsOfDcc6K+ -B625d27wyEGZHedBomT2vAD7sBjvO8hn/DP1Qb46a8uCHR6NSfnJ7bXOG1igaIbg -Y1zXirNdAgMBAAECggEASvdsicILZ42ryWgtjj8G9Yick7gft9RgPU9/txnzQUDG -2oQ+Mda6M/88ShPoNpj0XhYNdS+J3KSup9MsnwvcaYtvC/9I5BbpSObq9NzlErYn -+A7WkE5kfRP2OCQUsJEqc+oUkqi7HQRekp+0+VMRAuD+B9s49VkDXq0H8vS8eF/e -J9nj6c/RTK+Er5ccG5jSLrSy3kiIjAN1a6OIU/YPjPx7qv8ZZ6TLeRtvc8PV++cH -wB1qapZg5cuKge9UEcg+WINCkD2n9iK1jKC1ULYsiuwUR6LX9YHLUwr6S5/Dwwqc -Vb9nmftqJtCz+McrqRCdfeqSNGi0tjVEX7i+DtfZrQKBgQD7firgBE7nb53VDirG -W8Leo6EhCS/hCZFo0QhSBUCeOpmSaMsCzUIlqqPIBIQXir0AtBno/qXYiIJ4HgUB -lScrK+7KUirEO8o4x6xC2hbPk/A7fTgf0G5Mvj2TRidiLGGIupuRHeyjigiGa0mG -yWLoil6MJX44usnE49qDVy77/wKBgQDPyHThAugFSsVedxy29NQx7Zp8s/htpGHZ -wYksbunz+NlO/xzRvSu2OAps/WD6F+3KhCB5fV2tESVs7u2oQPLcjmIpurDtATWE -DJAAvcBl1L+cpQGN4D8zUrrZO8rw01sUZSv+kAnfsC01exzZe64+VDl3a1cYZkDT -A9RmbF/AowKBgDTYVxQJc7cH6idZub1CjNkRkwsJDimARDC9M71gYyqcb6anJHlr -PgoCKDYgVM1Jlttt/L/Lunecf6XT0QN7HubgbWXQDDJ9yclSk6zcfMyTbnhhoIh2 -2KaBlxi6Ng5X+wqrA4NjwVS/7XipVKLg8EqiwKk8O6CaB0m7AzB0AmhrAoGAcGsi -YYNzCTn1IzEKxiocjI7jYMj2hkvD7U766qFvzuI6oLUCYLAa8FHNwj4ss+Mycrmd -4F1ly3dVamSzDK9nNtGKZs1tYC2hSLqLRvtjFzVOHnBgMOS9DQWbtmDVYgrYYmaC -sQ45aV8mdqMPbtOt6GclWGkpDDh2pjSSPIAyJkUCgYAHw7dKqYO/YQPKmswVZm5t -TelfdJJG6GCXnFryyqo4pmEMy/i5kzF1t9Cnchhx/WeU+wGxrWd3RMP/sqP7MW9q -6Ie9Jj2vk4lUBoeFKk+kLeBUr+TkLSdcVEI0DSOdX681AUmxkVzVjGKYeiNa+V6u -XmgzS8JEYoMbNEAKXYX2qg== ------END PRIVATE KEY----- diff --git a/cli/tests/tls/RootCA.pem b/cli/tests/tls/RootCA.pem deleted file mode 100644 index c2f84ceeb..000000000 --- a/cli/tests/tls/RootCA.pem +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDIzCCAgugAwIBAgIJAMKPPW4tsOymMA0GCSqGSIb3DQEBCwUAMCcxCzAJBgNV -BAYTAlVTMRgwFgYDVQQDDA9FeGFtcGxlLVJvb3QtQ0EwIBcNMTkxMDIxMTYyODIy -WhgPMjExODA5MjcxNjI4MjJaMCcxCzAJBgNVBAYTAlVTMRgwFgYDVQQDDA9FeGFt -cGxlLVJvb3QtQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMH/IO -2qtHfyBKwANNPB4K0q5JVSg8XxZdRpTTlz0CwU0oRO3uHrI52raCCfVeiQutyZop -eFZTDWeXGudGAFA2B5m3orWt0s+touPi8MzjsG2TQ+WSI66QgbXTNDitDDBtTVcV -5G3Ic+3SppQAYiHSekLISnYWgXLl+k5CnEfTowg6cjqjVr0KjL03cTN3H7b+6+0S -ws4rYbW1j4ExR7K6BFNH6572yq5qR20E6GqlY+EcOZpw4CbCk9lS8/CWuXze/vMs -OfDcc6K+B625d27wyEGZHedBomT2vAD7sBjvO8hn/DP1Qb46a8uCHR6NSfnJ7bXO -G1igaIbgY1zXirNdAgMBAAGjUDBOMB0GA1UdDgQWBBTzut+pwwDfqmMYcI9KNWRD -hxcIpTAfBgNVHSMEGDAWgBTzut+pwwDfqmMYcI9KNWRDhxcIpTAMBgNVHRMEBTAD -AQH/MA0GCSqGSIb3DQEBCwUAA4IBAQB9AqSbZ+hEglAgSHxAMCqRFdhVu7MvaQM0 -P090mhGlOCt3yB7kdGfsIrUW6nQcTz7PPQFRaJMrFHPvFvPootkBUpTYR4hTkdce -H6RCRu2Jxl4Y9bY/uezd9YhGCYfUtfjA6/TH9FcuZfttmOOlxOt01XfNvVMIR6RM -z/AYhd+DeOXjr35F/VHeVpnk+55L0PYJsm1CdEbOs5Hy1ecR7ACuDkXnbM4fpz9I -kyIWJwk2zJReKcJMgi1aIinDM9ao/dca1G99PHOw8dnr4oyoTiv8ao6PWiSRHHMi -MNf4EgWfK+tZMnuqfpfO9740KzfcVoMNo4QJD4yn5YxroUOO/Azi ------END CERTIFICATE----- diff --git a/cli/tests/tls/domains.txt b/cli/tests/tls/domains.txt deleted file mode 100644 index 0bba95d33..000000000 --- a/cli/tests/tls/domains.txt +++ /dev/null @@ -1,6 +0,0 @@ -authorityKeyIdentifier=keyid,issuer -basicConstraints=CA:FALSE -keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment -subjectAltName = @alt_names -[alt_names] -DNS.1 = localhost diff --git a/cli/tests/tls/localhost.crt b/cli/tests/tls/localhost.crt deleted file mode 100644 index a71ae9050..000000000 --- a/cli/tests/tls/localhost.crt +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDajCCAlKgAwIBAgIJAOPyQVdy/UpPMA0GCSqGSIb3DQEBCwUAMCcxCzAJBgNV -BAYTAlVTMRgwFgYDVQQDDA9FeGFtcGxlLVJvb3QtQ0EwIBcNMTkxMDIxMTYyODU4 -WhgPMjExODA5MjcxNjI4NThaMG0xCzAJBgNVBAYTAlVTMRIwEAYDVQQIDAlZb3Vy -U3RhdGUxETAPBgNVBAcMCFlvdXJDaXR5MR0wGwYDVQQKDBRFeGFtcGxlLUNlcnRp -ZmljYXRlczEYMBYGA1UEAwwPbG9jYWxob3N0LmxvY2FsMIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEAz9svjVdf5jihUBtofd84XKdb8dEHQRJfDNKaJ4Ar -baqMHAdnqi/fWtlqEEMn8gweZ7+4hshECY5mnx4Hhy7IAbePDsTTbSm01dChhlxF -uvd9QuvzvrqSjSq+v4Jlau+pQIhUzzV12dF5bFvrIrGWxCZp+W7lLDZI6Pd6Su+y -ZIeiwrUaPMzdUePNf2hZI/IvWCUMCIyoqrrKHdHoPuvQCW17IyxsnFQJNbmN+Rtp -BQilhtwvBbggCBWhHxEdiqBaZHDw6Zl+bU7ejx1mu9A95wpQ9SCL2cRkAlz2LDOy -wznrTAwGcvqvFKxlV+3HsaD7rba4kCA1Ihp5mm/dS2k94QIDAQABo1EwTzAfBgNV -HSMEGDAWgBTzut+pwwDfqmMYcI9KNWRDhxcIpTAJBgNVHRMEAjAAMAsGA1UdDwQE -AwIE8DAUBgNVHREEDTALgglsb2NhbGhvc3QwDQYJKoZIhvcNAQELBQADggEBAKVu -vVpu5nPGAGn1SX4FQUcbn9Z5wgBkjnZxfJHJQX4sYIRlcirZviPHCZGPWex4VHC+ -lFMm+70YEN2uoe5jGrdgcugzx2Amc7/mLrsvvpMsaS0PlxNMcqhdM1WHbGjjdNln -XICVITSKnB1fSGH6uo9CMCWw5kgPS9o4QWrLLkxnds3hoz7gVEUyi/6V65mcfFNA -lof9iKcK9JsSHdBs35vpv7UKLX+96RM7Nm2Mu0yue5JiS79/zuMA/Kryxot4jv5z -ecdWFl0eIyQBZmBzMw2zPUqkxEnXLiKjV8jutEg/4qovTOB6YiA41qbARXdzNA2V -FYuchcTcWmnmVVRFyyU= ------END CERTIFICATE----- diff --git a/cli/tests/tls/localhost.key b/cli/tests/tls/localhost.key deleted file mode 100644 index 42774c977..000000000 --- a/cli/tests/tls/localhost.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDP2y+NV1/mOKFQ -G2h93zhcp1vx0QdBEl8M0pongCttqowcB2eqL99a2WoQQyfyDB5nv7iGyEQJjmaf -HgeHLsgBt48OxNNtKbTV0KGGXEW6931C6/O+upKNKr6/gmVq76lAiFTPNXXZ0Xls -W+sisZbEJmn5buUsNkjo93pK77Jkh6LCtRo8zN1R481/aFkj8i9YJQwIjKiqusod -0eg+69AJbXsjLGycVAk1uY35G2kFCKWG3C8FuCAIFaEfER2KoFpkcPDpmX5tTt6P -HWa70D3nClD1IIvZxGQCXPYsM7LDOetMDAZy+q8UrGVX7cexoPuttriQIDUiGnma -b91LaT3hAgMBAAECggEBAJABfn+BQorBP1m9s3ZJmcXvmW7+7/SwYrQCkRS+4te2 -6h1dMAAj7K4HpUkhDeLPbJ1aoeCXjTPFuemRp4uL6Lvvzahgy059L7FXOyFYemMf -pmQgDx5cKr6tF7yc/eDJrExuZ7urgTvouiRNxqmhuh+psZBDuXkZHwhwtQSH7uNg -KBDKu0qWO73vFLcLckdGEU3+H9oIWs5xcvvOkWzyvHbRGFJSihgcRpPPHodF5xB9 -T/gZIoJHMmCbUMlWaSasUyNXTuvCnkvBDol8vXrMJCVzKZj9GpPDcIFdc08GSn4I -pTdSNwzUcHbdERzdVU28Xt+t6W5rvp/4FWrssi4IzkUCgYEA//ZcEcBguRD4OFrx -6wbSjzCcUW1NWhzA8uTOORZi4SvndcH1cU4S2wznuHNubU1XlrGwJX6PUGebmY/l -53B5PJvStbVtZCVIxllR+ZVzRuL8wLodRHzlYH8GOzHwoa4ivSupkzl72ij1u/tI -NMLGfYEKVdNd8zXIESUY88NszvsCgYEAz+MDp3xOhFaCe+CPv80A592cJcfzc8Al -+rahEOu+VdN2QBZf86PIf2Bfv/t0QvnRvs1z648TuH6h83YSggOAbmfHyd789jkq -UWlktIaXbVn+VaHmPTcBWTg3ZTlvG+fiFCbZXiYhm+UUf1MDqZHdiifAoyVIjV/Z -YhCNJo3q39MCgYEAknrpK5t9fstwUcfyA/9OhnVaL9suVjB4V0iLn+3ovlXCywgp -ryLv9X3IKi2c9144jtu3I23vFCOGz3WjKzSZnQ7LogNmy9XudNxu5jcZ1mpWHPEl -iKk1F2j6Juwoek5OQRX4oHFYKHwiTOa75r3Em9Q6Fu20KVgQ24bwZafj3/sCgYAy -k0AoVw2jFIjaKl/Ogclen4OFjYek+XJD9Hpq62964d866Dafx5DXrFKfGkXGpZBp -owI4pK5fjC9KU8dc6g0szwLEEgPowy+QbtuZL8VXTTWbD7A75E3nrs2LStXFLDzM -OkdXqF801h6Oe1vAvUPwgItVJZTpEBCK0wwD/TLPEQKBgQDRkhlTtAoHW7W6STd0 -A/OWc0dxhzMurpxg0bLgCqUjw1ESGrSCGhffFn0IWa8sv19VWsZuBhTgjNatZsYB -AhDs/6OosT/3nJoh2/t0hYDj1FBI0lPXWYD4pesuZ5yIMrmSaAOtIzp4BGY7ui8N -wOqcq/jdiHj/MKEdqOXy3YAJrA== ------END PRIVATE KEY----- diff --git a/cli/tests/tls_connecttls.js b/cli/tests/tls_connecttls.js deleted file mode 100644 index 1ef6b99ee..000000000 --- a/cli/tests/tls_connecttls.js +++ /dev/null @@ -1,67 +0,0 @@ -import { deferred } from "../../test_util/std/async/deferred.ts"; -import { assert, assertEquals } from "../../test_util/std/testing/asserts.ts"; -import { BufReader, BufWriter } from "../../test_util/std/io/bufio.ts"; -import { TextProtoReader } from "../../test_util/std/textproto/mod.ts"; - -const encoder = new TextEncoder(); -const decoder = new TextDecoder(); - -const resolvable = deferred(); -const hostname = "localhost"; -const port = 3505; - -const listener = Deno.listenTls({ - hostname, - port, - certFile: "./tls/localhost.crt", - keyFile: "./tls/localhost.key", -}); - -const response = encoder.encode( - "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", -); - -listener.accept().then( - async (conn) => { - assert(conn.remoteAddr != null); - assert(conn.localAddr != null); - await conn.write(response); - // TODO(bartlomieju): this might be a bug - setTimeout(() => { - conn.close(); - resolvable.resolve(); - }, 0); - }, -); - -const conn = await Deno.connectTls({ - hostname, - port, -}); -assert(conn.rid > 0); -const w = new BufWriter(conn); -const r = new BufReader(conn); -const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`; -const writeResult = await w.write(encoder.encode(body)); -assertEquals(body.length, writeResult); -await w.flush(); -const tpr = new TextProtoReader(r); -const statusLine = await tpr.readLine(); -assert(statusLine !== null, `line must be read: ${String(statusLine)}`); -const m = statusLine.match(/^(.+?) (.+?) (.+?)$/); -assert(m !== null, "must be matched"); -const [_, proto, status, ok] = m; -assertEquals(proto, "HTTP/1.1"); -assertEquals(status, "200"); -assertEquals(ok, "OK"); -const headers = await tpr.readMIMEHeader(); -assert(headers !== null); -const contentLength = parseInt(headers.get("content-length")); -const bodyBuf = new Uint8Array(contentLength); -await r.readFull(bodyBuf); -assertEquals(decoder.decode(bodyBuf), "Hello World\n"); -conn.close(); -listener.close(); -await resolvable; - -console.log("DONE"); diff --git a/cli/tests/tls_starttls.js b/cli/tests/tls_starttls.js deleted file mode 100644 index 652ba869f..000000000 --- a/cli/tests/tls_starttls.js +++ /dev/null @@ -1,65 +0,0 @@ -import { deferred } from "../../test_util/std/async/deferred.ts"; -import { assert, assertEquals } from "../../test_util/std/testing/asserts.ts"; -import { BufReader, BufWriter } from "../../test_util/std/io/bufio.ts"; -import { TextProtoReader } from "../../test_util/std/textproto/mod.ts"; - -const encoder = new TextEncoder(); -const decoder = new TextDecoder(); - -const resolvable = deferred(); -const hostname = "localhost"; -const port = 3504; - -const listener = Deno.listenTls({ - hostname, - port, - certFile: "./tls/localhost.crt", - keyFile: "./tls/localhost.key", -}); - -const response = encoder.encode( - "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", -); - -listener.accept().then( - async (conn) => { - assert(conn.remoteAddr != null); - assert(conn.localAddr != null); - await conn.write(response); - // TODO(bartlomieju): this might be a bug - setTimeout(() => { - conn.close(); - resolvable.resolve(); - }, 0); - }, -); - -let conn = await Deno.connect({ hostname, port }); -conn = await Deno.startTls(conn, { hostname }); -assert(conn.rid > 0); -const w = new BufWriter(conn); -const r = new BufReader(conn); -const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`; -const writeResult = await w.write(encoder.encode(body)); -assertEquals(body.length, writeResult); -await w.flush(); -const tpr = new TextProtoReader(r); -const statusLine = await tpr.readLine(); -assert(statusLine !== null, `line must be read: ${String(statusLine)}`); -const m = statusLine.match(/^(.+?) (.+?) (.+?)$/); -assert(m !== null, "must be matched"); -const [_, proto, status, ok] = m; -assertEquals(proto, "HTTP/1.1"); -assertEquals(status, "200"); -assertEquals(ok, "OK"); -const headers = await tpr.readMIMEHeader(); -assert(headers !== null); -const contentLength = parseInt(headers.get("content-length")); -const bodyBuf = new Uint8Array(contentLength); -await r.readFull(bodyBuf); -assertEquals(decoder.decode(bodyBuf), "Hello World\n"); -conn.close(); -listener.close(); -await resolvable; - -console.log("DONE"); diff --git a/cli/tests/top_level_await.js b/cli/tests/top_level_await.js deleted file mode 100644 index af6fbd662..000000000 --- a/cli/tests/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/cli/tests/top_level_await.out b/cli/tests/top_level_await.out deleted file mode 100644 index 4b65d15fe..000000000 --- a/cli/tests/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/cli/tests/top_level_await.ts b/cli/tests/top_level_await.ts deleted file mode 100644 index 65de253ea..000000000 --- a/cli/tests/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/cli/tests/top_level_await_circular.js b/cli/tests/top_level_await_circular.js deleted file mode 100644 index ff2964b6a..000000000 --- a/cli/tests/top_level_await_circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/cli/tests/top_level_await_circular.out b/cli/tests/top_level_await_circular.out deleted file mode 100644 index 3b453122e..000000000 --- a/cli/tests/top_level_await_circular.out +++ /dev/null @@ -1,9 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promise. -Pending dynamic modules: -- [WILDCARD]tests/tla3/b.js diff --git a/cli/tests/top_level_await_loop.js b/cli/tests/top_level_await_loop.js deleted file mode 100644 index 384f8d0ed..000000000 --- a/cli/tests/top_level_await_loop.js +++ /dev/null @@ -1,18 +0,0 @@ -const importsDir = Deno.readDirSync(Deno.realPathSync("./tla2")); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/cli/tests/top_level_await_loop.out b/cli/tests/top_level_await_loop.out deleted file mode 100644 index 70e621e45..000000000 --- a/cli/tests/top_level_await_loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded Module { default: [Function: Foo] } -loading [WILDCARD]b.js -loaded Module { default: [Function: Bar] } -all loaded diff --git a/cli/tests/top_level_await_nested.out b/cli/tests/top_level_await_nested.out deleted file mode 100644 index 8a1218a10..000000000 --- a/cli/tests/top_level_await_nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/cli/tests/top_level_await_nested/a.js b/cli/tests/top_level_await_nested/a.js deleted file mode 100644 index 74837d4ba..000000000 --- a/cli/tests/top_level_await_nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/cli/tests/top_level_await_nested/b.js b/cli/tests/top_level_await_nested/b.js deleted file mode 100644 index 3bd241b50..000000000 --- a/cli/tests/top_level_await_nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/cli/tests/top_level_await_nested/main.js b/cli/tests/top_level_await_nested/main.js deleted file mode 100644 index ed46a4717..000000000 --- a/cli/tests/top_level_await_nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/cli/tests/top_level_await_order.js b/cli/tests/top_level_await_order.js deleted file mode 100644 index 30659cdfb..000000000 --- a/cli/tests/top_level_await_order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/cli/tests/top_level_await_order.out b/cli/tests/top_level_await_order.out deleted file mode 100644 index 4cc27858c..000000000 --- a/cli/tests/top_level_await_order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/cli/tests/top_level_await_unresolved.js b/cli/tests/top_level_await_unresolved.js deleted file mode 100644 index 231a8cd63..000000000 --- a/cli/tests/top_level_await_unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/cli/tests/top_level_await_unresolved.out b/cli/tests/top_level_await_unresolved.out deleted file mode 100644 index 77395f5d0..000000000 --- a/cli/tests/top_level_await_unresolved.out +++ /dev/null @@ -1 +0,0 @@ -error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promise. diff --git a/cli/tests/top_level_for_await.js b/cli/tests/top_level_for_await.js deleted file mode 100644 index a330f6c71..000000000 --- a/cli/tests/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/cli/tests/top_level_for_await.out b/cli/tests/top_level_for_await.out deleted file mode 100644 index 4539bbf2d..000000000 --- a/cli/tests/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/cli/tests/top_level_for_await.ts b/cli/tests/top_level_for_await.ts deleted file mode 100644 index 9179322d7..000000000 --- a/cli/tests/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/cli/tests/ts_decorators.ts b/cli/tests/ts_decorators.ts deleted file mode 100644 index 95fba6cd4..000000000 --- a/cli/tests/ts_decorators.ts +++ /dev/null @@ -1,14 +0,0 @@ -// deno-lint-ignore-file - -function Decorate() { - return function (constructor: any): any { - return class extends constructor { - protected someField: string = "asdf"; - }; - }; -} - -@Decorate() -class SomeClass {} - -console.log(new SomeClass()); diff --git a/cli/tests/ts_decorators.ts.out b/cli/tests/ts_decorators.ts.out deleted file mode 100644 index 381c7a809..000000000 --- a/cli/tests/ts_decorators.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Check [WILDCARD] -{ someField: "asdf" } diff --git a/cli/tests/ts_decorators_bundle.out b/cli/tests/ts_decorators_bundle.out deleted file mode 100644 index a5b77b7bf..000000000 --- a/cli/tests/ts_decorators_bundle.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD] -function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { -[WILDCARD] -new SomeClass().test(); -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/ts_decorators_bundle.ts b/cli/tests/ts_decorators_bundle.ts deleted file mode 100644 index 72120b2ec..000000000 --- a/cli/tests/ts_decorators_bundle.ts +++ /dev/null @@ -1,25 +0,0 @@ -// deno-lint-ignore-file - -import { B } from "./subdir/more_decorators.ts"; - -function Decorator() { - return function ( - target: Record, - propertyKey: string, - descriptor: TypedPropertyDescriptor, - ) { - const originalFn: Function = descriptor.value as Function; - descriptor.value = async function (...args: any[]) { - return await originalFn.apply(this, args); - }; - return descriptor; - }; -} - -class SomeClass { - @Decorator() - async test() {} -} - -new SomeClass().test(); -new B().method(); diff --git a/cli/tests/ts_import_from_js.deps.js b/cli/tests/ts_import_from_js.deps.js deleted file mode 100644 index bfea5ac79..000000000 --- a/cli/tests/ts_import_from_js.deps.js +++ /dev/null @@ -1,2 +0,0 @@ -import "./005_more_imports.ts"; -export { printHello } from "http://localhost:4545/cli/tests/subdir/mod2.ts"; diff --git a/cli/tests/ts_import_from_js.js b/cli/tests/ts_import_from_js.js deleted file mode 100644 index f912c2723..000000000 --- a/cli/tests/ts_import_from_js.js +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello } from "./ts_import_from_js.deps.js"; -printHello(); -console.log("success"); diff --git a/cli/tests/ts_import_from_js.js.out b/cli/tests/ts_import_from_js.js.out deleted file mode 100644 index e1d7a869f..000000000 --- a/cli/tests/ts_import_from_js.js.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello -Hello -success diff --git a/cli/tests/ts_type_imports.ts b/cli/tests/ts_type_imports.ts deleted file mode 100644 index 73c779156..000000000 --- a/cli/tests/ts_type_imports.ts +++ /dev/null @@ -1,5 +0,0 @@ -// deno-lint-ignore-file - -type Foo = import("./ts_type_imports_foo.ts").Foo; - -const foo: Foo = new Map(); diff --git a/cli/tests/ts_type_imports.ts.out b/cli/tests/ts_type_imports.ts.out deleted file mode 100644 index 3972d6a97..000000000 --- a/cli/tests/ts_type_imports.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -Check [WILDCARD]ts_type_imports.ts -error: TS2322 [ERROR]: Type 'Map' is not assignable to type 'Foo'. - Type 'string' is not assignable to type 'number'. -const foo: Foo = new Map(); - ~~~ - at [WILDCARD]ts_type_imports.ts:5:7 diff --git a/cli/tests/ts_type_imports_foo.ts b/cli/tests/ts_type_imports_foo.ts deleted file mode 100644 index db20773f6..000000000 --- a/cli/tests/ts_type_imports_foo.ts +++ /dev/null @@ -1 +0,0 @@ -export type Foo = Map; diff --git a/cli/tests/ts_type_only_import.d.ts b/cli/tests/ts_type_only_import.d.ts deleted file mode 100644 index d48e4b48a..000000000 --- a/cli/tests/ts_type_only_import.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface HelloWorld { - a: string; -} diff --git a/cli/tests/ts_type_only_import.ts b/cli/tests/ts_type_only_import.ts deleted file mode 100644 index 53e114373..000000000 --- a/cli/tests/ts_type_only_import.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./ts_type_only_import.d.ts"; diff --git a/cli/tests/ts_type_only_import.ts.out b/cli/tests/ts_type_only_import.ts.out deleted file mode 100644 index f808ed21a..000000000 --- a/cli/tests/ts_type_only_import.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -Check [WILDCARD]ts_type_only_import.ts -warning: Compiled module not found "[WILDCARD]ts_type_only_import.d.ts" - From: [WILDCARD]ts_type_only_import.ts - If the source module contains only types, use `import type` and `export type` to import it instead. diff --git a/cli/tests/ts_with_generic.ts b/cli/tests/ts_with_generic.ts deleted file mode 100644 index 1e3591f40..000000000 --- a/cli/tests/ts_with_generic.ts +++ /dev/null @@ -1,3 +0,0 @@ -// deno-lint-ignore-file - -const foo = { delete() {} }; diff --git a/cli/tests/tsc/a.js b/cli/tests/tsc/a.js deleted file mode 100644 index 5a7b3ff93..000000000 --- a/cli/tests/tsc/a.js +++ /dev/null @@ -1,2 +0,0 @@ -import { v4 } from "./d.ts"; -export function a() {} diff --git a/cli/tests/tsc/d.ts b/cli/tests/tsc/d.ts deleted file mode 100644 index 3c74b8c83..000000000 --- a/cli/tests/tsc/d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function v4() { - return "hello"; -} diff --git a/cli/tests/tsc/node_modules/b.js b/cli/tests/tsc/node_modules/b.js deleted file mode 100644 index 191660935..000000000 --- a/cli/tests/tsc/node_modules/b.js +++ /dev/null @@ -1,2 +0,0 @@ -import c from "./c.js"; -export { c }; diff --git a/cli/tests/tsc/node_modules/c.js b/cli/tests/tsc/node_modules/c.js deleted file mode 100644 index cff71c44a..000000000 --- a/cli/tests/tsc/node_modules/c.js +++ /dev/null @@ -1 +0,0 @@ -export default function c() {} diff --git a/cli/tests/tsc/test.js b/cli/tests/tsc/test.js deleted file mode 100644 index b7f46b351..000000000 --- a/cli/tests/tsc/test.js +++ /dev/null @@ -1,4 +0,0 @@ -import { a } from "./a.js"; -import { c } from "./node_modules/b.js"; - -console.log("hello"); diff --git a/cli/tests/tsc2/file_exportc.ts b/cli/tests/tsc2/file_exportc.ts deleted file mode 100644 index efcc5bb46..000000000 --- a/cli/tests/tsc2/file_exportc.ts +++ /dev/null @@ -1 +0,0 @@ -export * as c from "https://deno.land/x/c.js"; diff --git a/cli/tests/tsc2/file_libref.ts b/cli/tests/tsc2/file_libref.ts deleted file mode 100644 index 6f37da139..000000000 --- a/cli/tests/tsc2/file_libref.ts +++ /dev/null @@ -1,8 +0,0 @@ -// deno-lint-ignore-file -/// -/// -/// - -export const div = document.createElement("div"); -div.innerHTML = `Hello World!`; -console.log(Deno.args); diff --git a/cli/tests/tsc2/file_main.ts b/cli/tests/tsc2/file_main.ts deleted file mode 100644 index a45477fde..000000000 --- a/cli/tests/tsc2/file_main.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("hello deno"); diff --git a/cli/tests/tsc2/file_reexports.ts b/cli/tests/tsc2/file_reexports.ts deleted file mode 100644 index b26297423..000000000 --- a/cli/tests/tsc2/file_reexports.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as c from "./exportc.ts"; - -console.log(c.c); diff --git a/cli/tests/tsc2/https_deno.land-x-a.ts b/cli/tests/tsc2/https_deno.land-x-a.ts deleted file mode 100644 index 72b3a67bc..000000000 --- a/cli/tests/tsc2/https_deno.land-x-a.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as b from "./b.ts"; - -console.log(b); diff --git a/cli/tests/tsc2/https_deno.land-x-b.ts b/cli/tests/tsc2/https_deno.land-x-b.ts deleted file mode 100644 index 59d168993..000000000 --- a/cli/tests/tsc2/https_deno.land-x-b.ts +++ /dev/null @@ -1 +0,0 @@ -export const b = "b"; diff --git a/cli/tests/tsc2/https_deno.land-x-c.d.ts b/cli/tests/tsc2/https_deno.land-x-c.d.ts deleted file mode 100644 index bf3a09240..000000000 --- a/cli/tests/tsc2/https_deno.land-x-c.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const c: string; diff --git a/cli/tests/tsc2/https_deno.land-x-c.js b/cli/tests/tsc2/https_deno.land-x-c.js deleted file mode 100644 index 7f2cfac77..000000000 --- a/cli/tests/tsc2/https_deno.land-x-c.js +++ /dev/null @@ -1 +0,0 @@ -export const c = "c"; diff --git a/cli/tests/tsc2/https_deno.land-x-mod.ts b/cli/tests/tsc2/https_deno.land-x-mod.ts deleted file mode 100644 index a45477fde..000000000 --- a/cli/tests/tsc2/https_deno.land-x-mod.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("hello deno"); diff --git a/cli/tests/tsconfig.decorators.json b/cli/tests/tsconfig.decorators.json deleted file mode 100644 index 504cd646e..000000000 --- a/cli/tests/tsconfig.decorators.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "experimentalDecorators": true - } -} diff --git a/cli/tests/tsx_imports.ts b/cli/tests/tsx_imports.ts deleted file mode 100644 index 44ba10b7a..000000000 --- a/cli/tests/tsx_imports.ts +++ /dev/null @@ -1 +0,0 @@ -import "./Component.tsx"; diff --git a/cli/tests/tsx_imports.ts.out b/cli/tests/tsx_imports.ts.out deleted file mode 100644 index 1f8b10d32..000000000 --- a/cli/tests/tsx_imports.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -Check [WILDCARD]tsx_imports.ts -{ factory: [Function: View], props: null, children: [] } diff --git a/cli/tests/type_definitions.ts b/cli/tests/type_definitions.ts deleted file mode 100644 index a1bb37a65..000000000 --- a/cli/tests/type_definitions.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file - -// @deno-types="./type_definitions/foo.d.ts" -import { foo } from "./type_definitions/foo.js"; -// @deno-types="./type_definitions/fizz.d.ts" -import "./type_definitions/fizz.js"; - -import * as qat from "./type_definitions/qat.ts"; - -console.log(foo); -console.log(fizz); -console.log(qat.qat); diff --git a/cli/tests/type_definitions.ts.out b/cli/tests/type_definitions.ts.out deleted file mode 100644 index b4fa88c50..000000000 --- a/cli/tests/type_definitions.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]foo -fizz -qat diff --git a/cli/tests/type_definitions/bar.d.ts b/cli/tests/type_definitions/bar.d.ts deleted file mode 100644 index d43335dbb..000000000 --- a/cli/tests/type_definitions/bar.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -declare namespace bar { - export class Bar { - baz: string; - } -} diff --git a/cli/tests/type_definitions/bar.js b/cli/tests/type_definitions/bar.js deleted file mode 100644 index e9c2e5193..000000000 --- a/cli/tests/type_definitions/bar.js +++ /dev/null @@ -1,5 +0,0 @@ -export class Bar { - constructor() { - this.baz = "baz"; - } -} diff --git a/cli/tests/type_definitions/fizz.d.ts b/cli/tests/type_definitions/fizz.d.ts deleted file mode 100644 index 34eb41b96..000000000 --- a/cli/tests/type_definitions/fizz.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/** A global value. */ -declare const fizz: string; diff --git a/cli/tests/type_definitions/fizz.js b/cli/tests/type_definitions/fizz.js deleted file mode 100644 index 852162c94..000000000 --- a/cli/tests/type_definitions/fizz.js +++ /dev/null @@ -1 +0,0 @@ -globalThis.fizz = "fizz"; diff --git a/cli/tests/type_definitions/foo.d.ts b/cli/tests/type_definitions/foo.d.ts deleted file mode 100644 index ce39201e1..000000000 --- a/cli/tests/type_definitions/foo.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/** An exported value. */ -export const foo: string; diff --git a/cli/tests/type_definitions/foo.js b/cli/tests/type_definitions/foo.js deleted file mode 100644 index 61d366eb2..000000000 --- a/cli/tests/type_definitions/foo.js +++ /dev/null @@ -1 +0,0 @@ -export const foo = "foo"; diff --git a/cli/tests/type_definitions/qat.ts b/cli/tests/type_definitions/qat.ts deleted file mode 100644 index 6196c9d38..000000000 --- a/cli/tests/type_definitions/qat.ts +++ /dev/null @@ -1 +0,0 @@ -export const qat = "qat"; diff --git a/cli/tests/type_definitions_for_export.ts b/cli/tests/type_definitions_for_export.ts deleted file mode 100644 index 1f17b4962..000000000 --- a/cli/tests/type_definitions_for_export.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./export_type_def.ts"; - -function bar(a: number) { - console.log(a); -} - -bar(foo); diff --git a/cli/tests/type_definitions_for_export.ts.out b/cli/tests/type_definitions_for_export.ts.out deleted file mode 100644 index 8f1240bc7..000000000 --- a/cli/tests/type_definitions_for_export.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -Check [WILDCARD]type_definitions_for_export.ts -error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'number'. -bar(foo); - ~~~ - at [WILDCARD]type_definitions_for_export.ts:7:5 diff --git a/cli/tests/type_directives_01.ts b/cli/tests/type_directives_01.ts deleted file mode 100644 index 71305824c..000000000 --- a/cli/tests/type_directives_01.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as foo from "http://127.0.0.1:4545/xTypeScriptTypes.js"; - -console.log(foo.foo); diff --git a/cli/tests/type_directives_01.ts.out b/cli/tests/type_directives_01.ts.out deleted file mode 100644 index 77ed3ae26..000000000 --- a/cli/tests/type_directives_01.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -DEBUG TS - host.getSourceFile("http://127.0.0.1:4545/xTypeScriptTypes.d.ts", Latest) -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/type_directives_02.ts b/cli/tests/type_directives_02.ts deleted file mode 100644 index f7274bf26..000000000 --- a/cli/tests/type_directives_02.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as foo from "./subdir/type_reference.js"; - -console.log(foo.foo); diff --git a/cli/tests/type_directives_02.ts.out b/cli/tests/type_directives_02.ts.out deleted file mode 100644 index 7949dfab5..000000000 --- a/cli/tests/type_directives_02.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -DEBUG TS - host.getSourceFile("file:///[WILDCARD]cli/tests/subdir/type_reference.d.ts", Latest) -[WILDCARD] \ No newline at end of file diff --git a/cli/tests/type_directives_js_main.js b/cli/tests/type_directives_js_main.js deleted file mode 100644 index f7274bf26..000000000 --- a/cli/tests/type_directives_js_main.js +++ /dev/null @@ -1,3 +0,0 @@ -import * as foo from "./subdir/type_reference.js"; - -console.log(foo.foo); diff --git a/cli/tests/type_directives_js_main.js.out b/cli/tests/type_directives_js_main.js.out deleted file mode 100644 index 13decaa78..000000000 --- a/cli/tests/type_directives_js_main.js.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -DEBUG RS - [WILDCARD] - FileFetcher::fetch() - specifier: file:///[WILDCARD]cli/tests/subdir/type_reference.d.ts -[WILDCARD] diff --git a/cli/tests/type_directives_redirect.ts b/cli/tests/type_directives_redirect.ts deleted file mode 100644 index 1756d5af9..000000000 --- a/cli/tests/type_directives_redirect.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/type_directives_redirect.js"; diff --git a/cli/tests/type_directives_redirect.ts.out b/cli/tests/type_directives_redirect.ts.out deleted file mode 100644 index 471d9c0b4..000000000 --- a/cli/tests/type_directives_redirect.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -Download [WILDCARD]type_directives_redirect.js -Download [WILDCARD]xTypeScriptTypesRedirect.d.ts -Download [WILDCARD]xTypeScriptTypesRedirect.d.ts -Download [WILDCARD]xTypeScriptTypesRedirected.d.ts -Check [WILDCARD]type_directives_redirect.ts diff --git a/cli/tests/type_headers_deno_types.ts b/cli/tests/type_headers_deno_types.ts deleted file mode 100644 index 92391c666..000000000 --- a/cli/tests/type_headers_deno_types.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Following import uses two distinct ways to provide types: - * - X-TypeScript-Types headers - * - @deno-types directive - * - * Because "@deno-types" directive must be placed by user explicitly it - * should have higher precedence than type header. - * - * This is verified by providing conflicting type declaration - * depending on a way. There should be no TS error, otherwise - * it means that wrong type declarations are used (from X-TypeScript-Types) - * header. - */ - -// @deno-types="http://127.0.0.1:4545/type_headers_deno_types.foo.d.ts" -import { foo } from "http://127.0.0.1:4545/type_headers_deno_types.foo.js"; - -foo("hello"); diff --git a/cli/tests/type_headers_deno_types.ts.out b/cli/tests/type_headers_deno_types.ts.out deleted file mode 100644 index f1e4ca1f8..000000000 --- a/cli/tests/type_headers_deno_types.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -Download http://[WILDCARD]:4545/type_headers_deno_types.foo.js -Download http://[WILDCARD]:4545/type_headers_deno_types.foo.d.ts -Download http://[WILDCARD]:4545/type_headers_deno_types.d.ts -Check [WILDCARD]/type_headers_deno_types.ts -hello diff --git a/cli/tests/types.out b/cli/tests/types.out deleted file mode 100644 index 9cda650eb..000000000 --- a/cli/tests/types.out +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -[WILDCARD] -declare namespace Deno [WILDCARD] -declare var window: Window [WILDCARD] diff --git a/cli/tests/unbuffered_stderr.ts b/cli/tests/unbuffered_stderr.ts deleted file mode 100644 index 0f1d2a999..000000000 --- a/cli/tests/unbuffered_stderr.ts +++ /dev/null @@ -1 +0,0 @@ -Deno.stderr.write(new TextEncoder().encode("x")); diff --git a/cli/tests/unbuffered_stderr.ts.out b/cli/tests/unbuffered_stderr.ts.out deleted file mode 100644 index 500019738..000000000 --- a/cli/tests/unbuffered_stderr.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -x \ No newline at end of file diff --git a/cli/tests/unbuffered_stdout.ts b/cli/tests/unbuffered_stdout.ts deleted file mode 100644 index 9f1e07a97..000000000 --- a/cli/tests/unbuffered_stdout.ts +++ /dev/null @@ -1 +0,0 @@ -Deno.stdout.write(new TextEncoder().encode("a")); diff --git a/cli/tests/unbuffered_stdout.ts.out b/cli/tests/unbuffered_stdout.ts.out deleted file mode 100644 index 2e65efe2a..000000000 --- a/cli/tests/unbuffered_stdout.ts.out +++ /dev/null @@ -1 +0,0 @@ -a \ No newline at end of file diff --git a/cli/tests/unit/README.md b/cli/tests/unit/README.md index 114bbc043..e1197fe9b 100644 --- a/cli/tests/unit/README.md +++ b/cli/tests/unit/README.md @@ -26,7 +26,7 @@ unitTest( ## Running tests -There are three ways to run `unit_test_runner.ts`: +There are two ways to run `unit_test_runner.ts`: ```sh # Run all tests. diff --git a/cli/tests/unit/body_test.ts b/cli/tests/unit/body_test.ts index 78da2a9d4..fe0bbe25c 100644 --- a/cli/tests/unit/body_test.ts +++ b/cli/tests/unit/body_test.ts @@ -57,7 +57,7 @@ unitTest( { perms: { net: true } }, async function bodyURLEncodedFormData() { const response = await fetch( - "http://localhost:4545/cli/tests/subdir/form_urlencoded.txt", + "http://localhost:4545/subdir/form_urlencoded.txt", ); assert(response.body instanceof ReadableStream); diff --git a/cli/tests/unit/broadcast_channel_test.ts b/cli/tests/unit/broadcast_channel_test.ts index cfa62c856..33a8aaba0 100644 --- a/cli/tests/unit/broadcast_channel_test.ts +++ b/cli/tests/unit/broadcast_channel_test.ts @@ -6,7 +6,10 @@ Deno.test("broadcastchannel worker", async () => { const intercom = new BroadcastChannel("intercom"); let count = 0; - const url = new URL("../workers/broadcast_channel.ts", import.meta.url); + const url = new URL( + "../testdata/workers/broadcast_channel.ts", + import.meta.url, + ); const worker = new Worker(url.href, { type: "module", name: "worker" }); worker.onmessage = () => intercom.postMessage(++count); diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 24825c653..6e2b1a5d6 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -94,40 +94,40 @@ unitTest( ); unitTest({ perms: { net: true } }, async function fetchJsonSuccess() { - const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); + const response = await fetch("http://localhost:4545/fixture.json"); const json = await response.json(); assertEquals(json.name, "deno"); }); unitTest(async function fetchPerm() { await assertThrowsAsync(async () => { - await fetch("http://localhost:4545/cli/tests/fixture.json"); + await fetch("http://localhost:4545/fixture.json"); }, Deno.errors.PermissionDenied); }); unitTest({ perms: { net: true } }, async function fetchUrl() { - const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); - assertEquals(response.url, "http://localhost:4545/cli/tests/fixture.json"); + const response = await fetch("http://localhost:4545/fixture.json"); + assertEquals(response.url, "http://localhost:4545/fixture.json"); const _json = await response.json(); }); unitTest({ perms: { net: true } }, async function fetchURL() { const response = await fetch( - new URL("http://localhost:4545/cli/tests/fixture.json"), + new URL("http://localhost:4545/fixture.json"), ); - assertEquals(response.url, "http://localhost:4545/cli/tests/fixture.json"); + assertEquals(response.url, "http://localhost:4545/fixture.json"); const _json = await response.json(); }); unitTest({ perms: { net: true } }, async function fetchHeaders() { - const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); + const response = await fetch("http://localhost:4545/fixture.json"); const headers = response.headers; assertEquals(headers.get("Content-Type"), "application/json"); const _json = await response.json(); }); unitTest({ perms: { net: true } }, async function fetchBlob() { - const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); + const response = await fetch("http://localhost:4545/fixture.json"); const headers = response.headers; const blob = await response.blob(); assertEquals(blob.type, headers.get("Content-Type")); @@ -138,7 +138,7 @@ unitTest( { perms: { net: true } }, async function fetchBodyUsedReader() { const response = await fetch( - "http://localhost:4545/cli/tests/fixture.json", + "http://localhost:4545/fixture.json", ); assert(response.body !== null); @@ -156,7 +156,7 @@ unitTest( { perms: { net: true } }, async function fetchBodyUsedCancelStream() { const response = await fetch( - "http://localhost:4545/cli/tests/fixture.json", + "http://localhost:4545/fixture.json", ); assert(response.body !== null); @@ -168,7 +168,7 @@ unitTest( ); unitTest({ perms: { net: true } }, async function fetchAsyncIterator() { - const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); + const response = await fetch("http://localhost:4545/fixture.json"); const headers = response.headers; assert(response.body !== null); @@ -182,7 +182,7 @@ unitTest({ perms: { net: true } }, async function fetchAsyncIterator() { }); unitTest({ perms: { net: true } }, async function fetchBodyReader() { - const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); + const response = await fetch("http://localhost:4545/fixture.json"); const headers = response.headers; assert(response.body !== null); const reader = response.body.getReader(); @@ -221,7 +221,7 @@ unitTest( ); unitTest({ perms: { net: true } }, async function responseClone() { - const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); + const response = await fetch("http://localhost:4545/fixture.json"); const response1 = response.clone(); assert(response !== response1); assertEquals(response.status, response1.status); @@ -272,7 +272,7 @@ unitTest( { perms: { net: true } }, async function fetchURLEncodedFormDataSuccess() { const response = await fetch( - "http://localhost:4545/cli/tests/subdir/form_urlencoded.txt", + "http://localhost:4545/subdir/form_urlencoded.txt", ); const formData = await response.formData(); assert(formData.has("field_1")); @@ -360,12 +360,12 @@ unitTest( perms: { net: true }, }, async function fetchWithRedirection() { - const response = await fetch("http://localhost:4546/README.md"); + const response = await fetch("http://localhost:4546/hello.txt"); assertEquals(response.status, 200); assertEquals(response.statusText, "OK"); - assertEquals(response.url, "http://localhost:4545/README.md"); + assertEquals(response.url, "http://localhost:4545/hello.txt"); const body = await response.text(); - assert(body.includes("Deno")); + assert(body.includes("Hello world!")); }, ); @@ -375,7 +375,7 @@ unitTest( }, async function fetchWithRelativeRedirection() { const response = await fetch( - "http://localhost:4545/cli/tests/001_hello.js", + "http://localhost:4545/001_hello.js", ); assertEquals(response.status, 200); assertEquals(response.statusText, "OK"); @@ -411,7 +411,7 @@ unitTest( }, async function fetchWithInfRedirection() { await assertThrowsAsync( - () => fetch("http://localhost:4549/cli/tests"), + () => fetch("http://localhost:4549"), TypeError, "redirect", ); @@ -450,7 +450,7 @@ unitTest( { perms: { net: true } }, async function fetchSeparateInit() { // related to: https://github.com/denoland/deno/issues/10396 - const req = new Request("http://localhost:4545/cli/tests/001_hello.js"); + const req = new Request("http://localhost:4545/001_hello.js"); const init = { method: "GET", }; @@ -815,7 +815,7 @@ unitTest(async function responseWithoutBody() { }); unitTest({ perms: { net: true } }, async function fetchBodyReadTwice() { - const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); + const response = await fetch("http://localhost:4545/fixture.json"); // Read body const _json = await response.json(); @@ -839,7 +839,7 @@ unitTest( { perms: { net: true } }, async function fetchBodyReaderAfterRead() { const response = await fetch( - "http://localhost:4545/cli/tests/fixture.json", + "http://localhost:4545/fixture.json", ); assert(response.body !== null); const reader = await response.body.getReader(); @@ -919,7 +919,7 @@ unitTest( unitTest( { perms: { net: true } }, async function fetchResourceCloseAfterStreamCancel() { - const res = await fetch("http://localhost:4545/cli/tests/fixture.json"); + const res = await fetch("http://localhost:4545/fixture.json"); assert(res.body !== null); // After ReadableStream.cancel is called, resource handle must be closed @@ -1047,7 +1047,7 @@ MNf4EgWfK+tZMnuqfpfO9740KzfcVoMNo4QJD4yn5YxroUOO/Azi }, ); const response = await fetch( - "https://localhost:5545/cli/tests/fixture.json", + "https://localhost:5545/fixture.json", { client }, ); const json = await response.json(); diff --git a/cli/tests/unit/files_test.ts b/cli/tests/unit/files_test.ts index a409434c1..fed7c3252 100644 --- a/cli/tests/unit/files_test.ts +++ b/cli/tests/unit/files_test.ts @@ -17,7 +17,7 @@ unitTest(function filesStdioFileDescriptors() { }); unitTest({ perms: { read: true } }, async function filesCopyToStdout() { - const filename = "cli/tests/fixture.json"; + const filename = "cli/tests/testdata/fixture.json"; const file = await Deno.open(filename); assert(file.rid > 2); const bytesWritten = await copy(file, Deno.stdout); @@ -27,7 +27,7 @@ unitTest({ perms: { read: true } }, async function filesCopyToStdout() { }); unitTest({ perms: { read: true } }, async function filesIter() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); let totalSize = 0; @@ -42,7 +42,7 @@ unitTest({ perms: { read: true } }, async function filesIter() { unitTest( { perms: { read: true } }, async function filesIterCustomBufSize() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); let totalSize = 0; @@ -59,7 +59,7 @@ unitTest( ); unitTest({ perms: { read: true } }, function filesIterSync() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = Deno.openSync(filename); let totalSize = 0; @@ -74,7 +74,7 @@ unitTest({ perms: { read: true } }, function filesIterSync() { unitTest( { perms: { read: true } }, function filesIterSyncCustomBufSize() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = Deno.openSync(filename); let totalSize = 0; @@ -264,7 +264,7 @@ unitTest( ); unitTest(async function openOptions() { - const filename = "cli/tests/fixture.json"; + const filename = "cli/tests/testdata/fixture.json"; await assertThrowsAsync( async () => { await Deno.open(filename, { write: false }); @@ -532,7 +532,7 @@ unitTest( ); unitTest({ perms: { read: true } }, async function seekStart() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); const seekPosition = 6; // Deliberately move 1 step forward @@ -549,7 +549,7 @@ unitTest({ perms: { read: true } }, async function seekStart() { }); unitTest({ perms: { read: true } }, function seekSyncStart() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = Deno.openSync(filename); const seekPosition = 6; // Deliberately move 1 step forward @@ -566,7 +566,7 @@ unitTest({ perms: { read: true } }, function seekSyncStart() { }); unitTest({ perms: { read: true } }, async function seekCurrent() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); // Deliberately move 1 step forward await file.read(new Uint8Array(1)); // "H" @@ -583,7 +583,7 @@ unitTest({ perms: { read: true } }, async function seekCurrent() { }); unitTest({ perms: { read: true } }, function seekSyncCurrent() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = Deno.openSync(filename); // Deliberately move 1 step forward file.readSync(new Uint8Array(1)); // "H" @@ -600,7 +600,7 @@ unitTest({ perms: { read: true } }, function seekSyncCurrent() { }); unitTest({ perms: { read: true } }, async function seekEnd() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); const seekPosition = -6; // seek from end of file that has 12 chars, 12 - 6 = 6 @@ -614,7 +614,7 @@ unitTest({ perms: { read: true } }, async function seekEnd() { }); unitTest({ perms: { read: true } }, function seekSyncEnd() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = Deno.openSync(filename); const seekPosition = -6; // seek from end of file that has 12 chars, 12 - 6 = 6 @@ -628,7 +628,7 @@ unitTest({ perms: { read: true } }, function seekSyncEnd() { }); unitTest({ perms: { read: true } }, async function seekMode() { - const filename = "cli/tests/hello.txt"; + const filename = "cli/tests/testdata/hello.txt"; const file = await Deno.open(filename); await assertThrowsAsync( async () => { diff --git a/cli/tests/unit/http_test.ts b/cli/tests/unit/http_test.ts index 4cdd84902..d762a6497 100644 --- a/cli/tests/unit/http_test.ts +++ b/cli/tests/unit/http_test.ts @@ -208,8 +208,8 @@ unitTest( const listener = Deno.listenTls({ hostname, port, - certFile: "cli/tests/tls/localhost.crt", - keyFile: "cli/tests/tls/localhost.key", + certFile: "cli/tests/testdata/tls/localhost.crt", + keyFile: "cli/tests/testdata/tls/localhost.key", }); const conn = await listener.accept(); const httpConn = Deno.serveHttp(conn); @@ -226,7 +226,7 @@ unitTest( listener.close(); })(); - const caData = Deno.readTextFileSync("cli/tests/tls/RootCA.pem"); + const caData = Deno.readTextFileSync("cli/tests/testdata/tls/RootCA.pem"); const client = Deno.createHttpClient({ caData }); const resp = await fetch(`https://${hostname}:${port}/`, { client, diff --git a/cli/tests/unit/read_dir_test.ts b/cli/tests/unit/read_dir_test.ts index 2e4370153..4f02fae9b 100644 --- a/cli/tests/unit/read_dir_test.ts +++ b/cli/tests/unit/read_dir_test.ts @@ -22,12 +22,14 @@ function assertSameContent(files: Deno.DirEntry[]) { } unitTest({ perms: { read: true } }, function readDirSyncSuccess() { - const files = [...Deno.readDirSync("cli/tests/")]; + const files = [...Deno.readDirSync("cli/tests/testdata")]; assertSameContent(files); }); unitTest({ perms: { read: true } }, function readDirSyncWithUrl() { - const files = [...Deno.readDirSync(pathToAbsoluteFileUrl("cli/tests"))]; + const files = [ + ...Deno.readDirSync(pathToAbsoluteFileUrl("cli/tests/testdata")), + ]; assertSameContent(files); }); @@ -39,7 +41,7 @@ unitTest({ perms: { read: false } }, function readDirSyncPerm() { unitTest({ perms: { read: true } }, function readDirSyncNotDir() { assertThrows(() => { - Deno.readDirSync("cli/tests/fixture.json"); + Deno.readDirSync("cli/tests/testdata/fixture.json"); }, Error); }); @@ -51,7 +53,7 @@ unitTest({ perms: { read: true } }, function readDirSyncNotFound() { unitTest({ perms: { read: true } }, async function readDirSuccess() { const files = []; - for await (const dirEntry of Deno.readDir("cli/tests/")) { + for await (const dirEntry of Deno.readDir("cli/tests/testdata")) { files.push(dirEntry); } assertSameContent(files); @@ -60,7 +62,7 @@ unitTest({ perms: { read: true } }, async function readDirSuccess() { unitTest({ perms: { read: true } }, async function readDirWithUrl() { const files = []; for await ( - const dirEntry of Deno.readDir(pathToAbsoluteFileUrl("cli/tests")) + const dirEntry of Deno.readDir(pathToAbsoluteFileUrl("cli/tests/testdata")) ) { files.push(dirEntry); } diff --git a/cli/tests/unit/read_file_test.ts b/cli/tests/unit/read_file_test.ts index f638c7a7c..7dd2b5621 100644 --- a/cli/tests/unit/read_file_test.ts +++ b/cli/tests/unit/read_file_test.ts @@ -9,7 +9,7 @@ import { } from "./test_util.ts"; unitTest({ perms: { read: true } }, function readFileSyncSuccess() { - const data = Deno.readFileSync("cli/tests/fixture.json"); + const data = Deno.readFileSync("cli/tests/testdata/fixture.json"); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); const json = decoder.decode(data); @@ -19,7 +19,7 @@ unitTest({ perms: { read: true } }, function readFileSyncSuccess() { unitTest({ perms: { read: true } }, function readFileSyncUrl() { const data = Deno.readFileSync( - pathToAbsoluteFileUrl("cli/tests/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), ); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); @@ -30,7 +30,7 @@ unitTest({ perms: { read: true } }, function readFileSyncUrl() { unitTest({ perms: { read: false } }, function readFileSyncPerm() { assertThrows(() => { - Deno.readFileSync("cli/tests/fixture.json"); + Deno.readFileSync("cli/tests/testdata/fixture.json"); }, Deno.errors.PermissionDenied); }); @@ -42,7 +42,7 @@ unitTest({ perms: { read: true } }, function readFileSyncNotFound() { unitTest({ perms: { read: true } }, async function readFileUrl() { const data = await Deno.readFile( - pathToAbsoluteFileUrl("cli/tests/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), ); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); @@ -52,7 +52,7 @@ unitTest({ perms: { read: true } }, async function readFileUrl() { }); unitTest({ perms: { read: true } }, async function readFileSuccess() { - const data = await Deno.readFile("cli/tests/fixture.json"); + const data = await Deno.readFile("cli/tests/testdata/fixture.json"); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); const json = decoder.decode(data); @@ -62,13 +62,13 @@ unitTest({ perms: { read: true } }, async function readFileSuccess() { unitTest({ perms: { read: false } }, async function readFilePerm() { await assertThrowsAsync(async () => { - await Deno.readFile("cli/tests/fixture.json"); + await Deno.readFile("cli/tests/testdata/fixture.json"); }, Deno.errors.PermissionDenied); }); unitTest({ perms: { read: true } }, function readFileSyncLoop() { for (let i = 0; i < 256; i++) { - Deno.readFileSync("cli/tests/fixture.json"); + Deno.readFileSync("cli/tests/testdata/fixture.json"); } }); @@ -96,7 +96,9 @@ unitTest( const ac = new AbortController(); queueMicrotask(() => ac.abort()); await assertThrowsAsync(async () => { - await Deno.readFile("cli/tests/fixture.json", { signal: ac.signal }); + await Deno.readFile("cli/tests/testdata/fixture.json", { + signal: ac.signal, + }); }); }, ); @@ -107,7 +109,9 @@ unitTest( const ac = new AbortController(); queueMicrotask(() => ac.abort()); await assertThrowsAsync(async () => { - await Deno.readTextFile("cli/tests/fixture.json", { signal: ac.signal }); + await Deno.readTextFile("cli/tests/testdata/fixture.json", { + signal: ac.signal, + }); }); }, ); diff --git a/cli/tests/unit/read_text_file_test.ts b/cli/tests/unit/read_text_file_test.ts index a7eb1a730..3d7ccfaa6 100644 --- a/cli/tests/unit/read_text_file_test.ts +++ b/cli/tests/unit/read_text_file_test.ts @@ -8,7 +8,7 @@ import { } from "./test_util.ts"; unitTest({ perms: { read: true } }, function readTextFileSyncSuccess() { - const data = Deno.readTextFileSync("cli/tests/fixture.json"); + const data = Deno.readTextFileSync("cli/tests/testdata/fixture.json"); assert(data.length > 0); const pkg = JSON.parse(data); assertEquals(pkg.name, "deno"); @@ -16,7 +16,7 @@ unitTest({ perms: { read: true } }, function readTextFileSyncSuccess() { unitTest({ perms: { read: true } }, function readTextFileSyncByUrl() { const data = Deno.readTextFileSync( - pathToAbsoluteFileUrl("cli/tests/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), ); assert(data.length > 0); const pkg = JSON.parse(data); @@ -25,7 +25,7 @@ unitTest({ perms: { read: true } }, function readTextFileSyncByUrl() { unitTest({ perms: { read: false } }, function readTextFileSyncPerm() { assertThrows(() => { - Deno.readTextFileSync("cli/tests/fixture.json"); + Deno.readTextFileSync("cli/tests/testdata/fixture.json"); }, Deno.errors.PermissionDenied); }); @@ -38,7 +38,7 @@ unitTest({ perms: { read: true } }, function readTextFileSyncNotFound() { unitTest( { perms: { read: true } }, async function readTextFileSuccess() { - const data = await Deno.readTextFile("cli/tests/fixture.json"); + const data = await Deno.readTextFile("cli/tests/testdata/fixture.json"); assert(data.length > 0); const pkg = JSON.parse(data); assertEquals(pkg.name, "deno"); @@ -47,7 +47,7 @@ unitTest( unitTest({ perms: { read: true } }, async function readTextFileByUrl() { const data = await Deno.readTextFile( - pathToAbsoluteFileUrl("cli/tests/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), ); assert(data.length > 0); const pkg = JSON.parse(data); @@ -56,13 +56,13 @@ unitTest({ perms: { read: true } }, async function readTextFileByUrl() { unitTest({ perms: { read: false } }, async function readTextFilePerm() { await assertThrowsAsync(async () => { - await Deno.readTextFile("cli/tests/fixture.json"); + await Deno.readTextFile("cli/tests/testdata/fixture.json"); }, Deno.errors.PermissionDenied); }); unitTest({ perms: { read: true } }, function readTextFileSyncLoop() { for (let i = 0; i < 256; i++) { - Deno.readTextFileSync("cli/tests/fixture.json"); + Deno.readTextFileSync("cli/tests/testdata/fixture.json"); } }); diff --git a/cli/tests/unit/real_path_test.ts b/cli/tests/unit/real_path_test.ts index b84b0c0df..8c0728ca9 100644 --- a/cli/tests/unit/real_path_test.ts +++ b/cli/tests/unit/real_path_test.ts @@ -10,7 +10,7 @@ import { } from "./test_util.ts"; unitTest({ perms: { read: true } }, function realPathSyncSuccess() { - const relative = "cli/tests/fixture.json"; + const relative = "cli/tests/testdata/fixture.json"; const realPath = Deno.realPathSync(relative); if (Deno.build.os !== "windows") { assert(realPath.startsWith("/")); @@ -22,7 +22,7 @@ unitTest({ perms: { read: true } }, function realPathSyncSuccess() { }); unitTest({ perms: { read: true } }, function realPathSyncUrl() { - const relative = "cli/tests/fixture.json"; + const relative = "cli/tests/testdata/fixture.json"; const url = pathToAbsoluteFileUrl(relative); assertEquals(Deno.realPathSync(relative), Deno.realPathSync(url)); }); @@ -61,7 +61,7 @@ unitTest({ perms: { read: true } }, function realPathSyncNotFound() { }); unitTest({ perms: { read: true } }, async function realPathSuccess() { - const relativePath = "cli/tests/fixture.json"; + const relativePath = "cli/tests/testdata/fixture.json"; const realPath = await Deno.realPath(relativePath); if (Deno.build.os !== "windows") { assert(realPath.startsWith("/")); @@ -75,7 +75,7 @@ unitTest({ perms: { read: true } }, async function realPathSuccess() { unitTest( { perms: { read: true } }, async function realPathUrl() { - const relative = "cli/tests/fixture.json"; + const relative = "cli/tests/testdata/fixture.json"; const url = pathToAbsoluteFileUrl(relative); assertEquals(await Deno.realPath(relative), await Deno.realPath(url)); }, diff --git a/cli/tests/unit/resources_test.ts b/cli/tests/unit/resources_test.ts index ea183a068..e2ca4116d 100644 --- a/cli/tests/unit/resources_test.ts +++ b/cli/tests/unit/resources_test.ts @@ -37,7 +37,7 @@ unitTest({ perms: { net: true } }, async function resourcesNet() { unitTest({ perms: { read: true } }, async function resourcesFile() { const resourcesBefore = Deno.resources(); - const f = await Deno.open("cli/tests/hello.txt"); + const f = await Deno.open("cli/tests/testdata/hello.txt"); const resourcesAfter = Deno.resources(); f.close(); diff --git a/cli/tests/unit/stat_test.ts b/cli/tests/unit/stat_test.ts index 4b663e5b9..7db9dee71 100644 --- a/cli/tests/unit/stat_test.ts +++ b/cli/tests/unit/stat_test.ts @@ -41,11 +41,11 @@ unitTest({ perms: { read: true } }, async function fstatSuccess() { unitTest( { perms: { read: true, write: true } }, function statSyncSuccess() { - const packageInfo = Deno.statSync("README.md"); - assert(packageInfo.isFile); - assert(!packageInfo.isSymlink); + const readmeInfo = Deno.statSync("README.md"); + assert(readmeInfo.isFile); + assert(!readmeInfo.isSymlink); - const modulesInfo = Deno.statSync("cli/tests/symlink_to_subdir"); + const modulesInfo = Deno.statSync("cli/tests/testdata/symlink_to_subdir"); assert(modulesInfo.isDirectory); assert(!modulesInfo.isSymlink); @@ -62,12 +62,12 @@ unitTest( tempInfo.birthtime === null || now - tempInfo.birthtime.valueOf() < 1000, ); - const packageInfoByUrl = Deno.statSync(pathToAbsoluteFileUrl("README.md")); - assert(packageInfoByUrl.isFile); - assert(!packageInfoByUrl.isSymlink); + const readmeInfoByUrl = Deno.statSync(pathToAbsoluteFileUrl("README.md")); + assert(readmeInfoByUrl.isFile); + assert(!readmeInfoByUrl.isSymlink); const modulesInfoByUrl = Deno.statSync( - pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir"), + pathToAbsoluteFileUrl("cli/tests/testdata/symlink_to_subdir"), ); assert(modulesInfoByUrl.isDirectory); assert(!modulesInfoByUrl.isSymlink); @@ -122,12 +122,12 @@ unitTest({ perms: { read: true } }, function lstatSyncSuccess() { assert(packageInfoByUrl.isFile); assert(!packageInfoByUrl.isSymlink); - const modulesInfo = Deno.lstatSync("cli/tests/symlink_to_subdir"); + const modulesInfo = Deno.lstatSync("cli/tests/testdata/symlink_to_subdir"); assert(!modulesInfo.isDirectory); assert(modulesInfo.isSymlink); const modulesInfoByUrl = Deno.lstatSync( - pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir"), + pathToAbsoluteFileUrl("cli/tests/testdata/symlink_to_subdir"), ); assert(!modulesInfoByUrl.isDirectory); assert(modulesInfoByUrl.isSymlink); @@ -143,7 +143,7 @@ unitTest({ perms: { read: true } }, function lstatSyncSuccess() { unitTest({ perms: { read: false } }, function lstatSyncPerm() { assertThrows(() => { - Deno.lstatSync("README.md"); + Deno.lstatSync("hello.txt"); }, Deno.errors.PermissionDenied); }); @@ -156,22 +156,22 @@ unitTest({ perms: { read: true } }, function lstatSyncNotFound() { unitTest( { perms: { read: true, write: true } }, async function statSuccess() { - const packageInfo = await Deno.stat("README.md"); - assert(packageInfo.isFile); - assert(!packageInfo.isSymlink); + const readmeInfo = await Deno.stat("README.md"); + assert(readmeInfo.isFile); + assert(!readmeInfo.isSymlink); - const packageInfoByUrl = await Deno.stat( + const readmeInfoByUrl = await Deno.stat( pathToAbsoluteFileUrl("README.md"), ); - assert(packageInfoByUrl.isFile); - assert(!packageInfoByUrl.isSymlink); + assert(readmeInfoByUrl.isFile); + assert(!readmeInfoByUrl.isSymlink); - const modulesInfo = await Deno.stat("cli/tests/symlink_to_subdir"); + const modulesInfo = await Deno.stat("cli/tests/testdata/symlink_to_subdir"); assert(modulesInfo.isDirectory); assert(!modulesInfo.isSymlink); const modulesInfoByUrl = await Deno.stat( - pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir"), + pathToAbsoluteFileUrl("cli/tests/testdata/symlink_to_subdir"), ); assert(modulesInfoByUrl.isDirectory); assert(!modulesInfoByUrl.isSymlink); @@ -234,20 +234,20 @@ unitTest({ perms: { read: true } }, async function statNotFound() { }); unitTest({ perms: { read: true } }, async function lstatSuccess() { - const packageInfo = await Deno.lstat("README.md"); - assert(packageInfo.isFile); - assert(!packageInfo.isSymlink); + const readmeInfo = await Deno.lstat("README.md"); + assert(readmeInfo.isFile); + assert(!readmeInfo.isSymlink); - const packageInfoByUrl = await Deno.lstat(pathToAbsoluteFileUrl("README.md")); - assert(packageInfoByUrl.isFile); - assert(!packageInfoByUrl.isSymlink); + const readmeInfoByUrl = await Deno.lstat(pathToAbsoluteFileUrl("README.md")); + assert(readmeInfoByUrl.isFile); + assert(!readmeInfoByUrl.isSymlink); - const modulesInfo = await Deno.lstat("cli/tests/symlink_to_subdir"); + const modulesInfo = await Deno.lstat("cli/tests/testdata/symlink_to_subdir"); assert(!modulesInfo.isDirectory); assert(modulesInfo.isSymlink); const modulesInfoByUrl = await Deno.lstat( - pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir"), + pathToAbsoluteFileUrl("cli/tests/testdata/symlink_to_subdir"), ); assert(!modulesInfoByUrl.isDirectory); assert(modulesInfoByUrl.isSymlink); diff --git a/cli/tests/unit/tls_test.ts b/cli/tests/unit/tls_test.ts index 8472d93e0..12fe9bd50 100644 --- a/cli/tests/unit/tls_test.ts +++ b/cli/tests/unit/tls_test.ts @@ -37,8 +37,8 @@ unitTest( const listener = await Deno.listenTls({ hostname: "localhost", port: 3567, - certFile: "cli/tests/tls/localhost.crt", - keyFile: "cli/tests/tls/localhost.key", + certFile: "cli/tests/testdata/tls/localhost.crt", + keyFile: "cli/tests/testdata/tls/localhost.key", }); await assertThrowsAsync(async () => { @@ -54,7 +54,7 @@ unitTest(async function connectTLSCertFileNoReadPerm() { await Deno.connectTls({ hostname: "deno.land", port: 443, - certFile: "cli/tests/tls/RootCA.crt", + certFile: "cli/tests/testdata/tls/RootCA.crt", }); }, Deno.errors.PermissionDenied); }); @@ -65,8 +65,8 @@ unitTest( const options = { hostname: "localhost", port: 3500, - certFile: "cli/tests/tls/localhost.crt", - keyFile: "cli/tests/tls/localhost.key", + certFile: "cli/tests/testdata/tls/localhost.crt", + keyFile: "cli/tests/testdata/tls/localhost.key", }; assertThrows(() => { @@ -90,8 +90,8 @@ unitTest({ perms: { net: true } }, function listenTLSNoReadPerm() { Deno.listenTls({ hostname: "localhost", port: 3500, - certFile: "cli/tests/tls/localhost.crt", - keyFile: "cli/tests/tls/localhost.key", + certFile: "cli/tests/testdata/tls/localhost.crt", + keyFile: "cli/tests/testdata/tls/localhost.key", }); }, Deno.errors.PermissionDenied); }); @@ -104,8 +104,8 @@ unitTest( const options = { hostname: "localhost", port: 3500, - certFile: "cli/tests/tls/localhost.crt", - keyFile: "cli/tests/tls/localhost.key", + certFile: "cli/tests/testdata/tls/localhost.crt", + keyFile: "cli/tests/testdata/tls/localhost.key", }; const testDir = Deno.makeTempDirSync(); @@ -129,8 +129,8 @@ unitTest( const options = { hostname: "localhost", port: 3500, - certFile: "cli/tests/tls/localhost.crt", - keyFile: "cli/tests/tls/localhost.key", + certFile: "cli/tests/testdata/tls/localhost.crt", + keyFile: "cli/tests/testdata/tls/localhost.key", }; const testDir = Deno.makeTempDirSync(); @@ -158,8 +158,8 @@ unitTest( const listener = Deno.listenTls({ hostname, port, - certFile: "cli/tests/tls/localhost.crt", - keyFile: "cli/tests/tls/localhost.key", + certFile: "cli/tests/testdata/tls/localhost.crt", + keyFile: "cli/tests/testdata/tls/localhost.key", }); const response = encoder.encode( @@ -182,7 +182,7 @@ unitTest( const conn = await Deno.connectTls({ hostname, port, - certFile: "cli/tests/tls/RootCA.pem", + certFile: "cli/tests/testdata/tls/RootCA.pem", }); assert(conn.rid > 0); const w = new BufWriter(conn); @@ -222,15 +222,15 @@ async function tlsPair(): Promise<[Deno.Conn, Deno.Conn]> { const listener = Deno.listenTls({ hostname: "localhost", port, - certFile: "cli/tests/tls/localhost.crt", - keyFile: "cli/tests/tls/localhost.key", + certFile: "cli/tests/testdata/tls/localhost.crt", + keyFile: "cli/tests/testdata/tls/localhost.key", }); const acceptPromise = listener.accept(); const connectPromise = Deno.connectTls({ hostname: "localhost", port, - certFile: "cli/tests/tls/RootCA.pem", + certFile: "cli/tests/testdata/tls/RootCA.pem", }); const endpoints = await Promise.all([acceptPromise, connectPromise]); @@ -553,8 +553,8 @@ async function tlsWithTcpFailureTestImpl( const tlsListener = Deno.listenTls({ hostname: "localhost", port: tlsPort, - certFile: "cli/tests/tls/localhost.crt", - keyFile: "cli/tests/tls/localhost.key", + certFile: "cli/tests/testdata/tls/localhost.crt", + keyFile: "cli/tests/testdata/tls/localhost.key", }); const tcpPort = getPort(); @@ -570,7 +570,7 @@ async function tlsWithTcpFailureTestImpl( Deno.connectTls({ hostname: "localhost", port: tcpPort, - certFile: "cli/tests/tls/RootCA.crt", + certFile: "cli/tests/testdata/tls/RootCA.crt", }), ]); @@ -845,8 +845,8 @@ function createHttpsListener(port: number): Deno.Listener { const listener = Deno.listenTls({ hostname: "localhost", port, - certFile: "./cli/tests/tls/localhost.crt", - keyFile: "./cli/tests/tls/localhost.key", + certFile: "./cli/tests/testdata/tls/localhost.crt", + keyFile: "./cli/tests/testdata/tls/localhost.key", }); serve(listener); @@ -995,7 +995,9 @@ unitTest( hostname: "deno.land", port: 443, certChain: "bad data", - privateKey: await Deno.readTextFile("cli/tests/tls/localhost.key"), + privateKey: await Deno.readTextFile( + "cli/tests/testdata/tls/localhost.key", + ), }); }, Deno.errors.InvalidData); }, @@ -1008,7 +1010,9 @@ unitTest( await Deno.connectTls({ hostname: "deno.land", port: 443, - certChain: await Deno.readTextFile("cli/tests/tls/localhost.crt"), + certChain: await Deno.readTextFile( + "cli/tests/testdata/tls/localhost.crt", + ), privateKey: "bad data", }); }, Deno.errors.InvalidData); @@ -1022,7 +1026,9 @@ unitTest( await Deno.connectTls({ hostname: "deno.land", port: 443, - certChain: await Deno.readTextFile("cli/tests/tls/localhost.crt"), + certChain: await Deno.readTextFile( + "cli/tests/testdata/tls/localhost.crt", + ), privateKey: "", }); }, Deno.errors.InvalidData); @@ -1034,15 +1040,19 @@ unitTest( async function connectWithClientCert() { // The test_server running on port 4552 responds with 'PASS' if client // authentication was successful. Try it by running test_server and - // curl --key cli/tests/tls/localhost.key \ - // --cert cli/tests/tls/localhost.crt \ - // --cacert cli/tests/tls/RootCA.crt https://localhost:4552/ + // curl --key cli/tests/testdata/tls/localhost.key \ + // --cert cli/tests/testdata/tls/localhost.crt \ + // --cacert cli/tests/testdata/tls/RootCA.crt https://localhost:4552/ const conn = await Deno.connectTls({ hostname: "localhost", port: 4552, - certChain: await Deno.readTextFile("cli/tests/tls/localhost.crt"), - privateKey: await Deno.readTextFile("cli/tests/tls/localhost.key"), - certFile: "cli/tests/tls/RootCA.crt", + certChain: await Deno.readTextFile( + "cli/tests/testdata/tls/localhost.crt", + ), + privateKey: await Deno.readTextFile( + "cli/tests/testdata/tls/localhost.key", + ), + certFile: "cli/tests/testdata/tls/RootCA.crt", }); const result = decoder.decode(await readAll(conn)); assertEquals(result, "PASS"); diff --git a/cli/tests/unit/tty_test.ts b/cli/tests/unit/tty_test.ts index a9f1105f6..b45a43f1a 100644 --- a/cli/tests/unit/tty_test.ts +++ b/cli/tests/unit/tty_test.ts @@ -4,7 +4,7 @@ import { assert, assertThrows, unitTest } from "./test_util.ts"; // Note tests for Deno.setRaw is in integration tests. unitTest({ perms: { read: true } }, function consoleSizeFile() { - const file = Deno.openSync("cli/tests/hello.txt"); + const file = Deno.openSync("cli/tests/testdata/hello.txt"); assertThrows(() => { Deno.consoleSize(file.rid); }, Error); @@ -20,7 +20,7 @@ unitTest(function consoleSizeError() { unitTest({ perms: { read: true } }, function isatty() { // CI not under TTY, so cannot test stdin/stdout/stderr. - const f = Deno.openSync("cli/tests/hello.txt"); + const f = Deno.openSync("cli/tests/testdata/hello.txt"); assert(!Deno.isatty(f.rid)); f.close(); }); diff --git a/cli/tests/unit/wasm_test.ts b/cli/tests/unit/wasm_test.ts index 66fcacade..c2180db3c 100644 --- a/cli/tests/unit/wasm_test.ts +++ b/cli/tests/unit/wasm_test.ts @@ -74,7 +74,7 @@ unitTest( // deno-dom's WASM file is a real-world non-trivial case that gave us // trouble when implementing this. await WebAssembly.instantiateStreaming(fetch( - "http://localhost:4545/cli/tests/deno_dom_0.1.3-alpha2.wasm", + "http://localhost:4545/deno_dom_0.1.3-alpha2.wasm", )); }, ); diff --git a/cli/tests/unit/webgpu_test.ts b/cli/tests/unit/webgpu_test.ts index 4fbbd5cde..cbefa7c07 100644 --- a/cli/tests/unit/webgpu_test.ts +++ b/cli/tests/unit/webgpu_test.ts @@ -22,7 +22,7 @@ unitTest({ assert(device); const shaderCode = await Deno.readTextFile( - "cli/tests/webgpu_computepass_shader.wgsl", + "cli/tests/testdata/webgpu_computepass_shader.wgsl", ); const shaderModule = device.createShaderModule({ @@ -111,7 +111,7 @@ unitTest({ assert(device); const shaderCode = await Deno.readTextFile( - "cli/tests/webgpu_hellotriangle_shader.wgsl", + "cli/tests/testdata/webgpu_hellotriangle_shader.wgsl", ); const shaderModule = device.createShaderModule({ @@ -194,7 +194,10 @@ unitTest({ await outputBuffer.mapAsync(1); const data = new Uint8Array(outputBuffer.getMappedRange()); - assertEquals(data, await Deno.readFile("cli/tests/webgpu_hellotriangle.out")); + assertEquals( + data, + await Deno.readFile("cli/tests/testdata/webgpu_hellotriangle.out"), + ); outputBuffer.unmap(); diff --git a/cli/tests/unstable.js b/cli/tests/unstable.js deleted file mode 100644 index a9894be3e..000000000 --- a/cli/tests/unstable.js +++ /dev/null @@ -1 +0,0 @@ -console.log(Deno.loadavg); diff --git a/cli/tests/unstable.ts b/cli/tests/unstable.ts deleted file mode 100644 index a9894be3e..000000000 --- a/cli/tests/unstable.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(Deno.loadavg); diff --git a/cli/tests/unstable_disabled.out b/cli/tests/unstable_disabled.out deleted file mode 100644 index e951c5d0a..000000000 --- a/cli/tests/unstable_disabled.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD] -error: TS2339 [ERROR]: Property 'loadavg' does not exist on type 'typeof Deno'. 'Deno.loadavg' is an unstable API. Did you forget to run with the '--unstable' flag? -console.log(Deno.loadavg); - ~~~~~~~ - at [WILDCARD]/cli/tests/unstable.ts:1:18 diff --git a/cli/tests/unstable_disabled_js.out b/cli/tests/unstable_disabled_js.out deleted file mode 100644 index 417b7b537..000000000 --- a/cli/tests/unstable_disabled_js.out +++ /dev/null @@ -1 +0,0 @@ -undefined diff --git a/cli/tests/unstable_enabled.out b/cli/tests/unstable_enabled.out deleted file mode 100644 index b4cedce14..000000000 --- a/cli/tests/unstable_enabled.out +++ /dev/null @@ -1 +0,0 @@ -[Function: loadavg] diff --git a/cli/tests/unstable_enabled_js.out b/cli/tests/unstable_enabled_js.out deleted file mode 100644 index b4cedce14..000000000 --- a/cli/tests/unstable_enabled_js.out +++ /dev/null @@ -1 +0,0 @@ -[Function: loadavg] diff --git a/cli/tests/unstable_worker.ts b/cli/tests/unstable_worker.ts deleted file mode 100644 index 429754dfe..000000000 --- a/cli/tests/unstable_worker.ts +++ /dev/null @@ -1,12 +0,0 @@ -const w = new Worker( - new URL("workers/worker_unstable.ts", import.meta.url).href, - { - type: "module", - deno: { - namespace: true, - }, - name: "Unstable Worker", - }, -); - -w.postMessage({}); diff --git a/cli/tests/unstable_worker.ts.out b/cli/tests/unstable_worker.ts.out deleted file mode 100644 index ece47de97..000000000 --- a/cli/tests/unstable_worker.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[Function: query] -[Function: emit] diff --git a/cli/tests/unsupported_dynamic_import_scheme.out b/cli/tests/unsupported_dynamic_import_scheme.out deleted file mode 100644 index c708fced4..000000000 --- a/cli/tests/unsupported_dynamic_import_scheme.out +++ /dev/null @@ -1,7 +0,0 @@ -error: Uncaught (in promise) TypeError: Unsupported scheme "xxx" for module "xxx:". Supported schemes: [ - "data", - "blob", - "file", - "http", - "https", -] diff --git a/cli/tests/v8_flags.js b/cli/tests/v8_flags.js deleted file mode 100644 index f7999c4af..000000000 --- a/cli/tests/v8_flags.js +++ /dev/null @@ -1 +0,0 @@ -console.log(typeof gc); diff --git a/cli/tests/v8_flags.js.out b/cli/tests/v8_flags.js.out deleted file mode 100644 index e2dbde096..000000000 --- a/cli/tests/v8_flags.js.out +++ /dev/null @@ -1 +0,0 @@ -function diff --git a/cli/tests/v8_flags_unrecognized.out b/cli/tests/v8_flags_unrecognized.out deleted file mode 100644 index 56e70f830..000000000 --- a/cli/tests/v8_flags_unrecognized.out +++ /dev/null @@ -1,5 +0,0 @@ -error: V8 did not recognize flag '--foo' -error: V8 did not recognize flag 'bar' -error: V8 did not recognize flag '-baz' - -For a list of V8 flags, use '--v8-flags=--help' diff --git a/cli/tests/v8_help.out b/cli/tests/v8_help.out deleted file mode 100644 index 006d73557..000000000 --- a/cli/tests/v8_help.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -Options: -[WILDCARD] - --trace-gc [WILDCARD] diff --git a/cli/tests/wasm.ts b/cli/tests/wasm.ts deleted file mode 100644 index 96b5fdffc..000000000 --- a/cli/tests/wasm.ts +++ /dev/null @@ -1,16 +0,0 @@ -// deno-fmt-ignore -const wasmCode = new Uint8Array([ - 0, 97, 115, 109, 1, 0, 0, 0, 1, 133, 128, 128, 128, 0, 1, 96, 0, 1, 127, - 3, 130, 128, 128, 128, 0, 1, 0, 4, 132, 128, 128, 128, 0, 1, 112, 0, 0, - 5, 131, 128, 128, 128, 0, 1, 0, 1, 6, 129, 128, 128, 128, 0, 0, 7, 145, - 128, 128, 128, 0, 2, 6, 109, 101, 109, 111, 114, 121, 2, 0, 4, 109, 97, - 105, 110, 0, 0, 10, 138, 128, 128, 128, 0, 1, 132, 128, 128, 128, 0, 0, - 65, 42, 11 - ]); - -const wasmModule = new WebAssembly.Module(wasmCode); - -const wasmInstance = new WebAssembly.Instance(wasmModule); - -const main = wasmInstance.exports.main as CallableFunction; -console.log(main().toString()); diff --git a/cli/tests/wasm.ts.out b/cli/tests/wasm.ts.out deleted file mode 100644 index d81cc0710..000000000 --- a/cli/tests/wasm.ts.out +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/cli/tests/wasm_async.js b/cli/tests/wasm_async.js deleted file mode 100644 index 837460ae9..000000000 --- a/cli/tests/wasm_async.js +++ /dev/null @@ -1,27 +0,0 @@ -// The following blob can be created by taking the following s-expr and pass -// it through wat2wasm. -// (module -// (func $add (param $a i32) (param $b i32) (result i32) -// local.get $a -// local.get $b -// i32.add) -// (export "add" (func $add)) -// ) -// deno-fmt-ignore -const bytes = new Uint8Array([ - 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, 0x60, - 0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x07, 0x01, - 0x03, 0x61, 0x64, 0x64, 0x00, 0x00, 0x0a, 0x09, 0x01, 0x07, 0x00, 0x20, - 0x00, 0x20, 0x01, 0x6a, 0x0b -]); - -async function main() { - const wasm = await WebAssembly.instantiate(bytes); - const result = wasm.instance.exports.add(1, 3); - console.log("1 + 3 =", result); - if (result != 4) { - throw Error("bad"); - } -} - -main(); diff --git a/cli/tests/wasm_async.out b/cli/tests/wasm_async.out deleted file mode 100644 index 5cdf17de7..000000000 --- a/cli/tests/wasm_async.out +++ /dev/null @@ -1 +0,0 @@ -1 + 3 = 4 diff --git a/cli/tests/wasm_shared.out b/cli/tests/wasm_shared.out deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/wasm_shared.ts b/cli/tests/wasm_shared.ts deleted file mode 100644 index b713385d5..000000000 --- a/cli/tests/wasm_shared.ts +++ /dev/null @@ -1,6 +0,0 @@ -const memory = new WebAssembly.Memory({ - initial: 1, - maximum: 10, - shared: true, -}); -console.assert(memory.buffer instanceof SharedArrayBuffer); diff --git a/cli/tests/wasm_unreachable.js b/cli/tests/wasm_unreachable.js deleted file mode 100644 index 991ebcec8..000000000 --- a/cli/tests/wasm_unreachable.js +++ /dev/null @@ -1,50 +0,0 @@ -// WebAssembly module containing a single function with an unreachable instruction -const binary = Uint8Array.from([ - 0x00, - 0x61, - 0x73, - 0x6d, - 0x01, - 0x00, - 0x00, - 0x00, - 0x01, - 0x04, - 0x01, - 0x60, - 0x00, - 0x00, - 0x03, - 0x02, - 0x01, - 0x00, - 0x07, - 0x0f, - 0x01, - 0x0b, - 0x75, - 0x6e, - 0x72, - 0x65, - 0x61, - 0x63, - 0x68, - 0x61, - 0x62, - 0x6c, - 0x65, - 0x00, - 0x00, - 0x0a, - 0x05, - 0x01, - 0x03, - 0x00, - 0x00, - 0x0b, -]); - -const module = new WebAssembly.Module(binary); -const instance = new WebAssembly.Instance(module); - -instance.exports.unreachable(); diff --git a/cli/tests/wasm_unreachable.out b/cli/tests/wasm_unreachable.out deleted file mode 100644 index 743e7f6cd..000000000 --- a/cli/tests/wasm_unreachable.out +++ /dev/null @@ -1,3 +0,0 @@ -error: Uncaught RuntimeError: unreachable - at (wasm://wasm/[WILDCARD]) - at [WILDCARD]/cli/tests/wasm_unreachable.js:[WILDCARD] diff --git a/cli/tests/weakref.ts b/cli/tests/weakref.ts deleted file mode 100644 index 47c3985fe..000000000 --- a/cli/tests/weakref.ts +++ /dev/null @@ -1 +0,0 @@ -console.log(WeakRef, FinalizationRegistry); diff --git a/cli/tests/weakref.ts.out b/cli/tests/weakref.ts.out deleted file mode 100644 index 32bafcf2d..000000000 --- a/cli/tests/weakref.ts.out +++ /dev/null @@ -1 +0,0 @@ -[Function: WeakRef] [Function: FinalizationRegistry] diff --git a/cli/tests/webgpu_computepass_shader.wgsl b/cli/tests/webgpu_computepass_shader.wgsl deleted file mode 100644 index 7d4748e2a..000000000 --- a/cli/tests/webgpu_computepass_shader.wgsl +++ /dev/null @@ -1,37 +0,0 @@ -[[block]] -struct PrimeIndices { - data: [[stride(4)]] array; -}; // this is used as both input and output for convenience -[[group(0), binding(0)]] -var v_indices: [[access(read_write)]] PrimeIndices; -// The Collatz Conjecture states that for any integer n: -// If n is even, n = n/2 -// If n is odd, n = 3n+1 -// And repeat this process for each new n, you will always eventually reach 1. -// Though the conjecture has not been proven, no counterexample has ever been found. -// This function returns how many times this recurrence needs to be applied to reach 1. -fn collatz_iterations(n_base: u32) -> u32{ - var n: u32 = n_base; - var i: u32 = 0u; - loop { - if (n <= 1u) { - break; - } - if (n % 2u == 0u) { - n = n / 2u; - } - else { - // Overflow? (i.e. 3*n + 1 > 0xffffffffu?) - if (n >= 1431655765u) { // 0x55555555u - return 4294967295u; // 0xffffffffu - } - n = 3u * n + 1u; - } - i = i + 1u; - } - return i; -} -[[stage(compute), workgroup_size(1)]] -fn main([[builtin(global_invocation_id)]] global_id: vec3) { - v_indices.data[global_id.x] = collatz_iterations(v_indices.data[global_id.x]); -} diff --git a/cli/tests/webgpu_hellotriangle.out b/cli/tests/webgpu_hellotriangle.out deleted file mode 100644 index 91454dbfc..000000000 Binary files a/cli/tests/webgpu_hellotriangle.out and /dev/null differ diff --git a/cli/tests/webgpu_hellotriangle_shader.wgsl b/cli/tests/webgpu_hellotriangle_shader.wgsl deleted file mode 100644 index b8b2b69fc..000000000 --- a/cli/tests/webgpu_hellotriangle_shader.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -[[stage(vertex)]] -fn vs_main([[builtin(vertex_index)]] in_vertex_index: u32) -> [[builtin(position)]] vec4 { - let x = f32(i32(in_vertex_index) - 1); - let y = f32(i32(in_vertex_index & 1u) * 2 - 1); - return vec4(x, y, 0.0, 1.0); -} -[[stage(fragment)]] -fn fs_main() -> [[location(0)]] vec4 { - return vec4(1.0, 0.0, 0.0, 1.0); -} diff --git a/cli/tests/websocket_test.ts b/cli/tests/websocket_test.ts deleted file mode 100644 index 7d62679fe..000000000 --- a/cli/tests/websocket_test.ts +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { - assert, - assertEquals, - assertThrows, - fail, -} from "../../test_util/std/testing/asserts.ts"; -import { deferred } from "../../test_util/std/async/deferred.ts"; - -Deno.test("invalid scheme", () => { - assertThrows(() => new WebSocket("foo://localhost:4242")); -}); - -Deno.test("fragment", () => { - assertThrows(() => new WebSocket("ws://localhost:4242/#")); - assertThrows(() => new WebSocket("ws://localhost:4242/#foo")); -}); - -Deno.test("duplicate protocols", () => { - assertThrows(() => new WebSocket("ws://localhost:4242", ["foo", "foo"])); -}); - -Deno.test("invalid server", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:2121"); - let err = false; - ws.onerror = () => { - err = true; - }; - ws.onclose = () => { - if (err) { - promise.resolve(); - } else { - fail(); - } - }; - ws.onopen = () => fail(); - await promise; -}); - -Deno.test("connect & close", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => { - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("connect & abort", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.close(); - let err = false; - ws.onerror = () => { - err = true; - }; - ws.onclose = () => { - if (err) { - promise.resolve(); - } else { - fail(); - } - }; - ws.onopen = () => fail(); - await promise; -}); - -Deno.test("connect & close custom valid code", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => ws.close(1000); - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("connect & close custom invalid code", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => { - assertThrows(() => ws.close(1001)); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("connect & close custom valid reason", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => ws.close(1000, "foo"); - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("connect & close custom invalid reason", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => { - assertThrows(() => ws.close(1000, "".padEnd(124, "o"))); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo string", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.onerror = () => fail(); - ws.onopen = () => ws.send("foo"); - ws.onmessage = (e) => { - assertEquals(e.data, "foo"); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo string tls", async () => { - const promise1 = deferred(); - const promise2 = deferred(); - const ws = new WebSocket("wss://localhost:4243"); - ws.onerror = () => fail(); - ws.onopen = () => ws.send("foo"); - ws.onmessage = (e) => { - assertEquals(e.data, "foo"); - ws.close(); - promise1.resolve(); - }; - ws.onclose = () => { - promise2.resolve(); - }; - await promise1; - await promise2; -}); - -Deno.test("websocket error", async () => { - const promise1 = deferred(); - const ws = new WebSocket("wss://localhost:4242"); - ws.onopen = () => fail(); - ws.onerror = (err) => { - assert(err instanceof ErrorEvent); - - // Error message got changed because we don't use warp in test_util - assertEquals(err.message, "UnexpectedEof: tls handshake eof"); - promise1.resolve(); - }; - await promise1; -}); - -Deno.test("echo blob with binaryType blob", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - const blob = new Blob(["foo"]); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(blob); - ws.onmessage = (e) => { - e.data.text().then((actual: string) => { - blob.text().then((expected) => { - assertEquals(actual, expected); - }); - }); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo blob with binaryType arraybuffer", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.binaryType = "arraybuffer"; - const blob = new Blob(["foo"]); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(blob); - ws.onmessage = (e) => { - blob.arrayBuffer().then((expected) => { - assertEquals(e.data, expected); - }); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo uint8array with binaryType blob", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - const uint = new Uint8Array([102, 111, 111]); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(uint); - ws.onmessage = (e) => { - e.data.arrayBuffer().then((actual: ArrayBuffer) => { - assertEquals(actual, uint.buffer); - }); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo uint8array with binaryType arraybuffer", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.binaryType = "arraybuffer"; - const uint = new Uint8Array([102, 111, 111]); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(uint); - ws.onmessage = (e) => { - assertEquals(e.data, uint.buffer); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo arraybuffer with binaryType blob", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - const buffer = new ArrayBuffer(3); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(buffer); - ws.onmessage = (e) => { - e.data.arrayBuffer().then((actual: ArrayBuffer) => { - assertEquals(actual, buffer); - }); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("echo arraybuffer with binaryType arraybuffer", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - ws.binaryType = "arraybuffer"; - const buffer = new ArrayBuffer(3); - ws.onerror = () => fail(); - ws.onopen = () => ws.send(buffer); - ws.onmessage = (e) => { - assertEquals(e.data, buffer); - ws.close(); - }; - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("Event Handlers order", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4242"); - const arr: number[] = []; - ws.onerror = () => fail(); - ws.addEventListener("message", () => arr.push(1)); - ws.onmessage = () => fail(); - ws.addEventListener("message", () => { - arr.push(3); - ws.close(); - assertEquals(arr, [1, 2, 3]); - }); - ws.onmessage = () => arr.push(2); - ws.onopen = () => ws.send("Echo"); - ws.onclose = () => { - promise.resolve(); - }; - await promise; -}); - -Deno.test("Close without frame", async () => { - const promise = deferred(); - const ws = new WebSocket("ws://localhost:4244"); - ws.onerror = () => fail(); - ws.onclose = (e) => { - assertEquals(e.code, 1005); - promise.resolve(); - }; - await promise; -}); diff --git a/cli/tests/websocketstream_test.ts b/cli/tests/websocketstream_test.ts deleted file mode 100644 index 5b4d19f6e..000000000 --- a/cli/tests/websocketstream_test.ts +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -import { - assertEquals, - assertThrows, - assertThrowsAsync, -} from "../../test_util/std/testing/asserts.ts"; - -Deno.test("fragment", () => { - assertThrows(() => new WebSocketStream("ws://localhost:4242/#")); - assertThrows(() => new WebSocketStream("ws://localhost:4242/#foo")); -}); - -Deno.test("duplicate protocols", () => { - assertThrows(() => - new WebSocketStream("ws://localhost:4242", { - protocols: ["foo", "foo"], - }) - ); -}); - -Deno.test("connect & close custom valid code", async () => { - const ws = new WebSocketStream("ws://localhost:4242"); - await ws.connection; - ws.close({ code: 1000 }); - await ws.closed; -}); - -Deno.test("connect & close custom invalid reason", async () => { - const ws = new WebSocketStream("ws://localhost:4242"); - await ws.connection; - assertThrows(() => ws.close({ code: 1000, reason: "".padEnd(124, "o") })); - ws.close(); - await ws.closed; -}); - -Deno.test("echo string", async () => { - const ws = new WebSocketStream("ws://localhost:4242"); - const { readable, writable } = await ws.connection; - await writable.getWriter().write("foo"); - const res = await readable.getReader().read(); - assertEquals(res.value, "foo"); - ws.close(); - await ws.closed; -}); - -Deno.test("echo string tls", async () => { - const ws = new WebSocketStream("wss://localhost:4243"); - const { readable, writable } = await ws.connection; - await writable.getWriter().write("foo"); - const res = await readable.getReader().read(); - assertEquals(res.value, "foo"); - ws.close(); - await ws.closed; -}); - -Deno.test("websocket error", async () => { - const ws = new WebSocketStream("wss://localhost:4242"); - await Promise.all([ - assertThrowsAsync( - () => ws.connection, - Deno.errors.UnexpectedEof, - "tls handshake eof", - ), - assertThrowsAsync( - () => ws.closed, - Deno.errors.UnexpectedEof, - "tls handshake eof", - ), - ]); -}); - -Deno.test("echo uint8array", async () => { - const ws = new WebSocketStream("ws://localhost:4242"); - const { readable, writable } = await ws.connection; - const uint = new Uint8Array([102, 111, 111]); - await writable.getWriter().write(uint); - const res = await readable.getReader().read(); - assertEquals(res.value, uint); - ws.close(); - await ws.closed; -}); diff --git a/cli/tests/worker_close_race.js b/cli/tests/worker_close_race.js deleted file mode 100644 index 6d5bbe2c3..000000000 --- a/cli/tests/worker_close_race.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018-2021 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( - new URL("./workers/close_race_worker.js", import.meta.url), - { type: "module" }, -); - -worker.onmessage = () => { - worker.terminate(); -}; diff --git a/cli/tests/worker_close_race.js.out b/cli/tests/worker_close_race.js.out deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/worker_event_handler_test.js b/cli/tests/worker_event_handler_test.js deleted file mode 100644 index e0ce3d9f8..000000000 --- a/cli/tests/worker_event_handler_test.js +++ /dev/null @@ -1,5 +0,0 @@ -const w = new Worker( - new URL("./workers/worker_event_handlers.js", import.meta.url).href, - { type: "module" }, -); -w.postMessage({}); diff --git a/cli/tests/worker_event_handler_test.js.out b/cli/tests/worker_event_handler_test.js.out deleted file mode 100644 index 5556633b1..000000000 --- a/cli/tests/worker_event_handler_test.js.out +++ /dev/null @@ -1,11 +0,0 @@ -Target from self.onmessage: [object DedicatedWorkerGlobalScope] -Target from message event listener: [object DedicatedWorkerGlobalScope] -Arguments from self.onerror: [ - "Some error message", - "", - 0, - 0, - Error: Some error message - at [WILDCARD] -] -Is event canceled?: true diff --git a/cli/tests/workers/bench_large_message.ts b/cli/tests/workers/bench_large_message.ts deleted file mode 100644 index a89ea9a78..000000000 --- a/cli/tests/workers/bench_large_message.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2020 the Deno authors. All rights reserved. MIT license. - -function oneWorker(i: number) { - return new Promise((resolve) => { - let countDown = 10; - const worker = new Worker( - new URL("worker_large_message.js", import.meta.url).href, - { type: "module" }, - ); - worker.onmessage = (_e) => { - if (countDown > 0) { - countDown--; - return; - } - worker.terminate(); - resolve(); - }; - worker.postMessage("hi " + i); - }); -} - -function bench() { - const promises = []; - for (let i = 0; i < 50; i++) { - promises.push(oneWorker(i)); - } - - return Promise.all(promises); -} - -bench(); diff --git a/cli/tests/workers/bench_round_robin.ts b/cli/tests/workers/bench_round_robin.ts deleted file mode 100644 index a39f7ec6f..000000000 --- a/cli/tests/workers/bench_round_robin.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Benchmark measures time it takes to send a message to a group of workers one -// at a time and wait for a response from all of them. Just a general -// throughput and consistency benchmark. -const data = "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n"; -const workerCount = 4; -const cmdsPerWorker = 400; - -import { Deferred, deferred } from "../../../test_util/std/async/deferred.ts"; - -function handleAsyncMsgFromWorker( - promiseTable: Map>, - msg: { cmdId: number; data: string }, -) { - const promise = promiseTable.get(msg.cmdId); - if (promise === null) { - throw new Error(`Failed to find promise: cmdId: ${msg.cmdId}, msg: ${msg}`); - } - promise?.resolve(data); -} - -async function main() { - const workers: Array<[Map>, Worker]> = []; - for (let i = 1; i <= workerCount; ++i) { - const worker = new Worker( - new URL("bench_worker.ts", import.meta.url).href, - { type: "module" }, - ); - const promise = deferred(); - worker.onmessage = (e) => { - if (e.data.cmdId === 0) promise.resolve(); - }; - worker.postMessage({ cmdId: 0, action: 2 }); - await promise; - workers.push([new Map(), worker]); - } - // assign callback function - for (const [promiseTable, worker] of workers) { - worker.onmessage = (e) => { - handleAsyncMsgFromWorker(promiseTable, e.data); - }; - } - for (const cmdId of Array(cmdsPerWorker).keys()) { - const promises: Array> = []; - for (const [promiseTable, worker] of workers) { - const promise = deferred(); - promiseTable.set(cmdId, promise); - worker.postMessage({ cmdId: cmdId, action: 1, data }); - promises.push(promise); - } - for (const promise of promises) { - await promise; - } - } - for (const [, worker] of workers) { - const promise = deferred(); - worker.onmessage = (e) => { - if (e.data.cmdId === 3) promise.resolve(); - }; - worker.postMessage({ action: 3 }); - await promise; - } - console.log("Finished!"); -} - -main(); diff --git a/cli/tests/workers/bench_startup.ts b/cli/tests/workers/bench_startup.ts deleted file mode 100644 index bcf21ef44..000000000 --- a/cli/tests/workers/bench_startup.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Benchmark measures time it takes to start and stop a number of workers. -const workerCount = 50; - -async function bench() { - const workers: Worker[] = []; - for (let i = 1; i <= workerCount; ++i) { - const worker = new Worker( - new URL("bench_worker.ts", import.meta.url).href, - { type: "module" }, - ); - const promise = new Promise((resolve) => { - worker.onmessage = (e) => { - if (e.data.cmdId === 0) resolve(); - }; - }); - worker.postMessage({ cmdId: 0, action: 2 }); - await promise; - workers.push(worker); - } - console.log("Done creating workers closing workers!"); - for (const worker of workers) { - const promise = new Promise((resolve) => { - worker.onmessage = (e) => { - if (e.data.cmdId === 3) resolve(); - }; - }); - worker.postMessage({ action: 3 }); - await promise; - } - console.log("Finished!"); -} - -bench(); diff --git a/cli/tests/workers/bench_worker.ts b/cli/tests/workers/bench_worker.ts deleted file mode 100644 index 1edd2750f..000000000 --- a/cli/tests/workers/bench_worker.ts +++ /dev/null @@ -1,21 +0,0 @@ -onmessage = function (e) { - const { cmdId, action, data } = e.data; - switch (action) { - case 0: // Static response - postMessage({ - cmdId, - data: "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", - }); - break; - case 1: // Respond with request data - postMessage({ cmdId, data }); - break; - case 2: // Ping - postMessage({ cmdId }); - break; - case 3: // Close - postMessage({ cmdId: 3 }); - close(); - break; - } -}; diff --git a/cli/tests/workers/broadcast_channel.ts b/cli/tests/workers/broadcast_channel.ts deleted file mode 100644 index 5076e9eb7..000000000 --- a/cli/tests/workers/broadcast_channel.ts +++ /dev/null @@ -1,5 +0,0 @@ -new BroadcastChannel("intercom").onmessage = function (e) { - this.postMessage(e.data); -}; - -self.postMessage("go"); diff --git a/cli/tests/workers/busy_worker.js b/cli/tests/workers/busy_worker.js deleted file mode 100644 index 7deba0321..000000000 --- a/cli/tests/workers/busy_worker.js +++ /dev/null @@ -1,8 +0,0 @@ -self.onmessage = function (_evt) { - // infinite loop - for (let i = 0; true; i++) { - if (i % 1000 == 0) { - postMessage(i); - } - } -}; diff --git a/cli/tests/workers/close_race_worker.js b/cli/tests/workers/close_race_worker.js deleted file mode 100644 index f582a0d99..000000000 --- a/cli/tests/workers/close_race_worker.js +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -setTimeout(() => { - self.postMessage(""); - self.close(); -}, 500); diff --git a/cli/tests/workers/deno_worker.ts b/cli/tests/workers/deno_worker.ts deleted file mode 100644 index 2a29c8c4d..000000000 --- a/cli/tests/workers/deno_worker.ts +++ /dev/null @@ -1,7 +0,0 @@ -onmessage = function (e) { - if (typeof self.Deno === "undefined") { - throw new Error("Deno namespace not available in worker"); - } - - postMessage(e.data); -}; diff --git a/cli/tests/workers/dynamic_remote.ts b/cli/tests/workers/dynamic_remote.ts deleted file mode 100644 index 381c7f374..000000000 --- a/cli/tests/workers/dynamic_remote.ts +++ /dev/null @@ -1,2 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -await import("https://example.com/some/file.ts"); diff --git a/cli/tests/workers/error.ts b/cli/tests/workers/error.ts deleted file mode 100644 index 495971090..000000000 --- a/cli/tests/workers/error.ts +++ /dev/null @@ -1,5 +0,0 @@ -function foo() { - throw new Error("foo"); -} - -foo(); diff --git a/cli/tests/workers/event_worker.js b/cli/tests/workers/event_worker.js deleted file mode 100644 index 849b6026c..000000000 --- a/cli/tests/workers/event_worker.js +++ /dev/null @@ -1,7 +0,0 @@ -onmessage = function (e) { - if (e.data === "boom") { - throw new Error("boom error!"); - } - - postMessage(e.data); -}; diff --git a/cli/tests/workers/event_worker_scope.js b/cli/tests/workers/event_worker_scope.js deleted file mode 100644 index 0381801a8..000000000 --- a/cli/tests/workers/event_worker_scope.js +++ /dev/null @@ -1,43 +0,0 @@ -let messageHandlersCalled = 0; -let errorHandlersCalled = 0; - -onmessage = function (e) { - if (e.data === "boom") { - throw new Error("boom error!"); - } - messageHandlersCalled++; -}; - -self.addEventListener("message", (_e) => { - messageHandlersCalled++; -}); - -self.addEventListener("message", (_e) => { - messageHandlersCalled++; -}); - -self.addEventListener("message", (_e) => { - messageHandlersCalled++; - - postMessage({ - messageHandlersCalled, - errorHandlersCalled, - }); -}); - -onerror = function (_e) { - errorHandlersCalled++; -}; - -self.addEventListener("error", (_e) => { - errorHandlersCalled++; -}); - -self.addEventListener("error", (_e) => { - errorHandlersCalled++; -}); - -self.addEventListener("error", (e) => { - errorHandlersCalled++; - e.preventDefault(); -}); diff --git a/cli/tests/workers/fetching_worker.js b/cli/tests/workers/fetching_worker.js deleted file mode 100644 index e1bcdf911..000000000 --- a/cli/tests/workers/fetching_worker.js +++ /dev/null @@ -1,6 +0,0 @@ -const r = await fetch( - "http://localhost:4545/cli/tests/workers/fetching_worker.js", -); -await r.text(); -postMessage("Done!"); -close(); diff --git a/cli/tests/workers/http_worker.js b/cli/tests/workers/http_worker.js deleted file mode 100644 index 34603ed56..000000000 --- a/cli/tests/workers/http_worker.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -const listener = Deno.listen({ hostname: "127.0.0.1", port: 4506 }); -postMessage("ready"); -for await (const conn of listener) { - (async () => { - const requests = Deno.serveHttp(conn); - for await (const { respondWith } of requests) { - respondWith(new Response("Hello world")); - } - })(); -} diff --git a/cli/tests/workers/immediately_close_worker.js b/cli/tests/workers/immediately_close_worker.js deleted file mode 100644 index 8fd27343a..000000000 --- a/cli/tests/workers/immediately_close_worker.js +++ /dev/null @@ -1 +0,0 @@ -self.close(); diff --git a/cli/tests/workers/message_port.ts b/cli/tests/workers/message_port.ts deleted file mode 100644 index d78304a39..000000000 --- a/cli/tests/workers/message_port.ts +++ /dev/null @@ -1,14 +0,0 @@ -const channel = new MessageChannel(); - -channel.port2.onmessage = (e) => { - channel.port2.postMessage(e.data === "2"); - channel.port2.close(); -}; - -self.postMessage("1", [channel.port1]); - -self.onmessage = (e) => { - const port1 = e.ports[0]; - port1.postMessage(e.data === "3"); - port1.close(); -}; diff --git a/cli/tests/workers/nested_worker.js b/cli/tests/workers/nested_worker.js deleted file mode 100644 index 4b51b8763..000000000 --- a/cli/tests/workers/nested_worker.js +++ /dev/null @@ -1,18 +0,0 @@ -// Specifier should be resolved relative to current file -const jsWorker = new Worker( - new URL("sibling_worker.js", import.meta.url).href, - { type: "module", name: "sibling" }, -); - -jsWorker.onerror = (_e) => { - postMessage({ type: "error" }); -}; - -jsWorker.onmessage = (e) => { - postMessage({ type: "msg", text: e }); - close(); -}; - -onmessage = function (e) { - jsWorker.postMessage(e.data); -}; diff --git a/cli/tests/workers/no_permissions_worker.js b/cli/tests/workers/no_permissions_worker.js deleted file mode 100644 index db0d911ac..000000000 --- a/cli/tests/workers/no_permissions_worker.js +++ /dev/null @@ -1,17 +0,0 @@ -self.onmessage = async () => { - const hrtime = await Deno.permissions.query({ name: "hrtime" }); - const net = await Deno.permissions.query({ name: "net" }); - const ffi = await Deno.permissions.query({ name: "ffi" }); - const read = await Deno.permissions.query({ name: "read" }); - const run = await Deno.permissions.query({ name: "run" }); - const write = await Deno.permissions.query({ name: "write" }); - self.postMessage( - hrtime.state === "denied" && - net.state === "denied" && - ffi.state === "denied" && - read.state === "denied" && - run.state === "denied" && - write.state === "denied", - ); - self.close(); -}; diff --git a/cli/tests/workers/non_deno_worker.js b/cli/tests/workers/non_deno_worker.js deleted file mode 100644 index 773721560..000000000 --- a/cli/tests/workers/non_deno_worker.js +++ /dev/null @@ -1,7 +0,0 @@ -onmessage = function (e) { - if (typeof self.Deno !== "undefined") { - throw new Error("Deno namespace unexpectedly available in worker"); - } - - postMessage(e.data); -}; diff --git a/cli/tests/workers/nonexistent_worker.out b/cli/tests/workers/nonexistent_worker.out deleted file mode 100644 index 04b9f801d..000000000 --- a/cli/tests/workers/nonexistent_worker.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]error: Uncaught (in worker "") Cannot resolve module "file:///[WILDCARD]cli/tests/workers/doesnt_exist.js". -error: Uncaught (in promise) Error: Unhandled error event reached main worker. - at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/workers/nonexistent_worker.ts b/cli/tests/workers/nonexistent_worker.ts deleted file mode 100644 index 8ebe29114..000000000 --- a/cli/tests/workers/nonexistent_worker.ts +++ /dev/null @@ -1,5 +0,0 @@ -const w = new Worker(new URL("doesnt_exist.js", import.meta.url).href, { - type: "module", -}); - -w.postMessage("hello"); diff --git a/cli/tests/workers/parent_read_check_granular_worker.js b/cli/tests/workers/parent_read_check_granular_worker.js deleted file mode 100644 index 1391190cd..000000000 --- a/cli/tests/workers/parent_read_check_granular_worker.js +++ /dev/null @@ -1,41 +0,0 @@ -const worker = new Worker( - new URL("./read_check_granular_worker.js", import.meta.url).href, - { - type: "module", - deno: { - namespace: true, - permissions: { - read: [], - }, - }, - }, -); - -let received = 0; -const messages = []; - -worker.onmessage = ({ data: childResponse }) => { - received++; - postMessage({ - childHasPermission: childResponse.hasPermission, - index: childResponse.index, - parentHasPermission: messages[childResponse.index], - }); - if (received === messages.length) { - worker.terminate(); - } -}; - -onmessage = async ({ data }) => { - const { state } = await Deno.permissions.query({ - name: "read", - path: data.path, - }); - - messages[data.index] = state === "granted"; - - worker.postMessage({ - index: data.index, - route: data.route, - }); -}; diff --git a/cli/tests/workers/parent_read_check_worker.js b/cli/tests/workers/parent_read_check_worker.js deleted file mode 100644 index ec92cca3f..000000000 --- a/cli/tests/workers/parent_read_check_worker.js +++ /dev/null @@ -1,27 +0,0 @@ -onmessage = async () => { - const { state } = await Deno.permissions.query({ - name: "read", - }); - - const worker = new Worker( - new URL("./read_check_worker.js", import.meta.url).href, - { - type: "module", - deno: { - namespace: true, - permissions: { - read: false, - }, - }, - }, - ); - - worker.onmessage = ({ data: childHasPermission }) => { - postMessage({ - parentHasPermission: state === "granted", - childHasPermission, - }); - close(); - }; - worker.postMessage(null); -}; diff --git a/cli/tests/workers/permissions_blob_local.ts b/cli/tests/workers/permissions_blob_local.ts deleted file mode 100644 index 52f630bd8..000000000 --- a/cli/tests/workers/permissions_blob_local.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "file:///${ - Deno.build.os == "windows" ? "C:/" : "" -}local_file.ts";`; -const blob = new Blob([code]); -new Worker(URL.createObjectURL(blob), { type: "module" }); diff --git a/cli/tests/workers/permissions_blob_local.ts.out b/cli/tests/workers/permissions_blob_local.ts.out deleted file mode 100644 index 0835777ec..000000000 --- a/cli/tests/workers/permissions_blob_local.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in worker "") Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag - at blob:null/[WILDCARD]:1:0 -error: Uncaught (in promise) Error: Unhandled error event reached main worker. - at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/workers/permissions_blob_remote.ts b/cli/tests/workers/permissions_blob_remote.ts deleted file mode 100644 index 4808bc57b..000000000 --- a/cli/tests/workers/permissions_blob_remote.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "https://example.com/some/file.ts";`; -const blob = new Blob([code]); -new Worker(URL.createObjectURL(blob), { type: "module" }); diff --git a/cli/tests/workers/permissions_blob_remote.ts.out b/cli/tests/workers/permissions_blob_remote.ts.out deleted file mode 100644 index 2d01458ca..000000000 --- a/cli/tests/workers/permissions_blob_remote.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in worker "") Requires net access to "example.com", run again with the --allow-net flag - at blob:null/[WILDCARD]:1:0 -error: Uncaught (in promise) Error: Unhandled error event reached main worker. - at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/workers/permissions_data_local.ts b/cli/tests/workers/permissions_data_local.ts deleted file mode 100644 index cda80bed6..000000000 --- a/cli/tests/workers/permissions_data_local.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "file:///${ - Deno.build.os == "windows" ? "C:/" : "" -}local_file.ts";`; -new Worker(`data:application/javascript;base64,${btoa(code)}`, { - type: "module", -}); diff --git a/cli/tests/workers/permissions_data_local.ts.out b/cli/tests/workers/permissions_data_local.ts.out deleted file mode 100644 index 2a6be2b57..000000000 --- a/cli/tests/workers/permissions_data_local.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in worker "") Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag - at data:application/javascript;base64,[WILDCARD]:1:0 -error: Uncaught (in promise) Error: Unhandled error event reached main worker. - at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/workers/permissions_data_remote.ts b/cli/tests/workers/permissions_data_remote.ts deleted file mode 100644 index b37bd661d..000000000 --- a/cli/tests/workers/permissions_data_remote.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "https://example.com/some/file.ts";`; -new Worker(`data:application/javascript;base64,${btoa(code)}`, { - type: "module", -}); diff --git a/cli/tests/workers/permissions_data_remote.ts.out b/cli/tests/workers/permissions_data_remote.ts.out deleted file mode 100644 index 90677892a..000000000 --- a/cli/tests/workers/permissions_data_remote.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in worker "") Requires net access to "example.com", run again with the --allow-net flag - at data:application/javascript;base64,aW1wb3J0ICJodHRwczovL2V4YW1wbGUuY29tL3NvbWUvZmlsZS50cyI7:1:0 -error: Uncaught (in promise) Error: Unhandled error event reached main worker. - at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/workers/permissions_dynamic_remote.ts b/cli/tests/workers/permissions_dynamic_remote.ts deleted file mode 100644 index a5d293e16..000000000 --- a/cli/tests/workers/permissions_dynamic_remote.ts +++ /dev/null @@ -1,11 +0,0 @@ -new Worker( - "http://localhost:4545/cli/tests/workers/dynamic_remote.ts", - { - type: "module", - deno: { - permissions: { - net: false, - }, - }, - }, -); diff --git a/cli/tests/workers/permissions_dynamic_remote.ts.out b/cli/tests/workers/permissions_dynamic_remote.ts.out deleted file mode 100644 index e68c96df1..000000000 --- a/cli/tests/workers/permissions_dynamic_remote.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -error: Uncaught (in worker "") (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag -await import("https://example.com/some/file.ts"); -^ - at async http://localhost:4545/cli/tests/workers/dynamic_remote.ts:2:1 -[WILDCARD]error: Uncaught (in promise) Error: Unhandled error event reached main worker. - at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/workers/permissions_remote_remote.ts b/cli/tests/workers/permissions_remote_remote.ts deleted file mode 100644 index b1f954a31..000000000 --- a/cli/tests/workers/permissions_remote_remote.ts +++ /dev/null @@ -1,3 +0,0 @@ -new Worker("http://localhost:4545/cli/tests/workers/static_remote.ts", { - type: "module", -}); diff --git a/cli/tests/workers/permissions_remote_remote.ts.out b/cli/tests/workers/permissions_remote_remote.ts.out deleted file mode 100644 index 5656b75a1..000000000 --- a/cli/tests/workers/permissions_remote_remote.ts.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in worker "") Requires net access to "example.com", run again with the --allow-net flag - at http://localhost:4545/cli/tests/workers/static_remote.ts:2:0 -error: Uncaught (in promise) Error: Unhandled error event reached main worker. - at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/workers/post_undefined.ts b/cli/tests/workers/post_undefined.ts deleted file mode 100644 index 1b9b8d6ca..000000000 --- a/cli/tests/workers/post_undefined.ts +++ /dev/null @@ -1,5 +0,0 @@ -self.onmessage = (ev: MessageEvent) => { - console.log("received in worker", ev.data); - self.postMessage(undefined); - console.log("posted from worker"); -}; diff --git a/cli/tests/workers/racy_worker.js b/cli/tests/workers/racy_worker.js deleted file mode 100644 index 0f66c6278..000000000 --- a/cli/tests/workers/racy_worker.js +++ /dev/null @@ -1,25 +0,0 @@ -// See issue for details -// https://github.com/denoland/deno/issues/4080 -// -// After first received message, this worker schedules -// [assert(), close(), assert()] ops on the same turn of microtask queue -// All tasks after close should not make it - -onmessage = async function () { - let stage = 0; - await new Promise((_) => { - setTimeout(() => { - if (stage !== 0) throw "Unexpected stage"; - stage = 1; - }, 50); - setTimeout(() => { - if (stage !== 1) throw "Unexpected stage"; - stage = 2; - postMessage("DONE"); - close(); - }, 50); - setTimeout(() => { - throw "This should not be run"; - }, 50); - }); -}; diff --git a/cli/tests/workers/read_check_granular_worker.js b/cli/tests/workers/read_check_granular_worker.js deleted file mode 100644 index 25f2058b3..000000000 --- a/cli/tests/workers/read_check_granular_worker.js +++ /dev/null @@ -1,11 +0,0 @@ -onmessage = async ({ data }) => { - const { state } = await Deno.permissions.query({ - name: "read", - path: data.path, - }); - - postMessage({ - hasPermission: state === "granted", - index: data.index, - }); -}; diff --git a/cli/tests/workers/read_check_worker.js b/cli/tests/workers/read_check_worker.js deleted file mode 100644 index 2ad01bf5b..000000000 --- a/cli/tests/workers/read_check_worker.js +++ /dev/null @@ -1,7 +0,0 @@ -onmessage = async () => { - const { state } = await Deno.permissions.query({ - name: "read", - }); - postMessage(state === "granted"); - close(); -}; diff --git a/cli/tests/workers/shared_array_buffer.ts b/cli/tests/workers/shared_array_buffer.ts deleted file mode 100644 index 4af95863a..000000000 --- a/cli/tests/workers/shared_array_buffer.ts +++ /dev/null @@ -1,9 +0,0 @@ -self.postMessage("ready"); - -globalThis.addEventListener("message", (e) => { - const bytes1 = new Uint8Array(e.data[0]); - const bytes2 = new Uint8Array(e.data[1]); - bytes1[0] = 1; - bytes2[0] = 2; - self.postMessage("done"); -}); diff --git a/cli/tests/workers/sibling_worker.js b/cli/tests/workers/sibling_worker.js deleted file mode 100644 index 99707e5d6..000000000 --- a/cli/tests/workers/sibling_worker.js +++ /dev/null @@ -1,4 +0,0 @@ -onmessage = (e) => { - postMessage(e.data); - close(); -}; diff --git a/cli/tests/workers/static_remote.ts b/cli/tests/workers/static_remote.ts deleted file mode 100644 index 2d6e820fd..000000000 --- a/cli/tests/workers/static_remote.ts +++ /dev/null @@ -1,2 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -import "https://example.com/some/file.ts"; diff --git a/cli/tests/workers/test.ts b/cli/tests/workers/test.ts deleted file mode 100644 index 44cbca0fe..000000000 --- a/cli/tests/workers/test.ts +++ /dev/null @@ -1,852 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -// Requires to be run with `--allow-net` flag - -import { - assert, - assertEquals, - assertThrows, -} from "../../../test_util/std/testing/asserts.ts"; -import { deferred } from "../../../test_util/std/async/deferred.ts"; -import { fromFileUrl } from "../../../test_util/std/path/mod.ts"; - -Deno.test({ - name: "worker terminate", - fn: async function () { - const promise = deferred(); - - const jsWorker = new Worker( - new URL("test_worker.js", import.meta.url).href, - { type: "module" }, - ); - const tsWorker = new Worker( - new URL("test_worker.ts", import.meta.url).href, - { type: "module", name: "tsWorker" }, - ); - - tsWorker.onmessage = (e) => { - assertEquals(e.data, "Hello World"); - promise.resolve(); - }; - - jsWorker.onmessage = (e) => { - assertEquals(e.data, "Hello World"); - tsWorker.postMessage("Hello World"); - }; - - jsWorker.onerror = (e: Event) => { - e.preventDefault(); - jsWorker.postMessage("Hello World"); - }; - - jsWorker.postMessage("Hello World"); - await promise; - tsWorker.terminate(); - jsWorker.terminate(); - }, -}); - -Deno.test({ - name: "worker from data url", - async fn() { - const promise = deferred(); - const tsWorker = new Worker( - "data:application/typescript;base64,aWYgKHNlbGYubmFtZSAhPT0gInRzV29ya2VyIikgewogIHRocm93IEVycm9yKGBJbnZhbGlkIHdvcmtlciBuYW1lOiAke3NlbGYubmFtZX0sIGV4cGVjdGVkIHRzV29ya2VyYCk7Cn0KCm9ubWVzc2FnZSA9IGZ1bmN0aW9uIChlKTogdm9pZCB7CiAgcG9zdE1lc3NhZ2UoZS5kYXRhKTsKICBjbG9zZSgpOwp9Owo=", - { type: "module", name: "tsWorker" }, - ); - - tsWorker.onmessage = (e) => { - assertEquals(e.data, "Hello World"); - promise.resolve(); - }; - - tsWorker.postMessage("Hello World"); - - await promise; - tsWorker.terminate(); - }, -}); - -Deno.test({ - name: "worker nested", - fn: async function () { - const promise = deferred(); - - const nestedWorker = new Worker( - new URL("nested_worker.js", import.meta.url).href, - { type: "module", name: "nested" }, - ); - - nestedWorker.onmessage = (e) => { - assert(e.data.type !== "error"); - promise.resolve(); - }; - - nestedWorker.postMessage("Hello World"); - await promise; - nestedWorker.terminate(); - }, -}); - -Deno.test({ - name: "worker throws when executing", - fn: async function () { - const promise = deferred(); - const throwingWorker = new Worker( - new URL("throwing_worker.js", import.meta.url).href, - { type: "module" }, - ); - - // deno-lint-ignore no-explicit-any - throwingWorker.onerror = (e: any) => { - e.preventDefault(); - assert(/Uncaught Error: Thrown error/.test(e.message)); - promise.resolve(); - }; - - await promise; - throwingWorker.terminate(); - }, -}); - -Deno.test({ - name: "worker globals", - fn: async function () { - const promise = deferred(); - const workerOptions: WorkerOptions = { type: "module" }; - const w = new Worker( - new URL("worker_globals.ts", import.meta.url).href, - workerOptions, - ); - w.onmessage = (e) => { - assertEquals(e.data, "true, true, true, true"); - promise.resolve(); - }; - w.postMessage("Hello, world!"); - await promise; - w.terminate(); - }, -}); - -Deno.test({ - name: "worker fetch API", - fn: async function () { - const promise = deferred(); - - const fetchingWorker = new Worker( - new URL("fetching_worker.js", import.meta.url).href, - { type: "module" }, - ); - - // deno-lint-ignore no-explicit-any - fetchingWorker.onerror = (e: any) => { - e.preventDefault(); - promise.reject(e.message); - }; - - // Defer promise.resolve() to allow worker to shut down - fetchingWorker.onmessage = (e) => { - assert(e.data === "Done!"); - promise.resolve(); - }; - - await promise; - fetchingWorker.terminate(); - }, -}); - -Deno.test({ - name: "worker terminate busy loop", - fn: async function () { - const promise = deferred(); - - const busyWorker = new Worker( - new URL("busy_worker.js", import.meta.url), - { type: "module" }, - ); - - let testResult = 0; - - busyWorker.onmessage = (e) => { - testResult = e.data; - if (testResult >= 10000) { - busyWorker.terminate(); - busyWorker.onmessage = (_e) => { - throw new Error("unreachable"); - }; - setTimeout(() => { - assertEquals(testResult, 10000); - promise.resolve(); - }, 100); - } - }; - - busyWorker.postMessage("ping"); - await promise; - }, -}); - -Deno.test({ - name: "worker race condition", - fn: async function () { - // See issue for details - // https://github.com/denoland/deno/issues/4080 - const promise = deferred(); - - const racyWorker = new Worker( - new URL("racy_worker.js", import.meta.url), - { type: "module" }, - ); - - racyWorker.onmessage = (_e) => { - setTimeout(() => { - promise.resolve(); - }, 100); - }; - - racyWorker.postMessage("START"); - await promise; - }, -}); - -Deno.test({ - name: "worker is event listener", - fn: async function () { - let messageHandlersCalled = 0; - let errorHandlersCalled = 0; - - const promise1 = deferred(); - const promise2 = deferred(); - - const worker = new Worker( - new URL("event_worker.js", import.meta.url), - { type: "module" }, - ); - - worker.onmessage = (_e: Event) => { - messageHandlersCalled++; - }; - worker.addEventListener("message", (_e: Event) => { - messageHandlersCalled++; - }); - worker.addEventListener("message", (_e: Event) => { - messageHandlersCalled++; - promise1.resolve(); - }); - - worker.onerror = (e) => { - errorHandlersCalled++; - e.preventDefault(); - }; - worker.addEventListener("error", (_e: Event) => { - errorHandlersCalled++; - }); - worker.addEventListener("error", (_e: Event) => { - errorHandlersCalled++; - promise2.resolve(); - }); - - worker.postMessage("ping"); - await promise1; - assertEquals(messageHandlersCalled, 3); - - worker.postMessage("boom"); - await promise2; - assertEquals(errorHandlersCalled, 3); - worker.terminate(); - }, -}); - -Deno.test({ - name: "worker scope is event listener", - fn: async function () { - const promise1 = deferred(); - - const worker = new Worker( - new URL("event_worker_scope.js", import.meta.url), - { type: "module" }, - ); - - worker.onmessage = (e: MessageEvent) => { - const { messageHandlersCalled, errorHandlersCalled } = e.data; - assertEquals(messageHandlersCalled, 4); - assertEquals(errorHandlersCalled, 4); - promise1.resolve(); - }; - - worker.onerror = (_e) => { - throw new Error("unreachable"); - }; - - worker.postMessage("boom"); - worker.postMessage("ping"); - await promise1; - worker.terminate(); - }, -}); - -Deno.test({ - name: "worker with Deno namespace", - fn: async function () { - const promise = deferred(); - const promise2 = deferred(); - - const regularWorker = new Worker( - new URL("non_deno_worker.js", import.meta.url), - { type: "module" }, - ); - const denoWorker = new Worker( - new URL("deno_worker.ts", import.meta.url), - { - type: "module", - deno: { - namespace: true, - permissions: "inherit", - }, - }, - ); - - regularWorker.onmessage = (e) => { - assertEquals(e.data, "Hello World"); - regularWorker.terminate(); - promise.resolve(); - }; - - denoWorker.onmessage = (e) => { - assertEquals(e.data, "Hello World"); - denoWorker.terminate(); - promise2.resolve(); - }; - - regularWorker.postMessage("Hello World"); - await promise; - denoWorker.postMessage("Hello World"); - await promise2; - }, -}); - -Deno.test({ - name: "worker with crypto in scope", - fn: async function () { - const promise = deferred(); - const w = new Worker( - new URL("worker_crypto.js", import.meta.url).href, - { type: "module" }, - ); - w.onmessage = (e) => { - assertEquals(e.data, true); - promise.resolve(); - }; - w.postMessage(null); - await promise; - w.terminate(); - }, -}); - -Deno.test({ - name: "Worker event handler order", - fn: async function () { - const promise = deferred(); - const w = new Worker( - new URL("test_worker.ts", import.meta.url).href, - { type: "module", name: "tsWorker" }, - ); - const arr: number[] = []; - w.addEventListener("message", () => arr.push(1)); - w.onmessage = (_e) => { - arr.push(2); - }; - w.addEventListener("message", () => arr.push(3)); - w.addEventListener("message", () => { - assertEquals(arr, [1, 2, 3]); - promise.resolve(); - }); - w.postMessage("Hello World"); - await promise; - w.terminate(); - }, -}); - -Deno.test({ - name: "Worker immediate close", - fn: async function () { - const promise = deferred(); - const w = new Worker( - new URL("./immediately_close_worker.js", import.meta.url).href, - { type: "module" }, - ); - setTimeout(() => { - promise.resolve(); - }, 1000); - await promise; - w.terminate(); - }, -}); - -Deno.test({ - name: "Worker post undefined", - fn: async function () { - const promise = deferred(); - const worker = new Worker( - new URL("./post_undefined.ts", import.meta.url).href, - { type: "module" }, - ); - - const handleWorkerMessage = (e: MessageEvent) => { - console.log("main <- worker:", e.data); - worker.terminate(); - promise.resolve(); - }; - - worker.addEventListener("messageerror", () => console.log("message error")); - worker.addEventListener("error", () => console.log("error")); - worker.addEventListener("message", handleWorkerMessage); - - console.log("\npost from parent"); - worker.postMessage(undefined); - await promise; - }, -}); - -Deno.test("Worker inherits permissions", async function () { - const promise = deferred(); - const worker = new Worker( - new URL("./read_check_worker.js", import.meta.url).href, - { - type: "module", - deno: { - namespace: true, - permissions: "inherit", - }, - }, - ); - - worker.onmessage = ({ data: hasPermission }) => { - assert(hasPermission); - promise.resolve(); - }; - - worker.postMessage(null); - - await promise; - worker.terminate(); -}); - -Deno.test("Worker limit children permissions", async function () { - const promise = deferred(); - const worker = new Worker( - new URL("./read_check_worker.js", import.meta.url).href, - { - type: "module", - deno: { - namespace: true, - permissions: { - read: false, - }, - }, - }, - ); - - worker.onmessage = ({ data: hasPermission }) => { - assert(!hasPermission); - promise.resolve(); - }; - - worker.postMessage(null); - - await promise; - worker.terminate(); -}); - -Deno.test("Worker limit children permissions granularly", async function () { - const promise = deferred(); - const worker = new Worker( - new URL("./read_check_granular_worker.js", import.meta.url).href, - { - type: "module", - deno: { - namespace: true, - permissions: { - read: [ - new URL("./read_check_worker.js", import.meta.url), - ], - }, - }, - }, - ); - - //Routes are relative to the spawned worker location - const routes = [ - { - permission: false, - path: fromFileUrl( - new URL("read_check_granular_worker.js", import.meta.url), - ), - }, - { - permission: true, - path: fromFileUrl(new URL("read_check_worker.js", import.meta.url)), - }, - ]; - - let checked = 0; - worker.onmessage = ({ data }) => { - checked++; - assertEquals(data.hasPermission, routes[data.index].permission); - routes.shift(); - if (checked === routes.length) { - promise.resolve(); - } - }; - - routes.forEach(({ path }, index) => - worker.postMessage({ - index, - path, - }) - ); - - await promise; - worker.terminate(); -}); - -Deno.test("Nested worker limit children permissions", async function () { - const promise = deferred(); - - /** This worker has read permissions but doesn't grant them to its children */ - const worker = new Worker( - new URL("./parent_read_check_worker.js", import.meta.url).href, - { - type: "module", - deno: { - namespace: true, - permissions: "inherit", - }, - }, - ); - - worker.onmessage = ({ data }) => { - assert(data.parentHasPermission); - assert(!data.childHasPermission); - promise.resolve(); - }; - - worker.postMessage(null); - - await promise; - worker.terminate(); -}); - -Deno.test("Nested worker limit children permissions granularly", async function () { - const promise = deferred(); - - /** This worker has read permissions but doesn't grant them to its children */ - const worker = new Worker( - new URL("./parent_read_check_granular_worker.js", import.meta.url) - .href, - { - type: "module", - deno: { - namespace: true, - permissions: { - read: [ - new URL("./read_check_granular_worker.js", import.meta.url), - ], - }, - }, - }, - ); - - //Routes are relative to the spawned worker location - const routes = [ - { - childHasPermission: false, - parentHasPermission: true, - path: fromFileUrl( - new URL("read_check_granular_worker.js", import.meta.url), - ), - }, - { - childHasPermission: false, - parentHasPermission: false, - path: fromFileUrl(new URL("read_check_worker.js", import.meta.url)), - }, - ]; - - let checked = 0; - worker.onmessage = ({ data }) => { - checked++; - assertEquals( - data.childHasPermission, - routes[data.index].childHasPermission, - ); - assertEquals( - data.parentHasPermission, - routes[data.index].parentHasPermission, - ); - if (checked === routes.length) { - promise.resolve(); - } - }; - - // Index needed cause requests will be handled asynchronously - routes.forEach(({ path }, index) => - worker.postMessage({ - index, - path, - }) - ); - - await promise; - worker.terminate(); -}); - -// This test relies on env permissions not being granted on main thread -Deno.test("Worker initialization throws on worker permissions greater than parent thread permissions", function () { - assertThrows( - () => { - const worker = new Worker( - new URL("./deno_worker.ts", import.meta.url).href, - { - type: "module", - deno: { - namespace: true, - permissions: { - env: true, - }, - }, - }, - ); - worker.terminate(); - }, - Deno.errors.PermissionDenied, - "Can't escalate parent thread permissions", - ); -}); - -Deno.test("Worker with disabled permissions", async function () { - const promise = deferred(); - - const worker = new Worker( - new URL("./no_permissions_worker.js", import.meta.url).href, - { - type: "module", - deno: { - namespace: true, - permissions: "none", - }, - }, - ); - - worker.onmessage = ({ data: sandboxed }) => { - assert(sandboxed); - promise.resolve(); - }; - - worker.postMessage(null); - await promise; - worker.terminate(); -}); - -Deno.test({ - name: "worker location", - fn: async function () { - const promise = deferred(); - const workerModuleHref = - new URL("worker_location.ts", import.meta.url).href; - const w = new Worker(workerModuleHref, { type: "module" }); - w.onmessage = (e) => { - assertEquals(e.data, `${workerModuleHref}, true`); - promise.resolve(); - }; - w.postMessage("Hello, world!"); - await promise; - w.terminate(); - }, -}); - -Deno.test({ - name: "worker with relative specifier", - fn: async function () { - assertEquals(location.href, "http://127.0.0.1:4545/cli/tests/"); - const promise = deferred(); - const w = new Worker( - "./workers/test_worker.ts", - { type: "module", name: "tsWorker" }, - ); - w.onmessage = (e) => { - assertEquals(e.data, "Hello, world!"); - promise.resolve(); - }; - w.postMessage("Hello, world!"); - await promise; - w.terminate(); - }, -}); - -Deno.test({ - name: "Worker with top-level-await", - fn: async function () { - const result = deferred(); - const worker = new Worker( - new URL("worker_with_top_level_await.ts", import.meta.url).href, - { type: "module" }, - ); - worker.onmessage = (e) => { - if (e.data == "ready") { - worker.postMessage("trigger worker handler"); - } else if (e.data == "triggered worker handler") { - result.resolve(); - } else { - result.reject(new Error("Handler didn't run during top-level delay.")); - } - }; - await result; - worker.terminate(); - }, -}); - -Deno.test({ - name: "Worker with native HTTP", - fn: async function () { - const result = deferred(); - const worker = new Worker( - new URL( - "./http_worker.js", - import.meta.url, - ).href, - { - type: "module", - deno: { - namespace: true, - permissions: "inherit", - }, - }, - ); - worker.onmessage = () => { - result.resolve(); - }; - await result; - - assert(worker); - const response = await fetch("http://localhost:4506"); - assert(await response.arrayBuffer()); - worker.terminate(); - }, -}); - -Deno.test({ - name: "structured cloning postMessage", - fn: async function () { - const result = deferred(); - const worker = new Worker( - new URL("worker_structured_cloning.ts", import.meta.url).href, - { type: "module" }, - ); - - worker.onmessage = (e) => { - // self field should reference itself (circular ref) - const value = e.data.self.self.self; - - // fields a and b refer to the same array - assertEquals(value.a, ["a", true, 432]); - assertEquals(value.a, ["a", true, 432]); - value.b[0] = "b"; - value.a[2] += 5; - assertEquals(value.a, ["b", true, 437]); - assertEquals(value.b, ["b", true, 437]); - - const len = value.c.size; - value.c.add(1); // This value is already in the set. - value.c.add(2); - assertEquals(len + 1, value.c.size); - - result.resolve(); - }; - - worker.postMessage("START"); - await result; - worker.terminate(); - }, -}); - -Deno.test({ - name: "worker with relative specifier", - fn: async function () { - assertEquals(location.href, "http://127.0.0.1:4545/cli/tests/"); - const promise = deferred(); - const w = new Worker( - "./workers/test_worker.ts", - { type: "module", name: "tsWorker" }, - ); - w.onmessage = (e) => { - assertEquals(e.data, "Hello, world!"); - promise.resolve(); - }; - w.postMessage("Hello, world!"); - await promise; - w.terminate(); - }, -}); - -Deno.test({ - name: "worker SharedArrayBuffer", - fn: async function () { - const promise = deferred(); - const workerOptions: WorkerOptions = { type: "module" }; - const w = new Worker( - new URL("shared_array_buffer.ts", import.meta.url).href, - workerOptions, - ); - const sab1 = new SharedArrayBuffer(1); - const sab2 = new SharedArrayBuffer(1); - const bytes1 = new Uint8Array(sab1); - const bytes2 = new Uint8Array(sab2); - assertEquals(bytes1[0], 0); - assertEquals(bytes2[0], 0); - w.onmessage = () => { - w.postMessage([sab1, sab2]); - w.onmessage = () => { - assertEquals(bytes1[0], 1); - assertEquals(bytes2[0], 2); - promise.resolve(); - }; - }; - await promise; - w.terminate(); - }, -}); - -Deno.test({ - name: "Send MessagePorts from / to workers", - fn: async function () { - const result = deferred(); - const worker = new Worker( - new URL("message_port.ts", import.meta.url).href, - { type: "module" }, - ); - - const channel = new MessageChannel(); - - worker.onmessage = (e) => { - assertEquals(e.data, "1"); - assertEquals(e.ports.length, 1); - const port1 = e.ports[0]; - port1.onmessage = (e) => { - assertEquals(e.data, true); - port1.close(); - worker.postMessage("3", [channel.port1]); - }; - port1.postMessage("2"); - }; - - channel.port2.onmessage = (e) => { - assertEquals(e.data, true); - channel.port2.close(); - result.resolve(); - }; - - await result; - worker.terminate(); - }, -}); diff --git a/cli/tests/workers/test.ts.out b/cli/tests/workers/test.ts.out deleted file mode 100644 index 1b4238a9b..000000000 --- a/cli/tests/workers/test.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -test result: ok. [WILDCARD] passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]ms) - diff --git a/cli/tests/workers/test_worker.js b/cli/tests/workers/test_worker.js deleted file mode 100644 index 4260975a6..000000000 --- a/cli/tests/workers/test_worker.js +++ /dev/null @@ -1,19 +0,0 @@ -let thrown = false; - -if (self.name !== "") { - throw Error(`Bad worker name: ${self.name}, expected empty string.`); -} - -onmessage = function (e) { - if (thrown === false) { - thrown = true; - throw new SyntaxError("[test error]"); - } - - postMessage(e.data); - close(); -}; - -onerror = function () { - return false; -}; diff --git a/cli/tests/workers/test_worker.ts b/cli/tests/workers/test_worker.ts deleted file mode 100644 index 996476058..000000000 --- a/cli/tests/workers/test_worker.ts +++ /dev/null @@ -1,8 +0,0 @@ -if (self.name !== "tsWorker") { - throw Error(`Invalid worker name: ${self.name}, expected tsWorker`); -} - -onmessage = function (e) { - postMessage(e.data); - close(); -}; diff --git a/cli/tests/workers/throwing_worker.js b/cli/tests/workers/throwing_worker.js deleted file mode 100644 index 56ee4ff88..000000000 --- a/cli/tests/workers/throwing_worker.js +++ /dev/null @@ -1,2 +0,0 @@ -// This worker just throws error when it's being executed -throw Error("Thrown error"); diff --git a/cli/tests/workers/worker_crypto.js b/cli/tests/workers/worker_crypto.js deleted file mode 100644 index 4398ad068..000000000 --- a/cli/tests/workers/worker_crypto.js +++ /dev/null @@ -1,5 +0,0 @@ -self.crypto.getRandomValues(new Uint8Array(16)); - -onmessage = function () { - postMessage(!!self.crypto); -}; diff --git a/cli/tests/workers/worker_error.ts b/cli/tests/workers/worker_error.ts deleted file mode 100644 index 696680de8..000000000 --- a/cli/tests/workers/worker_error.ts +++ /dev/null @@ -1,5 +0,0 @@ -const worker = new Worker( - new URL("error.ts", import.meta.url).href, - { type: "module", name: "bar" }, -); -setTimeout(() => worker.terminate(), 30000); diff --git a/cli/tests/workers/worker_error.ts.out b/cli/tests/workers/worker_error.ts.out deleted file mode 100644 index 4a8e92f00..000000000 --- a/cli/tests/workers/worker_error.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD]error: Uncaught (in worker "bar") Error: foo[WILDCARD] - at foo ([WILDCARD]) - at [WILDCARD] -error: Uncaught (in promise) Error: Unhandled error event reached main worker. - at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/workers/worker_event_handlers.js b/cli/tests/workers/worker_event_handlers.js deleted file mode 100644 index c8976f79e..000000000 --- a/cli/tests/workers/worker_event_handlers.js +++ /dev/null @@ -1,23 +0,0 @@ -self.onmessage = (evt) => { - console.log("Target from self.onmessage:", String(evt.target)); -}; - -self.addEventListener("message", (evt) => { - console.log("Target from message event listener:", String(evt.target)); - - // Throw an error here so the global's error event will fire. - throw new Error("Some error message"); -}); - -self.onerror = (...args) => { - console.log("Arguments from self.onerror:", args); - return true; -}; - -self.addEventListener("error", (evt) => { - // Returning true from self.onerror means that subsequent event listeners - // should see the event as canceled. - console.log("Is event canceled?:", evt.defaultPrevented); - - self.close(); -}); diff --git a/cli/tests/workers/worker_globals.ts b/cli/tests/workers/worker_globals.ts deleted file mode 100644 index 90e369e41..000000000 --- a/cli/tests/workers/worker_globals.ts +++ /dev/null @@ -1,13 +0,0 @@ -onmessage = function () { - postMessage( - [ - self instanceof DedicatedWorkerGlobalScope, - self instanceof WorkerGlobalScope, - self instanceof EventTarget, - // TODO(nayeemrmn): Add `WorkerNavigator` to deno_lint globals. - // deno-lint-ignore no-undef - navigator instanceof WorkerNavigator, - ].join(", "), - ); - close(); -}; diff --git a/cli/tests/workers/worker_large_message.js b/cli/tests/workers/worker_large_message.js deleted file mode 100644 index a1ddae4f9..000000000 --- a/cli/tests/workers/worker_large_message.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2020 the Deno authors. All rights reserved. MIT license. - -const dataSmall = ""; -const dataLarge = "x".repeat(10 * 1024); - -onmessage = function (_e) { - for (let i = 0; i <= 10; i++) { - if (i % 2 == 0) { - postMessage(dataLarge); - } else { - postMessage(dataSmall); - } - } -}; diff --git a/cli/tests/workers/worker_location.ts b/cli/tests/workers/worker_location.ts deleted file mode 100644 index c3c1bb26f..000000000 --- a/cli/tests/workers/worker_location.ts +++ /dev/null @@ -1,6 +0,0 @@ -onmessage = function () { - postMessage( - `${location.href}, ${location instanceof WorkerLocation}`, - ); - close(); -}; diff --git a/cli/tests/workers/worker_nested_error.ts b/cli/tests/workers/worker_nested_error.ts deleted file mode 100644 index aba2011be..000000000 --- a/cli/tests/workers/worker_nested_error.ts +++ /dev/null @@ -1,5 +0,0 @@ -const worker = new Worker( - new URL("worker_error.ts", import.meta.url).href, - { type: "module", name: "baz" }, -); -setTimeout(() => worker.terminate(), 30000); diff --git a/cli/tests/workers/worker_nested_error.ts.out b/cli/tests/workers/worker_nested_error.ts.out deleted file mode 100644 index 4a8e92f00..000000000 --- a/cli/tests/workers/worker_nested_error.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD]error: Uncaught (in worker "bar") Error: foo[WILDCARD] - at foo ([WILDCARD]) - at [WILDCARD] -error: Uncaught (in promise) Error: Unhandled error event reached main worker. - at Worker.#pollControl ([WILDCARD]) diff --git a/cli/tests/workers/worker_structured_cloning.ts b/cli/tests/workers/worker_structured_cloning.ts deleted file mode 100644 index eb1719a9a..000000000 --- a/cli/tests/workers/worker_structured_cloning.ts +++ /dev/null @@ -1,15 +0,0 @@ -// More info on structured cloning can be found here: -// https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm - -self.onmessage = () => { - const arr = ["a", true, 432]; - const set = new Set([1, 3, 5, 7, 9]); - const selfReference = { - a: arr, - b: arr, - c: set, - }; - // deno-lint-ignore no-explicit-any - (selfReference as any).self = selfReference; - self.postMessage(selfReference); -}; diff --git a/cli/tests/workers/worker_types.ts b/cli/tests/workers/worker_types.ts deleted file mode 100644 index b67a3b782..000000000 --- a/cli/tests/workers/worker_types.ts +++ /dev/null @@ -1,4 +0,0 @@ -// deno-lint-ignore require-await -self.onmessage = async (_msg: MessageEvent) => { - self.postMessage("hello"); -}; diff --git a/cli/tests/workers/worker_unstable.ts b/cli/tests/workers/worker_unstable.ts deleted file mode 100644 index a5b5f7ba2..000000000 --- a/cli/tests/workers/worker_unstable.ts +++ /dev/null @@ -1,5 +0,0 @@ -console.log(Deno.permissions.query); -console.log(Deno.emit); -self.onmessage = () => { - self.close(); -}; diff --git a/cli/tests/workers/worker_with_top_level_await.ts b/cli/tests/workers/worker_with_top_level_await.ts deleted file mode 100644 index 1d20bb736..000000000 --- a/cli/tests/workers/worker_with_top_level_await.ts +++ /dev/null @@ -1,15 +0,0 @@ -function delay(ms: number) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, ms); - }); -} - -onmessage = (_e: MessageEvent) => { - postMessage("triggered worker handler"); - close(); -}; -postMessage("ready"); -await delay(1000); -postMessage("never"); diff --git a/cli/tests/x_deno_warning.js b/cli/tests/x_deno_warning.js deleted file mode 100644 index 34b950566..000000000 --- a/cli/tests/x_deno_warning.js +++ /dev/null @@ -1 +0,0 @@ -console.log("testing x-deno-warning header"); diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index b6bb8bbb2..4d4709e28 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -320,7 +320,7 @@ mod tests { use deno_core::parking_lot::Mutex; use std::process::Command; use tempfile::TempDir; - use test_util::tests_path; + use test_util::testdata_path; lazy_static::lazy_static! { pub static ref ENV_LOCK: Mutex<()> = Mutex::new(()); @@ -417,7 +417,7 @@ mod tests { install( Flags::default(), - "http://localhost:4545/cli/tests/echo_server.ts", + "http://localhost:4545/echo_server.ts", vec![], Some("echo_test".to_string()), None, @@ -437,11 +437,11 @@ mod tests { assert_eq!(content.chars().last().unwrap(), '\n'); if cfg!(windows) { - assert!(content - .contains(r#""run" "http://localhost:4545/cli/tests/echo_server.ts""#)); + assert!( + content.contains(r#""run" "http://localhost:4545/echo_server.ts""#) + ); } else { - assert!(content - .contains(r#"run 'http://localhost:4545/cli/tests/echo_server.ts'"#)); + assert!(content.contains(r#"run 'http://localhost:4545/echo_server.ts'"#)); } if let Some(home) = original_home { env::set_var("HOME", home); @@ -465,7 +465,7 @@ mod tests { unstable: true, ..Flags::default() }, - "http://localhost:4545/cli/tests/echo_server.ts", + "http://localhost:4545/echo_server.ts", vec![], Some("echo_test".to_string()), Some(temp_dir.path().to_path_buf()), @@ -484,12 +484,11 @@ mod tests { println!("this is the file path {:?}", content); if cfg!(windows) { assert!(content.contains( - r#""run" "--unstable" "http://localhost:4545/cli/tests/echo_server.ts""# + r#""run" "--unstable" "http://localhost:4545/echo_server.ts""# )); } else { - assert!(content.contains( - r#"run --unstable 'http://localhost:4545/cli/tests/echo_server.ts'"# - )); + assert!(content + .contains(r#"run --unstable 'http://localhost:4545/echo_server.ts'"#)); } } @@ -501,7 +500,7 @@ mod tests { install( Flags::default(), - "http://localhost:4545/cli/tests/echo_server.ts", + "http://localhost:4545/echo_server.ts", vec![], None, Some(temp_dir.path().to_path_buf()), @@ -517,11 +516,11 @@ mod tests { assert!(file_path.exists()); let content = fs::read_to_string(file_path).unwrap(); if cfg!(windows) { - assert!(content - .contains(r#""run" "http://localhost:4545/cli/tests/echo_server.ts""#)); + assert!( + content.contains(r#""run" "http://localhost:4545/echo_server.ts""#) + ); } else { - assert!(content - .contains(r#"run 'http://localhost:4545/cli/tests/echo_server.ts'"#)); + assert!(content.contains(r#"run 'http://localhost:4545/echo_server.ts'"#)); } } @@ -533,7 +532,7 @@ mod tests { install( Flags::default(), - "http://localhost:4545/cli/tests/subdir/main.ts", + "http://localhost:4545/subdir/main.ts", vec![], None, Some(temp_dir.path().to_path_buf()), @@ -549,11 +548,11 @@ mod tests { assert!(file_path.exists()); let content = fs::read_to_string(file_path).unwrap(); if cfg!(windows) { - assert!(content - .contains(r#""run" "http://localhost:4545/cli/tests/subdir/main.ts""#)); + assert!( + content.contains(r#""run" "http://localhost:4545/subdir/main.ts""#) + ); } else { - assert!(content - .contains(r#"run 'http://localhost:4545/cli/tests/subdir/main.ts'"#)); + assert!(content.contains(r#"run 'http://localhost:4545/subdir/main.ts'"#)); } } @@ -565,7 +564,7 @@ mod tests { install( Flags::default(), - "http://localhost:4545/cli/tests/echo_server.ts", + "http://localhost:4545/echo_server.ts", vec![], Some("echo_test".to_string()), Some(temp_dir.path().to_path_buf()), @@ -581,11 +580,11 @@ mod tests { assert!(file_path.exists()); let content = fs::read_to_string(file_path).unwrap(); if cfg!(windows) { - assert!(content - .contains(r#""run" "http://localhost:4545/cli/tests/echo_server.ts""#)); + assert!( + content.contains(r#""run" "http://localhost:4545/echo_server.ts""#) + ); } else { - assert!(content - .contains(r#"run 'http://localhost:4545/cli/tests/echo_server.ts'"#)); + assert!(content.contains(r#"run 'http://localhost:4545/echo_server.ts'"#)); } } @@ -600,7 +599,7 @@ mod tests { install( Flags::default(), - "http://localhost:4545/cli/tests/echo_server.ts", + "http://localhost:4545/echo_server.ts", vec![], Some("echo_test".to_string()), None, @@ -616,11 +615,11 @@ mod tests { assert!(file_path.exists()); let content = fs::read_to_string(file_path).unwrap(); if cfg!(windows) { - assert!(content - .contains(r#""run" "http://localhost:4545/cli/tests/echo_server.ts""#)); + assert!( + content.contains(r#""run" "http://localhost:4545/echo_server.ts""#) + ); } else { - assert!(content - .contains(r#"run 'http://localhost:4545/cli/tests/echo_server.ts'"#)); + assert!(content.contains(r#"run 'http://localhost:4545/echo_server.ts'"#)); } if let Some(install_root) = original_install_root { env::set_var("DENO_INSTALL_ROOT", install_root); @@ -641,7 +640,7 @@ mod tests { log_level: Some(Level::Error), ..Flags::default() }, - "http://localhost:4545/cli/tests/echo_server.ts", + "http://localhost:4545/echo_server.ts", vec!["--foobar".to_string()], Some("echo_test".to_string()), Some(temp_dir.path().to_path_buf()), @@ -657,9 +656,9 @@ mod tests { assert!(file_path.exists()); let content = fs::read_to_string(file_path).unwrap(); if cfg!(windows) { - assert!(content.contains(r#""run" "--allow-read" "--allow-net" "--quiet" "--no-check" "http://localhost:4545/cli/tests/echo_server.ts" "--foobar""#)); + assert!(content.contains(r#""run" "--allow-read" "--allow-net" "--quiet" "--no-check" "http://localhost:4545/echo_server.ts" "--foobar""#)); } else { - assert!(content.contains(r#"run --allow-read --allow-net --quiet --no-check 'http://localhost:4545/cli/tests/echo_server.ts' --foobar"#)); + assert!(content.contains(r#"run --allow-read --allow-net --quiet --no-check 'http://localhost:4545/echo_server.ts' --foobar"#)); } } @@ -700,7 +699,7 @@ mod tests { install( Flags::default(), - "http://localhost:4545/cli/tests/echo_server.ts", + "http://localhost:4545/echo_server.ts", vec![], Some("echo_test".to_string()), Some(temp_dir.path().to_path_buf()), @@ -717,7 +716,7 @@ mod tests { // No force. Install failed. let no_force_result = install( Flags::default(), - "http://localhost:4545/cli/tests/cat.ts", // using a different URL + "http://localhost:4545/cat.ts", // using a different URL vec![], Some("echo_test".to_string()), Some(temp_dir.path().to_path_buf()), @@ -735,7 +734,7 @@ mod tests { // Force. Install success. let force_result = install( Flags::default(), - "http://localhost:4545/cli/tests/cat.ts", // using a different URL + "http://localhost:4545/cat.ts", // using a different URL vec![], Some("echo_test".to_string()), Some(temp_dir.path().to_path_buf()), @@ -762,7 +761,7 @@ mod tests { config_path: Some(config_file_path.to_string_lossy().to_string()), ..Flags::default() }, - "http://localhost:4545/cli/tests/cat.ts", + "http://localhost:4545/cat.ts", vec![], Some("echo_test".to_string()), Some(temp_dir.path().to_path_buf()), @@ -789,7 +788,7 @@ mod tests { install( Flags::default(), - "http://localhost:4545/cli/tests/echo_server.ts", + "http://localhost:4545/echo_server.ts", vec!["\"".to_string()], Some("echo_test".to_string()), Some(temp_dir.path().to_path_buf()), @@ -808,9 +807,9 @@ mod tests { if cfg!(windows) { // TODO: see comment above this test } else { - assert!(content.contains( - r#"run 'http://localhost:4545/cli/tests/echo_server.ts' '"'"# - )); + assert!( + content.contains(r#"run 'http://localhost:4545/echo_server.ts' '"'"#) + ); } } @@ -864,7 +863,7 @@ mod tests { import_map_path: Some(import_map_path.to_string_lossy().to_string()), ..Flags::default() }, - "http://localhost:4545/cli/tests/cat.ts", + "http://localhost:4545/cat.ts", vec![], Some("echo_test".to_string()), Some(temp_dir.path().to_path_buf()), @@ -879,12 +878,12 @@ mod tests { assert!(file_path.exists()); let mut expected_string = format!( - "--import-map '{}' 'http://localhost:4545/cli/tests/cat.ts'", + "--import-map '{}' 'http://localhost:4545/cat.ts'", import_map_url.to_string() ); if cfg!(windows) { expected_string = format!( - "\"--import-map\" \"{}\" \"http://localhost:4545/cli/tests/cat.ts\"", + "\"--import-map\" \"{}\" \"http://localhost:4545/cat.ts\"", import_map_url.to_string() ); } @@ -898,7 +897,7 @@ mod tests { fn install_file_url() { let temp_dir = TempDir::new().expect("tempdir fail"); let bin_dir = temp_dir.path().join("bin"); - let module_path = fs::canonicalize(tests_path().join("cat.ts")).unwrap(); + let module_path = fs::canonicalize(testdata_path().join("cat.ts")).unwrap(); let file_module_string = Url::from_file_path(module_path).unwrap().to_string(); assert!(file_module_string.starts_with("file:///")); diff --git a/cli/tools/test_runner.rs b/cli/tools/test_runner.rs index 106555f7d..b0cf0c845 100644 --- a/cli/tools/test_runner.rs +++ b/cli/tools/test_runner.rs @@ -708,7 +708,7 @@ mod tests { #[test] fn test_collect_test_module_specifiers() { - let test_data_path = test_util::root_path().join("cli/tests/subdir"); + let sub_dir_path = test_util::testdata_path().join("subdir"); let mut matched_urls = collect_test_module_specifiers( vec![ "https://example.com/colors_test.ts".to_string(), @@ -717,12 +717,11 @@ mod tests { "subdir2/mod2.ts".to_string(), "http://example.com/printf_test.ts".to_string(), ], - &test_data_path, + &sub_dir_path, is_supported, ) .unwrap(); - let test_data_url = - Url::from_file_path(test_data_path).unwrap().to_string(); + let test_data_url = Url::from_file_path(sub_dir_path).unwrap().to_string(); let expected: Vec = vec![ format!("{}/mod1.ts", test_data_url), diff --git a/cli/tsc.rs b/cli/tsc.rs index b355c12fa..57bbeeca3 100644 --- a/cli/tsc.rs +++ b/cli/tsc.rs @@ -596,8 +596,6 @@ mod tests { use crate::module_graph::tests::MockSpecifierHandler; use crate::module_graph::GraphBuilder; use deno_core::parking_lot::Mutex; - use std::env; - use std::path::PathBuf; async fn setup( maybe_specifier: Option, @@ -607,8 +605,7 @@ mod tests { let specifier = maybe_specifier .unwrap_or_else(|| resolve_url_or_path("file:///main.ts").unwrap()); let hash_data = maybe_hash_data.unwrap_or_else(|| vec![b"".to_vec()]); - let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let fixtures = c.join("tests/tsc2"); + let fixtures = test_util::testdata_path().join("tsc2"); let handler = Arc::new(Mutex::new(MockSpecifierHandler { fixtures, ..MockSpecifierHandler::default() @@ -633,8 +630,7 @@ mod tests { specifier: &ModuleSpecifier, ) -> Result { let hash_data = vec![b"something".to_vec()]; - let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let fixtures = c.join("tests/tsc2"); + let fixtures = test_util::testdata_path().join("tsc2"); let handler = Arc::new(Mutex::new(MockSpecifierHandler { fixtures, ..Default::default() diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index 29a387887..c87d091ad 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -151,7 +151,7 @@ delete Object.prototype.__proto__; // TS1103: 'for-await-of' statement is only allowed within an async function // or async generator. 1103, - // TS2306: File 'file:///Users/rld/src/deno/cli/tests/subdir/amd_like.js' is + // TS2306: File 'file:///Users/rld/src/deno/cli/tests/testdata/subdir/amd_like.js' is // not a module. 2306, // TS2688: Cannot find type definition file for '...'. @@ -166,7 +166,7 @@ delete Object.prototype.__proto__; // TS5009: Cannot find the common subdirectory path for the input files. 5009, // TS5055: Cannot write file - // 'http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js' + // 'http://localhost:4545/subdir/mt_application_x_javascript.j4.js' // because it would overwrite input file. 5055, // TypeScript is overly opinionated that only CommonJS modules kinds can diff --git a/runtime/worker.rs b/runtime/worker.rs index 8057e38f1..b200ef08e 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -329,10 +329,7 @@ mod tests { #[tokio::test] async fn execute_mod_esm_imports_a() { - let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .parent() - .unwrap() - .join("cli/tests/esm_imports_a.js"); + let p = test_util::testdata_path().join("esm_imports_a.js"); let module_specifier = resolve_url_or_path(&p.to_string_lossy()).unwrap(); let mut worker = create_test_worker(); let result = worker.execute_module(&module_specifier).await; @@ -375,10 +372,7 @@ mod tests { // This assumes cwd is project root (an assumption made throughout the // tests). let mut worker = create_test_worker(); - let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .parent() - .unwrap() - .join("cli/tests/001_hello.js"); + let p = test_util::testdata_path().join("001_hello.js"); let module_specifier = resolve_url_or_path(&p.to_string_lossy()).unwrap(); let result = worker.execute_module(&module_specifier).await; assert!(result.is_ok()); diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 93a02c98e..d0067b15f 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -92,6 +92,10 @@ pub fn tests_path() -> PathBuf { root_path().join("cli").join("tests") } +pub fn testdata_path() -> PathBuf { + tests_path().join("testdata") +} + pub fn third_party_path() -> PathBuf { root_path().join("third_party") } @@ -200,7 +204,7 @@ async fn inf_redirects(req: Request) -> hyper::Result> { async fn another_redirect(req: Request) -> hyper::Result> { let p = req.uri().path(); assert_eq!(&p[0..1], "/"); - let url = format!("http://localhost:{}/cli/tests/subdir{}", PORT, p); + let url = format!("http://localhost:{}/subdir{}", PORT, p); Ok(redirect_resp(url)) } @@ -265,12 +269,9 @@ async fn get_tls_config( key: &str, ca: &str, ) -> io::Result> { - let mut cert_path = root_path(); - let mut key_path = root_path(); - let mut ca_path = root_path(); - cert_path.push(cert); - key_path.push(key); - ca_path.push(ca); + let cert_path = testdata_path().join(cert); + let key_path = testdata_path().join(key); + let ca_path = testdata_path().join(ca); let cert_file = std::fs::File::open(cert_path)?; let key_file = std::fs::File::open(key_path)?; @@ -323,9 +324,9 @@ async fn get_tls_config( } async fn run_wss_server(addr: &SocketAddr) { - let cert_file = "cli/tests/tls/localhost.crt"; - let key_file = "cli/tests/tls/localhost.key"; - let ca_cert_file = "cli/tests/tls/RootCA.pem"; + let cert_file = "tls/localhost.crt"; + let key_file = "tls/localhost.key"; + let ca_cert_file = "tls/RootCA.pem"; let tls_config = get_tls_config(cert_file, key_file, ca_cert_file) .await @@ -362,13 +363,13 @@ async fn run_wss_server(addr: &SocketAddr) { /// This server responds with 'PASS' if client authentication was successful. Try it by running /// test_server and -/// curl --key cli/tests/tls/localhost.key \ -/// --cert cli/tests/tls/localhost.crt \ -/// --cacert cli/tests/tls/RootCA.crt https://localhost:4552/ +/// curl --key cli/tests/testdata/tls/localhost.key \ +/// --cert cli/tests/testsdata/tls/localhost.crt \ +/// --cacert cli/tests/testdata/tls/RootCA.crt https://localhost:4552/ async fn run_tls_client_auth_server() { - let cert_file = "cli/tests/tls/localhost.crt"; - let key_file = "cli/tests/tls/localhost.key"; - let ca_cert_file = "cli/tests/tls/RootCA.pem"; + let cert_file = "tls/localhost.crt"; + let key_file = "tls/localhost.key"; + let ca_cert_file = "tls/RootCA.pem"; let tls_config = get_tls_config(cert_file, key_file, ca_cert_file) .await .unwrap(); @@ -444,7 +445,7 @@ async fn absolute_redirect( } } - let mut file_path = root_path(); + let mut file_path = testdata_path(); file_path.push(&req.uri().path()[1..]); if file_path.is_dir() || !file_path.exists() { let mut not_found_resp = Response::new(Body::empty()); @@ -676,7 +677,7 @@ async fn main_server(req: Request) -> hyper::Result> { ); Ok(res) } - (_, "/cli/tests/subdir/xTypeScriptTypesRedirect.d.ts") => { + (_, "/subdir/xTypeScriptTypesRedirect.d.ts") => { let mut res = Response::new(Body::from( "import './xTypeScriptTypesRedirected.d.ts';", )); @@ -686,7 +687,7 @@ async fn main_server(req: Request) -> hyper::Result> { ); Ok(res) } - (_, "/cli/tests/subdir/xTypeScriptTypesRedirected.d.ts") => { + (_, "/subdir/xTypeScriptTypesRedirected.d.ts") => { let mut res = Response::new(Body::from("export const foo: 'foo';")); res.headers_mut().insert( "Content-type", @@ -702,7 +703,7 @@ async fn main_server(req: Request) -> hyper::Result> { ); Ok(res) } - (_, "/cli/tests/subdir/file_with_:_in_name.ts") => { + (_, "/subdir/file_with_:_in_name.ts") => { let mut res = Response::new(Body::from( "console.log('Hello from file_with_:_in_name.ts');", )); @@ -712,7 +713,7 @@ async fn main_server(req: Request) -> hyper::Result> { ); Ok(res) } - (_, "/cli/tests/subdir/no_js_ext@1.0.0") => { + (_, "/subdir/no_js_ext@1.0.0") => { let mut res = Response::new(Body::from( r#"import { printHello } from "./mod2.ts"; printHello(); @@ -725,8 +726,8 @@ async fn main_server(req: Request) -> hyper::Result> { Ok(res) } (_, "/.well-known/deno-import-intellisense.json") => { - let file_path = root_path() - .join("cli/tests/lsp/registries/deno-import-intellisense.json"); + let file_path = + testdata_path().join("lsp/registries/deno-import-intellisense.json"); if let Ok(body) = tokio::fs::read(file_path).await { Ok(custom_headers( "/.well-known/deno-import-intellisense.json", @@ -737,10 +738,10 @@ async fn main_server(req: Request) -> hyper::Result> { } } _ => { - let mut file_path = root_path(); + let mut file_path = testdata_path(); file_path.push(&req.uri().path()[1..]); if let Ok(file) = tokio::fs::read(file_path).await { - let file_resp = custom_headers(&req.uri().path()[1..], file); + let file_resp = custom_headers(req.uri().path(), file); return Ok(file_resp); } @@ -860,12 +861,12 @@ async fn wrap_main_server() { async fn wrap_main_https_server() { let main_server_https_addr = SocketAddr::from(([127, 0, 0, 1], HTTPS_PORT)); - let cert_file = "cli/tests/tls/localhost.crt"; - let key_file = "cli/tests/tls/localhost.key"; - let ca_cert_file = "cli/tests/tls/RootCA.pem"; + let cert_file = "tls/localhost.crt"; + let key_file = "tls/localhost.key"; + let ca_cert_file = "tls/RootCA.pem"; let tls_config = get_tls_config(cert_file, key_file, ca_cert_file) .await - .expect("Cannot get TLS config"); + .unwrap(); loop { let tcp = TcpListener::bind(&main_server_https_addr) .await @@ -957,7 +958,7 @@ pub async fn run_all_servers() { fn custom_headers(p: &str, body: Vec) -> Response { let mut response = Response::new(Body::from(body)); - if p.ends_with("cli/tests/x_deno_warning.js") { + if p.ends_with("/x_deno_warning.js") { response.headers_mut().insert( "Content-Type", HeaderValue::from_static("application/javascript"), @@ -967,7 +968,7 @@ fn custom_headers(p: &str, body: Vec) -> Response { .insert("X-Deno-Warning", HeaderValue::from_static("foobar")); return response; } - if p.ends_with("cli/tests/053_import_compression/brotli") { + if p.ends_with("/053_import_compression/brotli") { response .headers_mut() .insert("Content-Encoding", HeaderValue::from_static("br")); @@ -980,7 +981,7 @@ fn custom_headers(p: &str, body: Vec) -> Response { .insert("Content-Length", HeaderValue::from_static("26")); return response; } - if p.ends_with("cli/tests/053_import_compression/gziped") { + if p.ends_with("/053_import_compression/gziped") { response .headers_mut() .insert("Content-Encoding", HeaderValue::from_static("gzip")); @@ -994,7 +995,7 @@ fn custom_headers(p: &str, body: Vec) -> Response { return response; } - if p.contains("cli/tests/encoding/") { + if p.contains("/encoding/") { let charset = p .split_terminator('/') .last() @@ -1069,7 +1070,7 @@ impl HttpServerCount { println!("test_server starting..."); let mut test_server = Command::new(test_server_path()) - .current_dir(root_path()) + .current_dir(testdata_path()) .stdout(Stdio::piped()) .spawn() .expect("failed to execute test_server"); @@ -1251,7 +1252,7 @@ pub fn run_and_collect_output_with_args( let mut deno_process_builder = deno_cmd(); deno_process_builder .args(args) - .current_dir(&tests_path()) + .current_dir(&testdata_path()) .stdin(Stdio::piped()) .stdout(Stdio::piped()) .stderr(Stdio::piped()); @@ -1313,7 +1314,7 @@ pub fn run_powershell_script_file( command .env("DENO_DIR", deno_dir.path()) - .current_dir(root_path()) + .current_dir(testdata_path()) .arg("-file") .arg(script_file_path); @@ -1348,9 +1349,7 @@ pub struct CheckOutputIntegrationTest { impl CheckOutputIntegrationTest { pub fn run(&self) { let args = self.args.split_whitespace(); - let root = root_path(); let deno_exe = deno_exe_path(); - println!("root path {}", root.display()); println!("deno_exe path {}", deno_exe.display()); let _http_server_guard = if self.http_server { @@ -1360,12 +1359,12 @@ impl CheckOutputIntegrationTest { }; let (mut reader, writer) = pipe().unwrap(); - let tests_dir = root.join("cli").join("tests"); + let testdata_dir = testdata_path(); let mut command = deno_cmd(); println!("deno_exe args {}", self.args); - println!("deno_exe tests path {:?}", &tests_dir); + println!("deno_exe testdata path {:?}", &testdata_dir); command.args(args); - command.current_dir(&tests_dir); + command.current_dir(&testdata_dir); command.stdin(Stdio::piped()); let writer_clone = writer.try_clone().unwrap(); command.stderr(writer_clone); @@ -1420,7 +1419,7 @@ impl CheckOutputIntegrationTest { let expected = if let Some(s) = self.output_str { s.to_owned() } else { - let output_path = tests_dir.join(self.output); + let output_path = testdata_dir.join(self.output); println!("output path {}", output_path.display()); std::fs::read_to_string(output_path).expect("cannot read output") }; @@ -1492,7 +1491,7 @@ pub fn pattern_match(pattern: &str, s: &str, wildcard: &str) -> bool { pub fn test_pty(args: &str, output_path: &str, input: &[u8]) { use pty::fork::Fork; - let tests_path = tests_path(); + let tests_path = testdata_path(); let fork = Fork::from_ptmx().unwrap(); if let Ok(mut master) = fork.is_parent() { let mut output_actual = String::new(); diff --git a/tools/lint.js b/tools/lint.js index 299632d90..f5aadc77c 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -17,19 +17,19 @@ async function dlint() { "*.js", "*.ts", ":!:.github/mtime_cache/action.js", - ":!:cli/tests/swc_syntax_error.ts", - ":!:cli/tests/038_checkjs.js", - ":!:cli/tests/error_008_checkjs.js", + ":!:cli/tests/testdata/swc_syntax_error.ts", + ":!:cli/tests/testdata/038_checkjs.js", + ":!:cli/tests/testdata/error_008_checkjs.js", ":!:std/**/testdata/*", ":!:std/**/node_modules/*", ":!:cli/bench/node*.js", ":!:cli/compilers/wasm_wrap.js", ":!:cli/dts/**", - ":!:cli/tests/encoding/**", - ":!:cli/tests/error_syntax.js", + ":!:cli/tests/testdata/encoding/**", + ":!:cli/tests/testdata/error_syntax.js", ":!:cli/tests/unit/**", - ":!:cli/tests/lint/**", - ":!:cli/tests/tsc/**", + ":!:cli/tests/testdata/lint/**", + ":!:cli/tests/testdata/tsc/**", ":!:cli/tsc/*typescript.js", ":!:test_util/wpt/**", ]); -- cgit v1.2.3