diff --git a/.dprint.json b/.dprint.json index 489a61e571..3b2376f786 100644 --- a/.dprint.json +++ b/.dprint.json @@ -65,7 +65,11 @@ "tests/wpt/runner/expectation.json", "tests/wpt/runner/manifest.json", "tests/wpt/suite", - "third_party" + "third_party", + "tests/specs/run/shebang_with_json_imports_tsc", + "tests/specs/run/shebang_with_json_imports_swc", + "tests/specs/run/ext_flag_takes_precedence_over_extension", + "tests/specs/run/error_syntax_empty_trailing_line/error_syntax_empty_trailing_line.mjs" ], "plugins": [ "https://plugins.dprint.dev/typescript-0.93.2.wasm", diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index a07dd56c83..686fbabcf6 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -24,272 +24,12 @@ use trust_dns_client::serialize::txt::Lexer; use trust_dns_client::serialize::txt::Parser; use util::assert_contains; use util::assert_not_contains; -use util::env_vars_for_npm_tests; use util::PathRef; use util::TestContext; use util::TestContextBuilder; const CODE_CACHE_DB_FILE_NAME: &str = "v8_code_cache_v2"; -itest!(stdout_write_all { - args: "run --quiet run/stdout_write_all.ts", - output: "run/stdout_write_all.out", -}); - -itest!(stdin_read_all { - args: "run --quiet run/stdin_read_all.ts", - output: "run/stdin_read_all.out", - input: Some("01234567890123456789012345678901234567890123456789"), -}); - -itest!(stdout_write_sync_async { - args: "run --quiet run/stdout_write_sync_async.ts", - output: "run/stdout_write_sync_async.out", -}); - -itest!(_001_hello { - args: "run --reload run/001_hello.js", - output: "run/001_hello.js.out", -}); - -itest!(_002_hello { - args: "run --quiet --reload run/002_hello.ts", - output: "run/002_hello.ts.out", -}); - -itest!(_003_relative_import { - args: "run --quiet --reload run/003_relative_import.ts", - output: "run/003_relative_import.ts.out", -}); - -itest!(_004_set_timeout { - args: "run --quiet --reload run/004_set_timeout.ts", - output: "run/004_set_timeout.ts.out", -}); - -itest!(_005_more_imports { - args: "run --quiet --reload run/005_more_imports.ts", - output: "run/005_more_imports.ts.out", -}); - -itest!(_006_url_imports { - args: "run --quiet --reload --allow-import run/006_url_imports.ts", - output: "run/006_url_imports.ts.out", - http_server: true, -}); - -itest!(_012_async { - args: "run --quiet --reload run/012_async.ts", - output: "run/012_async.ts.out", -}); - -itest!(_013_dynamic_import { - args: "run --quiet --reload --allow-read run/013_dynamic_import.ts", - output: "run/013_dynamic_import.ts.out", -}); - -itest!(_014_duplicate_import { - args: "run --quiet --reload --allow-read run/014_duplicate_import.ts ", - output: "run/014_duplicate_import.ts.out", -}); - -itest!(_015_duplicate_parallel_import { - args: - "run --quiet --reload --allow-read run/015_duplicate_parallel_import.js", - output: "run/015_duplicate_parallel_import.js.out", -}); - -itest!(_016_double_await { - args: "run --quiet --allow-read --reload run/016_double_await.ts", - output: "run/016_double_await.ts.out", -}); - -itest!(_017_import_redirect { - args: "run --quiet --allow-import --reload run/017_import_redirect.ts", - output: "run/017_import_redirect.ts.out", -}); - -itest!(_017_import_redirect_check { - args: - "run --quiet --allow-import --reload --check run/017_import_redirect.ts", - output: "run/017_import_redirect.ts.out", -}); - -itest!(_017_import_redirect_vendor_dir { - args: - "run --quiet --allow-import --reload --vendor --check $TESTDATA/run/017_import_redirect.ts", - output: "run/017_import_redirect.ts.out", - temp_cwd: true, -}); - -itest!(_017_import_redirect_info { - args: "info --quiet --allow-import --reload run/017_import_redirect.ts", - output: "run/017_import_redirect_info.out", -}); - -itest!(_018_async_catch { - args: "run --quiet --reload run/018_async_catch.ts", - output: "run/018_async_catch.ts.out", -}); - -itest!(_019_media_types { - args: "run --reload --allow-import run/019_media_types.ts", - output: "run/019_media_types.ts.out", - http_server: true, -}); - -itest!(_020_json_modules { - args: "run --reload run/020_json_modules.ts", - output: "run/020_json_modules.ts.out", - exit_code: 1, -}); - -itest!(_021_mjs_modules { - args: "run --quiet --reload run/021_mjs_modules.ts", - output: "run/021_mjs_modules.ts.out", -}); - -itest!(_025_reload_js_type_error { - args: "run --quiet --reload run/025_reload_js_type_error.js", - output: "run/025_reload_js_type_error.js.out", -}); - -itest!(_027_redirect_typescript { - args: "run --quiet --reload --allow-import run/027_redirect_typescript.ts", - output: "run/027_redirect_typescript.ts.out", - http_server: true, -}); - -itest!(_027_redirect_typescript_vendor_dir { - args: - "run --quiet --reload --vendor --allow-import $TESTDATA/run/027_redirect_typescript.ts", - output: "run/027_redirect_typescript.ts.out", - http_server: true, - temp_cwd: true, -}); - -itest!(_028_args { - args: - "run --quiet --reload run/028_args.ts --arg1 val1 --arg2=val2 -- arg3 arg4", - output: "run/028_args.ts.out", -}); - -itest!(_033_import_map_remote { - args: - "run --quiet --reload --allow-import --import-map=http://127.0.0.1:4545/import_maps/import_map_remote.json import_maps/test_remote.ts", - output: "run/033_import_map_remote.out", - http_server: true, -}); - -itest!(_033_import_map_vendor_dir_remote { - args: - "run --quiet --reload --allow-import --import-map=http://127.0.0.1:4545/import_maps/import_map_remote.json --vendor $TESTDATA/import_maps/test_remote.ts", - output: "run/033_import_map_remote.out", - http_server: true, - temp_cwd: true, -}); - -itest!(_033_import_map_data_uri { - args: - "run --quiet --reload --allow-import --import-map=data:application/json;charset=utf-8;base64,ewogICJpbXBvcnRzIjogewogICAgInRlc3Rfc2VydmVyLyI6ICJodHRwOi8vbG9jYWxob3N0OjQ1NDUvIgogIH0KfQ== run/import_maps/test_data.ts", - output: "run/import_maps/test_data.ts.out", - http_server: true, -}); - -itest!(onload { - args: "run --quiet --reload --config ../config/deno.json run/onload/main.ts", - output: "run/onload/main.out", -}); - -itest!(_035_cached_only_flag { - args: "run --reload --check --allow-import --cached-only http://127.0.0.1:4545/run/019_media_types.ts", - output: "run/035_cached_only_flag.out", - exit_code: 1, - http_server: true, -}); - -itest!(_038_checkjs { - // checking if JS file is run through TS compiler - args: - "run --reload --config run/checkjs.tsconfig.json --check run/038_checkjs.js", - exit_code: 1, - output: "run/038_checkjs.js.out", -}); - -itest!(_042_dyn_import_evalcontext { - args: "run --quiet --allow-read --reload run/042_dyn_import_evalcontext.ts", - output: "run/042_dyn_import_evalcontext.ts.out", -}); - -itest!(_044_bad_resource { - args: "run --quiet --reload --allow-read run/044_bad_resource.ts", - output: "run/044_bad_resource.ts.out", - exit_code: 1, -}); - -itest!(_046_tsx { - args: "run --quiet --reload run/046_jsx_test.tsx", - output: "run/046_jsx_test.tsx.out", -}); - -itest!(_047_jsx { - args: "run --quiet --reload run/047_jsx_test.jsx", - output: "run/047_jsx_test.jsx.out", -}); - -itest!(_048_media_types_jsx { - args: "run --reload --allow-import run/048_media_types_jsx.ts", - output: "run/048_media_types_jsx.ts.out", - http_server: true, -}); - -itest!(_052_no_remote_flag { - args: - "run --reload --check --allow-import --no-remote http://127.0.0.1:4545/run/019_media_types.ts", - output: "run/052_no_remote_flag.out", - exit_code: 1, - http_server: true, -}); - -itest!(_058_tasks_microtasks_close { - args: "run --quiet run/058_tasks_microtasks_close.ts", - output: "run/058_tasks_microtasks_close.ts.out", -}); - -itest!(_059_fs_relative_path_perm { - args: "run run/059_fs_relative_path_perm.ts", - output: "run/059_fs_relative_path_perm.ts.out", - exit_code: 1, -}); - -itest!(_070_location { - args: "run --location https://foo/bar?baz#bat run/070_location.ts", - output: "run/070_location.ts.out", -}); - -itest!(_071_location_unset { - args: "run run/071_location_unset.ts", - output: "run/071_location_unset.ts.out", -}); - -itest!(_072_location_relative_fetch { - args: "run --location http://127.0.0.1:4545/ --allow-net run/072_location_relative_fetch.ts", - output: "run/072_location_relative_fetch.ts.out", - http_server: true, -}); - -// tests the beforeunload event -itest!(beforeunload_event { - args: "run run/before_unload.js", - output: "run/before_unload.js.out", -}); - -// tests the serialization of webstorage (both localStorage and sessionStorage) -itest!(webstorage_serialization { - args: "run run/webstorage/serialization.ts", - output: "run/webstorage/serialization.ts.out", -}); - // tests to ensure that when `--location` is set, all code shares the same // localStorage cache based on the origin of the location URL. #[test] @@ -394,41 +134,6 @@ fn webstorage_main_module() { .assert_matches_text("Storage { hello: \"deno\", length: 1 }\n"); } -itest!(_075_import_local_query_hash { - args: "run run/075_import_local_query_hash.ts", - output: "run/075_import_local_query_hash.ts.out", -}); - -itest!(_077_fetch_empty { - args: "run -A run/077_fetch_empty.ts", - output: "run/077_fetch_empty.ts.out", - exit_code: 1, -}); - -itest!(_078_unload_on_exit { - args: "run run/078_unload_on_exit.ts", - output: "run/078_unload_on_exit.ts.out", - exit_code: 1, -}); - -itest!(_079_location_authentication { - args: - "run --location https://foo:bar@baz/qux run/079_location_authentication.ts", - output: "run/079_location_authentication.ts.out", -}); - -itest!(_081_location_relative_fetch_redirect { - args: "run --location http://127.0.0.1:4546/ --allow-net run/081_location_relative_fetch_redirect.ts", - output: "run/081_location_relative_fetch_redirect.ts.out", - http_server: true, - }); - -itest!(_082_prepare_stack_trace_throw { - args: "run run/082_prepare_stack_trace_throw.js", - output: "run/082_prepare_stack_trace_throw.js.out", - exit_code: 1, -}); - #[test] fn _083_legacy_external_source_map() { let _g = util::http_server(); @@ -457,27 +162,6 @@ fn _083_legacy_external_source_map() { assert_eq!(out, ""); } -itest!(dynamic_import_async_error { - args: "run --allow-read run/dynamic_import_async_error/main.ts", - output: "run/dynamic_import_async_error/main.out", -}); - -itest!(dynamic_import_already_rejected { - args: "run --allow-read run/dynamic_import_already_rejected/main.ts", - output: "run/dynamic_import_already_rejected/main.out", -}); - -itest!(dynamic_import_concurrent_non_statically_analyzable { - args: "run --allow-import --allow-read --allow-net --quiet run/dynamic_import_concurrent_non_statically_analyzable/main.ts", - output: "run/dynamic_import_concurrent_non_statically_analyzable/main.out", - http_server: true, -}); - -itest!(_088_dynamic_import_already_evaluating { - args: "run --allow-read run/088_dynamic_import_already_evaluating.ts", - output: "run/088_dynamic_import_already_evaluating.ts.out", -}); - itest!(_089_run_allow_list { args: "run --allow-run=curl run/089_run_allow_list.ts", envs: vec![ @@ -713,16 +397,6 @@ fn permission_request_long() { }); } -itest!(deny_all_permission_args { - args: "run --deny-env --deny-read --deny-write --deny-ffi --deny-run --deny-sys --deny-net run/deny_all_permission_args.js", - output: "run/deny_all_permission_args.out", -}); - -itest!(deny_some_permission_args { - args: "run --allow-env --deny-env=FOO --allow-read --deny-read=/foo --allow-write --deny-write=/foo --allow-ffi --deny-ffi=/foo --allow-run --deny-run=foo --allow-sys --deny-sys=hostname --allow-net --deny-net=127.0.0.1 run/deny_some_permission_args.js", - output: "run/deny_some_permission_args.out", -}); - #[test] fn permissions_cache() { TestContext::default() @@ -755,52 +429,6 @@ itest!(env_file_missing { output: "run/env_file_missing.out", }); -itest!(_091_use_define_for_class_fields { - args: "run --check run/091_use_define_for_class_fields.ts", - output: "run/091_use_define_for_class_fields.ts.out", - exit_code: 1, -}); - -itest!(js_import_detect { - args: "run --quiet --reload run/js_import_detect.ts", - output: "run/js_import_detect.ts.out", - exit_code: 0, -}); - -itest!(blob_gc_finalization { - args: "run run/blob_gc_finalization.js", - output: "run/blob_gc_finalization.js.out", - exit_code: 0, -}); - -itest!(fetch_response_finalization { - args: - "run --v8-flags=--expose-gc --allow-net run/fetch_response_finalization.js", - output: "run/fetch_response_finalization.js.out", - http_server: true, - exit_code: 0, -}); - -itest!(import_type { - args: "run --reload run/import_type.ts", - output: "run/import_type.ts.out", -}); - -itest!(import_type_no_check { - args: "run --reload --no-check run/import_type.ts", - output: "run/import_type.ts.out", -}); - -itest!(private_field_presence { - args: "run --reload run/private_field_presence.ts", - output: "run/private_field_presence.ts.out", -}); - -itest!(private_field_presence_no_check { - args: "run --reload --no-check run/private_field_presence.ts", - output: "run/private_field_presence.ts.out", -}); - itest!(lock_write_fetch { args: "run --quiet --allow-import --allow-read --allow-write --allow-env --allow-run run/lock_write_fetch/main.ts", @@ -809,33 +437,6 @@ itest!(lock_write_fetch { exit_code: 0, }); -itest!(lock_check_ok { - args: - "run --quiet --allow-import --lock=run/lock_check_ok.json http://127.0.0.1:4545/run/003_relative_import.ts", - output: "run/003_relative_import.ts.out", - http_server: true, -}); - -itest!(lock_check_ok2 { - args: - "run --allow-import --lock=run/lock_check_ok2.json run/019_media_types.ts", - output: "run/019_media_types.ts.out", - http_server: true, -}); - -itest!(lock_v2_check_ok { - args: - "run --allow-import --quiet --lock=run/lock_v2_check_ok.json http://127.0.0.1:4545/run/003_relative_import.ts", - output: "run/003_relative_import.ts.out", - http_server: true, -}); - -itest!(lock_v2_check_ok2 { - args: "run --allow-import --lock=run/lock_v2_check_ok2.json run/019_media_types.ts", - output: "run/019_media_types.ts.out", - http_server: true, -}); - #[test] fn lock_redirects() { let context = TestContextBuilder::new() @@ -1234,141 +835,12 @@ fn get_lockfile_npm_package_integrity( .to_string() } -itest!(mts_dmts_mjs { - args: "run subdir/import.mts", - output: "run/mts_dmts_mjs.out", -}); - -itest!(mts_dmts_mjs_no_check { - args: "run --no-check subdir/import.mts", - output: "run/mts_dmts_mjs.out", -}); - -itest!(async_error { - exit_code: 1, - args: "run --reload run/async_error.ts", - output: "run/async_error.ts.out", -}); - -itest!(config { - args: - "run --reload --config run/config/tsconfig.json --check run/config/main.ts", - output: "run/config/main.out", -}); - -itest!(config_types { - args: - "run --reload --quiet --check=all --config run/config_types/tsconfig.json run/config_types/main.ts", - output: "run/config_types/main.out", -}); - -itest!(config_types_remote { - http_server: true, - args: "run --allow-import --reload --quiet --check=all --config run/config_types/remote.tsconfig.json run/config_types/main.ts", - output: "run/config_types/main.out", -}); - -itest!(empty_typescript { - args: "run --reload --check run/empty.ts", - output_str: Some("Check file:[WILDCARD]/run/empty.ts\n"), -}); - -itest!(error_001 { - args: "run --reload run/error_001.ts", - exit_code: 1, - output: "run/error_001.ts.out", -}); - -itest!(error_002 { - args: "run --reload run/error_002.ts", - exit_code: 1, - output: "run/error_002.ts.out", -}); - -itest!(error_003_typescript { - args: "run --reload --check run/error_003_typescript.ts", - exit_code: 1, - output: "run/error_003_typescript.ts.out", -}); - -// Supposing that we've already attempted to run error_003_typescript.ts -// we want to make sure that JS wasn't emitted. Running again without reload flag -// should result in the same output. -// https://github.com/denoland/deno/issues/2436 -itest!(error_003_typescript2 { - args: "run --check run/error_003_typescript.ts", - exit_code: 1, - output: "run/error_003_typescript.ts.out", -}); - -itest!(error_004_missing_module { - args: "run --reload run/error_004_missing_module.ts", - exit_code: 1, - output: "run/error_004_missing_module.ts.out", -}); - -itest!(error_005_missing_dynamic_import { - args: - "run --reload --allow-read --quiet run/error_005_missing_dynamic_import.ts", - exit_code: 1, - output: "run/error_005_missing_dynamic_import.ts.out", -}); - -itest!(error_006_import_ext_failure { - args: "run --reload run/error_006_import_ext_failure.ts", - exit_code: 1, - output: "run/error_006_import_ext_failure.ts.out", -}); - -itest!(error_007_any { - args: "run --reload run/error_007_any.ts", - exit_code: 1, - output: "run/error_007_any.ts.out", -}); - -itest!(error_008_checkjs { - args: "run --reload run/error_008_checkjs.js", - exit_code: 1, - output: "run/error_008_checkjs.js.out", -}); - -itest!(error_009_extensions_error { - args: "run run/error_009_extensions_error.js", - output: "run/error_009_extensions_error.js.out", - exit_code: 1, -}); - -itest!(error_011_bad_module_specifier { - args: "run --reload run/error_011_bad_module_specifier.ts", - exit_code: 1, - output: "run/error_011_bad_module_specifier.ts.out", -}); - -itest!(error_012_bad_dynamic_import_specifier { - args: "run --reload --check run/error_012_bad_dynamic_import_specifier.ts", - exit_code: 1, - output: "run/error_012_bad_dynamic_import_specifier.ts.out", -}); - itest!(error_013_missing_script { args: "run --reload missing_file_name", exit_code: 1, output: "run/error_013_missing_script.out", }); -itest!(error_014_catch_dynamic_import_error { - args: - "run --reload --allow-read run/error_014_catch_dynamic_import_error.js", - output: "run/error_014_catch_dynamic_import_error.js.out", -}); - -itest!(error_015_dynamic_import_permissions { - args: "run --reload --quiet run/error_015_dynamic_import_permissions.js", - output: "run/error_015_dynamic_import_permissions.out", - exit_code: 1, - http_server: true, -}); - // We have an allow-import flag but not allow-read, it should still result in error. itest!(error_016_dynamic_import_permissions2 { args: @@ -1378,60 +850,6 @@ itest!(error_016_dynamic_import_permissions2 { http_server: true, }); -itest!(error_017_hide_long_source_ts { - args: "run --reload --check run/error_017_hide_long_source_ts.ts", - output: "run/error_017_hide_long_source_ts.ts.out", - exit_code: 1, -}); - -itest!(error_018_hide_long_source_js { - args: "run run/error_018_hide_long_source_js.js", - output: "run/error_018_hide_long_source_js.js.out", - exit_code: 1, -}); - -itest!(error_019_stack_function { - args: "run run/error_019_stack_function.ts", - output: "run/error_019_stack_function.ts.out", - exit_code: 1, -}); - -itest!(error_020_stack_constructor { - args: "run run/error_020_stack_constructor.ts", - output: "run/error_020_stack_constructor.ts.out", - exit_code: 1, -}); - -itest!(error_021_stack_method { - args: "run run/error_021_stack_method.ts", - output: "run/error_021_stack_method.ts.out", - exit_code: 1, -}); - -itest!(error_022_stack_custom_error { - args: "run run/error_022_stack_custom_error.ts", - output: "run/error_022_stack_custom_error.ts.out", - exit_code: 1, -}); - -itest!(error_023_stack_async { - args: "run run/error_023_stack_async.ts", - output: "run/error_023_stack_async.ts.out", - exit_code: 1, -}); - -itest!(error_024_stack_promise_all { - args: "run run/error_024_stack_promise_all.ts", - output: "run/error_024_stack_promise_all.ts.out", - exit_code: 1, -}); - -itest!(error_025_tab_indent { - args: "run run/error_025_tab_indent", - output: "run/error_025_tab_indent.out", - exit_code: 1, -}); - itest!(error_026_remote_import_error { args: "run --allow-import run/error_026_remote_import_error.ts", output: "run/error_026_remote_import_error.ts.out", @@ -1439,42 +857,6 @@ itest!(error_026_remote_import_error { http_server: true, }); -itest!(error_for_await { - args: "run --reload --check run/error_for_await.ts", - output: "run/error_for_await.ts.out", - exit_code: 1, -}); - -itest!(error_missing_module_named_import { - args: "run --reload run/error_missing_module_named_import.ts", - output: "run/error_missing_module_named_import.ts.out", - exit_code: 1, -}); - -itest!(error_no_check { - args: "run --reload --no-check run/error_no_check.ts", - output: "run/error_no_check.ts.out", - exit_code: 1, -}); - -itest!(error_syntax { - args: "run --reload run/error_syntax.js", - exit_code: 1, - output: "run/error_syntax.js.out", -}); - -itest!(error_syntax_empty_trailing_line { - args: "run --reload run/error_syntax_empty_trailing_line.mjs", - exit_code: 1, - output: "run/error_syntax_empty_trailing_line.mjs.out", -}); - -itest!(error_type_definitions { - args: "run --reload --check run/error_type_definitions.ts", - exit_code: 1, - output: "run/error_type_definitions.ts.out", -}); - itest!(error_local_static_import_from_remote_ts { args: "run --allow-import --reload http://localhost:4545/run/error_local_static_import_from_remote.ts", exit_code: 1, @@ -1489,138 +871,18 @@ itest!(error_local_static_import_from_remote_js { output: "run/error_local_static_import_from_remote.js.out", }); -itest!(exit_error42 { - exit_code: 42, - args: "run --quiet --reload run/exit_error42.ts", - output: "run/exit_error42.ts.out", -}); - -itest!(set_exit_code_0 { - args: "run --no-check run/set_exit_code_0.ts", - output_str: Some(""), - exit_code: 0, -}); - -itest!(set_exit_code_1 { - args: "run --no-check run/set_exit_code_1.ts", - output_str: Some(""), - exit_code: 42, -}); - -itest!(set_exit_code_2 { - args: "run --no-check run/set_exit_code_2.ts", - output_str: Some(""), - exit_code: 42, -}); - -itest!(op_exit_op_set_exit_code_in_worker { - args: "run --no-check --allow-read run/op_exit_op_set_exit_code_in_worker.ts", - exit_code: 21, - output_str: Some(""), -}); - -itest!(deno_exit_tampering { - args: "run --no-check run/deno_exit_tampering.ts", - output_str: Some(""), - exit_code: 42, -}); - -itest!(heapstats { - args: "run --quiet --v8-flags=--expose-gc run/heapstats.js", - output: "run/heapstats.js.out", -}); - -itest!(finalization_registry { - args: "run --quiet --v8-flags=--expose-gc run/finalization_registry.js", - output: "run/finalization_registry.js.out", -}); - -itest!(https_import { - args: "run --allow-import --quiet --reload --cert tls/RootCA.pem run/https_import.ts", - output: "run/https_import.ts.out", - http_server: true, -}); - -itest!(if_main { - args: "run --quiet --reload run/if_main.ts", - output: "run/if_main.ts.out", -}); - itest!(import_meta { args: "run --allow-import --quiet --reload --import-map=run/import_meta/importmap.json run/import_meta/main.ts", output: "run/import_meta/main.out", http_server: true, }); -itest!(main_module { - args: "run --quiet --reload run/main_module/main.ts", - output: "run/main_module/main.out", -}); - -itest!(no_check { - args: "run --allow-import --quiet --reload --no-check run/006_url_imports.ts", - output: "run/006_url_imports.ts.out", - http_server: true, -}); - -itest!(no_check_decorators { - args: "run --quiet --reload --no-check run/decorators/experimental/no_check/main.ts", - output: "run/decorators/experimental/no_check/main.out", -}); - -itest!(decorators_tc39_proposal { - args: "run --quiet --reload --check run/decorators/tc39_proposal/main.ts", - output: "run/decorators/tc39_proposal/main.out", -}); - -itest!(check_remote { - args: - "run --quiet --allow-import --reload --check=all run/no_check_remote.ts", - output: "run/no_check_remote.ts.disabled.out", - exit_code: 1, - http_server: true, -}); - itest!(no_check_remote { args: "run --allow-import --quiet --reload --no-check=remote run/no_check_remote.ts", output: "run/no_check_remote.ts.enabled.out", http_server: true, }); -itest!(runtime_decorators { - args: "run --quiet --reload --no-check run/decorators/experimental/runtime/main.ts", - output: "run/decorators/experimental/runtime/main.out", -}); - -itest!(seed_random { - args: "run --seed=100 run/seed_random.js", - output: "run/seed_random.js.out", -}); - -itest!(type_definitions { - args: "run --reload run/type_definitions.ts", - output: "run/type_definitions.ts.out", -}); - -itest!(type_definitions_for_export { - args: "run --reload --check run/type_definitions_for_export.ts", - output: "run/type_definitions_for_export.ts.out", - exit_code: 1, -}); - -itest!(type_directives_01 { - args: - "run --allow-import --reload --check=all -L debug run/type_directives_01.ts", - output: "run/type_directives_01.ts.out", - http_server: true, -}); - -itest!(type_directives_02 { - args: - "run --allow-import --reload --check=all -L debug run/type_directives_02.ts", - output: "run/type_directives_02.ts.out", -}); - #[test] fn type_directives_js_main() { let context = TestContext::default(); @@ -1642,216 +904,6 @@ itest!(type_directives_redirect { http_server: true, }); -itest!(type_headers_deno_types { - args: "run --allow-import --reload --check run/type_headers_deno_types.ts", - output: "run/type_headers_deno_types.ts.out", - http_server: true, -}); - -itest!(ts_type_imports { - args: "run --reload --check run/ts_type_imports.ts", - output: "run/ts_type_imports.ts.out", - exit_code: 1, -}); - -itest!(ts_decorators { - args: "run --reload --check run/decorators/experimental/ts/main.ts", - output: "run/decorators/experimental/ts/main.out", -}); - -itest!(ts_type_only_import { - args: "run --reload --check run/ts_type_only_import.ts", - output: "run/ts_type_only_import.ts.out", -}); - -itest!(swc_syntax_error { - args: "run --reload --check run/swc_syntax_error.ts", - output: "run/swc_syntax_error.ts.out", - exit_code: 1, -}); - -itest!(unbuffered_stderr { - args: "run --reload run/unbuffered_stderr.ts", - output: "run/unbuffered_stderr.ts.out", -}); - -itest!(unbuffered_stdout { - args: "run --quiet --reload run/unbuffered_stdout.ts", - output: "run/unbuffered_stdout.ts.out", -}); - -itest!(v8_flags_run { - args: "run --v8-flags=--expose-gc run/v8_flags.js", - output: "run/v8_flags.js.out", -}); - -itest!(v8_flags_env_run { - envs: vec![("DENO_V8_FLAGS".to_string(), "--expose-gc".to_string())], - args: "run run/v8_flags.js", - output: "run/v8_flags.js.out", -}); - -itest!(v8_flags_unrecognized { - args: "repl --v8-flags=--foo,bar,--trace-gc,-baz", - output: "run/v8_flags_unrecognized.out", - exit_code: 1, -}); - -itest!(v8_help { - args: "repl --v8-flags=--help", - output: "run/v8_help.out", -}); - -itest!(unsupported_dynamic_import_scheme { - args: "eval import('xxx:')", - output: "run/unsupported_dynamic_import_scheme.out", - exit_code: 1, -}); - -itest!(wasm { - args: "run --quiet run/wasm.ts", - output: "run/wasm.ts.out", -}); - -itest!(wasm_shared { - args: "run --quiet run/wasm_shared.ts", - output: "run/wasm_shared.out", -}); - -itest!(wasm_async { - args: "run run/wasm_async.js", - output: "run/wasm_async.out", -}); - -itest!(wasm_unreachable { - args: "run --allow-read run/wasm_unreachable.js", - output: "run/wasm_unreachable.out", - exit_code: 1, -}); - -itest!(wasm_url { - args: "run --quiet --allow-net=localhost:4545 run/wasm_url.js", - output: "run/wasm_url.out", - exit_code: 1, - http_server: true, -}); - -itest!(weakref { - args: "run --quiet --reload run/weakref.ts", - output: "run/weakref.ts.out", -}); - -itest!(top_level_await_order { - args: "run --allow-read run/top_level_await/order.js", - output: "run/top_level_await/order.out", -}); - -itest!(top_level_await_loop { - args: "run --allow-read run/top_level_await/loop.js", - output: "run/top_level_await/loop.out", -}); - -itest!(top_level_await_circular { - args: "run --allow-read run/top_level_await/circular.js", - output: "run/top_level_await/circular.out", - exit_code: 1, -}); - -// Regression test for https://github.com/denoland/deno/issues/11238. -itest!(top_level_await_nested { - args: "run --allow-read run/top_level_await/nested/main.js", - output: "run/top_level_await/nested.out", -}); - -itest!(top_level_await_unresolved { - args: "run run/top_level_await/unresolved.js", - output: "run/top_level_await/unresolved.out", - exit_code: 1, -}); - -itest!(top_level_await { - args: "run --allow-read run/top_level_await/top_level_await.js", - output: "run/top_level_await/top_level_await.out", -}); - -itest!(top_level_await_ts { - args: "run --quiet --allow-read run/top_level_await/top_level_await.ts", - output: "run/top_level_await/top_level_await.out", -}); - -itest!(top_level_for_await { - args: "run --quiet run/top_level_await/top_level_for_await.js", - output: "run/top_level_await/top_level_for_await.out", -}); - -itest!(top_level_for_await_ts { - args: "run --quiet run/top_level_await/top_level_for_await.ts", - output: "run/top_level_await/top_level_for_await.out", -}); - -itest!(unstable_worker { - args: "run --reload --quiet --allow-read run/unstable_worker.ts", - output: "run/unstable_worker.ts.out", -}); - -itest!(unstable_worker_options_disabled { - args: "run --quiet --reload --allow-read run/unstable_worker_options.js", - output: "run/unstable_worker_options.disabled.out", - exit_code: 70, -}); - -itest!(unstable_worker_options_enabled { - args: "run --quiet --reload --allow-read --unstable-worker-options run/unstable_worker_options.js", - output: "run/unstable_worker_options.enabled.out", -}); - -itest!(unstable_broadcast_channel_disabled { - args: "run --quiet --reload --allow-read run/unstable_broadcast_channel.js", - output: "run/unstable_broadcast_channel.disabled.out", -}); - -itest!(unstable_broadcast_channel_enabled { - args: "run --quiet --reload --allow-read --unstable-broadcast-channel run/unstable_broadcast_channel.js", - output: "run/unstable_broadcast_channel.enabled.out", -}); - -itest!(unstable_cron_disabled { - args: "run --quiet --reload --allow-read run/unstable_cron.js", - output: "run/unstable_cron.disabled.out", -}); - -itest!(unstable_cron_enabled { - args: - "run --quiet --reload --allow-read --unstable-cron run/unstable_cron.js", - output: "run/unstable_cron.enabled.out", -}); - -itest!(unstable_net_disabled { - args: "run --quiet --reload --allow-read run/unstable_net.js", - output: "run/unstable_net.disabled.out", -}); - -itest!(unstable_net_enabled { - args: "run --quiet --reload --allow-read --unstable-net run/unstable_net.js", - output: "run/unstable_net.enabled.out", -}); - -itest!(unstable_kv_disabled { - args: "run --quiet --reload --allow-read run/unstable_kv.js", - output: "run/unstable_kv.disabled.out", -}); - -itest!(unstable_kv_enabled { - args: "run --quiet --reload --allow-read --unstable-kv run/unstable_kv.js", - output: "run/unstable_kv.enabled.out", -}); - -itest!(import_compression { - args: "run --allow-import --quiet --reload --allow-net run/import_compression/main.ts", - output: "run/import_compression/main.out", - http_server: true, -}); - itest!(disallow_http_from_https_js { args: "run --allow-import --quiet --reload --cert tls/RootCA.pem https://localhost:5545/run/disallow_http_from_https.js", output: "run/disallow_http_from_https_js.out", @@ -1866,131 +918,6 @@ itest!(disallow_http_from_https_ts { exit_code: 1, }); -itest!(dynamic_import_conditional { - args: "run --quiet --reload run/dynamic_import_conditional.js", - output: "run/dynamic_import_conditional.js.out", -}); - -itest!(tsx_imports { - args: "run --reload --check run/tsx_imports/tsx_imports.ts", - output: "run/tsx_imports/tsx_imports.ts.out", -}); - -itest!(fix_dynamic_import_errors { - args: "run --reload run/fix_dynamic_import_errors.js", - output: "run/fix_dynamic_import_errors.js.out", -}); - -itest!(fix_emittable_skipped { - args: "run --reload run/fix_emittable_skipped.js", - output: "run/fix_emittable_skipped.ts.out", -}); - -itest!(fix_js_import_js { - args: "run --quiet --reload run/fix_js_import_js.ts", - output: "run/fix_js_import_js.ts.out", -}); - -itest!(fix_js_imports { - args: "run --quiet --reload run/fix_js_imports.ts", - output: "run/fix_js_imports.ts.out", -}); - -itest!(fix_tsc_file_exists { - args: "run --quiet --reload tsc/test.js", - output: "run/fix_tsc_file_exists.out", -}); - -itest!(fix_worker_dispatchevent { - args: "run --quiet --reload run/fix_worker_dispatchevent.ts", - output: "run/fix_worker_dispatchevent.ts.out", -}); - -itest!(es_private_fields { - args: "run --quiet --reload run/es_private_fields.js", - output: "run/es_private_fields.js.out", -}); - -itest!(ts_import_from_js { - args: "run --allow-import --quiet --reload run/ts_import_from_js/main.js", - output: "run/ts_import_from_js/main.out", - http_server: true, -}); - -itest!(jsx_import_from_ts { - args: "run --quiet --reload run/jsx_import_from_ts.ts", - output: "run/jsx_import_from_ts.ts.out", -}); - -itest!(jsx_import_source_pragma { - args: "run --reload --allow-import run/jsx_import_source_pragma.tsx", - output: "run/jsx_import_source.out", - http_server: true, -}); - -itest!(jsx_import_source_pragma_with_config { - args: - "run --reload --allow-import --config jsx/deno-jsx.jsonc --no-lock run/jsx_import_source_pragma.tsx", - output: "run/jsx_import_source.out", - http_server: true, -}); - -itest!(jsx_import_source_pragma_with_dev_config { - args: - "run --reload --allow-import --config jsx/deno-jsxdev.jsonc --no-lock run/jsx_import_source_pragma.tsx", - output: "run/jsx_import_source_dev.out", - http_server: true, -}); - -itest!(jsx_import_source_no_pragma { - args: - "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock run/jsx_import_source_no_pragma.tsx", - output: "run/jsx_import_source.out", - http_server: true, -}); - -itest!(jsx_import_source_no_pragma_dev { - args: "run --allow-import --reload --config jsx/deno-jsxdev.jsonc --no-lock run/jsx_import_source_no_pragma.tsx", - output: "run/jsx_import_source_dev.out", - http_server: true, -}); - -itest!(jsx_import_source_pragma_import_map { - args: "run --allow-import --reload --import-map jsx/import-map.json run/jsx_import_source_pragma_import_map.tsx", - output: "run/jsx_import_source_import_map.out", - http_server: true, -}); - -itest!(jsx_import_source_pragma_import_map_dev { - args: "run --allow-import --reload --import-map jsx/import-map.json --config jsx/deno-jsxdev-import-map.jsonc run/jsx_import_source_pragma_import_map.tsx", - output: "run/jsx_import_source_import_map_dev.out", - http_server: true, -}); - -itest!(jsx_import_source_precompile_import_map { - args: "run --allow-import --reload --check --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-precompile.jsonc run/jsx_precompile/no_pragma.tsx", - output: "run/jsx_precompile/no_pragma.out", - http_server: true, -}); - -itest!(jsx_import_source_precompile_import_map_skip_element { - args: "run --allow-import --reload --check --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-precompile-skip.jsonc run/jsx_precompile/skip.tsx", - output: "run/jsx_precompile/skip.out", - http_server: true, -}); - -itest!(jsx_import_source_import_map { - args: "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-import-map.jsonc run/jsx_import_source_no_pragma.tsx", - output: "run/jsx_import_source_import_map.out", - http_server: true, -}); - -itest!(jsx_import_source_import_map_dev { - args: "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsxdev-import-map.jsonc run/jsx_import_source_no_pragma.tsx", - output: "run/jsx_import_source_import_map_dev.out", - http_server: true, -}); - itest!(jsx_import_source_import_map_scoped { args: "run --allow-import --reload --import-map jsx/import-map-scoped.json --no-lock --config jsx/deno-jsx-import-map.jsonc subdir/jsx_import_source_no_pragma.tsx", output: "run/jsx_import_source_import_map.out", @@ -2003,289 +930,12 @@ itest!(jsx_import_source_import_map_scoped_dev { http_server: true, }); -itest!(jsx_import_source_pragma_no_check { - args: - "run --allow-import --reload --no-check run/jsx_import_source_pragma.tsx", - output: "run/jsx_import_source.out", - http_server: true, -}); - -itest!(jsx_import_source_pragma_with_config_no_check { - args: "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --no-check run/jsx_import_source_pragma.tsx", - output: "run/jsx_import_source.out", - http_server: true, -}); - -itest!(jsx_import_source_pragma_with_config_vendor_dir { - args: "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --vendor $TESTDATA/run/jsx_import_source_pragma.tsx", - output: "run/jsx_import_source.out", - http_server: true, - temp_cwd: true, - copy_temp_dir: Some("jsx/"), -}); - -itest!(jsx_import_source_no_pragma_no_check { - args: - "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --no-check run/jsx_import_source_no_pragma.tsx", - output: "run/jsx_import_source.out", - http_server: true, -}); - -itest!(jsx_import_source_pragma_import_map_no_check { - args: "run --allow-import --reload --import-map jsx/import-map.json --no-check run/jsx_import_source_pragma_import_map.tsx", - output: "run/jsx_import_source_import_map.out", - http_server: true, -}); - -itest!(jsx_import_source_import_map_no_check { - args: "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-import-map.jsonc --no-check run/jsx_import_source_no_pragma.tsx", - output: "run/jsx_import_source_import_map.out", - http_server: true, -}); - -itest!(jsx_import_source_error { - args: "run --config jsx/deno-jsx-error.jsonc --check run/jsx_import_source_no_pragma.tsx", - output: "run/jsx_import_source_error.out", - exit_code: 1, -}); - -itest!(single_compile_with_reload { - args: "run --reload --allow-read run/single_compile_with_reload.ts", - output: "run/single_compile_with_reload.ts.out", -}); - -itest!(proto_exploit { - args: "run run/proto_exploit.js", - output: "run/proto_exploit.js.out", -}); - -itest!(reference_types { - args: "run --reload --quiet run/reference_types.ts", - output: "run/reference_types.ts.out", -}); - -itest!(references_types_remote { - http_server: true, - args: "run --reload --quiet run/reference_types_remote.ts", - output: "run/reference_types_remote.ts.out", -}); - -itest!(reference_types_error { - args: - "run --config run/checkjs.tsconfig.json --check run/reference_types_error.js", - output: "run/reference_types_error.js.out", - exit_code: 1, -}); - -itest!(reference_types_error_vendor_dir { - args: - "run --config run/checkjs.tsconfig.json --check --vendor $TESTDATA/run/reference_types_error.js", - output: "run/reference_types_error.js.out", - exit_code: 1, -}); - -itest!(reference_types_error_no_check { - args: "run --no-check run/reference_types_error.js", - output_str: Some(""), -}); - -itest!(import_data_url_error_stack { - args: "run --quiet --reload run/import_data_url_error_stack.ts", - output: "run/import_data_url_error_stack.ts.out", - exit_code: 1, -}); - -itest!(import_data_url_import_relative { - args: "run --quiet --reload run/import_data_url_import_relative.ts", - output: "run/import_data_url_import_relative.ts.out", - exit_code: 1, -}); - -itest!(import_data_url_imports { - args: "run --allow-import --quiet --reload run/import_data_url_imports.ts", - output: "run/import_data_url_imports.ts.out", - http_server: true, -}); - -itest!(import_data_url_jsx { - args: "run --quiet --reload run/import_data_url_jsx.ts", - output: "run/import_data_url_jsx.ts.out", -}); - -itest!(import_data_url { - args: "run --quiet --reload run/import_data_url.ts", - output: "run/import_data_url.ts.out", -}); - -itest!(import_dynamic_data_url { - args: "run --quiet --reload run/import_dynamic_data_url.ts", - output: "run/import_dynamic_data_url.ts.out", -}); - -itest!(import_blob_url_error_stack { - args: "run --quiet --reload run/import_blob_url_error_stack.ts", - output: "run/import_blob_url_error_stack.ts.out", - exit_code: 1, -}); - -itest!(import_blob_url_import_relative { - args: "run --quiet --reload run/import_blob_url_import_relative.ts", - output: "run/import_blob_url_import_relative.ts.out", - exit_code: 1, -}); - -itest!(import_blob_url_imports { - args: - "run --allow-import --quiet --reload --allow-net=localhost:4545 run/import_blob_url_imports.ts", - output: "run/import_blob_url_imports.ts.out", - http_server: true, -}); - -itest!(import_blob_url_jsx { - args: "run --quiet --reload run/import_blob_url_jsx.ts", - output: "run/import_blob_url_jsx.ts.out", -}); - -itest!(import_blob_url { - args: "run --quiet --reload run/import_blob_url.ts", - output: "run/import_blob_url.ts.out", -}); - -itest!(import_file_with_colon { - args: "run --allow-import --quiet --reload run/import_file_with_colon.ts", - output: "run/import_file_with_colon.ts.out", - http_server: true, -}); - -itest!(import_extensionless { - args: "run --allow-import --quiet --reload run/import_extensionless.ts", - output: "run/import_extensionless.ts.out", - http_server: true, -}); - -itest!(classic_workers_event_loop { - args: - "run --enable-testing-features-do-not-use run/classic_workers_event_loop.js", - output: "run/classic_workers_event_loop.js.out", -}); - // FIXME(bartlomieju): disabled, because this test is very flaky on CI // itest!(local_sources_not_cached_in_memory { // args: "run --allow-read --allow-write run/no_mem_cache.js", // output: "run/no_mem_cache.js.out", // }); -// This test checks that inline source map data is used. It uses a hand crafted -// source map that maps to a file that exists, but is not loaded into the module -// graph (inline_js_source_map_2.ts) (because there are no direct dependencies). -// Source line is not remapped because no inline source contents are included in -// the sourcemap and the file is not present in the dependency graph. -itest!(inline_js_source_map_2 { - args: "run --quiet run/inline_js_source_map_2.js", - output: "run/inline_js_source_map_2.js.out", - exit_code: 1, -}); - -// This test checks that inline source map data is used. It uses a hand crafted -// source map that maps to a file that exists, but is not loaded into the module -// graph (inline_js_source_map_2.ts) (because there are no direct dependencies). -// Source line remapped using th inline source contents that are included in the -// inline source map. -itest!(inline_js_source_map_2_with_inline_contents { - args: "run --quiet run/inline_js_source_map_2_with_inline_contents.js", - output: "run/inline_js_source_map_2_with_inline_contents.js.out", - exit_code: 1, -}); - -// This test checks that inline source map data is used. It uses a hand crafted -// source map that maps to a file that exists, and is loaded into the module -// graph because of a direct import statement (inline_js_source_map.ts). The -// source map was generated from an earlier version of this file, where the throw -// was not commented out. The source line is remapped using source contents that -// from the module graph. -itest!(inline_js_source_map_with_contents_from_graph { - args: "run --allow-import --quiet run/inline_js_source_map_with_contents_from_graph.js", - output: "run/inline_js_source_map_with_contents_from_graph.js.out", - exit_code: 1, - http_server: true, -}); - -// This test ensures that a descriptive error is shown when we're unable to load -// the import map. Even though this tests only the `run` subcommand, we can be sure -// that the error message is similar for other subcommands as they all use -// `program_state.maybe_import_map` to access the import map underneath. -itest!(error_import_map_unable_to_load { - args: "run --import-map=import_maps/does_not_exist.json import_maps/test.ts", - output: "run/error_import_map_unable_to_load.out", - exit_code: 1, -}); - -// Test that setting `self` in the main thread to some other value doesn't break -// the world. -itest!(replace_self { - args: "run run/replace_self.js", - output: "run/replace_self.js.out", -}); - -itest!(worker_event_handler_test { - args: "run --quiet --reload --allow-read run/worker_event_handler_test.js", - output: "run/worker_event_handler_test.js.out", -}); - -itest!(worker_close_race { - args: "run --quiet --reload --allow-read run/worker_close_race.js", - output: "run/worker_close_race.js.out", -}); - -itest!(worker_drop_handle_race { - args: "run --quiet --reload --allow-read run/worker_drop_handle_race.js", - output: "run/worker_drop_handle_race.js.out", - exit_code: 1, -}); - -itest!(worker_drop_handle_race_terminate { - args: "run run/worker_drop_handle_race_terminate.js", - output: "run/worker_drop_handle_race_terminate.js.out", -}); - -itest!(worker_close_nested { - args: "run --quiet --reload --allow-read run/worker_close_nested.js", - output: "run/worker_close_nested.js.out", -}); - -itest!(worker_message_before_close { - args: "run --quiet --reload --allow-read run/worker_message_before_close.js", - output: "run/worker_message_before_close.js.out", -}); - -itest!(worker_close_in_wasm_reactions { - args: - "run --quiet --reload --allow-read run/worker_close_in_wasm_reactions.js", - output: "run/worker_close_in_wasm_reactions.js.out", -}); - -itest!(shebang_tsc { - args: "run --quiet --check run/shebang.ts", - output: "run/shebang.ts.out", -}); - -itest!(shebang_swc { - args: "run --quiet run/shebang.ts", - output: "run/shebang.ts.out", -}); - -itest!(shebang_with_json_imports_tsc { - args: "run --quiet import_attributes/json_with_shebang.ts", - output: "import_attributes/json_with_shebang.ts.out", - exit_code: 1, -}); - -itest!(shebang_with_json_imports_swc { - args: "run --quiet --no-check import_attributes/json_with_shebang.ts", - output: "import_attributes/json_with_shebang.ts.out", - exit_code: 1, -}); - #[test] fn no_validate_asm() { let output = util::deno_cmd() @@ -2523,7 +1173,6 @@ fn dont_cache_on_check_fail() { mod permissions { use test_util as util; - use test_util::itest; use util::TestContext; #[test] @@ -2973,31 +1622,6 @@ mod permissions { }); } - itest!(_063_permissions_revoke { - args: "run --allow-read=foo,bar run/063_permissions_revoke.ts", - output: "run/063_permissions_revoke.ts.out", - }); - - itest!(_063_permissions_revoke_sync { - args: "run --allow-read=foo,bar run/063_permissions_revoke_sync.ts", - output: "run/063_permissions_revoke.ts.out", - }); - - itest!(_064_permissions_revoke_global { - args: "run --allow-read=foo,bar run/064_permissions_revoke_global.ts", - output: "run/064_permissions_revoke_global.ts.out", - }); - - itest!(_064_permissions_revoke_global_sync { - args: "run --allow-read=foo,bar run/064_permissions_revoke_global_sync.ts", - output: "run/064_permissions_revoke_global.ts.out", - }); - - itest!(_065_permissions_revoke_net { - args: "run --allow-net run/065_permissions_revoke_net.ts", - output: "run/065_permissions_revoke_net.ts.out", - }); - #[test] fn _066_prompt() { TestContext::default() @@ -3033,63 +1657,8 @@ mod permissions { console.expect("The end of test"); }); } - - itest!(dynamic_import_static_analysis_no_permissions { - args: "run --quiet --reload --no-prompt dynamic_import/static_analysis_no_permissions.ts", - output: "dynamic_import/static_analysis_no_permissions.ts.out", - }); - - itest!(dynamic_import_permissions_remote_remote { - args: "run --quiet --reload --allow-import=localhost:4545 dynamic_import/permissions_remote_remote.ts", - output: "dynamic_import/permissions_remote_remote.ts.out", - http_server: true, - exit_code: 1, - }); - - itest!(dynamic_import_permissions_data_remote { - args: "run --quiet --reload --allow-import=localhost:4545 dynamic_import/permissions_data_remote.ts", - output: "dynamic_import/permissions_data_remote.ts.out", - http_server: true, - exit_code: 1, - }); - - itest!(dynamic_import_permissions_blob_remote { - args: "run --quiet --reload --allow-net=localhost:4545 dynamic_import/permissions_blob_remote.ts", - output: "dynamic_import/permissions_blob_remote.ts.out", - http_server: true, - exit_code: 1, - }); - - itest!(dynamic_import_permissions_data_local { - args: "run --quiet --reload --allow-net=localhost:4545 dynamic_import/permissions_data_local.ts", - output: "dynamic_import/permissions_data_local.ts.out", - http_server: true, - exit_code: 1, - }); - - itest!(dynamic_import_permissions_blob_local { - args: "run --quiet --reload --allow-net=localhost:4545 dynamic_import/permissions_blob_local.ts", - output: "dynamic_import/permissions_blob_local.ts.out", - http_server: true, - exit_code: 1, - }); } -itest!(tls_starttls { - args: "run --quiet --reload --allow-net --allow-read --cert tls/RootCA.pem --config ../config/deno.json run/tls_starttls.js", - output: "run/tls.out", -}); - -itest!(tls_connecttls { - args: "run --quiet --reload --allow-net --allow-read --cert tls/RootCA.pem --config ../config/deno.json run/tls_connecttls.js", - output: "run/tls.out", -}); - -itest!(byte_order_mark { - args: "run --no-check run/byte_order_mark.ts", - output: "run/byte_order_mark.out", -}); - #[test] #[cfg(windows)] fn process_stdin_read_unblock() { @@ -3137,24 +1706,6 @@ fn issue9750() { }); } -// Regression test for https://github.com/denoland/deno/issues/11451. -itest!(dom_exception_formatting { - args: "run run/dom_exception_formatting.ts", - output: "run/dom_exception_formatting.ts.out", - exit_code: 1, -}); - -itest!(long_data_url_formatting { - args: "run run/long_data_url_formatting.ts", - output: "run/long_data_url_formatting.ts.out", - exit_code: 1, -}); - -itest!(eval_context_throw_dom_exception { - args: "run run/eval_context_throw_dom_exception.js", - output: "run/eval_context_throw_dom_exception.js.out", -}); - #[test] #[cfg(unix)] fn navigator_language_unix() { @@ -3278,85 +1829,6 @@ fn issue12807() { assert!(status.success()); } -itest!(issue_13562 { - args: "run run/issue13562.ts", - output: "run/issue13562.ts.out", -}); - -itest!(import_attributes_static_import { - args: "run --allow-read import_attributes/static_import.ts", - output: "import_attributes/static_import.out", -}); - -itest!(import_attributes_static_export { - args: "run --allow-read import_attributes/static_export.ts", - output: "import_attributes/static_export.out", -}); - -itest!(import_attributes_static_error { - args: "run --allow-read import_attributes/static_error.ts", - output: "import_attributes/static_error.out", - exit_code: 1, -}); - -itest!(import_attributes_dynamic_import { - args: "run --allow-read --check import_attributes/dynamic_import.ts", - output: "import_attributes/dynamic_import.out", -}); - -itest!(import_attributes_dynamic_error { - args: "run --allow-read import_attributes/dynamic_error.ts", - output: "import_attributes/dynamic_error.out", - exit_code: 1, -}); - -itest!(import_attributes_type_check { - args: "run --allow-read --check import_attributes/type_check.ts", - output: "import_attributes/type_check.out", - exit_code: 1, -}); - -itest!(colors_without_global_this { - args: "run run/colors_without_globalThis.js", - output_str: Some("true\n"), -}); - -itest!(config_auto_discovered_for_local_script { - args: "run --quiet run/with_config/frontend_work.ts", - output_str: Some("ok\n"), -}); - -itest!(config_auto_discovered_for_local_script_log { - args: "run -L debug run/with_config/frontend_work.ts", - output: "run/with_config/auto_discovery_log.out", -}); - -itest!(no_config_auto_discovery_for_local_script { - args: "run --quiet --no-config --check run/with_config/frontend_work.ts", - output: "run/with_config/no_auto_discovery.out", - exit_code: 1, -}); - -itest!(config_not_auto_discovered_for_remote_script { - args: "run --allow-import --quiet http://127.0.0.1:4545/run/with_config/server_side_work.ts", - output_str: Some("ok\n"), - http_server: true, -}); - -// In this case we shouldn't discover `package.json` file, because it's in a -// directory that is above the directory containing `deno.json` file. -itest!( - package_json_auto_discovered_for_local_script_arg_with_stop { - args: "run -L debug with_stop/some/nested/dir/main.ts", - output: "run/with_package_json/with_stop/main.out", - cwd: Some("run/with_package_json/"), - copy_temp_dir: Some("run/with_package_json/"), - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, - } -); - #[test] fn package_json_no_node_modules_dir_created() { // it should not create a node_modules directory @@ -3395,81 +1867,6 @@ fn node_modules_dir_no_npm_specifiers_no_dir_created() { assert!(!temp_dir.path().join("node_modules").exists()); } -itest!(wasm_streaming_panic_test { - args: "run run/wasm_streaming_panic_test.js", - output: "run/wasm_streaming_panic_test.js.out", - exit_code: 1, -}); - -// Regression test for https://github.com/denoland/deno/issues/13897. -itest!(fetch_async_error_stack { - args: "run --quiet -A run/fetch_async_error_stack.ts", - output: "run/fetch_async_error_stack.ts.out", - exit_code: 1, -}); - -itest!(event_listener_error { - args: "run --quiet run/event_listener_error.ts", - output: "run/event_listener_error.ts.out", - exit_code: 1, -}); - -itest!(event_listener_error_handled { - args: "run --quiet run/event_listener_error_handled.ts", - output: "run/event_listener_error_handled.ts.out", -}); - -// https://github.com/denoland/deno/pull/14159#issuecomment-1092285446 -itest!(event_listener_error_immediate_exit { - args: "run --quiet run/event_listener_error_immediate_exit.ts", - output: "run/event_listener_error_immediate_exit.ts.out", - exit_code: 1, -}); - -// https://github.com/denoland/deno/pull/14159#issuecomment-1092285446 -itest!(event_listener_error_immediate_exit_worker { - args: "run --quiet -A run/event_listener_error_immediate_exit_worker.ts", - output: "run/event_listener_error_immediate_exit_worker.ts.out", - exit_code: 1, -}); - -itest!(set_timeout_error { - args: "run --quiet run/set_timeout_error.ts", - output: "run/set_timeout_error.ts.out", - exit_code: 1, -}); - -itest!(set_timeout_error_handled { - args: "run --quiet run/set_timeout_error_handled.ts", - output: "run/set_timeout_error_handled.ts.out", -}); - -itest!(aggregate_error { - args: "run --quiet run/aggregate_error.ts", - output: "run/aggregate_error.out", - exit_code: 1, -}); - -itest!(complex_error { - args: "run --quiet run/complex_error.ts", - output: "run/complex_error.ts.out", - exit_code: 1, -}); - -// Regression test for https://github.com/denoland/deno/issues/16340. -itest!(error_with_errors_prop { - args: "run --quiet run/error_with_errors_prop.js", - output: "run/error_with_errors_prop.js.out", - exit_code: 1, -}); - -// Regression test for https://github.com/denoland/deno/issues/12143. -itest!(js_root_with_ts_check { - args: "run --quiet --check run/js_root_with_ts_check.js", - output: "run/js_root_with_ts_check.js.out", - exit_code: 1, -}); - #[test] fn check_local_then_remote() { let _http_guard = util::http_server(); @@ -3502,18 +1899,6 @@ fn check_local_then_remote() { assert_contains!(stderr, "Type 'string' is not assignable to type 'number'."); } -// Regression test for https://github.com/denoland/deno/issues/15163 -itest!(check_js_points_to_ts { - args: "run --quiet --check --config run/checkjs.tsconfig.json run/check_js_points_to_ts/test.js", - output: "run/check_js_points_to_ts/test.js.out", - exit_code: 1, -}); - -itest!(no_prompt_flag { - args: "run --quiet --no-prompt run/no_prompt.ts", - output_str: Some(""), -}); - #[test] fn permission_request_with_no_prompt() { TestContext::default() @@ -3544,57 +1929,6 @@ fn deno_no_prompt_environment_variable() { assert!(output.status.success()); } -itest!(report_error { - args: "run --quiet run/report_error.ts", - output: "run/report_error.ts.out", - exit_code: 1, -}); - -itest!(report_error_handled { - args: "run --quiet run/report_error_handled.ts", - output: "run/report_error_handled.ts.out", -}); - -// Regression test for https://github.com/denoland/deno/issues/15513. -itest!(report_error_end_of_program { - args: "run --quiet run/report_error_end_of_program.ts", - output: "run/report_error_end_of_program.ts.out", - exit_code: 1, -}); - -itest!(queue_microtask_error { - args: "run --quiet run/queue_microtask_error.ts", - output: "run/queue_microtask_error.ts.out", - exit_code: 1, -}); - -itest!(queue_microtask_error_handled { - args: "run --quiet run/queue_microtask_error_handled.ts", - output: "run/queue_microtask_error_handled.ts.out", -}); - -itest!(spawn_stdout_inherit { - args: "run --quiet -A run/spawn_stdout_inherit.ts", - output: "run/spawn_stdout_inherit.ts.out", -}); - -itest!(error_name_non_string { - args: "run --quiet run/error_name_non_string.js", - output: "run/error_name_non_string.js.out", - exit_code: 1, -}); - -itest!(custom_inspect_url { - args: "run run/custom_inspect_url.js", - output: "run/custom_inspect_url.js.out", -}); - -itest!(config_json_import { - args: "run --quiet -c jsx/deno-jsx.json run/config_json_import.ts", - output: "run/config_json_import.ts.out", - http_server: true, -}); - #[test] fn running_declaration_files() { let context = TestContextBuilder::new().use_temp_cwd().build(); @@ -3613,11 +1947,6 @@ fn running_declaration_files() { } } -itest!(test_and_bench_are_noops_in_run { - args: "run run/test_and_bench_in_run.js", - output_str: Some(""), -}); - #[cfg(not(target_os = "windows"))] itest!(spawn_kill_permissions { args: "run --quiet --allow-run=cat spawn_kill_permissions.ts", @@ -3628,51 +1957,6 @@ itest!(spawn_kill_permissions { output_str: Some(""), }); -itest!(followup_dyn_import_resolved { - args: "run --allow-read run/followup_dyn_import_resolves/main.ts", - output: "run/followup_dyn_import_resolves/main.ts.out", -}); - -itest!(unhandled_rejection { - args: "run --check run/unhandled_rejection.ts", - output: "run/unhandled_rejection.ts.out", -}); - -itest!(unhandled_rejection_sync_error { - args: "run --check run/unhandled_rejection_sync_error.ts", - output: "run/unhandled_rejection_sync_error.ts.out", -}); - -// Regression test for https://github.com/denoland/deno/issues/15661 -itest!(unhandled_rejection_dynamic_import { - args: "run --allow-read run/unhandled_rejection_dynamic_import/main.ts", - output: "run/unhandled_rejection_dynamic_import/main.ts.out", - exit_code: 1, -}); - -// Regression test for https://github.com/denoland/deno/issues/16909 -itest!(unhandled_rejection_dynamic_import2 { - args: "run --allow-read run/unhandled_rejection_dynamic_import2/main.ts", - output: "run/unhandled_rejection_dynamic_import2/main.ts.out", -}); - -itest!(rejection_handled { - args: "run --check run/rejection_handled.ts", - output: "run/rejection_handled.out", -}); - -itest!(nested_error { - args: "run run/nested_error/main.ts", - output: "run/nested_error/main.ts.out", - exit_code: 1, -}); - -itest!(node_env_var_allowlist { - args: "run --no-prompt run/node_env_var_allowlist.ts", - output: "run/node_env_var_allowlist.ts.out", - exit_code: 1, -}); - #[test] fn cache_test() { let _g = util::http_server(); @@ -4212,48 +2496,6 @@ fn broken_stdout_repl() { assert_not_contains!(stderr, "panic"); } -itest!(error_cause { - args: "run run/error_cause.ts", - output: "run/error_cause.ts.out", - exit_code: 1, -}); - -itest!(error_cause_recursive_aggregate { - args: "run error_cause_recursive_aggregate.ts", - output: "error_cause_recursive_aggregate.ts.out", - exit_code: 1, -}); - -itest!(error_cause_recursive_tail { - args: "run error_cause_recursive_tail.ts", - output: "error_cause_recursive_tail.ts.out", - exit_code: 1, -}); - -itest!(error_cause_recursive { - args: "run run/error_cause_recursive.ts", - output: "run/error_cause_recursive.ts.out", - exit_code: 1, -}); - -itest!(js_without_extension { - args: "run --ext js --check file_extensions/js_without_extension", - output: "file_extensions/js_without_extension.out", - exit_code: 0, -}); - -itest!(ts_without_extension { - args: "run --ext ts --check file_extensions/ts_without_extension", - output: "file_extensions/ts_without_extension.out", - exit_code: 0, -}); - -itest!(ext_flag_takes_precedence_over_extension { - args: "run --ext ts --check file_extensions/ts_with_js_extension.js", - output: "file_extensions/ts_with_js_extension.out", - exit_code: 0, -}); - #[tokio::test(flavor = "multi_thread")] async fn websocketstream_ping() { let _g = util::http_server(); @@ -4435,24 +2677,6 @@ async fn websocket_server_idletimeout() { assert_eq!(child.wait().unwrap().code(), Some(123)); } -itest!(no_lock_flag { - args: "run --allow-import --no-lock run/no_lock_flag/main.ts", - output: "run/no_lock_flag/main.out", - http_server: true, - exit_code: 0, -}); - -itest!(permission_args { - args: "run run/001_hello.js --allow-net", - output: "run/permission_args.out", - envs: vec![("NO_COLOR".to_string(), "1".to_string())], -}); - -itest!(permission_args_quiet { - args: "run --quiet run/001_hello.js --allow-net", - output: "run/001_hello.js.out", -}); - // Regression test for https://github.com/denoland/deno/issues/16772 #[test] fn file_fetcher_preserves_permissions() { @@ -4560,12 +2784,6 @@ fn permission_prompt_escapes_ansi_codes_and_control_chars() { } } -itest!(dynamic_import_syntax_error { - args: "run -A run/dynamic_import_syntax_error.js", - output: "run/dynamic_import_syntax_error.js.out", - exit_code: 1, -}); - itest!(extension_import { args: "run run/extension_import.ts", output: "run/extension_import.ts.out", @@ -4679,25 +2897,6 @@ console.log(returnsHi());"#, .assert_exit_code(1); } -itest!(explicit_resource_management { - args: "run --quiet --check run/explicit_resource_management/main.ts", - output: "run/explicit_resource_management/main.out", -}); - -itest!(unsafe_proto { - args: "run -A run/unsafe_proto/main.js", - output: "run/unsafe_proto/main.out", - http_server: false, - exit_code: 0, -}); - -itest!(unsafe_proto_flag { - args: "run -A --unstable-unsafe-proto run/unsafe_proto/main.js", - output: "run/unsafe_proto/main_with_unsafe_proto_flag.out", - http_server: false, - exit_code: 0, -}); - // TODO(bartlomieju): temporary disabled // itest!(warn_on_deprecated_api { // args: "run -A run/warn_on_deprecated_api/main.js", diff --git a/tests/specs/run/_001_hello/001_hello.js b/tests/specs/run/_001_hello/001_hello.js new file mode 100644 index 0000000000..accefceba6 --- /dev/null +++ b/tests/specs/run/_001_hello/001_hello.js @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/tests/testdata/run/001_hello.js.out b/tests/specs/run/_001_hello/001_hello.js.out similarity index 100% rename from tests/testdata/run/001_hello.js.out rename to tests/specs/run/_001_hello/001_hello.js.out diff --git a/tests/specs/run/_001_hello/__test__.jsonc b/tests/specs/run/_001_hello/__test__.jsonc new file mode 100644 index 0000000000..4fd8126f0c --- /dev/null +++ b/tests/specs/run/_001_hello/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload 001_hello.js", + "output": "001_hello.js.out" +} diff --git a/tests/specs/run/_002_hello/002_hello.ts b/tests/specs/run/_002_hello/002_hello.ts new file mode 100644 index 0000000000..accefceba6 --- /dev/null +++ b/tests/specs/run/_002_hello/002_hello.ts @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/tests/testdata/run/002_hello.ts.out b/tests/specs/run/_002_hello/002_hello.ts.out similarity index 100% rename from tests/testdata/run/002_hello.ts.out rename to tests/specs/run/_002_hello/002_hello.ts.out diff --git a/tests/specs/run/_002_hello/__test__.jsonc b/tests/specs/run/_002_hello/__test__.jsonc new file mode 100644 index 0000000000..dde74d27cb --- /dev/null +++ b/tests/specs/run/_002_hello/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 002_hello.ts", + "output": "002_hello.ts.out" +} diff --git a/tests/specs/run/_003_relative_import/003_relative_import.ts b/tests/specs/run/_003_relative_import/003_relative_import.ts new file mode 100644 index 0000000000..d392f4a5d1 --- /dev/null +++ b/tests/specs/run/_003_relative_import/003_relative_import.ts @@ -0,0 +1,3 @@ +import { printHello } from "./print_hello.ts"; + +printHello(); diff --git a/tests/testdata/run/003_relative_import.ts.out b/tests/specs/run/_003_relative_import/003_relative_import.ts.out similarity index 100% rename from tests/testdata/run/003_relative_import.ts.out rename to tests/specs/run/_003_relative_import/003_relative_import.ts.out diff --git a/tests/specs/run/_003_relative_import/__test__.jsonc b/tests/specs/run/_003_relative_import/__test__.jsonc new file mode 100644 index 0000000000..7bed2c00af --- /dev/null +++ b/tests/specs/run/_003_relative_import/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 003_relative_import.ts", + "output": "003_relative_import.ts.out" +} diff --git a/tests/specs/run/_003_relative_import/print_hello.ts b/tests/specs/run/_003_relative_import/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/_003_relative_import/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/testdata/run/004_set_timeout.ts b/tests/specs/run/_004_set_timeout/004_set_timeout.ts similarity index 100% rename from tests/testdata/run/004_set_timeout.ts rename to tests/specs/run/_004_set_timeout/004_set_timeout.ts diff --git a/tests/testdata/run/004_set_timeout.ts.out b/tests/specs/run/_004_set_timeout/004_set_timeout.ts.out similarity index 100% rename from tests/testdata/run/004_set_timeout.ts.out rename to tests/specs/run/_004_set_timeout/004_set_timeout.ts.out diff --git a/tests/specs/run/_004_set_timeout/__test__.jsonc b/tests/specs/run/_004_set_timeout/__test__.jsonc new file mode 100644 index 0000000000..6904dc0935 --- /dev/null +++ b/tests/specs/run/_004_set_timeout/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 004_set_timeout.ts", + "output": "004_set_timeout.ts.out" +} diff --git a/tests/testdata/run/005_more_imports.ts b/tests/specs/run/_005_more_imports/005_more_imports.ts similarity index 65% rename from tests/testdata/run/005_more_imports.ts rename to tests/specs/run/_005_more_imports/005_more_imports.ts index 6c96fac64c..c69556be15 100644 --- a/tests/testdata/run/005_more_imports.ts +++ b/tests/specs/run/_005_more_imports/005_more_imports.ts @@ -1,4 +1,4 @@ -import { printHello3, returnsFoo2, returnsHi } from "../subdir/mod1.ts"; +import { printHello3, returnsFoo2, returnsHi } from "./mod1.ts"; printHello3(); diff --git a/tests/testdata/run/005_more_imports.ts.out b/tests/specs/run/_005_more_imports/005_more_imports.ts.out similarity index 100% rename from tests/testdata/run/005_more_imports.ts.out rename to tests/specs/run/_005_more_imports/005_more_imports.ts.out diff --git a/tests/specs/run/_005_more_imports/__test__.jsonc b/tests/specs/run/_005_more_imports/__test__.jsonc new file mode 100644 index 0000000000..159a0265a8 --- /dev/null +++ b/tests/specs/run/_005_more_imports/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 005_more_imports.ts", + "output": "005_more_imports.ts.out" +} diff --git a/tests/specs/run/_005_more_imports/mod1.ts b/tests/specs/run/_005_more_imports/mod1.ts new file mode 100644 index 0000000000..5e58f432ed --- /dev/null +++ b/tests/specs/run/_005_more_imports/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/tests/specs/run/_005_more_imports/print_hello.ts b/tests/specs/run/_005_more_imports/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/_005_more_imports/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/_005_more_imports/subdir2/mod2.ts b/tests/specs/run/_005_more_imports/subdir2/mod2.ts new file mode 100644 index 0000000000..9071d0aeb4 --- /dev/null +++ b/tests/specs/run/_005_more_imports/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/tests/specs/run/_006_url_imports/006_url_imports.ts b/tests/specs/run/_006_url_imports/006_url_imports.ts new file mode 100644 index 0000000000..4036f27ed8 --- /dev/null +++ b/tests/specs/run/_006_url_imports/006_url_imports.ts @@ -0,0 +1,3 @@ +import { printHello } from "http://localhost:4545/subdir/mod2.ts"; +printHello(); +console.log("success"); diff --git a/tests/specs/run/_006_url_imports/006_url_imports.ts.out b/tests/specs/run/_006_url_imports/006_url_imports.ts.out new file mode 100644 index 0000000000..989ce33e93 --- /dev/null +++ b/tests/specs/run/_006_url_imports/006_url_imports.ts.out @@ -0,0 +1,2 @@ +Hello +success diff --git a/tests/specs/run/_006_url_imports/__test__.jsonc b/tests/specs/run/_006_url_imports/__test__.jsonc new file mode 100644 index 0000000000..50c0379ab9 --- /dev/null +++ b/tests/specs/run/_006_url_imports/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-import 006_url_imports.ts", + "output": "006_url_imports.ts.out" +} diff --git a/tests/specs/run/_006_url_imports/print_hello.ts b/tests/specs/run/_006_url_imports/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/_006_url_imports/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/_006_url_imports/subdir2/mod2.ts b/tests/specs/run/_006_url_imports/subdir2/mod2.ts new file mode 100644 index 0000000000..9071d0aeb4 --- /dev/null +++ b/tests/specs/run/_006_url_imports/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/tests/testdata/run/012_async.ts b/tests/specs/run/_012_async/012_async.ts similarity index 100% rename from tests/testdata/run/012_async.ts rename to tests/specs/run/_012_async/012_async.ts diff --git a/tests/testdata/run/012_async.ts.out b/tests/specs/run/_012_async/012_async.ts.out similarity index 100% rename from tests/testdata/run/012_async.ts.out rename to tests/specs/run/_012_async/012_async.ts.out diff --git a/tests/specs/run/_012_async/__test__.jsonc b/tests/specs/run/_012_async/__test__.jsonc new file mode 100644 index 0000000000..2778f04847 --- /dev/null +++ b/tests/specs/run/_012_async/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 012_async.ts", + "output": "012_async.ts.out" +} diff --git a/tests/specs/run/_013_dynamic_import/013_dynamic_import.ts b/tests/specs/run/_013_dynamic_import/013_dynamic_import.ts new file mode 100644 index 0000000000..5e73b6eb79 --- /dev/null +++ b/tests/specs/run/_013_dynamic_import/013_dynamic_import.ts @@ -0,0 +1,15 @@ +(async () => { + const { returnsHi, returnsFoo2, printHello3 } = await import( + "./mod1.ts" + ); + + printHello3(); + + if (returnsHi() !== "Hi") { + throw Error("Unexpected"); + } + + if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); + } +})(); diff --git a/tests/testdata/run/013_dynamic_import.ts.out b/tests/specs/run/_013_dynamic_import/013_dynamic_import.ts.out similarity index 100% rename from tests/testdata/run/013_dynamic_import.ts.out rename to tests/specs/run/_013_dynamic_import/013_dynamic_import.ts.out diff --git a/tests/specs/run/_013_dynamic_import/__test__.jsonc b/tests/specs/run/_013_dynamic_import/__test__.jsonc new file mode 100644 index 0000000000..8be2c975bd --- /dev/null +++ b/tests/specs/run/_013_dynamic_import/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read 013_dynamic_import.ts", + "output": "013_dynamic_import.ts.out" +} diff --git a/tests/specs/run/_013_dynamic_import/mod1.ts b/tests/specs/run/_013_dynamic_import/mod1.ts new file mode 100644 index 0000000000..5e58f432ed --- /dev/null +++ b/tests/specs/run/_013_dynamic_import/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/tests/specs/run/_013_dynamic_import/print_hello.ts b/tests/specs/run/_013_dynamic_import/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/_013_dynamic_import/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/_013_dynamic_import/subdir2/mod2.ts b/tests/specs/run/_013_dynamic_import/subdir2/mod2.ts new file mode 100644 index 0000000000..9071d0aeb4 --- /dev/null +++ b/tests/specs/run/_013_dynamic_import/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/tests/specs/run/_014_duplicate_import/014_duplicate_import.ts b/tests/specs/run/_014_duplicate_import/014_duplicate_import.ts new file mode 100644 index 0000000000..b996ca8aef --- /dev/null +++ b/tests/specs/run/_014_duplicate_import/014_duplicate_import.ts @@ -0,0 +1,9 @@ +// with all the imports of the same module, the module should only be +// instantiated once +import "./auto_print_hello.ts"; + +import "./auto_print_hello.ts"; + +(async () => { + await import("./auto_print_hello.ts"); +})(); diff --git a/tests/testdata/run/014_duplicate_import.ts.out b/tests/specs/run/_014_duplicate_import/014_duplicate_import.ts.out similarity index 100% rename from tests/testdata/run/014_duplicate_import.ts.out rename to tests/specs/run/_014_duplicate_import/014_duplicate_import.ts.out diff --git a/tests/specs/run/_014_duplicate_import/__test__.jsonc b/tests/specs/run/_014_duplicate_import/__test__.jsonc new file mode 100644 index 0000000000..7172fc1833 --- /dev/null +++ b/tests/specs/run/_014_duplicate_import/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read 014_duplicate_import.ts ", + "output": "014_duplicate_import.ts.out" +} diff --git a/tests/specs/run/_014_duplicate_import/auto_print_hello.ts b/tests/specs/run/_014_duplicate_import/auto_print_hello.ts new file mode 100644 index 0000000000..5efa72e03f --- /dev/null +++ b/tests/specs/run/_014_duplicate_import/auto_print_hello.ts @@ -0,0 +1,2 @@ +console.log("hello!"); +export default {}; diff --git a/tests/testdata/run/015_duplicate_parallel_import.js b/tests/specs/run/_015_duplicate_parallel_import/015_duplicate_parallel_import.js similarity index 91% rename from tests/testdata/run/015_duplicate_parallel_import.js rename to tests/specs/run/_015_duplicate_parallel_import/015_duplicate_parallel_import.js index 2fbe2c732e..136d80f462 100644 --- a/tests/testdata/run/015_duplicate_parallel_import.js +++ b/tests/specs/run/_015_duplicate_parallel_import/015_duplicate_parallel_import.js @@ -3,7 +3,7 @@ const promises = new Array(100) .fill(null) - .map(() => import("../subdir/mod1.ts")); + .map(() => import("./mod1.ts")); Promise.all(promises).then((imports) => { const mod = imports.reduce((first, cur) => { diff --git a/tests/testdata/run/015_duplicate_parallel_import.js.out b/tests/specs/run/_015_duplicate_parallel_import/015_duplicate_parallel_import.js.out similarity index 100% rename from tests/testdata/run/015_duplicate_parallel_import.js.out rename to tests/specs/run/_015_duplicate_parallel_import/015_duplicate_parallel_import.js.out diff --git a/tests/specs/run/_015_duplicate_parallel_import/__test__.jsonc b/tests/specs/run/_015_duplicate_parallel_import/__test__.jsonc new file mode 100644 index 0000000000..44fe479e29 --- /dev/null +++ b/tests/specs/run/_015_duplicate_parallel_import/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read 015_duplicate_parallel_import.js", + "output": "015_duplicate_parallel_import.js.out" +} diff --git a/tests/specs/run/_015_duplicate_parallel_import/mod1.ts b/tests/specs/run/_015_duplicate_parallel_import/mod1.ts new file mode 100644 index 0000000000..5e58f432ed --- /dev/null +++ b/tests/specs/run/_015_duplicate_parallel_import/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/tests/specs/run/_015_duplicate_parallel_import/print_hello.ts b/tests/specs/run/_015_duplicate_parallel_import/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/_015_duplicate_parallel_import/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/_015_duplicate_parallel_import/subdir2/mod2.ts b/tests/specs/run/_015_duplicate_parallel_import/subdir2/mod2.ts new file mode 100644 index 0000000000..9071d0aeb4 --- /dev/null +++ b/tests/specs/run/_015_duplicate_parallel_import/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/tests/testdata/run/016_double_await.ts b/tests/specs/run/_016_double_await/016_double_await.ts similarity index 100% rename from tests/testdata/run/016_double_await.ts rename to tests/specs/run/_016_double_await/016_double_await.ts diff --git a/tests/testdata/run/016_double_await.ts.out b/tests/specs/run/_016_double_await/016_double_await.ts.out similarity index 100% rename from tests/testdata/run/016_double_await.ts.out rename to tests/specs/run/_016_double_await/016_double_await.ts.out diff --git a/tests/specs/run/_016_double_await/__test__.jsonc b/tests/specs/run/_016_double_await/__test__.jsonc new file mode 100644 index 0000000000..9ff2027168 --- /dev/null +++ b/tests/specs/run/_016_double_await/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --allow-read --reload 016_double_await.ts", + "output": "016_double_await.ts.out" +} diff --git a/tests/specs/run/_017_import_redirect/017_import_redirect.ts b/tests/specs/run/_017_import_redirect/017_import_redirect.ts new file mode 100644 index 0000000000..1265dd4edc --- /dev/null +++ b/tests/specs/run/_017_import_redirect/017_import_redirect.ts @@ -0,0 +1,4 @@ +// http -> https redirect would happen: +import { printHello } from "http://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts"; + +printHello(); diff --git a/tests/testdata/run/017_import_redirect.ts.out b/tests/specs/run/_017_import_redirect/017_import_redirect.ts.out similarity index 100% rename from tests/testdata/run/017_import_redirect.ts.out rename to tests/specs/run/_017_import_redirect/017_import_redirect.ts.out diff --git a/tests/specs/run/_017_import_redirect/__test__.jsonc b/tests/specs/run/_017_import_redirect/__test__.jsonc new file mode 100644 index 0000000000..dd5442dcd1 --- /dev/null +++ b/tests/specs/run/_017_import_redirect/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --allow-import --reload --check 017_import_redirect.ts", + "output": "017_import_redirect.ts.out" +} diff --git a/tests/specs/run/_017_import_redirect_check/017_import_redirect.ts b/tests/specs/run/_017_import_redirect_check/017_import_redirect.ts new file mode 100644 index 0000000000..1265dd4edc --- /dev/null +++ b/tests/specs/run/_017_import_redirect_check/017_import_redirect.ts @@ -0,0 +1,4 @@ +// http -> https redirect would happen: +import { printHello } from "http://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts"; + +printHello(); diff --git a/tests/testdata/run/https_import.ts.out b/tests/specs/run/_017_import_redirect_check/017_import_redirect.ts.out similarity index 100% rename from tests/testdata/run/https_import.ts.out rename to tests/specs/run/_017_import_redirect_check/017_import_redirect.ts.out diff --git a/tests/specs/run/_017_import_redirect_check/__test__.jsonc b/tests/specs/run/_017_import_redirect_check/__test__.jsonc new file mode 100644 index 0000000000..dd5442dcd1 --- /dev/null +++ b/tests/specs/run/_017_import_redirect_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --allow-import --reload --check 017_import_redirect.ts", + "output": "017_import_redirect.ts.out" +} diff --git a/tests/specs/run/_017_import_redirect_info/017_import_redirect.ts b/tests/specs/run/_017_import_redirect_info/017_import_redirect.ts new file mode 100644 index 0000000000..1265dd4edc --- /dev/null +++ b/tests/specs/run/_017_import_redirect_info/017_import_redirect.ts @@ -0,0 +1,4 @@ +// http -> https redirect would happen: +import { printHello } from "http://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts"; + +printHello(); diff --git a/tests/testdata/run/017_import_redirect_info.out b/tests/specs/run/_017_import_redirect_info/017_import_redirect_info.out similarity index 100% rename from tests/testdata/run/017_import_redirect_info.out rename to tests/specs/run/_017_import_redirect_info/017_import_redirect_info.out diff --git a/tests/specs/run/_017_import_redirect_info/__test__.jsonc b/tests/specs/run/_017_import_redirect_info/__test__.jsonc new file mode 100644 index 0000000000..d23e8dd998 --- /dev/null +++ b/tests/specs/run/_017_import_redirect_info/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "info --quiet --allow-import --reload 017_import_redirect.ts", + "output": "017_import_redirect_info.out" +} diff --git a/tests/specs/run/_017_import_redirect_vendor_dir/017_import_redirect.ts b/tests/specs/run/_017_import_redirect_vendor_dir/017_import_redirect.ts new file mode 100644 index 0000000000..1265dd4edc --- /dev/null +++ b/tests/specs/run/_017_import_redirect_vendor_dir/017_import_redirect.ts @@ -0,0 +1,4 @@ +// http -> https redirect would happen: +import { printHello } from "http://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts"; + +printHello(); diff --git a/tests/testdata/run/import_blob_url_imports.ts.out b/tests/specs/run/_017_import_redirect_vendor_dir/017_import_redirect.ts.out similarity index 100% rename from tests/testdata/run/import_blob_url_imports.ts.out rename to tests/specs/run/_017_import_redirect_vendor_dir/017_import_redirect.ts.out diff --git a/tests/specs/run/_017_import_redirect_vendor_dir/__test__.jsonc b/tests/specs/run/_017_import_redirect_vendor_dir/__test__.jsonc new file mode 100644 index 0000000000..dd5442dcd1 --- /dev/null +++ b/tests/specs/run/_017_import_redirect_vendor_dir/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --allow-import --reload --check 017_import_redirect.ts", + "output": "017_import_redirect.ts.out" +} diff --git a/tests/testdata/run/018_async_catch.ts b/tests/specs/run/_018_async_catch/018_async_catch.ts similarity index 100% rename from tests/testdata/run/018_async_catch.ts rename to tests/specs/run/_018_async_catch/018_async_catch.ts diff --git a/tests/testdata/run/018_async_catch.ts.out b/tests/specs/run/_018_async_catch/018_async_catch.ts.out similarity index 100% rename from tests/testdata/run/018_async_catch.ts.out rename to tests/specs/run/_018_async_catch/018_async_catch.ts.out diff --git a/tests/specs/run/_018_async_catch/__test__.jsonc b/tests/specs/run/_018_async_catch/__test__.jsonc new file mode 100644 index 0000000000..7995c79fdb --- /dev/null +++ b/tests/specs/run/_018_async_catch/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 018_async_catch.ts", + "output": "018_async_catch.ts.out" +} diff --git a/tests/specs/run/_019_media_types/019_media_types.ts b/tests/specs/run/_019_media_types/019_media_types.ts new file mode 100644 index 0000000000..d985bd2496 --- /dev/null +++ b/tests/specs/run/_019_media_types/019_media_types.ts @@ -0,0 +1,24 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. + +import { loaded as loadedTs1 } from "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; +import { loaded as loadedTs2 } from "http://localhost:4545/subdir/mt_video_vdn.t2.ts"; +import { loaded as loadedTs3 } from "http://localhost:4545/subdir/mt_video_mp2t.t3.ts"; +import { loaded as loadedTs4 } from "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts"; +import { loaded as loadedJs1 } from "http://localhost:4545/subdir/mt_text_javascript.j1.js"; +import { loaded as loadedJs2 } from "http://localhost:4545/subdir/mt_application_ecmascript.j2.js"; +import { loaded as loadedJs3 } from "http://localhost:4545/subdir/mt_text_ecmascript.j3.js"; +import { loaded as loadedJs4 } from "http://localhost:4545/subdir/mt_application_x_javascript.j4.js"; + +console.log( + "success", + loadedTs1, + loadedTs2, + loadedTs3, + loadedTs4, + loadedJs1, + loadedJs2, + loadedJs3, + loadedJs4, +); diff --git a/tests/testdata/run/019_media_types.ts.out b/tests/specs/run/_019_media_types/019_media_types.ts.out similarity index 100% rename from tests/testdata/run/019_media_types.ts.out rename to tests/specs/run/_019_media_types/019_media_types.ts.out diff --git a/tests/specs/run/_019_media_types/__test__.jsonc b/tests/specs/run/_019_media_types/__test__.jsonc new file mode 100644 index 0000000000..b741a0bf22 --- /dev/null +++ b/tests/specs/run/_019_media_types/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --allow-import 019_media_types.ts", + "output": "019_media_types.ts.out" +} diff --git a/tests/specs/run/_020_json_modules/020_json_modules.ts b/tests/specs/run/_020_json_modules/020_json_modules.ts new file mode 100644 index 0000000000..bde024cf86 --- /dev/null +++ b/tests/specs/run/_020_json_modules/020_json_modules.ts @@ -0,0 +1,2 @@ +import config from "./config.json"; +console.log(JSON.stringify(config)); diff --git a/tests/testdata/run/020_json_modules.ts.out b/tests/specs/run/_020_json_modules/020_json_modules.ts.out similarity index 80% rename from tests/testdata/run/020_json_modules.ts.out rename to tests/specs/run/_020_json_modules/020_json_modules.ts.out index 948901724a..8bf0b41465 100644 --- a/tests/testdata/run/020_json_modules.ts.out +++ b/tests/specs/run/_020_json_modules/020_json_modules.ts.out @@ -1,3 +1,3 @@ error: Expected a JavaScript or TypeScript module, but identified a Json module. Consider importing Json modules with an import attribute with the type of "json". - Specifier: [WILDCARD]/subdir/config.json + Specifier: [WILDCARD]/config.json [WILDCARD] \ No newline at end of file diff --git a/tests/specs/run/_020_json_modules/__test__.jsonc b/tests/specs/run/_020_json_modules/__test__.jsonc new file mode 100644 index 0000000000..618616438a --- /dev/null +++ b/tests/specs/run/_020_json_modules/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload 020_json_modules.ts", + "output": "020_json_modules.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/_020_json_modules/config.json b/tests/specs/run/_020_json_modules/config.json new file mode 100644 index 0000000000..01c3b5e79a --- /dev/null +++ b/tests/specs/run/_020_json_modules/config.json @@ -0,0 +1,6 @@ +{ + "foo": { + "bar": true, + "baz": ["qat", 1] + } +} diff --git a/tests/specs/run/_021_mjs_modules/021_mjs_modules.ts b/tests/specs/run/_021_mjs_modules/021_mjs_modules.ts new file mode 100644 index 0000000000..326fce3e51 --- /dev/null +++ b/tests/specs/run/_021_mjs_modules/021_mjs_modules.ts @@ -0,0 +1,2 @@ +import { isMod5 } from "./mod5.mjs"; +console.log(isMod5); diff --git a/tests/testdata/run/021_mjs_modules.ts.out b/tests/specs/run/_021_mjs_modules/021_mjs_modules.ts.out similarity index 100% rename from tests/testdata/run/021_mjs_modules.ts.out rename to tests/specs/run/_021_mjs_modules/021_mjs_modules.ts.out diff --git a/tests/specs/run/_021_mjs_modules/__test__.jsonc b/tests/specs/run/_021_mjs_modules/__test__.jsonc new file mode 100644 index 0000000000..f029658862 --- /dev/null +++ b/tests/specs/run/_021_mjs_modules/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 021_mjs_modules.ts", + "output": "021_mjs_modules.ts.out" +} diff --git a/tests/specs/run/_021_mjs_modules/mod5.mjs b/tests/specs/run/_021_mjs_modules/mod5.mjs new file mode 100644 index 0000000000..f21d8862b1 --- /dev/null +++ b/tests/specs/run/_021_mjs_modules/mod5.mjs @@ -0,0 +1 @@ +export const isMod5 = true; diff --git a/tests/testdata/run/025_reload_js_type_error.js b/tests/specs/run/_025_reload_js_type_error/025_reload_js_type_error.js similarity index 100% rename from tests/testdata/run/025_reload_js_type_error.js rename to tests/specs/run/_025_reload_js_type_error/025_reload_js_type_error.js diff --git a/tests/testdata/run/025_reload_js_type_error.js.out b/tests/specs/run/_025_reload_js_type_error/025_reload_js_type_error.js.out similarity index 100% rename from tests/testdata/run/025_reload_js_type_error.js.out rename to tests/specs/run/_025_reload_js_type_error/025_reload_js_type_error.js.out diff --git a/tests/specs/run/_025_reload_js_type_error/__test__.jsonc b/tests/specs/run/_025_reload_js_type_error/__test__.jsonc new file mode 100644 index 0000000000..ce098f9097 --- /dev/null +++ b/tests/specs/run/_025_reload_js_type_error/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 025_reload_js_type_error.js", + "output": "025_reload_js_type_error.js.out" +} diff --git a/tests/testdata/run/027_redirect_typescript.ts b/tests/specs/run/_027_redirect_typescript/027_redirect_typescript.ts similarity index 100% rename from tests/testdata/run/027_redirect_typescript.ts rename to tests/specs/run/_027_redirect_typescript/027_redirect_typescript.ts diff --git a/tests/testdata/run/027_redirect_typescript.ts.out b/tests/specs/run/_027_redirect_typescript/027_redirect_typescript.ts.out similarity index 100% rename from tests/testdata/run/027_redirect_typescript.ts.out rename to tests/specs/run/_027_redirect_typescript/027_redirect_typescript.ts.out diff --git a/tests/specs/run/_027_redirect_typescript/__test__.jsonc b/tests/specs/run/_027_redirect_typescript/__test__.jsonc new file mode 100644 index 0000000000..fca55c9f8e --- /dev/null +++ b/tests/specs/run/_027_redirect_typescript/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-import 027_redirect_typescript.ts", + "output": "027_redirect_typescript.ts.out" +} diff --git a/tests/specs/run/_027_redirect_typescript_vendor_dir/027_redirect_typescript.ts b/tests/specs/run/_027_redirect_typescript_vendor_dir/027_redirect_typescript.ts new file mode 100644 index 0000000000..584341975f --- /dev/null +++ b/tests/specs/run/_027_redirect_typescript_vendor_dir/027_redirect_typescript.ts @@ -0,0 +1,2 @@ +import { value } from "http://localhost:4547/redirects/redirect4.ts"; +console.log(value); diff --git a/tests/specs/run/_027_redirect_typescript_vendor_dir/027_redirect_typescript.ts.out b/tests/specs/run/_027_redirect_typescript_vendor_dir/027_redirect_typescript.ts.out new file mode 100644 index 0000000000..480d4e8ca0 --- /dev/null +++ b/tests/specs/run/_027_redirect_typescript_vendor_dir/027_redirect_typescript.ts.out @@ -0,0 +1 @@ +4 imports 1 diff --git a/tests/specs/run/_027_redirect_typescript_vendor_dir/__test__.jsonc b/tests/specs/run/_027_redirect_typescript_vendor_dir/__test__.jsonc new file mode 100644 index 0000000000..f35557907b --- /dev/null +++ b/tests/specs/run/_027_redirect_typescript_vendor_dir/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --vendor --allow-import 027_redirect_typescript.ts", + "output": "027_redirect_typescript.ts.out" +} diff --git a/tests/specs/run/_027_redirect_typescript_vendor_dir/vendor/http_localhost_4545/subdir/redirects/redirect1.ts b/tests/specs/run/_027_redirect_typescript_vendor_dir/vendor/http_localhost_4545/subdir/redirects/redirect1.ts new file mode 100644 index 0000000000..d674be88c3 --- /dev/null +++ b/tests/specs/run/_027_redirect_typescript_vendor_dir/vendor/http_localhost_4545/subdir/redirects/redirect1.ts @@ -0,0 +1 @@ +export const redirect = 1; diff --git a/tests/specs/run/_027_redirect_typescript_vendor_dir/vendor/http_localhost_4545/subdir/redirects/redirect4.ts b/tests/specs/run/_027_redirect_typescript_vendor_dir/vendor/http_localhost_4545/subdir/redirects/redirect4.ts new file mode 100644 index 0000000000..45c65c5eb3 --- /dev/null +++ b/tests/specs/run/_027_redirect_typescript_vendor_dir/vendor/http_localhost_4545/subdir/redirects/redirect4.ts @@ -0,0 +1,2 @@ +import { redirect } from "./redirect1.ts"; +export const value = `4 imports ${redirect}`; diff --git a/tests/specs/run/_027_redirect_typescript_vendor_dir/vendor/manifest.json b/tests/specs/run/_027_redirect_typescript_vendor_dir/vendor/manifest.json new file mode 100644 index 0000000000..49cc42e8cc --- /dev/null +++ b/tests/specs/run/_027_redirect_typescript_vendor_dir/vendor/manifest.json @@ -0,0 +1,9 @@ +{ + "modules": { + "http://localhost:4547/redirects/redirect4.ts": { + "headers": { + "location": "http://localhost:4545/subdir/redirects/redirect4.ts" + } + } + } +} diff --git a/tests/testdata/run/028_args.ts b/tests/specs/run/_028_args/028_args.ts similarity index 100% rename from tests/testdata/run/028_args.ts rename to tests/specs/run/_028_args/028_args.ts diff --git a/tests/testdata/run/028_args.ts.out b/tests/specs/run/_028_args/028_args.ts.out similarity index 100% rename from tests/testdata/run/028_args.ts.out rename to tests/specs/run/_028_args/028_args.ts.out diff --git a/tests/specs/run/_028_args/__test__.jsonc b/tests/specs/run/_028_args/__test__.jsonc new file mode 100644 index 0000000000..6ab81bf21d --- /dev/null +++ b/tests/specs/run/_028_args/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 028_args.ts --arg1 val1 --arg2=val2 -- arg3 arg4", + "output": "028_args.ts.out" +} diff --git a/tests/specs/run/_033_import_map_data_uri/__test__.jsonc b/tests/specs/run/_033_import_map_data_uri/__test__.jsonc new file mode 100644 index 0000000000..400269c751 --- /dev/null +++ b/tests/specs/run/_033_import_map_data_uri/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-import --import-map=data:application/json;charset=utf-8;base64,ewogICJpbXBvcnRzIjogewogICAgInRlc3Rfc2VydmVyLyI6ICJodHRwOi8vbG9jYWxob3N0OjQ1NDUvIgogIH0KfQ== test_data.ts", + "output": "test_data.ts.out" +} diff --git a/tests/specs/run/_033_import_map_data_uri/lodash/lodash.ts b/tests/specs/run/_033_import_map_data_uri/lodash/lodash.ts new file mode 100644 index 0000000000..2ec04ed3cf --- /dev/null +++ b/tests/specs/run/_033_import_map_data_uri/lodash/lodash.ts @@ -0,0 +1 @@ +console.log("Hello from remapped lodash!"); diff --git a/tests/specs/run/_033_import_map_data_uri/lodash/other_file.ts b/tests/specs/run/_033_import_map_data_uri/lodash/other_file.ts new file mode 100644 index 0000000000..714adae3fb --- /dev/null +++ b/tests/specs/run/_033_import_map_data_uri/lodash/other_file.ts @@ -0,0 +1 @@ +console.log("Hello from remapped lodash dir!"); diff --git a/tests/testdata/run/import_maps/test_data.ts b/tests/specs/run/_033_import_map_data_uri/test_data.ts similarity index 100% rename from tests/testdata/run/import_maps/test_data.ts rename to tests/specs/run/_033_import_map_data_uri/test_data.ts diff --git a/tests/testdata/run/import_maps/test_data.ts.out b/tests/specs/run/_033_import_map_data_uri/test_data.ts.out similarity index 100% rename from tests/testdata/run/import_maps/test_data.ts.out rename to tests/specs/run/_033_import_map_data_uri/test_data.ts.out diff --git a/tests/testdata/run/033_import_map_remote.out b/tests/specs/run/_033_import_map_remote/033_import_map_remote.out similarity index 100% rename from tests/testdata/run/033_import_map_remote.out rename to tests/specs/run/_033_import_map_remote/033_import_map_remote.out diff --git a/tests/specs/run/_033_import_map_remote/__test__.jsonc b/tests/specs/run/_033_import_map_remote/__test__.jsonc new file mode 100644 index 0000000000..20c848d492 --- /dev/null +++ b/tests/specs/run/_033_import_map_remote/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-import --import-map=import_map_remote.json test_remote.ts", + "output": "033_import_map_remote.out" +} diff --git a/tests/specs/run/_033_import_map_remote/import_map_remote.json b/tests/specs/run/_033_import_map_remote/import_map_remote.json new file mode 100644 index 0000000000..190fc4f55a --- /dev/null +++ b/tests/specs/run/_033_import_map_remote/import_map_remote.json @@ -0,0 +1,10 @@ +{ + "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", + "print_hello": "./print_hello.ts" + } +} diff --git a/tests/specs/run/_033_import_map_remote/lodash/lodash.ts b/tests/specs/run/_033_import_map_remote/lodash/lodash.ts new file mode 100644 index 0000000000..2ec04ed3cf --- /dev/null +++ b/tests/specs/run/_033_import_map_remote/lodash/lodash.ts @@ -0,0 +1 @@ +console.log("Hello from remapped lodash!"); diff --git a/tests/specs/run/_033_import_map_remote/lodash/other_file.ts b/tests/specs/run/_033_import_map_remote/lodash/other_file.ts new file mode 100644 index 0000000000..714adae3fb --- /dev/null +++ b/tests/specs/run/_033_import_map_remote/lodash/other_file.ts @@ -0,0 +1 @@ +console.log("Hello from remapped lodash dir!"); diff --git a/tests/specs/run/_033_import_map_remote/moment/moment.ts b/tests/specs/run/_033_import_map_remote/moment/moment.ts new file mode 100644 index 0000000000..2b54a431e7 --- /dev/null +++ b/tests/specs/run/_033_import_map_remote/moment/moment.ts @@ -0,0 +1 @@ +console.log("Hello from remapped moment!"); diff --git a/tests/specs/run/_033_import_map_remote/moment/other_file.ts b/tests/specs/run/_033_import_map_remote/moment/other_file.ts new file mode 100644 index 0000000000..24f3a0226d --- /dev/null +++ b/tests/specs/run/_033_import_map_remote/moment/other_file.ts @@ -0,0 +1 @@ +console.log("Hello from remapped moment dir!"); diff --git a/tests/specs/run/_033_import_map_remote/print_hello.ts b/tests/specs/run/_033_import_map_remote/print_hello.ts new file mode 100644 index 0000000000..7942573905 --- /dev/null +++ b/tests/specs/run/_033_import_map_remote/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello, world!"); +} diff --git a/tests/specs/run/_033_import_map_remote/test_remote.ts b/tests/specs/run/_033_import_map_remote/test_remote.ts new file mode 100644 index 0000000000..206bdbd5ff --- /dev/null +++ b/tests/specs/run/_033_import_map_remote/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/tests/specs/run/_033_import_map_remote/vue.ts b/tests/specs/run/_033_import_map_remote/vue.ts new file mode 100644 index 0000000000..76dbe19179 --- /dev/null +++ b/tests/specs/run/_033_import_map_remote/vue.ts @@ -0,0 +1 @@ +console.log("Hello from remapped Vue!"); diff --git a/tests/specs/run/_033_import_map_vendor_dir_remote/033_import_map_remote.out b/tests/specs/run/_033_import_map_vendor_dir_remote/033_import_map_remote.out new file mode 100644 index 0000000000..804fa0d57e --- /dev/null +++ b/tests/specs/run/_033_import_map_vendor_dir_remote/033_import_map_remote.out @@ -0,0 +1,5 @@ +Hello from remapped moment! +Hello from remapped moment dir! +Hello from remapped lodash! +Hello from remapped lodash dir! +Hello from remapped Vue! diff --git a/tests/specs/run/_033_import_map_vendor_dir_remote/__test__.jsonc b/tests/specs/run/_033_import_map_vendor_dir_remote/__test__.jsonc new file mode 100644 index 0000000000..4eb3a22c50 --- /dev/null +++ b/tests/specs/run/_033_import_map_vendor_dir_remote/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-import --import-map=import_map_remote.json --vendor test_remote.ts", + "output": "033_import_map_remote.out" +} diff --git a/tests/specs/run/_033_import_map_vendor_dir_remote/import_map_remote.json b/tests/specs/run/_033_import_map_vendor_dir_remote/import_map_remote.json new file mode 100644 index 0000000000..190fc4f55a --- /dev/null +++ b/tests/specs/run/_033_import_map_vendor_dir_remote/import_map_remote.json @@ -0,0 +1,10 @@ +{ + "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", + "print_hello": "./print_hello.ts" + } +} diff --git a/tests/specs/run/_033_import_map_vendor_dir_remote/lodash/lodash.ts b/tests/specs/run/_033_import_map_vendor_dir_remote/lodash/lodash.ts new file mode 100644 index 0000000000..2ec04ed3cf --- /dev/null +++ b/tests/specs/run/_033_import_map_vendor_dir_remote/lodash/lodash.ts @@ -0,0 +1 @@ +console.log("Hello from remapped lodash!"); diff --git a/tests/specs/run/_033_import_map_vendor_dir_remote/lodash/other_file.ts b/tests/specs/run/_033_import_map_vendor_dir_remote/lodash/other_file.ts new file mode 100644 index 0000000000..714adae3fb --- /dev/null +++ b/tests/specs/run/_033_import_map_vendor_dir_remote/lodash/other_file.ts @@ -0,0 +1 @@ +console.log("Hello from remapped lodash dir!"); diff --git a/tests/specs/run/_033_import_map_vendor_dir_remote/moment/moment.ts b/tests/specs/run/_033_import_map_vendor_dir_remote/moment/moment.ts new file mode 100644 index 0000000000..2b54a431e7 --- /dev/null +++ b/tests/specs/run/_033_import_map_vendor_dir_remote/moment/moment.ts @@ -0,0 +1 @@ +console.log("Hello from remapped moment!"); diff --git a/tests/specs/run/_033_import_map_vendor_dir_remote/moment/other_file.ts b/tests/specs/run/_033_import_map_vendor_dir_remote/moment/other_file.ts new file mode 100644 index 0000000000..24f3a0226d --- /dev/null +++ b/tests/specs/run/_033_import_map_vendor_dir_remote/moment/other_file.ts @@ -0,0 +1 @@ +console.log("Hello from remapped moment dir!"); diff --git a/tests/specs/run/_033_import_map_vendor_dir_remote/print_hello.ts b/tests/specs/run/_033_import_map_vendor_dir_remote/print_hello.ts new file mode 100644 index 0000000000..7942573905 --- /dev/null +++ b/tests/specs/run/_033_import_map_vendor_dir_remote/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello, world!"); +} diff --git a/tests/specs/run/_033_import_map_vendor_dir_remote/test_remote.ts b/tests/specs/run/_033_import_map_vendor_dir_remote/test_remote.ts new file mode 100644 index 0000000000..206bdbd5ff --- /dev/null +++ b/tests/specs/run/_033_import_map_vendor_dir_remote/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/tests/specs/run/_033_import_map_vendor_dir_remote/vue.ts b/tests/specs/run/_033_import_map_vendor_dir_remote/vue.ts new file mode 100644 index 0000000000..76dbe19179 --- /dev/null +++ b/tests/specs/run/_033_import_map_vendor_dir_remote/vue.ts @@ -0,0 +1 @@ +console.log("Hello from remapped Vue!"); diff --git a/tests/specs/run/_035_cached_only_flag/019_media_types.ts b/tests/specs/run/_035_cached_only_flag/019_media_types.ts new file mode 100644 index 0000000000..d985bd2496 --- /dev/null +++ b/tests/specs/run/_035_cached_only_flag/019_media_types.ts @@ -0,0 +1,24 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. + +import { loaded as loadedTs1 } from "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; +import { loaded as loadedTs2 } from "http://localhost:4545/subdir/mt_video_vdn.t2.ts"; +import { loaded as loadedTs3 } from "http://localhost:4545/subdir/mt_video_mp2t.t3.ts"; +import { loaded as loadedTs4 } from "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts"; +import { loaded as loadedJs1 } from "http://localhost:4545/subdir/mt_text_javascript.j1.js"; +import { loaded as loadedJs2 } from "http://localhost:4545/subdir/mt_application_ecmascript.j2.js"; +import { loaded as loadedJs3 } from "http://localhost:4545/subdir/mt_text_ecmascript.j3.js"; +import { loaded as loadedJs4 } from "http://localhost:4545/subdir/mt_application_x_javascript.j4.js"; + +console.log( + "success", + loadedTs1, + loadedTs2, + loadedTs3, + loadedTs4, + loadedJs1, + loadedJs2, + loadedJs3, + loadedJs4, +); diff --git a/tests/specs/run/_035_cached_only_flag/035_cached_only_flag.out b/tests/specs/run/_035_cached_only_flag/035_cached_only_flag.out new file mode 100644 index 0000000000..aad3f2fbc1 --- /dev/null +++ b/tests/specs/run/_035_cached_only_flag/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/tests/specs/run/_035_cached_only_flag/__test__.jsonc b/tests/specs/run/_035_cached_only_flag/__test__.jsonc new file mode 100644 index 0000000000..ac9d01cdd0 --- /dev/null +++ b/tests/specs/run/_035_cached_only_flag/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --check --allow-import --cached-only http://127.0.0.1:4545/019_media_types.ts", + "output": "035_cached_only_flag.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/038_checkjs.js b/tests/specs/run/_038_checkjs/038_checkjs.js similarity index 100% rename from tests/testdata/run/038_checkjs.js rename to tests/specs/run/_038_checkjs/038_checkjs.js diff --git a/tests/testdata/run/038_checkjs.js.out b/tests/specs/run/_038_checkjs/038_checkjs.js.out similarity index 100% rename from tests/testdata/run/038_checkjs.js.out rename to tests/specs/run/_038_checkjs/038_checkjs.js.out diff --git a/tests/specs/run/_038_checkjs/__test__.jsonc b/tests/specs/run/_038_checkjs/__test__.jsonc new file mode 100644 index 0000000000..6915787d2d --- /dev/null +++ b/tests/specs/run/_038_checkjs/__test__.jsonc @@ -0,0 +1,6 @@ +{ + // checking if JS file is run through TS compiler + "args": "run --reload --config checkjs.tsconfig.json --check 038_checkjs.js", + "exitCode": 1, + "output": "038_checkjs.js.out" +} diff --git a/tests/specs/run/_038_checkjs/checkjs.tsconfig.json b/tests/specs/run/_038_checkjs/checkjs.tsconfig.json new file mode 100644 index 0000000000..08ac60b6cd --- /dev/null +++ b/tests/specs/run/_038_checkjs/checkjs.tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} diff --git a/tests/testdata/run/042_dyn_import_evalcontext.ts b/tests/specs/run/_042_dyn_import_evalcontext/042_dyn_import_evalcontext.ts similarity index 63% rename from tests/testdata/run/042_dyn_import_evalcontext.ts rename to tests/specs/run/_042_dyn_import_evalcontext/042_dyn_import_evalcontext.ts index 386ae48ec7..f39ae24685 100644 --- a/tests/testdata/run/042_dyn_import_evalcontext.ts +++ b/tests/specs/run/_042_dyn_import_evalcontext/042_dyn_import_evalcontext.ts @@ -1,5 +1,5 @@ // @ts-expect-error "Deno[Deno.internal].core" is not a public interface Deno[Deno.internal].core.evalContext( - "(async () => console.log(await import('./subdir/mod4.js')))()", + "(async () => console.log(await import('./_042_dyn_import_evalcontext/mod4.js')))()", new URL("..", import.meta.url).href, ); diff --git a/tests/testdata/run/042_dyn_import_evalcontext.ts.out b/tests/specs/run/_042_dyn_import_evalcontext/042_dyn_import_evalcontext.ts.out similarity index 100% rename from tests/testdata/run/042_dyn_import_evalcontext.ts.out rename to tests/specs/run/_042_dyn_import_evalcontext/042_dyn_import_evalcontext.ts.out diff --git a/tests/specs/run/_042_dyn_import_evalcontext/__test__.jsonc b/tests/specs/run/_042_dyn_import_evalcontext/__test__.jsonc new file mode 100644 index 0000000000..e3cb0d1844 --- /dev/null +++ b/tests/specs/run/_042_dyn_import_evalcontext/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --allow-read --reload 042_dyn_import_evalcontext.ts", + "output": "042_dyn_import_evalcontext.ts.out" +} diff --git a/tests/specs/run/_042_dyn_import_evalcontext/mod4.js b/tests/specs/run/_042_dyn_import_evalcontext/mod4.js new file mode 100644 index 0000000000..71332dbc42 --- /dev/null +++ b/tests/specs/run/_042_dyn_import_evalcontext/mod4.js @@ -0,0 +1 @@ +export const isMod4 = true; diff --git a/tests/specs/run/_044_bad_resource/044_bad_resource.ts b/tests/specs/run/_044_bad_resource/044_bad_resource.ts new file mode 100644 index 0000000000..c76a11eff9 --- /dev/null +++ b/tests/specs/run/_044_bad_resource/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/tests/testdata/run/044_bad_resource.ts.out b/tests/specs/run/_044_bad_resource/044_bad_resource.ts.out similarity index 100% rename from tests/testdata/run/044_bad_resource.ts.out rename to tests/specs/run/_044_bad_resource/044_bad_resource.ts.out diff --git a/tests/specs/run/_044_bad_resource/__test__.jsonc b/tests/specs/run/_044_bad_resource/__test__.jsonc new file mode 100644 index 0000000000..cb7832e74a --- /dev/null +++ b/tests/specs/run/_044_bad_resource/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload --allow-read 044_bad_resource.ts", + "output": "044_bad_resource.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/046_jsx_test.tsx b/tests/specs/run/_046_tsx/046_jsx_test.tsx similarity index 100% rename from tests/testdata/run/046_jsx_test.tsx rename to tests/specs/run/_046_tsx/046_jsx_test.tsx diff --git a/tests/testdata/run/046_jsx_test.tsx.out b/tests/specs/run/_046_tsx/046_jsx_test.tsx.out similarity index 100% rename from tests/testdata/run/046_jsx_test.tsx.out rename to tests/specs/run/_046_tsx/046_jsx_test.tsx.out diff --git a/tests/specs/run/_046_tsx/__test__.jsonc b/tests/specs/run/_046_tsx/__test__.jsonc new file mode 100644 index 0000000000..28a48ececc --- /dev/null +++ b/tests/specs/run/_046_tsx/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 046_jsx_test.tsx", + "output": "046_jsx_test.tsx.out" +} diff --git a/tests/testdata/run/047_jsx_test.jsx b/tests/specs/run/_047_jsx/047_jsx_test.jsx similarity index 100% rename from tests/testdata/run/047_jsx_test.jsx rename to tests/specs/run/_047_jsx/047_jsx_test.jsx diff --git a/tests/testdata/run/047_jsx_test.jsx.out b/tests/specs/run/_047_jsx/047_jsx_test.jsx.out similarity index 100% rename from tests/testdata/run/047_jsx_test.jsx.out rename to tests/specs/run/_047_jsx/047_jsx_test.jsx.out diff --git a/tests/specs/run/_047_jsx/__test__.jsonc b/tests/specs/run/_047_jsx/__test__.jsonc new file mode 100644 index 0000000000..bb89db0177 --- /dev/null +++ b/tests/specs/run/_047_jsx/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload 047_jsx_test.jsx", + "output": "047_jsx_test.jsx.out" +} diff --git a/tests/specs/run/_048_media_types_jsx/048_media_types_jsx.ts b/tests/specs/run/_048_media_types_jsx/048_media_types_jsx.ts new file mode 100644 index 0000000000..8dcd0ad687 --- /dev/null +++ b/tests/specs/run/_048_media_types_jsx/048_media_types_jsx.ts @@ -0,0 +1,32 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. +import { loaded as loadedTsx1 } from "http://localhost:4545/subdir/mt_text_typescript_tsx.t1.tsx"; +import { loaded as loadedTsx2 } from "http://localhost:4545/subdir/mt_video_vdn_tsx.t2.tsx"; +import { loaded as loadedTsx3 } from "http://localhost:4545/subdir/mt_video_mp2t_tsx.t3.tsx"; +import { loaded as loadedTsx4 } from "http://localhost:4545/subdir/mt_application_x_typescript_tsx.t4.tsx"; +import { loaded as loadedJsx1 } from "http://localhost:4545/subdir/mt_text_javascript_jsx.j1.jsx"; +import { loaded as loadedJsx2 } from "http://localhost:4545/subdir/mt_application_ecmascript_jsx.j2.jsx"; +import { loaded as loadedJsx3 } from "http://localhost:4545/subdir/mt_text_ecmascript_jsx.j3.jsx"; +import { loaded as loadedJsx4 } from "http://localhost:4545/subdir/mt_application_x_javascript_jsx.j4.jsx"; + +declare global { + namespace JSX { + interface IntrinsicElements { + // deno-lint-ignore no-explicit-any + [elemName: string]: any; + } + } +} + +console.log( + "success", + loadedTsx1, + loadedTsx2, + loadedTsx3, + loadedTsx4, + loadedJsx1, + loadedJsx2, + loadedJsx3, + loadedJsx4, +); diff --git a/tests/testdata/run/048_media_types_jsx.ts.out b/tests/specs/run/_048_media_types_jsx/048_media_types_jsx.ts.out similarity index 100% rename from tests/testdata/run/048_media_types_jsx.ts.out rename to tests/specs/run/_048_media_types_jsx/048_media_types_jsx.ts.out diff --git a/tests/specs/run/_048_media_types_jsx/__test__.jsonc b/tests/specs/run/_048_media_types_jsx/__test__.jsonc new file mode 100644 index 0000000000..0dec930b09 --- /dev/null +++ b/tests/specs/run/_048_media_types_jsx/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --allow-import 048_media_types_jsx.ts", + "output": "048_media_types_jsx.ts.out" +} diff --git a/tests/specs/run/_052_no_remote_flag/019_media_types.ts b/tests/specs/run/_052_no_remote_flag/019_media_types.ts new file mode 100644 index 0000000000..d985bd2496 --- /dev/null +++ b/tests/specs/run/_052_no_remote_flag/019_media_types.ts @@ -0,0 +1,24 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. + +import { loaded as loadedTs1 } from "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; +import { loaded as loadedTs2 } from "http://localhost:4545/subdir/mt_video_vdn.t2.ts"; +import { loaded as loadedTs3 } from "http://localhost:4545/subdir/mt_video_mp2t.t3.ts"; +import { loaded as loadedTs4 } from "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts"; +import { loaded as loadedJs1 } from "http://localhost:4545/subdir/mt_text_javascript.j1.js"; +import { loaded as loadedJs2 } from "http://localhost:4545/subdir/mt_application_ecmascript.j2.js"; +import { loaded as loadedJs3 } from "http://localhost:4545/subdir/mt_text_ecmascript.j3.js"; +import { loaded as loadedJs4 } from "http://localhost:4545/subdir/mt_application_x_javascript.j4.js"; + +console.log( + "success", + loadedTs1, + loadedTs2, + loadedTs3, + loadedTs4, + loadedJs1, + loadedJs2, + loadedJs3, + loadedJs4, +); diff --git a/tests/testdata/run/052_no_remote_flag.out b/tests/specs/run/_052_no_remote_flag/052_no_remote_flag.out similarity index 53% rename from tests/testdata/run/052_no_remote_flag.out rename to tests/specs/run/_052_no_remote_flag/052_no_remote_flag.out index 2f5950ee89..c1f9f4e131 100644 --- a/tests/testdata/run/052_no_remote_flag.out +++ b/tests/specs/run/_052_no_remote_flag/052_no_remote_flag.out @@ -1 +1 @@ -error: A remote specifier was requested: "http://127.0.0.1:4545/run/019_media_types.ts", but --no-remote is specified. +error: A remote specifier was requested: "http://127.0.0.1:4545/019_media_types.ts", but --no-remote is specified. diff --git a/tests/specs/run/_052_no_remote_flag/__test__.jsonc b/tests/specs/run/_052_no_remote_flag/__test__.jsonc new file mode 100644 index 0000000000..c8ac477c66 --- /dev/null +++ b/tests/specs/run/_052_no_remote_flag/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --check --allow-import --no-remote http://127.0.0.1:4545/019_media_types.ts", + "output": "052_no_remote_flag.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/058_tasks_microtasks_close.ts b/tests/specs/run/_058_tasks_microtasks_close/058_tasks_microtasks_close.ts similarity index 100% rename from tests/testdata/run/058_tasks_microtasks_close.ts rename to tests/specs/run/_058_tasks_microtasks_close/058_tasks_microtasks_close.ts diff --git a/tests/testdata/run/058_tasks_microtasks_close.ts.out b/tests/specs/run/_058_tasks_microtasks_close/058_tasks_microtasks_close.ts.out similarity index 100% rename from tests/testdata/run/058_tasks_microtasks_close.ts.out rename to tests/specs/run/_058_tasks_microtasks_close/058_tasks_microtasks_close.ts.out diff --git a/tests/specs/run/_058_tasks_microtasks_close/__test__.jsonc b/tests/specs/run/_058_tasks_microtasks_close/__test__.jsonc new file mode 100644 index 0000000000..9eec8f53cb --- /dev/null +++ b/tests/specs/run/_058_tasks_microtasks_close/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet 058_tasks_microtasks_close.ts", + "output": "058_tasks_microtasks_close.ts.out" +} diff --git a/tests/testdata/run/059_fs_relative_path_perm.ts b/tests/specs/run/_059_fs_relative_path_perm/059_fs_relative_path_perm.ts similarity index 100% rename from tests/testdata/run/059_fs_relative_path_perm.ts rename to tests/specs/run/_059_fs_relative_path_perm/059_fs_relative_path_perm.ts diff --git a/tests/testdata/run/059_fs_relative_path_perm.ts.out b/tests/specs/run/_059_fs_relative_path_perm/059_fs_relative_path_perm.ts.out similarity index 100% rename from tests/testdata/run/059_fs_relative_path_perm.ts.out rename to tests/specs/run/_059_fs_relative_path_perm/059_fs_relative_path_perm.ts.out diff --git a/tests/specs/run/_059_fs_relative_path_perm/__test__.jsonc b/tests/specs/run/_059_fs_relative_path_perm/__test__.jsonc new file mode 100644 index 0000000000..04a7b8aa4f --- /dev/null +++ b/tests/specs/run/_059_fs_relative_path_perm/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run 059_fs_relative_path_perm.ts", + "output": "059_fs_relative_path_perm.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/063_permissions_revoke.ts b/tests/specs/run/_063_permissions_revoke/063_permissions_revoke.ts similarity index 100% rename from tests/testdata/run/063_permissions_revoke.ts rename to tests/specs/run/_063_permissions_revoke/063_permissions_revoke.ts diff --git a/tests/testdata/run/063_permissions_revoke.ts.out b/tests/specs/run/_063_permissions_revoke/063_permissions_revoke.ts.out similarity index 100% rename from tests/testdata/run/063_permissions_revoke.ts.out rename to tests/specs/run/_063_permissions_revoke/063_permissions_revoke.ts.out diff --git a/tests/specs/run/_063_permissions_revoke/__test__.jsonc b/tests/specs/run/_063_permissions_revoke/__test__.jsonc new file mode 100644 index 0000000000..1dd5ed747f --- /dev/null +++ b/tests/specs/run/_063_permissions_revoke/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read=foo,bar 063_permissions_revoke.ts", + "output": "063_permissions_revoke.ts.out" +} diff --git a/tests/specs/run/_063_permissions_revoke_sync/063_permissions_revoke.ts.out b/tests/specs/run/_063_permissions_revoke_sync/063_permissions_revoke.ts.out new file mode 100644 index 0000000000..bbd64c557b --- /dev/null +++ b/tests/specs/run/_063_permissions_revoke_sync/063_permissions_revoke.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]PermissionStatus { state: "prompt", onchange: null } +PermissionStatus { state: "granted", onchange: null } +PermissionStatus { state: "prompt", onchange: null } diff --git a/tests/testdata/run/063_permissions_revoke_sync.ts b/tests/specs/run/_063_permissions_revoke_sync/063_permissions_revoke_sync.ts similarity index 100% rename from tests/testdata/run/063_permissions_revoke_sync.ts rename to tests/specs/run/_063_permissions_revoke_sync/063_permissions_revoke_sync.ts diff --git a/tests/specs/run/_063_permissions_revoke_sync/__test__.jsonc b/tests/specs/run/_063_permissions_revoke_sync/__test__.jsonc new file mode 100644 index 0000000000..8dd9384e3d --- /dev/null +++ b/tests/specs/run/_063_permissions_revoke_sync/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read=foo,bar 063_permissions_revoke_sync.ts", + "output": "063_permissions_revoke.ts.out" +} diff --git a/tests/testdata/run/064_permissions_revoke_global.ts b/tests/specs/run/_064_permissions_revoke_global/064_permissions_revoke_global.ts similarity index 100% rename from tests/testdata/run/064_permissions_revoke_global.ts rename to tests/specs/run/_064_permissions_revoke_global/064_permissions_revoke_global.ts diff --git a/tests/testdata/run/064_permissions_revoke_global.ts.out b/tests/specs/run/_064_permissions_revoke_global/064_permissions_revoke_global.ts.out similarity index 100% rename from tests/testdata/run/064_permissions_revoke_global.ts.out rename to tests/specs/run/_064_permissions_revoke_global/064_permissions_revoke_global.ts.out diff --git a/tests/specs/run/_064_permissions_revoke_global/__test__.jsonc b/tests/specs/run/_064_permissions_revoke_global/__test__.jsonc new file mode 100644 index 0000000000..929e48ee8d --- /dev/null +++ b/tests/specs/run/_064_permissions_revoke_global/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read=foo,bar 064_permissions_revoke_global.ts", + "output": "064_permissions_revoke_global.ts.out" +} diff --git a/tests/specs/run/_064_permissions_revoke_global_sync/064_permissions_revoke_global.ts.out b/tests/specs/run/_064_permissions_revoke_global_sync/064_permissions_revoke_global.ts.out new file mode 100644 index 0000000000..f7e389a76b --- /dev/null +++ b/tests/specs/run/_064_permissions_revoke_global_sync/064_permissions_revoke_global.ts.out @@ -0,0 +1,3 @@ +[WILDCARD]PermissionStatus { state: "prompt", onchange: null } +PermissionStatus { state: "prompt", onchange: null } +PermissionStatus { state: "prompt", onchange: null } diff --git a/tests/testdata/run/064_permissions_revoke_global_sync.ts b/tests/specs/run/_064_permissions_revoke_global_sync/064_permissions_revoke_global_sync.ts similarity index 100% rename from tests/testdata/run/064_permissions_revoke_global_sync.ts rename to tests/specs/run/_064_permissions_revoke_global_sync/064_permissions_revoke_global_sync.ts diff --git a/tests/specs/run/_064_permissions_revoke_global_sync/__test__.jsonc b/tests/specs/run/_064_permissions_revoke_global_sync/__test__.jsonc new file mode 100644 index 0000000000..8d6f8079d3 --- /dev/null +++ b/tests/specs/run/_064_permissions_revoke_global_sync/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read=foo,bar 064_permissions_revoke_global_sync.ts", + "output": "064_permissions_revoke_global.ts.out" +} diff --git a/tests/testdata/run/065_permissions_revoke_net.ts b/tests/specs/run/_065_permissions_revoke_net/065_permissions_revoke_net.ts similarity index 100% rename from tests/testdata/run/065_permissions_revoke_net.ts rename to tests/specs/run/_065_permissions_revoke_net/065_permissions_revoke_net.ts diff --git a/tests/testdata/run/065_permissions_revoke_net.ts.out b/tests/specs/run/_065_permissions_revoke_net/065_permissions_revoke_net.ts.out similarity index 100% rename from tests/testdata/run/065_permissions_revoke_net.ts.out rename to tests/specs/run/_065_permissions_revoke_net/065_permissions_revoke_net.ts.out diff --git a/tests/specs/run/_065_permissions_revoke_net/__test__.jsonc b/tests/specs/run/_065_permissions_revoke_net/__test__.jsonc new file mode 100644 index 0000000000..ab66835fdb --- /dev/null +++ b/tests/specs/run/_065_permissions_revoke_net/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-net 065_permissions_revoke_net.ts", + "output": "065_permissions_revoke_net.ts.out" +} diff --git a/tests/testdata/run/070_location.ts b/tests/specs/run/_070_location/070_location.ts similarity index 100% rename from tests/testdata/run/070_location.ts rename to tests/specs/run/_070_location/070_location.ts diff --git a/tests/testdata/run/070_location.ts.out b/tests/specs/run/_070_location/070_location.ts.out similarity index 100% rename from tests/testdata/run/070_location.ts.out rename to tests/specs/run/_070_location/070_location.ts.out diff --git a/tests/specs/run/_070_location/__test__.jsonc b/tests/specs/run/_070_location/__test__.jsonc new file mode 100644 index 0000000000..ad92752ea0 --- /dev/null +++ b/tests/specs/run/_070_location/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --location https://foo/bar?baz#bat 070_location.ts", + "output": "070_location.ts.out" +} diff --git a/tests/testdata/run/071_location_unset.ts b/tests/specs/run/_071_location_unset/071_location_unset.ts similarity index 100% rename from tests/testdata/run/071_location_unset.ts rename to tests/specs/run/_071_location_unset/071_location_unset.ts diff --git a/tests/testdata/run/071_location_unset.ts.out b/tests/specs/run/_071_location_unset/071_location_unset.ts.out similarity index 100% rename from tests/testdata/run/071_location_unset.ts.out rename to tests/specs/run/_071_location_unset/071_location_unset.ts.out diff --git a/tests/specs/run/_071_location_unset/__test__.jsonc b/tests/specs/run/_071_location_unset/__test__.jsonc new file mode 100644 index 0000000000..946755cf5a --- /dev/null +++ b/tests/specs/run/_071_location_unset/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run 071_location_unset.ts", + "output": "071_location_unset.ts.out" +} diff --git a/tests/testdata/run/072_location_relative_fetch.ts b/tests/specs/run/_072_location_relative_fetch/072_location_relative_fetch.ts similarity index 100% rename from tests/testdata/run/072_location_relative_fetch.ts rename to tests/specs/run/_072_location_relative_fetch/072_location_relative_fetch.ts diff --git a/tests/testdata/run/072_location_relative_fetch.ts.out b/tests/specs/run/_072_location_relative_fetch/072_location_relative_fetch.ts.out similarity index 100% rename from tests/testdata/run/072_location_relative_fetch.ts.out rename to tests/specs/run/_072_location_relative_fetch/072_location_relative_fetch.ts.out diff --git a/tests/specs/run/_072_location_relative_fetch/__test__.jsonc b/tests/specs/run/_072_location_relative_fetch/__test__.jsonc new file mode 100644 index 0000000000..e6e9e48996 --- /dev/null +++ b/tests/specs/run/_072_location_relative_fetch/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --location http://127.0.0.1:4545/ --allow-net 072_location_relative_fetch.ts", + "output": "072_location_relative_fetch.ts.out" +} diff --git a/tests/specs/run/_072_location_relative_fetch/fetch/hello.txt b/tests/specs/run/_072_location_relative_fetch/fetch/hello.txt new file mode 100644 index 0000000000..af5626b4a1 --- /dev/null +++ b/tests/specs/run/_072_location_relative_fetch/fetch/hello.txt @@ -0,0 +1 @@ +Hello, world! diff --git a/tests/specs/run/_075_import_local_query_hash/001_hello.js b/tests/specs/run/_075_import_local_query_hash/001_hello.js new file mode 100644 index 0000000000..accefceba6 --- /dev/null +++ b/tests/specs/run/_075_import_local_query_hash/001_hello.js @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/tests/specs/run/_075_import_local_query_hash/002_hello.ts b/tests/specs/run/_075_import_local_query_hash/002_hello.ts new file mode 100644 index 0000000000..accefceba6 --- /dev/null +++ b/tests/specs/run/_075_import_local_query_hash/002_hello.ts @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/tests/testdata/run/075_import_local_query_hash.ts b/tests/specs/run/_075_import_local_query_hash/075_import_local_query_hash.ts similarity index 100% rename from tests/testdata/run/075_import_local_query_hash.ts rename to tests/specs/run/_075_import_local_query_hash/075_import_local_query_hash.ts diff --git a/tests/testdata/run/075_import_local_query_hash.ts.out b/tests/specs/run/_075_import_local_query_hash/075_import_local_query_hash.ts.out similarity index 100% rename from tests/testdata/run/075_import_local_query_hash.ts.out rename to tests/specs/run/_075_import_local_query_hash/075_import_local_query_hash.ts.out diff --git a/tests/specs/run/_075_import_local_query_hash/__test__.jsonc b/tests/specs/run/_075_import_local_query_hash/__test__.jsonc new file mode 100644 index 0000000000..521cd3ea8a --- /dev/null +++ b/tests/specs/run/_075_import_local_query_hash/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run 075_import_local_query_hash.ts", + "output": "075_import_local_query_hash.ts.out" +} diff --git a/tests/testdata/run/077_fetch_empty.ts b/tests/specs/run/_077_fetch_empty/077_fetch_empty.ts similarity index 100% rename from tests/testdata/run/077_fetch_empty.ts rename to tests/specs/run/_077_fetch_empty/077_fetch_empty.ts diff --git a/tests/testdata/run/077_fetch_empty.ts.out b/tests/specs/run/_077_fetch_empty/077_fetch_empty.ts.out similarity index 100% rename from tests/testdata/run/077_fetch_empty.ts.out rename to tests/specs/run/_077_fetch_empty/077_fetch_empty.ts.out diff --git a/tests/specs/run/_077_fetch_empty/__test__.jsonc b/tests/specs/run/_077_fetch_empty/__test__.jsonc new file mode 100644 index 0000000000..654b109380 --- /dev/null +++ b/tests/specs/run/_077_fetch_empty/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run -A 077_fetch_empty.ts", + "output": "077_fetch_empty.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/078_unload_on_exit.ts b/tests/specs/run/_078_unload_on_exit/078_unload_on_exit.ts similarity index 100% rename from tests/testdata/run/078_unload_on_exit.ts rename to tests/specs/run/_078_unload_on_exit/078_unload_on_exit.ts diff --git a/tests/testdata/run/078_unload_on_exit.ts.out b/tests/specs/run/_078_unload_on_exit/078_unload_on_exit.ts.out similarity index 100% rename from tests/testdata/run/078_unload_on_exit.ts.out rename to tests/specs/run/_078_unload_on_exit/078_unload_on_exit.ts.out diff --git a/tests/specs/run/_078_unload_on_exit/__test__.jsonc b/tests/specs/run/_078_unload_on_exit/__test__.jsonc new file mode 100644 index 0000000000..4091b7dc99 --- /dev/null +++ b/tests/specs/run/_078_unload_on_exit/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run 078_unload_on_exit.ts", + "output": "078_unload_on_exit.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/079_location_authentication.ts b/tests/specs/run/_079_location_authentication/079_location_authentication.ts similarity index 100% rename from tests/testdata/run/079_location_authentication.ts rename to tests/specs/run/_079_location_authentication/079_location_authentication.ts diff --git a/tests/testdata/run/079_location_authentication.ts.out b/tests/specs/run/_079_location_authentication/079_location_authentication.ts.out similarity index 100% rename from tests/testdata/run/079_location_authentication.ts.out rename to tests/specs/run/_079_location_authentication/079_location_authentication.ts.out diff --git a/tests/specs/run/_079_location_authentication/__test__.jsonc b/tests/specs/run/_079_location_authentication/__test__.jsonc new file mode 100644 index 0000000000..30ba279490 --- /dev/null +++ b/tests/specs/run/_079_location_authentication/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --location https://foo:bar@baz/qux 079_location_authentication.ts", + "output": "079_location_authentication.ts.out" +} diff --git a/tests/testdata/run/081_location_relative_fetch_redirect.ts b/tests/specs/run/_081_location_relative_fetch_redirect/081_location_relative_fetch_redirect.ts similarity index 100% rename from tests/testdata/run/081_location_relative_fetch_redirect.ts rename to tests/specs/run/_081_location_relative_fetch_redirect/081_location_relative_fetch_redirect.ts diff --git a/tests/testdata/run/081_location_relative_fetch_redirect.ts.out b/tests/specs/run/_081_location_relative_fetch_redirect/081_location_relative_fetch_redirect.ts.out similarity index 100% rename from tests/testdata/run/081_location_relative_fetch_redirect.ts.out rename to tests/specs/run/_081_location_relative_fetch_redirect/081_location_relative_fetch_redirect.ts.out diff --git a/tests/specs/run/_081_location_relative_fetch_redirect/__test__.jsonc b/tests/specs/run/_081_location_relative_fetch_redirect/__test__.jsonc new file mode 100644 index 0000000000..6756bf6d1f --- /dev/null +++ b/tests/specs/run/_081_location_relative_fetch_redirect/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --location http://127.0.0.1:4546/ --allow-net 081_location_relative_fetch_redirect.ts", + "output": "081_location_relative_fetch_redirect.ts.out" +} diff --git a/tests/testdata/run/082_prepare_stack_trace_throw.js b/tests/specs/run/_082_prepare_stack_trace_throw/082_prepare_stack_trace_throw.js similarity index 100% rename from tests/testdata/run/082_prepare_stack_trace_throw.js rename to tests/specs/run/_082_prepare_stack_trace_throw/082_prepare_stack_trace_throw.js diff --git a/tests/testdata/run/082_prepare_stack_trace_throw.js.out b/tests/specs/run/_082_prepare_stack_trace_throw/082_prepare_stack_trace_throw.js.out similarity index 100% rename from tests/testdata/run/082_prepare_stack_trace_throw.js.out rename to tests/specs/run/_082_prepare_stack_trace_throw/082_prepare_stack_trace_throw.js.out diff --git a/tests/specs/run/_082_prepare_stack_trace_throw/__test__.jsonc b/tests/specs/run/_082_prepare_stack_trace_throw/__test__.jsonc new file mode 100644 index 0000000000..41b27e3bdd --- /dev/null +++ b/tests/specs/run/_082_prepare_stack_trace_throw/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run 082_prepare_stack_trace_throw.js", + "output": "082_prepare_stack_trace_throw.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/088_dynamic_import_already_evaluating.ts b/tests/specs/run/_088_dynamic_import_already_evaluating/088_dynamic_import_already_evaluating.ts similarity index 100% rename from tests/testdata/run/088_dynamic_import_already_evaluating.ts rename to tests/specs/run/_088_dynamic_import_already_evaluating/088_dynamic_import_already_evaluating.ts diff --git a/tests/testdata/run/088_dynamic_import_already_evaluating.ts.out b/tests/specs/run/_088_dynamic_import_already_evaluating/088_dynamic_import_already_evaluating.ts.out similarity index 100% rename from tests/testdata/run/088_dynamic_import_already_evaluating.ts.out rename to tests/specs/run/_088_dynamic_import_already_evaluating/088_dynamic_import_already_evaluating.ts.out diff --git a/tests/specs/run/_088_dynamic_import_already_evaluating/088_dynamic_import_target.ts b/tests/specs/run/_088_dynamic_import_already_evaluating/088_dynamic_import_target.ts new file mode 100644 index 0000000000..226f1851a6 --- /dev/null +++ b/tests/specs/run/_088_dynamic_import_already_evaluating/088_dynamic_import_target.ts @@ -0,0 +1,3 @@ +console.log(1); +await new Promise((r) => setTimeout(r, 100)); +console.log(2); diff --git a/tests/specs/run/_088_dynamic_import_already_evaluating/__test__.jsonc b/tests/specs/run/_088_dynamic_import_already_evaluating/__test__.jsonc new file mode 100644 index 0000000000..4ce912bf86 --- /dev/null +++ b/tests/specs/run/_088_dynamic_import_already_evaluating/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read 088_dynamic_import_already_evaluating.ts", + "output": "088_dynamic_import_already_evaluating.ts.out" +} diff --git a/tests/testdata/run/091_use_define_for_class_fields.ts b/tests/specs/run/_091_use_define_for_class_fields/091_use_define_for_class_fields.ts similarity index 100% rename from tests/testdata/run/091_use_define_for_class_fields.ts rename to tests/specs/run/_091_use_define_for_class_fields/091_use_define_for_class_fields.ts diff --git a/tests/testdata/run/091_use_define_for_class_fields.ts.out b/tests/specs/run/_091_use_define_for_class_fields/091_use_define_for_class_fields.ts.out similarity index 100% rename from tests/testdata/run/091_use_define_for_class_fields.ts.out rename to tests/specs/run/_091_use_define_for_class_fields/091_use_define_for_class_fields.ts.out diff --git a/tests/specs/run/_091_use_define_for_class_fields/__test__.jsonc b/tests/specs/run/_091_use_define_for_class_fields/__test__.jsonc new file mode 100644 index 0000000000..100db44aa8 --- /dev/null +++ b/tests/specs/run/_091_use_define_for_class_fields/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --check 091_use_define_for_class_fields.ts", + "output": "091_use_define_for_class_fields.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/aggregate_error/__test__.jsonc b/tests/specs/run/aggregate_error/__test__.jsonc new file mode 100644 index 0000000000..e9bd82481c --- /dev/null +++ b/tests/specs/run/aggregate_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet aggregate_error.ts", + "output": "aggregate_error.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/aggregate_error.out b/tests/specs/run/aggregate_error/aggregate_error.out similarity index 100% rename from tests/testdata/run/aggregate_error.out rename to tests/specs/run/aggregate_error/aggregate_error.out diff --git a/tests/testdata/run/aggregate_error.ts b/tests/specs/run/aggregate_error/aggregate_error.ts similarity index 100% rename from tests/testdata/run/aggregate_error.ts rename to tests/specs/run/aggregate_error/aggregate_error.ts diff --git a/tests/specs/run/async_error/__test__.jsonc b/tests/specs/run/async_error/__test__.jsonc new file mode 100644 index 0000000000..86c31adac7 --- /dev/null +++ b/tests/specs/run/async_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload async_error.ts", + "output": "async_error.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/async_error.ts b/tests/specs/run/async_error/async_error.ts similarity index 100% rename from tests/testdata/run/async_error.ts rename to tests/specs/run/async_error/async_error.ts diff --git a/tests/testdata/run/async_error.ts.out b/tests/specs/run/async_error/async_error.ts.out similarity index 100% rename from tests/testdata/run/async_error.ts.out rename to tests/specs/run/async_error/async_error.ts.out diff --git a/tests/specs/run/beforeunload_event/__test__.jsonc b/tests/specs/run/beforeunload_event/__test__.jsonc new file mode 100644 index 0000000000..01c7e70077 --- /dev/null +++ b/tests/specs/run/beforeunload_event/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run before_unload.js", + "output": "before_unload.js.out" +} diff --git a/tests/testdata/run/before_unload.js b/tests/specs/run/beforeunload_event/before_unload.js similarity index 100% rename from tests/testdata/run/before_unload.js rename to tests/specs/run/beforeunload_event/before_unload.js diff --git a/tests/testdata/run/before_unload.js.out b/tests/specs/run/beforeunload_event/before_unload.js.out similarity index 100% rename from tests/testdata/run/before_unload.js.out rename to tests/specs/run/beforeunload_event/before_unload.js.out diff --git a/tests/specs/run/blob_gc_finalization/__test__.jsonc b/tests/specs/run/blob_gc_finalization/__test__.jsonc new file mode 100644 index 0000000000..20a8128fce --- /dev/null +++ b/tests/specs/run/blob_gc_finalization/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run blob_gc_finalization.js", + "output": "blob_gc_finalization.js.out", + "exitCode": 0 +} diff --git a/tests/testdata/run/blob_gc_finalization.js b/tests/specs/run/blob_gc_finalization/blob_gc_finalization.js similarity index 100% rename from tests/testdata/run/blob_gc_finalization.js rename to tests/specs/run/blob_gc_finalization/blob_gc_finalization.js diff --git a/tests/testdata/run/blob_gc_finalization.js.out b/tests/specs/run/blob_gc_finalization/blob_gc_finalization.js.out similarity index 100% rename from tests/testdata/run/blob_gc_finalization.js.out rename to tests/specs/run/blob_gc_finalization/blob_gc_finalization.js.out diff --git a/tests/specs/run/byte_order_mark/001_hello.js b/tests/specs/run/byte_order_mark/001_hello.js new file mode 100644 index 0000000000..accefceba6 --- /dev/null +++ b/tests/specs/run/byte_order_mark/001_hello.js @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/tests/specs/run/byte_order_mark/__test__.jsonc b/tests/specs/run/byte_order_mark/__test__.jsonc new file mode 100644 index 0000000000..f47cb7d025 --- /dev/null +++ b/tests/specs/run/byte_order_mark/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --no-check byte_order_mark.ts", + "output": "byte_order_mark.out" +} diff --git a/tests/testdata/run/byte_order_mark.out b/tests/specs/run/byte_order_mark/byte_order_mark.out similarity index 100% rename from tests/testdata/run/byte_order_mark.out rename to tests/specs/run/byte_order_mark/byte_order_mark.out diff --git a/tests/testdata/run/byte_order_mark.ts b/tests/specs/run/byte_order_mark/byte_order_mark.ts similarity index 86% rename from tests/testdata/run/byte_order_mark.ts rename to tests/specs/run/byte_order_mark/byte_order_mark.ts index 40eb23c1d0..71da3e1e9c 100644 --- a/tests/testdata/run/byte_order_mark.ts +++ b/tests/specs/run/byte_order_mark/byte_order_mark.ts @@ -1,4 +1,4 @@ -import "./001_hello.js"; +import "./001_hello.js"; // Note this file starts with special byte order mark // it's important that this file is a .ts typescript file which is passed to // deno through `--no-check` mode. diff --git a/tests/specs/run/check_js_points_to_ts/__test__.jsonc b/tests/specs/run/check_js_points_to_ts/__test__.jsonc new file mode 100644 index 0000000000..a63b9e5a46 --- /dev/null +++ b/tests/specs/run/check_js_points_to_ts/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --check --config checkjs.tsconfig.json check_js_points_to_ts/test.js", + "output": "check_js_points_to_ts/test.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/check_js_points_to_ts/bar.ts b/tests/specs/run/check_js_points_to_ts/check_js_points_to_ts/bar.ts similarity index 100% rename from tests/testdata/run/check_js_points_to_ts/bar.ts rename to tests/specs/run/check_js_points_to_ts/check_js_points_to_ts/bar.ts diff --git a/tests/testdata/run/check_js_points_to_ts/foo.d.ts b/tests/specs/run/check_js_points_to_ts/check_js_points_to_ts/foo.d.ts similarity index 100% rename from tests/testdata/run/check_js_points_to_ts/foo.d.ts rename to tests/specs/run/check_js_points_to_ts/check_js_points_to_ts/foo.d.ts diff --git a/tests/testdata/run/check_js_points_to_ts/foo.js b/tests/specs/run/check_js_points_to_ts/check_js_points_to_ts/foo.js similarity index 100% rename from tests/testdata/run/check_js_points_to_ts/foo.js rename to tests/specs/run/check_js_points_to_ts/check_js_points_to_ts/foo.js diff --git a/tests/testdata/run/check_js_points_to_ts/test.js b/tests/specs/run/check_js_points_to_ts/check_js_points_to_ts/test.js similarity index 100% rename from tests/testdata/run/check_js_points_to_ts/test.js rename to tests/specs/run/check_js_points_to_ts/check_js_points_to_ts/test.js diff --git a/tests/testdata/run/check_js_points_to_ts/test.js.out b/tests/specs/run/check_js_points_to_ts/check_js_points_to_ts/test.js.out similarity index 100% rename from tests/testdata/run/check_js_points_to_ts/test.js.out rename to tests/specs/run/check_js_points_to_ts/check_js_points_to_ts/test.js.out diff --git a/tests/specs/run/check_js_points_to_ts/checkjs.tsconfig.json b/tests/specs/run/check_js_points_to_ts/checkjs.tsconfig.json new file mode 100644 index 0000000000..08ac60b6cd --- /dev/null +++ b/tests/specs/run/check_js_points_to_ts/checkjs.tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} diff --git a/tests/specs/run/check_remote/__test__.jsonc b/tests/specs/run/check_remote/__test__.jsonc new file mode 100644 index 0000000000..6543e61b3f --- /dev/null +++ b/tests/specs/run/check_remote/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --allow-import --reload --check=all no_check_remote.ts", + "output": "no_check_remote.ts.disabled.out", + "exitCode": 1 +} diff --git a/tests/specs/run/check_remote/no_check_remote.ts b/tests/specs/run/check_remote/no_check_remote.ts new file mode 100644 index 0000000000..f42dadf8a7 --- /dev/null +++ b/tests/specs/run/check_remote/no_check_remote.ts @@ -0,0 +1,3 @@ +import * as a from "./type_error.ts"; + +console.log(a.a); diff --git a/tests/testdata/run/no_check_remote.ts.disabled.out b/tests/specs/run/check_remote/no_check_remote.ts.disabled.out similarity index 66% rename from tests/testdata/run/no_check_remote.ts.disabled.out rename to tests/specs/run/check_remote/no_check_remote.ts.disabled.out index 3442646348..06c046072d 100644 --- a/tests/testdata/run/no_check_remote.ts.disabled.out +++ b/tests/specs/run/check_remote/no_check_remote.ts.disabled.out @@ -1,4 +1,4 @@ error: TS2322 [ERROR]: Type '12' is not assignable to type '"a"'. export const a: "a" = 12; ^ - at http://localhost:4545/subdir/type_error.ts:1:14 + at [WILDCARD]/type_error.ts:1:14 diff --git a/tests/specs/run/check_remote/type_error.ts b/tests/specs/run/check_remote/type_error.ts new file mode 100644 index 0000000000..cc3c1d29d8 --- /dev/null +++ b/tests/specs/run/check_remote/type_error.ts @@ -0,0 +1 @@ +export const a: "a" = 12; diff --git a/tests/specs/run/classic_workers_event_loop/__test__.jsonc b/tests/specs/run/classic_workers_event_loop/__test__.jsonc new file mode 100644 index 0000000000..44ea36bdc0 --- /dev/null +++ b/tests/specs/run/classic_workers_event_loop/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --enable-testing-features-do-not-use classic_workers_event_loop.js", + "output": "classic_workers_event_loop.js.out" +} diff --git a/tests/testdata/run/classic_workers_event_loop.js b/tests/specs/run/classic_workers_event_loop/classic_workers_event_loop.js similarity index 100% rename from tests/testdata/run/classic_workers_event_loop.js rename to tests/specs/run/classic_workers_event_loop/classic_workers_event_loop.js diff --git a/tests/testdata/run/classic_workers_event_loop.js.out b/tests/specs/run/classic_workers_event_loop/classic_workers_event_loop.js.out similarity index 100% rename from tests/testdata/run/classic_workers_event_loop.js.out rename to tests/specs/run/classic_workers_event_loop/classic_workers_event_loop.js.out diff --git a/tests/specs/run/colors_without_global_this/__test__.jsonc b/tests/specs/run/colors_without_global_this/__test__.jsonc new file mode 100644 index 0000000000..1d2f1c1cfe --- /dev/null +++ b/tests/specs/run/colors_without_global_this/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run colors_without_globalThis.js", + "output": "true\n" +} diff --git a/tests/testdata/run/colors_without_globalThis.js b/tests/specs/run/colors_without_global_this/colors_without_globalThis.js similarity index 100% rename from tests/testdata/run/colors_without_globalThis.js rename to tests/specs/run/colors_without_global_this/colors_without_globalThis.js diff --git a/tests/specs/run/complex_error/__test__.jsonc b/tests/specs/run/complex_error/__test__.jsonc new file mode 100644 index 0000000000..2f7274be49 --- /dev/null +++ b/tests/specs/run/complex_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet complex_error.ts", + "output": "complex_error.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/complex_error.ts b/tests/specs/run/complex_error/complex_error.ts similarity index 100% rename from tests/testdata/run/complex_error.ts rename to tests/specs/run/complex_error/complex_error.ts diff --git a/tests/testdata/run/complex_error.ts.out b/tests/specs/run/complex_error/complex_error.ts.out similarity index 100% rename from tests/testdata/run/complex_error.ts.out rename to tests/specs/run/complex_error/complex_error.ts.out diff --git a/tests/specs/run/config/__test__.jsonc b/tests/specs/run/config/__test__.jsonc new file mode 100644 index 0000000000..59d3ae5fcc --- /dev/null +++ b/tests/specs/run/config/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --config config/tsconfig.json --check config/main.ts", + "output": "config/main.out" +} diff --git a/tests/testdata/run/config/main.out b/tests/specs/run/config/config/main.out similarity index 100% rename from tests/testdata/run/config/main.out rename to tests/specs/run/config/config/main.out diff --git a/tests/testdata/run/config/main.ts b/tests/specs/run/config/config/main.ts similarity index 100% rename from tests/testdata/run/config/main.ts rename to tests/specs/run/config/config/main.ts diff --git a/tests/testdata/run/config/tsconfig.json b/tests/specs/run/config/config/tsconfig.json similarity index 100% rename from tests/testdata/run/config/tsconfig.json rename to tests/specs/run/config/config/tsconfig.json diff --git a/tests/specs/run/config_auto_discovered_for_local_script/__test__.jsonc b/tests/specs/run/config_auto_discovered_for_local_script/__test__.jsonc new file mode 100644 index 0000000000..bd2a77ab1a --- /dev/null +++ b/tests/specs/run/config_auto_discovered_for_local_script/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet frontend_work.ts", + "output": "ok\n" +} diff --git a/tests/testdata/run/with_config/frontend_work.ts b/tests/specs/run/config_auto_discovered_for_local_script/frontend_work.ts similarity index 100% rename from tests/testdata/run/with_config/frontend_work.ts rename to tests/specs/run/config_auto_discovered_for_local_script/frontend_work.ts diff --git a/tests/specs/run/config_auto_discovered_for_local_script_log/__test__.jsonc b/tests/specs/run/config_auto_discovered_for_local_script_log/__test__.jsonc new file mode 100644 index 0000000000..5182cc9589 --- /dev/null +++ b/tests/specs/run/config_auto_discovered_for_local_script_log/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run -L debug frontend_work.ts", + "output": "auto_discovery_log.out" +} diff --git a/tests/testdata/run/with_config/auto_discovery_log.out b/tests/specs/run/config_auto_discovered_for_local_script_log/auto_discovery_log.out similarity index 100% rename from tests/testdata/run/with_config/auto_discovery_log.out rename to tests/specs/run/config_auto_discovered_for_local_script_log/auto_discovery_log.out diff --git a/tests/testdata/run/with_config/deno.jsonc b/tests/specs/run/config_auto_discovered_for_local_script_log/deno.jsonc similarity index 100% rename from tests/testdata/run/with_config/deno.jsonc rename to tests/specs/run/config_auto_discovered_for_local_script_log/deno.jsonc diff --git a/tests/specs/run/config_auto_discovered_for_local_script_log/frontend_work.ts b/tests/specs/run/config_auto_discovered_for_local_script_log/frontend_work.ts new file mode 100644 index 0000000000..783af44e4c --- /dev/null +++ b/tests/specs/run/config_auto_discovered_for_local_script_log/frontend_work.ts @@ -0,0 +1,4 @@ +function _main() { + console.log(document); +} +console.log("ok"); diff --git a/tests/specs/run/config_json_import/__test__.jsonc b/tests/specs/run/config_json_import/__test__.jsonc new file mode 100644 index 0000000000..6ef632ff8d --- /dev/null +++ b/tests/specs/run/config_json_import/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet -c deno-jsx.json config_json_import.ts", + "output": "config_json_import.ts.out" +} diff --git a/tests/specs/run/config_json_import/config_json_import.ts b/tests/specs/run/config_json_import/config_json_import.ts new file mode 100644 index 0000000000..4a772fac3f --- /dev/null +++ b/tests/specs/run/config_json_import/config_json_import.ts @@ -0,0 +1,2 @@ +import config from "./deno-jsx.json" with { type: "json" }; +console.log(config); diff --git a/tests/testdata/run/config_json_import.ts.out b/tests/specs/run/config_json_import/config_json_import.ts.out similarity index 100% rename from tests/testdata/run/config_json_import.ts.out rename to tests/specs/run/config_json_import/config_json_import.ts.out diff --git a/tests/specs/run/config_json_import/deno-jsx.json b/tests/specs/run/config_json_import/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/config_json_import/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/config_not_auto_discovered_for_remote_script/__test__.jsonc b/tests/specs/run/config_not_auto_discovered_for_remote_script/__test__.jsonc new file mode 100644 index 0000000000..e6ccc02aca --- /dev/null +++ b/tests/specs/run/config_not_auto_discovered_for_remote_script/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --quiet server_side_work.ts", + "output": "ok\n" +} diff --git a/tests/testdata/run/with_config/server_side_work.ts b/tests/specs/run/config_not_auto_discovered_for_remote_script/server_side_work.ts similarity index 100% rename from tests/testdata/run/with_config/server_side_work.ts rename to tests/specs/run/config_not_auto_discovered_for_remote_script/server_side_work.ts diff --git a/tests/specs/run/config_types/__test__.jsonc b/tests/specs/run/config_types/__test__.jsonc new file mode 100644 index 0000000000..d803915c73 --- /dev/null +++ b/tests/specs/run/config_types/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --quiet --check=all --config config_types/tsconfig.json config_types/main.ts", + "output": "config_types/main.out" +} diff --git a/tests/specs/run/config_types/config_types/deno.lock b/tests/specs/run/config_types/config_types/deno.lock new file mode 100644 index 0000000000..157bd98a2e --- /dev/null +++ b/tests/specs/run/config_types/config_types/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/run/config_types/types.d.ts": "741c39165e37de0c12acc5c081841f4362487e3f17dc4cad7017b70af72c4605" + } +} diff --git a/tests/testdata/run/config_types/main.out b/tests/specs/run/config_types/config_types/main.out similarity index 100% rename from tests/testdata/run/config_types/main.out rename to tests/specs/run/config_types/config_types/main.out diff --git a/tests/testdata/run/config_types/main.ts b/tests/specs/run/config_types/config_types/main.ts similarity index 100% rename from tests/testdata/run/config_types/main.ts rename to tests/specs/run/config_types/config_types/main.ts diff --git a/tests/testdata/run/config_types/remote.tsconfig.json b/tests/specs/run/config_types/config_types/remote.tsconfig.json similarity index 100% rename from tests/testdata/run/config_types/remote.tsconfig.json rename to tests/specs/run/config_types/config_types/remote.tsconfig.json diff --git a/tests/testdata/run/config_types/tsconfig.json b/tests/specs/run/config_types/config_types/tsconfig.json similarity index 100% rename from tests/testdata/run/config_types/tsconfig.json rename to tests/specs/run/config_types/config_types/tsconfig.json diff --git a/tests/specs/run/config_types/config_types/types.d.ts b/tests/specs/run/config_types/config_types/types.d.ts new file mode 100644 index 0000000000..536a6d0a69 --- /dev/null +++ b/tests/specs/run/config_types/config_types/types.d.ts @@ -0,0 +1,2 @@ +// deno-lint-ignore-file no-var +declare var a: string; diff --git a/tests/specs/run/config_types_remote/__test__.jsonc b/tests/specs/run/config_types_remote/__test__.jsonc new file mode 100644 index 0000000000..87457ace21 --- /dev/null +++ b/tests/specs/run/config_types_remote/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --quiet --check=all --config config_types/remote.tsconfig.json config_types/main.ts", + "output": "config_types/main.out" +} diff --git a/tests/specs/run/config_types_remote/config_types/deno.lock b/tests/specs/run/config_types_remote/config_types/deno.lock new file mode 100644 index 0000000000..157bd98a2e --- /dev/null +++ b/tests/specs/run/config_types_remote/config_types/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/run/config_types/types.d.ts": "741c39165e37de0c12acc5c081841f4362487e3f17dc4cad7017b70af72c4605" + } +} diff --git a/tests/testdata/run/reference_types.ts.out b/tests/specs/run/config_types_remote/config_types/main.out similarity index 100% rename from tests/testdata/run/reference_types.ts.out rename to tests/specs/run/config_types_remote/config_types/main.out diff --git a/tests/specs/run/config_types_remote/config_types/main.ts b/tests/specs/run/config_types_remote/config_types/main.ts new file mode 100644 index 0000000000..f1a8d65831 --- /dev/null +++ b/tests/specs/run/config_types_remote/config_types/main.ts @@ -0,0 +1 @@ +console.log(globalThis.a); diff --git a/tests/specs/run/config_types_remote/config_types/remote.tsconfig.json b/tests/specs/run/config_types_remote/config_types/remote.tsconfig.json new file mode 100644 index 0000000000..255ff5def0 --- /dev/null +++ b/tests/specs/run/config_types_remote/config_types/remote.tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "types": [ + "http://localhost:4545/run/config_types/types.d.ts" + ] + } +} diff --git a/tests/specs/run/config_types_remote/config_types/tsconfig.json b/tests/specs/run/config_types_remote/config_types/tsconfig.json new file mode 100644 index 0000000000..85f1549e0d --- /dev/null +++ b/tests/specs/run/config_types_remote/config_types/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "types": [ + "./types.d.ts" + ] + } +} diff --git a/tests/specs/run/config_types_remote/config_types/types.d.ts b/tests/specs/run/config_types_remote/config_types/types.d.ts new file mode 100644 index 0000000000..536a6d0a69 --- /dev/null +++ b/tests/specs/run/config_types_remote/config_types/types.d.ts @@ -0,0 +1,2 @@ +// deno-lint-ignore-file no-var +declare var a: string; diff --git a/tests/specs/run/custom_inspect_url/__test__.jsonc b/tests/specs/run/custom_inspect_url/__test__.jsonc new file mode 100644 index 0000000000..1c1c2b9c47 --- /dev/null +++ b/tests/specs/run/custom_inspect_url/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run custom_inspect_url.js", + "output": "custom_inspect_url.js.out" +} diff --git a/tests/testdata/run/custom_inspect_url.js b/tests/specs/run/custom_inspect_url/custom_inspect_url.js similarity index 100% rename from tests/testdata/run/custom_inspect_url.js rename to tests/specs/run/custom_inspect_url/custom_inspect_url.js diff --git a/tests/testdata/run/custom_inspect_url.js.out b/tests/specs/run/custom_inspect_url/custom_inspect_url.js.out similarity index 100% rename from tests/testdata/run/custom_inspect_url.js.out rename to tests/specs/run/custom_inspect_url/custom_inspect_url.js.out diff --git a/tests/specs/run/decorators_tc39_proposal/__test__.jsonc b/tests/specs/run/decorators_tc39_proposal/__test__.jsonc new file mode 100644 index 0000000000..8e529695d9 --- /dev/null +++ b/tests/specs/run/decorators_tc39_proposal/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --check decorators/tc39_proposal/main.ts", + "output": "decorators/tc39_proposal/main.out" +} diff --git a/tests/testdata/run/decorators/experimental/deno.json b/tests/specs/run/decorators_tc39_proposal/decorators/experimental/deno.json similarity index 100% rename from tests/testdata/run/decorators/experimental/deno.json rename to tests/specs/run/decorators_tc39_proposal/decorators/experimental/deno.json diff --git a/tests/testdata/run/decorators/experimental/no_check/main.out b/tests/specs/run/decorators_tc39_proposal/decorators/experimental/no_check/main.out similarity index 100% rename from tests/testdata/run/decorators/experimental/no_check/main.out rename to tests/specs/run/decorators_tc39_proposal/decorators/experimental/no_check/main.out diff --git a/tests/testdata/run/decorators/experimental/no_check/main.ts b/tests/specs/run/decorators_tc39_proposal/decorators/experimental/no_check/main.ts similarity index 100% rename from tests/testdata/run/decorators/experimental/no_check/main.ts rename to tests/specs/run/decorators_tc39_proposal/decorators/experimental/no_check/main.ts diff --git a/tests/testdata/run/decorators/experimental/runtime/main.out b/tests/specs/run/decorators_tc39_proposal/decorators/experimental/runtime/main.out similarity index 100% rename from tests/testdata/run/decorators/experimental/runtime/main.out rename to tests/specs/run/decorators_tc39_proposal/decorators/experimental/runtime/main.out diff --git a/tests/testdata/run/decorators/experimental/runtime/main.ts b/tests/specs/run/decorators_tc39_proposal/decorators/experimental/runtime/main.ts similarity index 100% rename from tests/testdata/run/decorators/experimental/runtime/main.ts rename to tests/specs/run/decorators_tc39_proposal/decorators/experimental/runtime/main.ts diff --git a/tests/testdata/run/decorators/experimental/ts/main.out b/tests/specs/run/decorators_tc39_proposal/decorators/experimental/ts/main.out similarity index 100% rename from tests/testdata/run/decorators/experimental/ts/main.out rename to tests/specs/run/decorators_tc39_proposal/decorators/experimental/ts/main.out diff --git a/tests/testdata/run/decorators/experimental/ts/main.ts b/tests/specs/run/decorators_tc39_proposal/decorators/experimental/ts/main.ts similarity index 100% rename from tests/testdata/run/decorators/experimental/ts/main.ts rename to tests/specs/run/decorators_tc39_proposal/decorators/experimental/ts/main.ts diff --git a/tests/testdata/run/decorators/tc39_proposal/main.out b/tests/specs/run/decorators_tc39_proposal/decorators/tc39_proposal/main.out similarity index 100% rename from tests/testdata/run/decorators/tc39_proposal/main.out rename to tests/specs/run/decorators_tc39_proposal/decorators/tc39_proposal/main.out diff --git a/tests/testdata/run/decorators/tc39_proposal/main.ts b/tests/specs/run/decorators_tc39_proposal/decorators/tc39_proposal/main.ts similarity index 100% rename from tests/testdata/run/decorators/tc39_proposal/main.ts rename to tests/specs/run/decorators_tc39_proposal/decorators/tc39_proposal/main.ts diff --git a/tests/specs/run/deno_exit_tampering/__test__.jsonc b/tests/specs/run/deno_exit_tampering/__test__.jsonc new file mode 100644 index 0000000000..1666fbacb3 --- /dev/null +++ b/tests/specs/run/deno_exit_tampering/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --no-check deno_exit_tampering.ts", + "output": "", + "exitCode": 42 +} diff --git a/tests/testdata/run/deno_exit_tampering.ts b/tests/specs/run/deno_exit_tampering/deno_exit_tampering.ts similarity index 100% rename from tests/testdata/run/deno_exit_tampering.ts rename to tests/specs/run/deno_exit_tampering/deno_exit_tampering.ts diff --git a/tests/specs/run/deny_all_permission_args/__test__.jsonc b/tests/specs/run/deny_all_permission_args/__test__.jsonc new file mode 100644 index 0000000000..1d6b286822 --- /dev/null +++ b/tests/specs/run/deny_all_permission_args/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --deny-env --deny-read --deny-write --deny-ffi --deny-run --deny-sys --deny-net deny_all_permission_args.js", + "output": "deny_all_permission_args.out" +} diff --git a/tests/testdata/run/deny_all_permission_args.js b/tests/specs/run/deny_all_permission_args/deny_all_permission_args.js similarity index 100% rename from tests/testdata/run/deny_all_permission_args.js rename to tests/specs/run/deny_all_permission_args/deny_all_permission_args.js diff --git a/tests/testdata/run/deny_all_permission_args.out b/tests/specs/run/deny_all_permission_args/deny_all_permission_args.out similarity index 100% rename from tests/testdata/run/deny_all_permission_args.out rename to tests/specs/run/deny_all_permission_args/deny_all_permission_args.out diff --git a/tests/specs/run/deny_some_permission_args/__test__.jsonc b/tests/specs/run/deny_some_permission_args/__test__.jsonc new file mode 100644 index 0000000000..a55ee57e48 --- /dev/null +++ b/tests/specs/run/deny_some_permission_args/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-env --deny-env=FOO --allow-read --deny-read=/foo --allow-write --deny-write=/foo --allow-ffi --deny-ffi=/foo --allow-run --deny-run=foo --allow-sys --deny-sys=hostname --allow-net --deny-net=127.0.0.1 deny_some_permission_args.js", + "output": "deny_some_permission_args.out" +} diff --git a/tests/testdata/run/deny_some_permission_args.js b/tests/specs/run/deny_some_permission_args/deny_some_permission_args.js similarity index 100% rename from tests/testdata/run/deny_some_permission_args.js rename to tests/specs/run/deny_some_permission_args/deny_some_permission_args.js diff --git a/tests/testdata/run/deny_some_permission_args.out b/tests/specs/run/deny_some_permission_args/deny_some_permission_args.out similarity index 100% rename from tests/testdata/run/deny_some_permission_args.out rename to tests/specs/run/deny_some_permission_args/deny_some_permission_args.out diff --git a/tests/specs/run/dom_exception_formatting/__test__.jsonc b/tests/specs/run/dom_exception_formatting/__test__.jsonc new file mode 100644 index 0000000000..5b1505b57b --- /dev/null +++ b/tests/specs/run/dom_exception_formatting/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run dom_exception_formatting.ts", + "output": "dom_exception_formatting.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/dom_exception_formatting.ts b/tests/specs/run/dom_exception_formatting/dom_exception_formatting.ts similarity index 100% rename from tests/testdata/run/dom_exception_formatting.ts rename to tests/specs/run/dom_exception_formatting/dom_exception_formatting.ts diff --git a/tests/testdata/run/dom_exception_formatting.ts.out b/tests/specs/run/dom_exception_formatting/dom_exception_formatting.ts.out similarity index 100% rename from tests/testdata/run/dom_exception_formatting.ts.out rename to tests/specs/run/dom_exception_formatting/dom_exception_formatting.ts.out diff --git a/tests/specs/run/dynamic_import_already_rejected/__test__.jsonc b/tests/specs/run/dynamic_import_already_rejected/__test__.jsonc new file mode 100644 index 0000000000..0cd1201309 --- /dev/null +++ b/tests/specs/run/dynamic_import_already_rejected/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read dynamic_import_already_rejected/main.ts", + "output": "dynamic_import_already_rejected/main.out" +} diff --git a/tests/testdata/run/dynamic_import_already_rejected/error_001.ts b/tests/specs/run/dynamic_import_already_rejected/dynamic_import_already_rejected/error_001.ts similarity index 100% rename from tests/testdata/run/dynamic_import_already_rejected/error_001.ts rename to tests/specs/run/dynamic_import_already_rejected/dynamic_import_already_rejected/error_001.ts diff --git a/tests/testdata/run/dynamic_import_already_rejected/main.out b/tests/specs/run/dynamic_import_already_rejected/dynamic_import_already_rejected/main.out similarity index 100% rename from tests/testdata/run/dynamic_import_already_rejected/main.out rename to tests/specs/run/dynamic_import_already_rejected/dynamic_import_already_rejected/main.out diff --git a/tests/testdata/run/dynamic_import_already_rejected/main.ts b/tests/specs/run/dynamic_import_already_rejected/dynamic_import_already_rejected/main.ts similarity index 100% rename from tests/testdata/run/dynamic_import_already_rejected/main.ts rename to tests/specs/run/dynamic_import_already_rejected/dynamic_import_already_rejected/main.ts diff --git a/tests/specs/run/dynamic_import_async_error/__test__.jsonc b/tests/specs/run/dynamic_import_async_error/__test__.jsonc new file mode 100644 index 0000000000..9824c34508 --- /dev/null +++ b/tests/specs/run/dynamic_import_async_error/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read dynamic_import_async_error/main.ts", + "output": "dynamic_import_async_error/main.out" +} diff --git a/tests/testdata/run/dynamic_import_async_error/delayed_error.ts b/tests/specs/run/dynamic_import_async_error/dynamic_import_async_error/delayed_error.ts similarity index 100% rename from tests/testdata/run/dynamic_import_async_error/delayed_error.ts rename to tests/specs/run/dynamic_import_async_error/dynamic_import_async_error/delayed_error.ts diff --git a/tests/testdata/run/dynamic_import_async_error/main.out b/tests/specs/run/dynamic_import_async_error/dynamic_import_async_error/main.out similarity index 100% rename from tests/testdata/run/dynamic_import_async_error/main.out rename to tests/specs/run/dynamic_import_async_error/dynamic_import_async_error/main.out diff --git a/tests/testdata/run/dynamic_import_async_error/main.ts b/tests/specs/run/dynamic_import_async_error/dynamic_import_async_error/main.ts similarity index 100% rename from tests/testdata/run/dynamic_import_async_error/main.ts rename to tests/specs/run/dynamic_import_async_error/dynamic_import_async_error/main.ts diff --git a/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/__test__.jsonc b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/__test__.jsonc new file mode 100644 index 0000000000..c4c30ca5d4 --- /dev/null +++ b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --allow-read --allow-net --quiet dynamic_import_concurrent_non_statically_analyzable/main.ts", + "output": "dynamic_import_concurrent_non_statically_analyzable/main.out" +} diff --git a/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/main.out similarity index 100% rename from tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out rename to tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/main.out diff --git a/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/main.ts similarity index 100% rename from tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts rename to tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/main.ts diff --git a/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/mod.ts similarity index 100% rename from tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts rename to tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/mod.ts diff --git a/tests/specs/run/dynamic_import_conditional/__test__.jsonc b/tests/specs/run/dynamic_import_conditional/__test__.jsonc new file mode 100644 index 0000000000..8adff3a16d --- /dev/null +++ b/tests/specs/run/dynamic_import_conditional/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload dynamic_import_conditional.js", + "output": "dynamic_import_conditional.js.out" +} diff --git a/tests/testdata/run/dynamic_import_conditional.js b/tests/specs/run/dynamic_import_conditional/dynamic_import_conditional.js similarity index 100% rename from tests/testdata/run/dynamic_import_conditional.js rename to tests/specs/run/dynamic_import_conditional/dynamic_import_conditional.js diff --git a/tests/testdata/run/dynamic_import_conditional.js.out b/tests/specs/run/dynamic_import_conditional/dynamic_import_conditional.js.out similarity index 100% rename from tests/testdata/run/dynamic_import_conditional.js.out rename to tests/specs/run/dynamic_import_conditional/dynamic_import_conditional.js.out diff --git a/tests/specs/run/dynamic_import_permissions_blob_local/__test__.jsonc b/tests/specs/run/dynamic_import_permissions_blob_local/__test__.jsonc new file mode 100644 index 0000000000..27a747b3a5 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_blob_local/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload --allow-net=localhost:4545 permissions_blob_local.ts", + "output": "permissions_blob_local.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/dynamic_import_permissions_blob_local/permissions_blob_local.ts b/tests/specs/run/dynamic_import_permissions_blob_local/permissions_blob_local.ts new file mode 100644 index 0000000000..865c1777a9 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_blob_local/permissions_blob_local.ts @@ -0,0 +1,6 @@ +// This file doesn't really exist, but it doesn't matter, a "NotCapable" 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/tests/specs/run/dynamic_import_permissions_blob_local/permissions_blob_local.ts.out b/tests/specs/run/dynamic_import_permissions_blob_local/permissions_blob_local.ts.out new file mode 100644 index 0000000000..b7b246ba2b --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_blob_local/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:8 +await import(URL.createObjectURL(blob)); +^ + at async file://[WILDCARD]/permissions_blob_local.ts:6:1 diff --git a/tests/specs/run/dynamic_import_permissions_blob_remote/__test__.jsonc b/tests/specs/run/dynamic_import_permissions_blob_remote/__test__.jsonc new file mode 100644 index 0000000000..f9d66b6b38 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_blob_remote/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload --allow-net=localhost:4545 permissions_blob_remote.ts", + "output": "permissions_blob_remote.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/dynamic_import_permissions_blob_remote/permissions_blob_remote.ts b/tests/specs/run/dynamic_import_permissions_blob_remote/permissions_blob_remote.ts new file mode 100644 index 0000000000..569b1f84c5 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_blob_remote/permissions_blob_remote.ts @@ -0,0 +1,3 @@ +const code = `import "https://example.com/some/file.ts";`; +const blob = new Blob([code]); +await import(URL.createObjectURL(blob)); diff --git a/tests/specs/run/dynamic_import_permissions_blob_remote/permissions_blob_remote.ts.out b/tests/specs/run/dynamic_import_permissions_blob_remote/permissions_blob_remote.ts.out new file mode 100644 index 0000000000..287cf99985 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_blob_remote/permissions_blob_remote.ts.out @@ -0,0 +1,5 @@ +error: Uncaught (in promise) TypeError: Requires import access to "example.com:443", run again with the --allow-import flag + at blob:null/[WILDCARD]:1:8 +await import(URL.createObjectURL(blob)); +^ + at async file:///[WILDCARD]/permissions_blob_remote.ts:3:1 diff --git a/tests/specs/run/dynamic_import_permissions_data_local/__test__.jsonc b/tests/specs/run/dynamic_import_permissions_data_local/__test__.jsonc new file mode 100644 index 0000000000..8f118d8be3 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_data_local/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload --allow-net=localhost:4545 permissions_data_local.ts", + "output": "permissions_data_local.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/dynamic_import_permissions_data_local/permissions_data_local.ts b/tests/specs/run/dynamic_import_permissions_data_local/permissions_data_local.ts new file mode 100644 index 0000000000..01bff7d7a2 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_data_local/permissions_data_local.ts @@ -0,0 +1,5 @@ +// This file doesn't really exist, but it doesn't matter, a "NotCapable" 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/tests/specs/run/dynamic_import_permissions_data_local/permissions_data_local.ts.out b/tests/specs/run/dynamic_import_permissions_data_local/permissions_data_local.ts.out new file mode 100644 index 0000000000..bf8c1948e6 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_data_local/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:8 +await import(`data:application/javascript;base64,${btoa(code)}`); +^ + at async file:///[WILDCARD]/permissions_data_local.ts:5:1 diff --git a/tests/specs/run/dynamic_import_permissions_data_remote/__test__.jsonc b/tests/specs/run/dynamic_import_permissions_data_remote/__test__.jsonc new file mode 100644 index 0000000000..5b2c0c568f --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_data_remote/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload --allow-import=localhost:4545 permissions_data_remote.ts", + "output": "permissions_data_remote.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/dynamic_import_permissions_data_remote/permissions_data_remote.ts b/tests/specs/run/dynamic_import_permissions_data_remote/permissions_data_remote.ts new file mode 100644 index 0000000000..b0a9540c32 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_data_remote/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/tests/specs/run/dynamic_import_permissions_data_remote/permissions_data_remote.ts.out b/tests/specs/run/dynamic_import_permissions_data_remote/permissions_data_remote.ts.out new file mode 100644 index 0000000000..c8de9382a5 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_data_remote/permissions_data_remote.ts.out @@ -0,0 +1,5 @@ +error: Uncaught (in promise) TypeError: Requires import access to "example.com:443", run again with the --allow-import flag + at data:application/javascript;base64,aW1wb3J0ICJodHRwczovL2V4YW1wbGUuY29tL3NvbWUvZmlsZS50cyI7:1:8 +await import(`data:application/javascript;base64,${btoa(code)}`); +^ + at async file:///[WILDCARD]/permissions_data_remote.ts:3:1 diff --git a/tests/specs/run/dynamic_import_permissions_remote_remote/__test__.jsonc b/tests/specs/run/dynamic_import_permissions_remote_remote/__test__.jsonc new file mode 100644 index 0000000000..00fd2a6e4c --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_remote_remote/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload --allow-import=localhost:4545 permissions_remote_remote.ts", + "output": "permissions_remote_remote.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/dynamic_import_permissions_remote_remote/permissions_remote_remote.ts b/tests/specs/run/dynamic_import_permissions_remote_remote/permissions_remote_remote.ts new file mode 100644 index 0000000000..65a2541910 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_remote_remote/permissions_remote_remote.ts @@ -0,0 +1,3 @@ +await import( + "" + "http://localhost:4545/dynamic_import/static_remote.ts" +); diff --git a/tests/specs/run/dynamic_import_permissions_remote_remote/permissions_remote_remote.ts.out b/tests/specs/run/dynamic_import_permissions_remote_remote/permissions_remote_remote.ts.out new file mode 100644 index 0000000000..16fe3bbdd6 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_remote_remote/permissions_remote_remote.ts.out @@ -0,0 +1,5 @@ +error: Uncaught (in promise) TypeError: Requires import access to "example.com:443", run again with the --allow-import flag + at http://localhost:4545/dynamic_import/static_remote.ts:2:8 +await import( +^ + at async file:///[WILDCARD]/permissions_remote_remote.ts:1:1 diff --git a/tests/specs/run/dynamic_import_permissions_remote_remote/static_remote.ts b/tests/specs/run/dynamic_import_permissions_remote_remote/static_remote.ts new file mode 100644 index 0000000000..2d6e820fd6 --- /dev/null +++ b/tests/specs/run/dynamic_import_permissions_remote_remote/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/tests/specs/run/dynamic_import_static_analysis_no_permissions/__test__.jsonc b/tests/specs/run/dynamic_import_static_analysis_no_permissions/__test__.jsonc new file mode 100644 index 0000000000..9379748691 --- /dev/null +++ b/tests/specs/run/dynamic_import_static_analysis_no_permissions/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --no-prompt static_analysis_no_permissions.ts", + "output": "static_analysis_no_permissions.ts.out" +} diff --git a/tests/testdata/run/empty.ts b/tests/specs/run/dynamic_import_static_analysis_no_permissions/empty_1.ts similarity index 100% rename from tests/testdata/run/empty.ts rename to tests/specs/run/dynamic_import_static_analysis_no_permissions/empty_1.ts diff --git a/tests/testdata/run/wasm_shared.out b/tests/specs/run/dynamic_import_static_analysis_no_permissions/empty_2.ts similarity index 100% rename from tests/testdata/run/wasm_shared.out rename to tests/specs/run/dynamic_import_static_analysis_no_permissions/empty_2.ts diff --git a/tests/specs/run/dynamic_import_static_analysis_no_permissions/static_analysis_no_permissions.ts b/tests/specs/run/dynamic_import_static_analysis_no_permissions/static_analysis_no_permissions.ts new file mode 100644 index 0000000000..de75ba87b6 --- /dev/null +++ b/tests/specs/run/dynamic_import_static_analysis_no_permissions/static_analysis_no_permissions.ts @@ -0,0 +1,13 @@ +try { + await import("./empty_1.ts"); + console.log("✅ Succeeded importing statically analyzable specifier"); +} catch { + console.log("⌠Failed importing statically analyzable specifier"); +} + +try { + await import("" + "./empty_2.ts"); + console.log("⌠Succeeded importing non-statically analyzable specifier"); +} catch { + console.log("✅ Failed importing non-statically analyzable specifier"); +} diff --git a/tests/specs/run/dynamic_import_static_analysis_no_permissions/static_analysis_no_permissions.ts.out b/tests/specs/run/dynamic_import_static_analysis_no_permissions/static_analysis_no_permissions.ts.out new file mode 100644 index 0000000000..ba9249ab0b --- /dev/null +++ b/tests/specs/run/dynamic_import_static_analysis_no_permissions/static_analysis_no_permissions.ts.out @@ -0,0 +1,2 @@ +✅ Succeeded importing statically analyzable specifier +✅ Failed importing non-statically analyzable specifier diff --git a/tests/specs/run/dynamic_import_syntax_error/__test__.jsonc b/tests/specs/run/dynamic_import_syntax_error/__test__.jsonc new file mode 100644 index 0000000000..1971d3184c --- /dev/null +++ b/tests/specs/run/dynamic_import_syntax_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run -A dynamic_import_syntax_error.js", + "output": "dynamic_import_syntax_error.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/dynamic_import_syntax_error.js b/tests/specs/run/dynamic_import_syntax_error/dynamic_import_syntax_error.js similarity index 100% rename from tests/testdata/run/dynamic_import_syntax_error.js rename to tests/specs/run/dynamic_import_syntax_error/dynamic_import_syntax_error.js diff --git a/tests/testdata/run/dynamic_import_syntax_error.js.out b/tests/specs/run/dynamic_import_syntax_error/dynamic_import_syntax_error.js.out similarity index 100% rename from tests/testdata/run/dynamic_import_syntax_error.js.out rename to tests/specs/run/dynamic_import_syntax_error/dynamic_import_syntax_error.js.out diff --git a/tests/specs/run/dynamic_import_syntax_error/dynamic_import_syntax_error_import.js b/tests/specs/run/dynamic_import_syntax_error/dynamic_import_syntax_error_import.js new file mode 100644 index 0000000000..bcf0756385 --- /dev/null +++ b/tests/specs/run/dynamic_import_syntax_error/dynamic_import_syntax_error_import.js @@ -0,0 +1,5 @@ +// deno-lint-ignore-file +function foo() { + await Promise.resolve(); +} +foo(); diff --git a/tests/specs/run/empty_typescript/__test__.jsonc b/tests/specs/run/empty_typescript/__test__.jsonc new file mode 100644 index 0000000000..8090c50f68 --- /dev/null +++ b/tests/specs/run/empty_typescript/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --check empty.ts", + "output": "Check file:[WILDCARD]/empty.ts\n" +} diff --git a/tests/testdata/run/worker_close_race.js.out b/tests/specs/run/empty_typescript/empty.ts similarity index 100% rename from tests/testdata/run/worker_close_race.js.out rename to tests/specs/run/empty_typescript/empty.ts diff --git a/tests/specs/run/error_001/__test__.jsonc b/tests/specs/run/error_001/__test__.jsonc new file mode 100644 index 0000000000..7b9158e4f5 --- /dev/null +++ b/tests/specs/run/error_001/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload error_001.ts", + "output": "error_001.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/error_001/error_001.ts b/tests/specs/run/error_001/error_001.ts new file mode 100644 index 0000000000..b01068bc01 --- /dev/null +++ b/tests/specs/run/error_001/error_001.ts @@ -0,0 +1,9 @@ +function foo(): never { + throw Error("bad"); +} + +function bar() { + foo(); +} + +bar(); diff --git a/tests/testdata/run/error_001.ts.out b/tests/specs/run/error_001/error_001.ts.out similarity index 100% rename from tests/testdata/run/error_001.ts.out rename to tests/specs/run/error_001/error_001.ts.out diff --git a/tests/specs/run/error_002/__test__.jsonc b/tests/specs/run/error_002/__test__.jsonc new file mode 100644 index 0000000000..3a68a86751 --- /dev/null +++ b/tests/specs/run/error_002/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload error_002.ts", + "output": "error_002.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/error_002/error_002.ts b/tests/specs/run/error_002/error_002.ts new file mode 100644 index 0000000000..ac712fbf71 --- /dev/null +++ b/tests/specs/run/error_002/error_002.ts @@ -0,0 +1,7 @@ +import { throwsError } from "./mod1.ts"; + +function foo() { + throwsError(); +} + +foo(); diff --git a/tests/testdata/run/error_002.ts.out b/tests/specs/run/error_002/error_002.ts.out similarity index 78% rename from tests/testdata/run/error_002.ts.out rename to tests/specs/run/error_002/error_002.ts.out index 9fec5d968a..1051e7360c 100644 --- a/tests/testdata/run/error_002.ts.out +++ b/tests/specs/run/error_002/error_002.ts.out @@ -1,6 +1,6 @@ [WILDCARD]error: Uncaught (in promise) Error: exception from mod1 throw Error("exception from mod1"); ^ - at throwsError ([WILDCARD]/subdir/mod1.ts:16:9) + at throwsError ([WILDCARD]/mod1.ts:16:9) at foo ([WILDCARD]/error_002.ts:4:3) at [WILDCARD]/error_002.ts:7:1 diff --git a/tests/specs/run/error_002/mod1.ts b/tests/specs/run/error_002/mod1.ts new file mode 100644 index 0000000000..5e58f432ed --- /dev/null +++ b/tests/specs/run/error_002/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/tests/specs/run/error_002/print_hello.ts b/tests/specs/run/error_002/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/error_002/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/error_002/subdir2/mod2.ts b/tests/specs/run/error_002/subdir2/mod2.ts new file mode 100644 index 0000000000..9071d0aeb4 --- /dev/null +++ b/tests/specs/run/error_002/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/tests/specs/run/error_003_typescript/__test__.jsonc b/tests/specs/run/error_003_typescript/__test__.jsonc new file mode 100644 index 0000000000..f7ef69b268 --- /dev/null +++ b/tests/specs/run/error_003_typescript/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --check error_003_typescript.ts", + "output": "error_003_typescript.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_003_typescript.ts b/tests/specs/run/error_003_typescript/error_003_typescript.ts similarity index 100% rename from tests/testdata/run/error_003_typescript.ts rename to tests/specs/run/error_003_typescript/error_003_typescript.ts diff --git a/tests/testdata/run/error_003_typescript.ts.out b/tests/specs/run/error_003_typescript/error_003_typescript.ts.out similarity index 100% rename from tests/testdata/run/error_003_typescript.ts.out rename to tests/specs/run/error_003_typescript/error_003_typescript.ts.out diff --git a/tests/specs/run/error_003_typescript2/__test__.jsonc b/tests/specs/run/error_003_typescript2/__test__.jsonc new file mode 100644 index 0000000000..ceeb6e7d94 --- /dev/null +++ b/tests/specs/run/error_003_typescript2/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --check error_003_typescript.ts", + "output": "error_003_typescript.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/error_003_typescript2/error_003_typescript.ts b/tests/specs/run/error_003_typescript2/error_003_typescript.ts new file mode 100644 index 0000000000..e1f882123c --- /dev/null +++ b/tests/specs/run/error_003_typescript2/error_003_typescript.ts @@ -0,0 +1,20 @@ +// deno-lint-ignore-file +let x = { + a: { + b: { + c() { + return { d: "hello" }; + }, + }, + }, +}; +let y = { + a: { + b: { + c() { + return { d: 1234 }; + }, + }, + }, +}; +x = y; diff --git a/tests/specs/run/error_003_typescript2/error_003_typescript.ts.out b/tests/specs/run/error_003_typescript2/error_003_typescript.ts.out new file mode 100644 index 0000000000..bbb2ec4708 --- /dev/null +++ b/tests/specs/run/error_003_typescript2/error_003_typescript.ts.out @@ -0,0 +1,7 @@ +[WILDCARD] +error: TS2322 [ERROR]: Type '{ a: { b: { c(): { d: number; }; }; }; }' is not assignable to type '{ a: { b: { c(): { d: string; }; }; }; }'. + The types of 'a.b.c().d' are incompatible between these types. + Type 'number' is not assignable to type 'string'. +x = y; +^ + at [WILDCARD]/error_003_typescript.ts:20:1 diff --git a/tests/specs/run/error_004_missing_module/__test__.jsonc b/tests/specs/run/error_004_missing_module/__test__.jsonc new file mode 100644 index 0000000000..824b9d8c9c --- /dev/null +++ b/tests/specs/run/error_004_missing_module/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload error_004_missing_module.ts", + "output": "error_004_missing_module.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_004_missing_module.ts b/tests/specs/run/error_004_missing_module/error_004_missing_module.ts similarity index 100% rename from tests/testdata/run/error_004_missing_module.ts rename to tests/specs/run/error_004_missing_module/error_004_missing_module.ts diff --git a/tests/testdata/run/error_004_missing_module.ts.out b/tests/specs/run/error_004_missing_module/error_004_missing_module.ts.out similarity index 100% rename from tests/testdata/run/error_004_missing_module.ts.out rename to tests/specs/run/error_004_missing_module/error_004_missing_module.ts.out diff --git a/tests/specs/run/error_005_missing_dynamic_import/__test__.jsonc b/tests/specs/run/error_005_missing_dynamic_import/__test__.jsonc new file mode 100644 index 0000000000..b9f6a1b747 --- /dev/null +++ b/tests/specs/run/error_005_missing_dynamic_import/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --allow-read --quiet error_005_missing_dynamic_import.ts", + "output": "error_005_missing_dynamic_import.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_005_missing_dynamic_import.ts b/tests/specs/run/error_005_missing_dynamic_import/error_005_missing_dynamic_import.ts similarity index 100% rename from tests/testdata/run/error_005_missing_dynamic_import.ts rename to tests/specs/run/error_005_missing_dynamic_import/error_005_missing_dynamic_import.ts diff --git a/tests/testdata/run/error_005_missing_dynamic_import.ts.out b/tests/specs/run/error_005_missing_dynamic_import/error_005_missing_dynamic_import.ts.out similarity index 100% rename from tests/testdata/run/error_005_missing_dynamic_import.ts.out rename to tests/specs/run/error_005_missing_dynamic_import/error_005_missing_dynamic_import.ts.out diff --git a/tests/specs/run/error_006_import_ext_failure/__test__.jsonc b/tests/specs/run/error_006_import_ext_failure/__test__.jsonc new file mode 100644 index 0000000000..0e70bdcaf6 --- /dev/null +++ b/tests/specs/run/error_006_import_ext_failure/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload error_006_import_ext_failure.ts", + "output": "error_006_import_ext_failure.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_006_import_ext_failure.ts b/tests/specs/run/error_006_import_ext_failure/error_006_import_ext_failure.ts similarity index 100% rename from tests/testdata/run/error_006_import_ext_failure.ts rename to tests/specs/run/error_006_import_ext_failure/error_006_import_ext_failure.ts diff --git a/tests/testdata/run/error_006_import_ext_failure.ts.out b/tests/specs/run/error_006_import_ext_failure/error_006_import_ext_failure.ts.out similarity index 100% rename from tests/testdata/run/error_006_import_ext_failure.ts.out rename to tests/specs/run/error_006_import_ext_failure/error_006_import_ext_failure.ts.out diff --git a/tests/specs/run/error_007_any/__test__.jsonc b/tests/specs/run/error_007_any/__test__.jsonc new file mode 100644 index 0000000000..8a1c0d27e6 --- /dev/null +++ b/tests/specs/run/error_007_any/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload error_007_any.ts", + "output": "error_007_any.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_007_any.ts b/tests/specs/run/error_007_any/error_007_any.ts similarity index 100% rename from tests/testdata/run/error_007_any.ts rename to tests/specs/run/error_007_any/error_007_any.ts diff --git a/tests/testdata/run/error_007_any.ts.out b/tests/specs/run/error_007_any/error_007_any.ts.out similarity index 100% rename from tests/testdata/run/error_007_any.ts.out rename to tests/specs/run/error_007_any/error_007_any.ts.out diff --git a/tests/specs/run/error_008_checkjs/__test__.jsonc b/tests/specs/run/error_008_checkjs/__test__.jsonc new file mode 100644 index 0000000000..f735be953c --- /dev/null +++ b/tests/specs/run/error_008_checkjs/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload error_008_checkjs.js", + "output": "error_008_checkjs.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_008_checkjs.js b/tests/specs/run/error_008_checkjs/error_008_checkjs.js similarity index 100% rename from tests/testdata/run/error_008_checkjs.js rename to tests/specs/run/error_008_checkjs/error_008_checkjs.js diff --git a/tests/testdata/run/error_008_checkjs.js.out b/tests/specs/run/error_008_checkjs/error_008_checkjs.js.out similarity index 100% rename from tests/testdata/run/error_008_checkjs.js.out rename to tests/specs/run/error_008_checkjs/error_008_checkjs.js.out diff --git a/tests/specs/run/error_009_extensions_error/__test__.jsonc b/tests/specs/run/error_009_extensions_error/__test__.jsonc new file mode 100644 index 0000000000..740d5119f5 --- /dev/null +++ b/tests/specs/run/error_009_extensions_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_009_extensions_error.js", + "output": "error_009_extensions_error.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_009_extensions_error.js b/tests/specs/run/error_009_extensions_error/error_009_extensions_error.js similarity index 100% rename from tests/testdata/run/error_009_extensions_error.js rename to tests/specs/run/error_009_extensions_error/error_009_extensions_error.js diff --git a/tests/testdata/run/error_009_extensions_error.js.out b/tests/specs/run/error_009_extensions_error/error_009_extensions_error.js.out similarity index 100% rename from tests/testdata/run/error_009_extensions_error.js.out rename to tests/specs/run/error_009_extensions_error/error_009_extensions_error.js.out diff --git a/tests/specs/run/error_011_bad_module_specifier/__test__.jsonc b/tests/specs/run/error_011_bad_module_specifier/__test__.jsonc new file mode 100644 index 0000000000..5ca5146bec --- /dev/null +++ b/tests/specs/run/error_011_bad_module_specifier/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload error_011_bad_module_specifier.ts", + "output": "error_011_bad_module_specifier.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_011_bad_module_specifier.ts b/tests/specs/run/error_011_bad_module_specifier/error_011_bad_module_specifier.ts similarity index 100% rename from tests/testdata/run/error_011_bad_module_specifier.ts rename to tests/specs/run/error_011_bad_module_specifier/error_011_bad_module_specifier.ts diff --git a/tests/testdata/run/error_011_bad_module_specifier.ts.out b/tests/specs/run/error_011_bad_module_specifier/error_011_bad_module_specifier.ts.out similarity index 100% rename from tests/testdata/run/error_011_bad_module_specifier.ts.out rename to tests/specs/run/error_011_bad_module_specifier/error_011_bad_module_specifier.ts.out diff --git a/tests/specs/run/error_012_bad_dynamic_import_specifier/__test__.jsonc b/tests/specs/run/error_012_bad_dynamic_import_specifier/__test__.jsonc new file mode 100644 index 0000000000..9344f730dc --- /dev/null +++ b/tests/specs/run/error_012_bad_dynamic_import_specifier/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --check error_012_bad_dynamic_import_specifier.ts", + "output": "error_012_bad_dynamic_import_specifier.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts b/tests/specs/run/error_012_bad_dynamic_import_specifier/error_012_bad_dynamic_import_specifier.ts similarity index 100% rename from tests/testdata/run/error_012_bad_dynamic_import_specifier.ts rename to tests/specs/run/error_012_bad_dynamic_import_specifier/error_012_bad_dynamic_import_specifier.ts diff --git a/tests/testdata/run/error_012_bad_dynamic_import_specifier.ts.out b/tests/specs/run/error_012_bad_dynamic_import_specifier/error_012_bad_dynamic_import_specifier.ts.out similarity index 100% rename from tests/testdata/run/error_012_bad_dynamic_import_specifier.ts.out rename to tests/specs/run/error_012_bad_dynamic_import_specifier/error_012_bad_dynamic_import_specifier.ts.out diff --git a/tests/specs/run/error_014_catch_dynamic_import_error/__test__.jsonc b/tests/specs/run/error_014_catch_dynamic_import_error/__test__.jsonc new file mode 100644 index 0000000000..94957dc659 --- /dev/null +++ b/tests/specs/run/error_014_catch_dynamic_import_error/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --allow-read error_014_catch_dynamic_import_error.js", + "output": "error_014_catch_dynamic_import_error.js.out" +} diff --git a/tests/testdata/run/error_014_catch_dynamic_import_error.js b/tests/specs/run/error_014_catch_dynamic_import_error/error_014_catch_dynamic_import_error.js similarity index 79% rename from tests/testdata/run/error_014_catch_dynamic_import_error.js rename to tests/specs/run/error_014_catch_dynamic_import_error/error_014_catch_dynamic_import_error.js index c58e54dcbb..05b021d15d 100644 --- a/tests/testdata/run/error_014_catch_dynamic_import_error.js +++ b/tests/specs/run/error_014_catch_dynamic_import_error/error_014_catch_dynamic_import_error.js @@ -7,21 +7,21 @@ } try { - await import("../subdir/indirect_import_error.js"); + await import("./indirect_import_error.js"); } catch (err) { console.log("Caught indirect direct dynamic import error."); console.log(err); } try { - await import("../subdir/throws.js"); + await import("./throws.js"); } catch (err) { console.log("Caught error thrown by dynamically imported module."); console.log(err); } try { - await import("../subdir/indirect_throws.js"); + await import("./indirect_throws.js"); } catch (err) { console.log( "Caught error thrown indirectly by dynamically imported module.", diff --git a/tests/testdata/run/error_014_catch_dynamic_import_error.js.out b/tests/specs/run/error_014_catch_dynamic_import_error/error_014_catch_dynamic_import_error.js.out similarity index 83% rename from tests/testdata/run/error_014_catch_dynamic_import_error.js.out rename to tests/specs/run/error_014_catch_dynamic_import_error/error_014_catch_dynamic_import_error.js.out index 868c971940..71feaa55bf 100644 --- a/tests/testdata/run/error_014_catch_dynamic_import_error.js.out +++ b/tests/specs/run/error_014_catch_dynamic_import_error/error_014_catch_dynamic_import_error.js.out @@ -7,13 +7,13 @@ TypeError: Relative import path "does not exist" not prefixed with / or ./ or .. } Caught indirect direct dynamic import error. TypeError: Relative import path "does not exist either" not prefixed with / or ./ or ../ - at [WILDCARD]/subdir/indirect_import_error.js:1:15 + at [WILDCARD]/indirect_import_error.js:1:15 at async [WILDCARD]/error_014_catch_dynamic_import_error.js:10:5 { code: "ERR_MODULE_NOT_FOUND" } Caught error thrown by dynamically imported module. Error: An error - at [WILDCARD]/subdir/throws.js:6:7 + at [WILDCARD]/throws.js:6:7 Caught error thrown indirectly by dynamically imported module. Error: An error - at [WILDCARD]/subdir/throws.js:6:7 + at [WILDCARD]/throws.js:6:7 diff --git a/tests/specs/run/error_014_catch_dynamic_import_error/indirect_import_error.js b/tests/specs/run/error_014_catch_dynamic_import_error/indirect_import_error.js new file mode 100644 index 0000000000..84011d2913 --- /dev/null +++ b/tests/specs/run/error_014_catch_dynamic_import_error/indirect_import_error.js @@ -0,0 +1 @@ +export * from "does not exist either"; diff --git a/tests/specs/run/error_014_catch_dynamic_import_error/indirect_throws.js b/tests/specs/run/error_014_catch_dynamic_import_error/indirect_throws.js new file mode 100644 index 0000000000..e1810a66cb --- /dev/null +++ b/tests/specs/run/error_014_catch_dynamic_import_error/indirect_throws.js @@ -0,0 +1 @@ +export * from "./throws.js"; diff --git a/tests/specs/run/error_014_catch_dynamic_import_error/throws.js b/tests/specs/run/error_014_catch_dynamic_import_error/throws.js new file mode 100644 index 0000000000..abdf291568 --- /dev/null +++ b/tests/specs/run/error_014_catch_dynamic_import_error/throws.js @@ -0,0 +1,6 @@ +// deno-lint-ignore-file +export function boo() { + console.log("Boo!"); +} + +throw new Error("An error"); diff --git a/tests/specs/run/error_015_dynamic_import_permissions/__test__.jsonc b/tests/specs/run/error_015_dynamic_import_permissions/__test__.jsonc new file mode 100644 index 0000000000..3ab25f1a52 --- /dev/null +++ b/tests/specs/run/error_015_dynamic_import_permissions/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --quiet error_015_dynamic_import_permissions.js", + "output": "error_015_dynamic_import_permissions.out", + "exitCode": 1 +} diff --git a/tests/specs/run/error_015_dynamic_import_permissions/error_015_dynamic_import_permissions.js b/tests/specs/run/error_015_dynamic_import_permissions/error_015_dynamic_import_permissions.js new file mode 100644 index 0000000000..6e7daf5d01 --- /dev/null +++ b/tests/specs/run/error_015_dynamic_import_permissions/error_015_dynamic_import_permissions.js @@ -0,0 +1,3 @@ +(async () => { + await import("" + "http://example.com/mod4.js"); +})(); diff --git a/tests/testdata/run/error_015_dynamic_import_permissions.out b/tests/specs/run/error_015_dynamic_import_permissions/error_015_dynamic_import_permissions.out similarity index 77% rename from tests/testdata/run/error_015_dynamic_import_permissions.out rename to tests/specs/run/error_015_dynamic_import_permissions/error_015_dynamic_import_permissions.out index 15c26b4251..8ef2f6f1e4 100644 --- a/tests/testdata/run/error_015_dynamic_import_permissions.out +++ b/tests/specs/run/error_015_dynamic_import_permissions/error_015_dynamic_import_permissions.out @@ -1,4 +1,4 @@ error: Uncaught (in promise) TypeError: Requires import access to "example.com:80", run again with the --allow-import flag - await import("" + "http://example.com/subdir/mod4.js"); + await import("" + "http://example.com/mod4.js"); ^ at async file://[WILDCARD]/error_015_dynamic_import_permissions.js:2:3 diff --git a/tests/specs/run/error_015_dynamic_import_permissions/mod4.js b/tests/specs/run/error_015_dynamic_import_permissions/mod4.js new file mode 100644 index 0000000000..71332dbc42 --- /dev/null +++ b/tests/specs/run/error_015_dynamic_import_permissions/mod4.js @@ -0,0 +1 @@ +export const isMod4 = true; diff --git a/tests/specs/run/error_017_hide_long_source_ts/__test__.jsonc b/tests/specs/run/error_017_hide_long_source_ts/__test__.jsonc new file mode 100644 index 0000000000..382d560391 --- /dev/null +++ b/tests/specs/run/error_017_hide_long_source_ts/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --check error_017_hide_long_source_ts.ts", + "output": "error_017_hide_long_source_ts.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_017_hide_long_source_ts.ts b/tests/specs/run/error_017_hide_long_source_ts/error_017_hide_long_source_ts.ts similarity index 100% rename from tests/testdata/run/error_017_hide_long_source_ts.ts rename to tests/specs/run/error_017_hide_long_source_ts/error_017_hide_long_source_ts.ts diff --git a/tests/testdata/run/error_017_hide_long_source_ts.ts.out b/tests/specs/run/error_017_hide_long_source_ts/error_017_hide_long_source_ts.ts.out similarity index 100% rename from tests/testdata/run/error_017_hide_long_source_ts.ts.out rename to tests/specs/run/error_017_hide_long_source_ts/error_017_hide_long_source_ts.ts.out diff --git a/tests/specs/run/error_018_hide_long_source_js/__test__.jsonc b/tests/specs/run/error_018_hide_long_source_js/__test__.jsonc new file mode 100644 index 0000000000..4e91a820df --- /dev/null +++ b/tests/specs/run/error_018_hide_long_source_js/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_018_hide_long_source_js.js", + "output": "error_018_hide_long_source_js.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_018_hide_long_source_js.js b/tests/specs/run/error_018_hide_long_source_js/error_018_hide_long_source_js.js similarity index 100% rename from tests/testdata/run/error_018_hide_long_source_js.js rename to tests/specs/run/error_018_hide_long_source_js/error_018_hide_long_source_js.js diff --git a/tests/testdata/run/error_018_hide_long_source_js.js.out b/tests/specs/run/error_018_hide_long_source_js/error_018_hide_long_source_js.js.out similarity index 100% rename from tests/testdata/run/error_018_hide_long_source_js.js.out rename to tests/specs/run/error_018_hide_long_source_js/error_018_hide_long_source_js.js.out diff --git a/tests/specs/run/error_019_stack_function/__test__.jsonc b/tests/specs/run/error_019_stack_function/__test__.jsonc new file mode 100644 index 0000000000..5e272ee492 --- /dev/null +++ b/tests/specs/run/error_019_stack_function/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_019_stack_function.ts", + "output": "error_019_stack_function.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_019_stack_function.ts b/tests/specs/run/error_019_stack_function/error_019_stack_function.ts similarity index 100% rename from tests/testdata/run/error_019_stack_function.ts rename to tests/specs/run/error_019_stack_function/error_019_stack_function.ts diff --git a/tests/testdata/run/error_019_stack_function.ts.out b/tests/specs/run/error_019_stack_function/error_019_stack_function.ts.out similarity index 100% rename from tests/testdata/run/error_019_stack_function.ts.out rename to tests/specs/run/error_019_stack_function/error_019_stack_function.ts.out diff --git a/tests/specs/run/error_020_stack_constructor/__test__.jsonc b/tests/specs/run/error_020_stack_constructor/__test__.jsonc new file mode 100644 index 0000000000..2dd574565e --- /dev/null +++ b/tests/specs/run/error_020_stack_constructor/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_020_stack_constructor.ts", + "output": "error_020_stack_constructor.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_020_stack_constructor.ts b/tests/specs/run/error_020_stack_constructor/error_020_stack_constructor.ts similarity index 100% rename from tests/testdata/run/error_020_stack_constructor.ts rename to tests/specs/run/error_020_stack_constructor/error_020_stack_constructor.ts diff --git a/tests/testdata/run/error_020_stack_constructor.ts.out b/tests/specs/run/error_020_stack_constructor/error_020_stack_constructor.ts.out similarity index 100% rename from tests/testdata/run/error_020_stack_constructor.ts.out rename to tests/specs/run/error_020_stack_constructor/error_020_stack_constructor.ts.out diff --git a/tests/specs/run/error_021_stack_method/__test__.jsonc b/tests/specs/run/error_021_stack_method/__test__.jsonc new file mode 100644 index 0000000000..db78cac094 --- /dev/null +++ b/tests/specs/run/error_021_stack_method/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_021_stack_method.ts", + "output": "error_021_stack_method.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_021_stack_method.ts b/tests/specs/run/error_021_stack_method/error_021_stack_method.ts similarity index 100% rename from tests/testdata/run/error_021_stack_method.ts rename to tests/specs/run/error_021_stack_method/error_021_stack_method.ts diff --git a/tests/testdata/run/error_021_stack_method.ts.out b/tests/specs/run/error_021_stack_method/error_021_stack_method.ts.out similarity index 100% rename from tests/testdata/run/error_021_stack_method.ts.out rename to tests/specs/run/error_021_stack_method/error_021_stack_method.ts.out diff --git a/tests/specs/run/error_022_stack_custom_error/__test__.jsonc b/tests/specs/run/error_022_stack_custom_error/__test__.jsonc new file mode 100644 index 0000000000..f315058338 --- /dev/null +++ b/tests/specs/run/error_022_stack_custom_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_022_stack_custom_error.ts", + "output": "error_022_stack_custom_error.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_022_stack_custom_error.ts b/tests/specs/run/error_022_stack_custom_error/error_022_stack_custom_error.ts similarity index 100% rename from tests/testdata/run/error_022_stack_custom_error.ts rename to tests/specs/run/error_022_stack_custom_error/error_022_stack_custom_error.ts diff --git a/tests/testdata/run/error_022_stack_custom_error.ts.out b/tests/specs/run/error_022_stack_custom_error/error_022_stack_custom_error.ts.out similarity index 100% rename from tests/testdata/run/error_022_stack_custom_error.ts.out rename to tests/specs/run/error_022_stack_custom_error/error_022_stack_custom_error.ts.out diff --git a/tests/specs/run/error_023_stack_async/__test__.jsonc b/tests/specs/run/error_023_stack_async/__test__.jsonc new file mode 100644 index 0000000000..76cdff013d --- /dev/null +++ b/tests/specs/run/error_023_stack_async/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_023_stack_async.ts", + "output": "error_023_stack_async.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_023_stack_async.ts b/tests/specs/run/error_023_stack_async/error_023_stack_async.ts similarity index 100% rename from tests/testdata/run/error_023_stack_async.ts rename to tests/specs/run/error_023_stack_async/error_023_stack_async.ts diff --git a/tests/testdata/run/error_023_stack_async.ts.out b/tests/specs/run/error_023_stack_async/error_023_stack_async.ts.out similarity index 100% rename from tests/testdata/run/error_023_stack_async.ts.out rename to tests/specs/run/error_023_stack_async/error_023_stack_async.ts.out diff --git a/tests/specs/run/error_024_stack_promise_all/__test__.jsonc b/tests/specs/run/error_024_stack_promise_all/__test__.jsonc new file mode 100644 index 0000000000..7c733f9711 --- /dev/null +++ b/tests/specs/run/error_024_stack_promise_all/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_024_stack_promise_all.ts", + "output": "error_024_stack_promise_all.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_024_stack_promise_all.ts b/tests/specs/run/error_024_stack_promise_all/error_024_stack_promise_all.ts similarity index 100% rename from tests/testdata/run/error_024_stack_promise_all.ts rename to tests/specs/run/error_024_stack_promise_all/error_024_stack_promise_all.ts diff --git a/tests/testdata/run/error_024_stack_promise_all.ts.out b/tests/specs/run/error_024_stack_promise_all/error_024_stack_promise_all.ts.out similarity index 100% rename from tests/testdata/run/error_024_stack_promise_all.ts.out rename to tests/specs/run/error_024_stack_promise_all/error_024_stack_promise_all.ts.out diff --git a/tests/specs/run/error_025_tab_indent/__test__.jsonc b/tests/specs/run/error_025_tab_indent/__test__.jsonc new file mode 100644 index 0000000000..23c49458e5 --- /dev/null +++ b/tests/specs/run/error_025_tab_indent/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_025_tab_indent", + "output": "error_025_tab_indent.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_025_tab_indent b/tests/specs/run/error_025_tab_indent/error_025_tab_indent similarity index 100% rename from tests/testdata/run/error_025_tab_indent rename to tests/specs/run/error_025_tab_indent/error_025_tab_indent diff --git a/tests/testdata/run/error_025_tab_indent.out b/tests/specs/run/error_025_tab_indent/error_025_tab_indent.out similarity index 100% rename from tests/testdata/run/error_025_tab_indent.out rename to tests/specs/run/error_025_tab_indent/error_025_tab_indent.out diff --git a/tests/specs/run/error_cause/__test__.jsonc b/tests/specs/run/error_cause/__test__.jsonc new file mode 100644 index 0000000000..ccbf71dea7 --- /dev/null +++ b/tests/specs/run/error_cause/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_cause.ts", + "output": "error_cause.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_cause.ts b/tests/specs/run/error_cause/error_cause.ts similarity index 100% rename from tests/testdata/run/error_cause.ts rename to tests/specs/run/error_cause/error_cause.ts diff --git a/tests/testdata/run/error_cause.ts.out b/tests/specs/run/error_cause/error_cause.ts.out similarity index 100% rename from tests/testdata/run/error_cause.ts.out rename to tests/specs/run/error_cause/error_cause.ts.out diff --git a/tests/specs/run/error_cause_recursive/__test__.jsonc b/tests/specs/run/error_cause_recursive/__test__.jsonc new file mode 100644 index 0000000000..71c4cf3cc1 --- /dev/null +++ b/tests/specs/run/error_cause_recursive/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_cause_recursive.ts", + "output": "error_cause_recursive.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_cause_recursive.ts b/tests/specs/run/error_cause_recursive/error_cause_recursive.ts similarity index 100% rename from tests/testdata/run/error_cause_recursive.ts rename to tests/specs/run/error_cause_recursive/error_cause_recursive.ts diff --git a/tests/testdata/run/error_cause_recursive.ts.out b/tests/specs/run/error_cause_recursive/error_cause_recursive.ts.out similarity index 100% rename from tests/testdata/run/error_cause_recursive.ts.out rename to tests/specs/run/error_cause_recursive/error_cause_recursive.ts.out diff --git a/tests/specs/run/error_cause_recursive_aggregate/__test__.jsonc b/tests/specs/run/error_cause_recursive_aggregate/__test__.jsonc new file mode 100644 index 0000000000..2aabee0ecb --- /dev/null +++ b/tests/specs/run/error_cause_recursive_aggregate/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_cause_recursive_aggregate.ts", + "output": "error_cause_recursive_aggregate.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/error_cause_recursive_aggregate.ts b/tests/specs/run/error_cause_recursive_aggregate/error_cause_recursive_aggregate.ts similarity index 100% rename from tests/testdata/error_cause_recursive_aggregate.ts rename to tests/specs/run/error_cause_recursive_aggregate/error_cause_recursive_aggregate.ts diff --git a/tests/testdata/error_cause_recursive_aggregate.ts.out b/tests/specs/run/error_cause_recursive_aggregate/error_cause_recursive_aggregate.ts.out similarity index 100% rename from tests/testdata/error_cause_recursive_aggregate.ts.out rename to tests/specs/run/error_cause_recursive_aggregate/error_cause_recursive_aggregate.ts.out diff --git a/tests/specs/run/error_cause_recursive_tail/__test__.jsonc b/tests/specs/run/error_cause_recursive_tail/__test__.jsonc new file mode 100644 index 0000000000..249ccac483 --- /dev/null +++ b/tests/specs/run/error_cause_recursive_tail/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_cause_recursive_tail.ts", + "output": "error_cause_recursive_tail.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/error_cause_recursive_tail.ts b/tests/specs/run/error_cause_recursive_tail/error_cause_recursive_tail.ts similarity index 100% rename from tests/testdata/error_cause_recursive_tail.ts rename to tests/specs/run/error_cause_recursive_tail/error_cause_recursive_tail.ts diff --git a/tests/testdata/error_cause_recursive_tail.ts.out b/tests/specs/run/error_cause_recursive_tail/error_cause_recursive_tail.ts.out similarity index 100% rename from tests/testdata/error_cause_recursive_tail.ts.out rename to tests/specs/run/error_cause_recursive_tail/error_cause_recursive_tail.ts.out diff --git a/tests/specs/run/error_for_await/__test__.jsonc b/tests/specs/run/error_for_await/__test__.jsonc new file mode 100644 index 0000000000..b67f67ecee --- /dev/null +++ b/tests/specs/run/error_for_await/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --check error_for_await.ts", + "output": "error_for_await.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_for_await.ts b/tests/specs/run/error_for_await/error_for_await.ts similarity index 100% rename from tests/testdata/run/error_for_await.ts rename to tests/specs/run/error_for_await/error_for_await.ts diff --git a/tests/testdata/run/error_for_await.ts.out b/tests/specs/run/error_for_await/error_for_await.ts.out similarity index 100% rename from tests/testdata/run/error_for_await.ts.out rename to tests/specs/run/error_for_await/error_for_await.ts.out diff --git a/tests/specs/run/error_import_map_unable_to_load/__test__.jsonc b/tests/specs/run/error_import_map_unable_to_load/__test__.jsonc new file mode 100644 index 0000000000..c7dd939a45 --- /dev/null +++ b/tests/specs/run/error_import_map_unable_to_load/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --import-map=import_maps/does_not_exist.json import_maps/test.ts", + "output": "error_import_map_unable_to_load.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_import_map_unable_to_load.out b/tests/specs/run/error_import_map_unable_to_load/error_import_map_unable_to_load.out similarity index 100% rename from tests/testdata/run/error_import_map_unable_to_load.out rename to tests/specs/run/error_import_map_unable_to_load/error_import_map_unable_to_load.out diff --git a/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts b/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts new file mode 100644 index 0000000000..5e8efea69b --- /dev/null +++ b/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts @@ -0,0 +1 @@ +import "test_server/import_maps/lodash/lodash.ts"; diff --git a/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts.out b/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts.out new file mode 100644 index 0000000000..da996dc0d9 --- /dev/null +++ b/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts.out @@ -0,0 +1 @@ +Hello from remapped lodash! diff --git a/tests/specs/run/error_missing_module_named_import/__test__.jsonc b/tests/specs/run/error_missing_module_named_import/__test__.jsonc new file mode 100644 index 0000000000..9f5780d2a9 --- /dev/null +++ b/tests/specs/run/error_missing_module_named_import/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload error_missing_module_named_import.ts", + "output": "error_missing_module_named_import.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_missing_module_named_import.ts b/tests/specs/run/error_missing_module_named_import/error_missing_module_named_import.ts similarity index 100% rename from tests/testdata/run/error_missing_module_named_import.ts rename to tests/specs/run/error_missing_module_named_import/error_missing_module_named_import.ts diff --git a/tests/testdata/run/error_missing_module_named_import.ts.out b/tests/specs/run/error_missing_module_named_import/error_missing_module_named_import.ts.out similarity index 100% rename from tests/testdata/run/error_missing_module_named_import.ts.out rename to tests/specs/run/error_missing_module_named_import/error_missing_module_named_import.ts.out diff --git a/tests/specs/run/error_name_non_string/__test__.jsonc b/tests/specs/run/error_name_non_string/__test__.jsonc new file mode 100644 index 0000000000..a6748b56a2 --- /dev/null +++ b/tests/specs/run/error_name_non_string/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet error_name_non_string.js", + "output": "error_name_non_string.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_name_non_string.js b/tests/specs/run/error_name_non_string/error_name_non_string.js similarity index 100% rename from tests/testdata/run/error_name_non_string.js rename to tests/specs/run/error_name_non_string/error_name_non_string.js diff --git a/tests/testdata/run/error_name_non_string.js.out b/tests/specs/run/error_name_non_string/error_name_non_string.js.out similarity index 100% rename from tests/testdata/run/error_name_non_string.js.out rename to tests/specs/run/error_name_non_string/error_name_non_string.js.out diff --git a/tests/specs/run/error_no_check/__test__.jsonc b/tests/specs/run/error_no_check/__test__.jsonc new file mode 100644 index 0000000000..439dc5615d --- /dev/null +++ b/tests/specs/run/error_no_check/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --no-check error_no_check.ts", + "output": "error_no_check.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/error_no_check/error_no_check.ts b/tests/specs/run/error_no_check/error_no_check.ts new file mode 100644 index 0000000000..95ebff0282 --- /dev/null +++ b/tests/specs/run/error_no_check/error_no_check.ts @@ -0,0 +1 @@ +export { AnInterface, isAnInterface } from "./type_and_code.ts"; diff --git a/tests/specs/run/error_no_check/error_no_check.ts.out b/tests/specs/run/error_no_check/error_no_check.ts.out new file mode 100644 index 0000000000..c4e85332d1 --- /dev/null +++ b/tests/specs/run/error_no_check/error_no_check.ts.out @@ -0,0 +1,2 @@ +error: Uncaught SyntaxError: The requested module './type_and_code.ts' does not provide an export named 'AnInterface' +[WILDCARD] \ No newline at end of file diff --git a/tests/specs/run/error_no_check/type_and_code.ts b/tests/specs/run/error_no_check/type_and_code.ts new file mode 100644 index 0000000000..b147134195 --- /dev/null +++ b/tests/specs/run/error_no_check/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/tests/specs/run/error_syntax/__test__.jsonc b/tests/specs/run/error_syntax/__test__.jsonc new file mode 100644 index 0000000000..7a60f2c732 --- /dev/null +++ b/tests/specs/run/error_syntax/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload error_syntax.js", + "output": "error_syntax.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_syntax.js b/tests/specs/run/error_syntax/error_syntax.js similarity index 100% rename from tests/testdata/run/error_syntax.js rename to tests/specs/run/error_syntax/error_syntax.js diff --git a/tests/testdata/run/error_syntax.js.out b/tests/specs/run/error_syntax/error_syntax.js.out similarity index 100% rename from tests/testdata/run/error_syntax.js.out rename to tests/specs/run/error_syntax/error_syntax.js.out diff --git a/tests/specs/run/error_syntax_empty_trailing_line/__test__.jsonc b/tests/specs/run/error_syntax_empty_trailing_line/__test__.jsonc new file mode 100644 index 0000000000..72f1de1f7a --- /dev/null +++ b/tests/specs/run/error_syntax_empty_trailing_line/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload error_syntax_empty_trailing_line.mjs", + "output": "error_syntax_empty_trailing_line.mjs.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_syntax_empty_trailing_line.mjs b/tests/specs/run/error_syntax_empty_trailing_line/error_syntax_empty_trailing_line.mjs similarity index 100% rename from tests/testdata/run/error_syntax_empty_trailing_line.mjs rename to tests/specs/run/error_syntax_empty_trailing_line/error_syntax_empty_trailing_line.mjs diff --git a/tests/testdata/run/error_syntax_empty_trailing_line.mjs.out b/tests/specs/run/error_syntax_empty_trailing_line/error_syntax_empty_trailing_line.mjs.out similarity index 100% rename from tests/testdata/run/error_syntax_empty_trailing_line.mjs.out rename to tests/specs/run/error_syntax_empty_trailing_line/error_syntax_empty_trailing_line.mjs.out diff --git a/tests/specs/run/error_type_definitions/__test__.jsonc b/tests/specs/run/error_type_definitions/__test__.jsonc new file mode 100644 index 0000000000..0ea9bc0164 --- /dev/null +++ b/tests/specs/run/error_type_definitions/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --check error_type_definitions.ts", + "output": "error_type_definitions.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/error_type_definitions/error_type_definitions.ts b/tests/specs/run/error_type_definitions/error_type_definitions.ts new file mode 100644 index 0000000000..ceb11787e5 --- /dev/null +++ b/tests/specs/run/error_type_definitions/error_type_definitions.ts @@ -0,0 +1,5 @@ +// @deno-types="./type_definitions/bar.d.ts" +import { Bar } from "./type_definitions/bar.js"; + +const bar = new Bar(); +console.log(bar); diff --git a/tests/testdata/run/error_type_definitions.ts.out b/tests/specs/run/error_type_definitions/error_type_definitions.ts.out similarity index 100% rename from tests/testdata/run/error_type_definitions.ts.out rename to tests/specs/run/error_type_definitions/error_type_definitions.ts.out diff --git a/tests/specs/run/error_type_definitions/type_definitions/bar.d.ts b/tests/specs/run/error_type_definitions/type_definitions/bar.d.ts new file mode 100644 index 0000000000..d43335dbb5 --- /dev/null +++ b/tests/specs/run/error_type_definitions/type_definitions/bar.d.ts @@ -0,0 +1,7 @@ +/// + +declare namespace bar { + export class Bar { + baz: string; + } +} diff --git a/tests/specs/run/error_type_definitions/type_definitions/bar.js b/tests/specs/run/error_type_definitions/type_definitions/bar.js new file mode 100644 index 0000000000..e9c2e5193c --- /dev/null +++ b/tests/specs/run/error_type_definitions/type_definitions/bar.js @@ -0,0 +1,5 @@ +export class Bar { + constructor() { + this.baz = "baz"; + } +} diff --git a/tests/specs/run/error_type_definitions/type_definitions/fizz.d.ts b/tests/specs/run/error_type_definitions/type_definitions/fizz.d.ts new file mode 100644 index 0000000000..34eb41b960 --- /dev/null +++ b/tests/specs/run/error_type_definitions/type_definitions/fizz.d.ts @@ -0,0 +1,2 @@ +/** A global value. */ +declare const fizz: string; diff --git a/tests/specs/run/error_type_definitions/type_definitions/fizz.js b/tests/specs/run/error_type_definitions/type_definitions/fizz.js new file mode 100644 index 0000000000..852162c940 --- /dev/null +++ b/tests/specs/run/error_type_definitions/type_definitions/fizz.js @@ -0,0 +1 @@ +globalThis.fizz = "fizz"; diff --git a/tests/specs/run/error_type_definitions/type_definitions/foo.d.ts b/tests/specs/run/error_type_definitions/type_definitions/foo.d.ts new file mode 100644 index 0000000000..ce39201e1b --- /dev/null +++ b/tests/specs/run/error_type_definitions/type_definitions/foo.d.ts @@ -0,0 +1,2 @@ +/** An exported value. */ +export const foo: string; diff --git a/tests/specs/run/error_type_definitions/type_definitions/foo.js b/tests/specs/run/error_type_definitions/type_definitions/foo.js new file mode 100644 index 0000000000..61d366eb25 --- /dev/null +++ b/tests/specs/run/error_type_definitions/type_definitions/foo.js @@ -0,0 +1 @@ +export const foo = "foo"; diff --git a/tests/specs/run/error_type_definitions/type_definitions/qat.ts b/tests/specs/run/error_type_definitions/type_definitions/qat.ts new file mode 100644 index 0000000000..6196c9d387 --- /dev/null +++ b/tests/specs/run/error_type_definitions/type_definitions/qat.ts @@ -0,0 +1 @@ +export const qat = "qat"; diff --git a/tests/specs/run/error_with_errors_prop/__test__.jsonc b/tests/specs/run/error_with_errors_prop/__test__.jsonc new file mode 100644 index 0000000000..afbfd24cfe --- /dev/null +++ b/tests/specs/run/error_with_errors_prop/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet error_with_errors_prop.js", + "output": "error_with_errors_prop.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/error_with_errors_prop.js b/tests/specs/run/error_with_errors_prop/error_with_errors_prop.js similarity index 100% rename from tests/testdata/run/error_with_errors_prop.js rename to tests/specs/run/error_with_errors_prop/error_with_errors_prop.js diff --git a/tests/testdata/run/error_with_errors_prop.js.out b/tests/specs/run/error_with_errors_prop/error_with_errors_prop.js.out similarity index 100% rename from tests/testdata/run/error_with_errors_prop.js.out rename to tests/specs/run/error_with_errors_prop/error_with_errors_prop.js.out diff --git a/tests/specs/run/es_private_fields/__test__.jsonc b/tests/specs/run/es_private_fields/__test__.jsonc new file mode 100644 index 0000000000..817efd67e3 --- /dev/null +++ b/tests/specs/run/es_private_fields/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload es_private_fields.js", + "output": "es_private_fields.js.out" +} diff --git a/tests/testdata/run/es_private_fields.js b/tests/specs/run/es_private_fields/es_private_fields.js similarity index 100% rename from tests/testdata/run/es_private_fields.js rename to tests/specs/run/es_private_fields/es_private_fields.js diff --git a/tests/testdata/run/es_private_fields.js.out b/tests/specs/run/es_private_fields/es_private_fields.js.out similarity index 100% rename from tests/testdata/run/es_private_fields.js.out rename to tests/specs/run/es_private_fields/es_private_fields.js.out diff --git a/tests/specs/run/eval_context_throw_dom_exception/__test__.jsonc b/tests/specs/run/eval_context_throw_dom_exception/__test__.jsonc new file mode 100644 index 0000000000..6ad302b03a --- /dev/null +++ b/tests/specs/run/eval_context_throw_dom_exception/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run eval_context_throw_dom_exception.js", + "output": "eval_context_throw_dom_exception.js.out" +} diff --git a/tests/testdata/run/eval_context_throw_dom_exception.js b/tests/specs/run/eval_context_throw_dom_exception/eval_context_throw_dom_exception.js similarity index 100% rename from tests/testdata/run/eval_context_throw_dom_exception.js rename to tests/specs/run/eval_context_throw_dom_exception/eval_context_throw_dom_exception.js diff --git a/tests/testdata/run/eval_context_throw_dom_exception.js.out b/tests/specs/run/eval_context_throw_dom_exception/eval_context_throw_dom_exception.js.out similarity index 100% rename from tests/testdata/run/eval_context_throw_dom_exception.js.out rename to tests/specs/run/eval_context_throw_dom_exception/eval_context_throw_dom_exception.js.out diff --git a/tests/specs/run/event_listener_error/__test__.jsonc b/tests/specs/run/event_listener_error/__test__.jsonc new file mode 100644 index 0000000000..b2540e03dc --- /dev/null +++ b/tests/specs/run/event_listener_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet event_listener_error.ts", + "output": "event_listener_error.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/event_listener_error.ts b/tests/specs/run/event_listener_error/event_listener_error.ts similarity index 100% rename from tests/testdata/run/event_listener_error.ts rename to tests/specs/run/event_listener_error/event_listener_error.ts diff --git a/tests/testdata/run/event_listener_error.ts.out b/tests/specs/run/event_listener_error/event_listener_error.ts.out similarity index 100% rename from tests/testdata/run/event_listener_error.ts.out rename to tests/specs/run/event_listener_error/event_listener_error.ts.out diff --git a/tests/specs/run/event_listener_error_handled/__test__.jsonc b/tests/specs/run/event_listener_error_handled/__test__.jsonc new file mode 100644 index 0000000000..f1fdcd5dba --- /dev/null +++ b/tests/specs/run/event_listener_error_handled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet event_listener_error_handled.ts", + "output": "event_listener_error_handled.ts.out" +} diff --git a/tests/testdata/run/event_listener_error_handled.ts b/tests/specs/run/event_listener_error_handled/event_listener_error_handled.ts similarity index 100% rename from tests/testdata/run/event_listener_error_handled.ts rename to tests/specs/run/event_listener_error_handled/event_listener_error_handled.ts diff --git a/tests/testdata/run/event_listener_error_handled.ts.out b/tests/specs/run/event_listener_error_handled/event_listener_error_handled.ts.out similarity index 100% rename from tests/testdata/run/event_listener_error_handled.ts.out rename to tests/specs/run/event_listener_error_handled/event_listener_error_handled.ts.out diff --git a/tests/specs/run/event_listener_error_immediate_exit/__test__.jsonc b/tests/specs/run/event_listener_error_immediate_exit/__test__.jsonc new file mode 100644 index 0000000000..2974c0e422 --- /dev/null +++ b/tests/specs/run/event_listener_error_immediate_exit/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet event_listener_error_immediate_exit.ts", + "output": "event_listener_error_immediate_exit.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/event_listener_error_immediate_exit.ts b/tests/specs/run/event_listener_error_immediate_exit/event_listener_error_immediate_exit.ts similarity index 100% rename from tests/testdata/run/event_listener_error_immediate_exit.ts rename to tests/specs/run/event_listener_error_immediate_exit/event_listener_error_immediate_exit.ts diff --git a/tests/testdata/run/event_listener_error_immediate_exit.ts.out b/tests/specs/run/event_listener_error_immediate_exit/event_listener_error_immediate_exit.ts.out similarity index 100% rename from tests/testdata/run/event_listener_error_immediate_exit.ts.out rename to tests/specs/run/event_listener_error_immediate_exit/event_listener_error_immediate_exit.ts.out diff --git a/tests/specs/run/event_listener_error_immediate_exit_worker/__test__.jsonc b/tests/specs/run/event_listener_error_immediate_exit_worker/__test__.jsonc new file mode 100644 index 0000000000..6ef3ef2ed1 --- /dev/null +++ b/tests/specs/run/event_listener_error_immediate_exit_worker/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet -A event_listener_error_immediate_exit_worker.ts", + "output": "event_listener_error_immediate_exit_worker.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/event_listener_error_immediate_exit_worker/event_listener_error_immediate_exit.ts b/tests/specs/run/event_listener_error_immediate_exit_worker/event_listener_error_immediate_exit.ts new file mode 100644 index 0000000000..292a0df007 --- /dev/null +++ b/tests/specs/run/event_listener_error_immediate_exit_worker/event_listener_error_immediate_exit.ts @@ -0,0 +1,12 @@ +addEventListener("foo", () => { + queueMicrotask(() => console.log("queueMicrotask")); + setTimeout(() => console.log("timer"), 0); + throw new Error("bar"); +}); +console.log(1); +// @ts-ignore Deno[Deno.internal].core +Deno[Deno.internal].core.setNextTickCallback(() => console.log("nextTick")); +// @ts-ignore Deno[Deno.internal].core +Deno[Deno.internal].core.setHasTickScheduled(true); +dispatchEvent(new CustomEvent("foo")); +console.log(2); diff --git a/tests/testdata/run/event_listener_error_immediate_exit_worker.ts b/tests/specs/run/event_listener_error_immediate_exit_worker/event_listener_error_immediate_exit_worker.ts similarity index 100% rename from tests/testdata/run/event_listener_error_immediate_exit_worker.ts rename to tests/specs/run/event_listener_error_immediate_exit_worker/event_listener_error_immediate_exit_worker.ts diff --git a/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out b/tests/specs/run/event_listener_error_immediate_exit_worker/event_listener_error_immediate_exit_worker.ts.out similarity index 100% rename from tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out rename to tests/specs/run/event_listener_error_immediate_exit_worker/event_listener_error_immediate_exit_worker.ts.out diff --git a/tests/specs/run/exit_error42/__test__.jsonc b/tests/specs/run/exit_error42/__test__.jsonc new file mode 100644 index 0000000000..43d3089566 --- /dev/null +++ b/tests/specs/run/exit_error42/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload exit_error42.ts", + "output": "exit_error42.ts.out", + "exitCode": 42 +} diff --git a/tests/testdata/run/exit_error42.ts b/tests/specs/run/exit_error42/exit_error42.ts similarity index 100% rename from tests/testdata/run/exit_error42.ts rename to tests/specs/run/exit_error42/exit_error42.ts diff --git a/tests/testdata/run/exit_error42.ts.out b/tests/specs/run/exit_error42/exit_error42.ts.out similarity index 100% rename from tests/testdata/run/exit_error42.ts.out rename to tests/specs/run/exit_error42/exit_error42.ts.out diff --git a/tests/specs/run/explicit_resource_management/__test__.jsonc b/tests/specs/run/explicit_resource_management/__test__.jsonc new file mode 100644 index 0000000000..7062e6f36f --- /dev/null +++ b/tests/specs/run/explicit_resource_management/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --check explicit_resource_management/main.ts", + "output": "explicit_resource_management/main.out" +} diff --git a/tests/testdata/run/explicit_resource_management/main.out b/tests/specs/run/explicit_resource_management/explicit_resource_management/main.out similarity index 100% rename from tests/testdata/run/explicit_resource_management/main.out rename to tests/specs/run/explicit_resource_management/explicit_resource_management/main.out diff --git a/tests/testdata/run/explicit_resource_management/main.ts b/tests/specs/run/explicit_resource_management/explicit_resource_management/main.ts similarity index 100% rename from tests/testdata/run/explicit_resource_management/main.ts rename to tests/specs/run/explicit_resource_management/explicit_resource_management/main.ts diff --git a/tests/specs/run/ext_flag_takes_precedence_over_extension/__test__.jsonc b/tests/specs/run/ext_flag_takes_precedence_over_extension/__test__.jsonc new file mode 100644 index 0000000000..0806088b4e --- /dev/null +++ b/tests/specs/run/ext_flag_takes_precedence_over_extension/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --ext ts --check ts_with_js_extension.js", + "output": "ts_with_js_extension.out", + "exitCode": 0 +} diff --git a/tests/specs/run/ext_flag_takes_precedence_over_extension/ts_with_js_extension.js b/tests/specs/run/ext_flag_takes_precedence_over_extension/ts_with_js_extension.js new file mode 100644 index 0000000000..3c49f74846 --- /dev/null +++ b/tests/specs/run/ext_flag_takes_precedence_over_extension/ts_with_js_extension.js @@ -0,0 +1,5 @@ +interface Lollipop { + _: number; +} + +console.log("executing typescript with extension"); diff --git a/tests/specs/run/ext_flag_takes_precedence_over_extension/ts_with_js_extension.out b/tests/specs/run/ext_flag_takes_precedence_over_extension/ts_with_js_extension.out new file mode 100644 index 0000000000..7ae7b9168f --- /dev/null +++ b/tests/specs/run/ext_flag_takes_precedence_over_extension/ts_with_js_extension.out @@ -0,0 +1,2 @@ +Check [WILDCARD]/ts_with_js_extension.js +executing typescript with extension diff --git a/tests/specs/run/fetch_async_error_stack/__test__.jsonc b/tests/specs/run/fetch_async_error_stack/__test__.jsonc new file mode 100644 index 0000000000..152f57807c --- /dev/null +++ b/tests/specs/run/fetch_async_error_stack/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet -A fetch_async_error_stack.ts", + "output": "fetch_async_error_stack.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/fetch_async_error_stack.ts b/tests/specs/run/fetch_async_error_stack/fetch_async_error_stack.ts similarity index 100% rename from tests/testdata/run/fetch_async_error_stack.ts rename to tests/specs/run/fetch_async_error_stack/fetch_async_error_stack.ts diff --git a/tests/testdata/run/fetch_async_error_stack.ts.out b/tests/specs/run/fetch_async_error_stack/fetch_async_error_stack.ts.out similarity index 100% rename from tests/testdata/run/fetch_async_error_stack.ts.out rename to tests/specs/run/fetch_async_error_stack/fetch_async_error_stack.ts.out diff --git a/tests/specs/run/fetch_response_finalization/__test__.jsonc b/tests/specs/run/fetch_response_finalization/__test__.jsonc new file mode 100644 index 0000000000..51a7e2b045 --- /dev/null +++ b/tests/specs/run/fetch_response_finalization/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --v8-flags=--expose-gc --allow-net fetch_response_finalization.js", + "output": "fetch_response_finalization.js.out", + "exitCode": 0 +} diff --git a/tests/testdata/run/fetch_response_finalization.js b/tests/specs/run/fetch_response_finalization/fetch_response_finalization.js similarity index 100% rename from tests/testdata/run/fetch_response_finalization.js rename to tests/specs/run/fetch_response_finalization/fetch_response_finalization.js diff --git a/tests/testdata/run/fetch_response_finalization.js.out b/tests/specs/run/fetch_response_finalization/fetch_response_finalization.js.out similarity index 100% rename from tests/testdata/run/fetch_response_finalization.js.out rename to tests/specs/run/fetch_response_finalization/fetch_response_finalization.js.out diff --git a/tests/specs/run/finalization_registry/__test__.jsonc b/tests/specs/run/finalization_registry/__test__.jsonc new file mode 100644 index 0000000000..f7526506c5 --- /dev/null +++ b/tests/specs/run/finalization_registry/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --v8-flags=--expose-gc finalization_registry.js", + "output": "finalization_registry.js.out" +} diff --git a/tests/testdata/run/finalization_registry.js b/tests/specs/run/finalization_registry/finalization_registry.js similarity index 100% rename from tests/testdata/run/finalization_registry.js rename to tests/specs/run/finalization_registry/finalization_registry.js diff --git a/tests/testdata/run/finalization_registry.js.out b/tests/specs/run/finalization_registry/finalization_registry.js.out similarity index 100% rename from tests/testdata/run/finalization_registry.js.out rename to tests/specs/run/finalization_registry/finalization_registry.js.out diff --git a/tests/specs/run/fix_dynamic_import_errors/__test__.jsonc b/tests/specs/run/fix_dynamic_import_errors/__test__.jsonc new file mode 100644 index 0000000000..d9302d2cae --- /dev/null +++ b/tests/specs/run/fix_dynamic_import_errors/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload fix_dynamic_import_errors.js", + "output": "fix_dynamic_import_errors.js.out" +} diff --git a/tests/specs/run/fix_dynamic_import_errors/b.js b/tests/specs/run/fix_dynamic_import_errors/b.js new file mode 100644 index 0000000000..6ea50d3608 --- /dev/null +++ b/tests/specs/run/fix_dynamic_import_errors/b.js @@ -0,0 +1,2 @@ +import "./bad.mjs"; +export default () => "error"; diff --git a/tests/specs/run/fix_dynamic_import_errors/c.js b/tests/specs/run/fix_dynamic_import_errors/c.js new file mode 100644 index 0000000000..20546455ea --- /dev/null +++ b/tests/specs/run/fix_dynamic_import_errors/c.js @@ -0,0 +1,2 @@ +await import("./bad2.mjs"); +export default () => "error"; diff --git a/tests/testdata/run/fix_dynamic_import_errors.js b/tests/specs/run/fix_dynamic_import_errors/fix_dynamic_import_errors.js similarity index 52% rename from tests/testdata/run/fix_dynamic_import_errors.js rename to tests/specs/run/fix_dynamic_import_errors/fix_dynamic_import_errors.js index 1d7be37e06..e105cbada6 100644 --- a/tests/testdata/run/fix_dynamic_import_errors.js +++ b/tests/specs/run/fix_dynamic_import_errors/fix_dynamic_import_errors.js @@ -1,7 +1,7 @@ -import("../dynamic_import/b.js").catch(() => { +import("./b.js").catch(() => { console.log("caught import error from b.js"); }); -import("../dynamic_import/c.js").catch(() => { +import("./c.js").catch(() => { console.log("caught import error from c.js"); }); diff --git a/tests/testdata/run/fix_dynamic_import_errors.js.out b/tests/specs/run/fix_dynamic_import_errors/fix_dynamic_import_errors.js.out similarity index 100% rename from tests/testdata/run/fix_dynamic_import_errors.js.out rename to tests/specs/run/fix_dynamic_import_errors/fix_dynamic_import_errors.js.out diff --git a/tests/specs/run/fix_emittable_skipped/__test__.jsonc b/tests/specs/run/fix_emittable_skipped/__test__.jsonc new file mode 100644 index 0000000000..ef1445e0e3 --- /dev/null +++ b/tests/specs/run/fix_emittable_skipped/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload fix_emittable_skipped.js", + "output": "fix_emittable_skipped.ts.out" +} diff --git a/tests/specs/run/fix_emittable_skipped/emittable.d.ts b/tests/specs/run/fix_emittable_skipped/emittable.d.ts new file mode 100644 index 0000000000..425b80f244 --- /dev/null +++ b/tests/specs/run/fix_emittable_skipped/emittable.d.ts @@ -0,0 +1 @@ +export const a: string; diff --git a/tests/specs/run/fix_emittable_skipped/fix_emittable_skipped.js b/tests/specs/run/fix_emittable_skipped/fix_emittable_skipped.js new file mode 100644 index 0000000000..b94af2730f --- /dev/null +++ b/tests/specs/run/fix_emittable_skipped/fix_emittable_skipped.js @@ -0,0 +1,7 @@ +/// + +import "./polyfill.ts"; + +export const a = "a"; + +console.log(globalThis.polyfill); diff --git a/tests/testdata/run/fix_emittable_skipped.ts.out b/tests/specs/run/fix_emittable_skipped/fix_emittable_skipped.ts.out similarity index 100% rename from tests/testdata/run/fix_emittable_skipped.ts.out rename to tests/specs/run/fix_emittable_skipped/fix_emittable_skipped.ts.out diff --git a/tests/specs/run/fix_emittable_skipped/polyfill.ts b/tests/specs/run/fix_emittable_skipped/polyfill.ts new file mode 100644 index 0000000000..7af67c4c03 --- /dev/null +++ b/tests/specs/run/fix_emittable_skipped/polyfill.ts @@ -0,0 +1,8 @@ +declare global { + const polyfill: () => void; +} + +// deno-lint-ignore no-explicit-any +(globalThis as any).polyfill = () => { + console.log("polyfill"); +}; diff --git a/tests/specs/run/fix_js_import_js/__test__.jsonc b/tests/specs/run/fix_js_import_js/__test__.jsonc new file mode 100644 index 0000000000..94b1df540a --- /dev/null +++ b/tests/specs/run/fix_js_import_js/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload fix_js_import_js.ts", + "output": "fix_js_import_js.ts.out" +} diff --git a/tests/specs/run/fix_js_import_js/fix_js_import_js.ts b/tests/specs/run/fix_js_import_js/fix_js_import_js.ts new file mode 100644 index 0000000000..4862f03e10 --- /dev/null +++ b/tests/specs/run/fix_js_import_js/fix_js_import_js.ts @@ -0,0 +1,3 @@ +import { isMod4 } from "./mod6.js"; + +console.log(isMod4); diff --git a/tests/testdata/run/fix_js_import_js.ts.out b/tests/specs/run/fix_js_import_js/fix_js_import_js.ts.out similarity index 100% rename from tests/testdata/run/fix_js_import_js.ts.out rename to tests/specs/run/fix_js_import_js/fix_js_import_js.ts.out diff --git a/tests/specs/run/fix_js_import_js/mod4.js b/tests/specs/run/fix_js_import_js/mod4.js new file mode 100644 index 0000000000..71332dbc42 --- /dev/null +++ b/tests/specs/run/fix_js_import_js/mod4.js @@ -0,0 +1 @@ +export const isMod4 = true; diff --git a/tests/specs/run/fix_js_import_js/mod6.js b/tests/specs/run/fix_js_import_js/mod6.js new file mode 100644 index 0000000000..5e17c9ee02 --- /dev/null +++ b/tests/specs/run/fix_js_import_js/mod6.js @@ -0,0 +1 @@ +export { isMod4 } from "./mod4.js"; diff --git a/tests/specs/run/fix_js_imports/__test__.jsonc b/tests/specs/run/fix_js_imports/__test__.jsonc new file mode 100644 index 0000000000..a3635d18c9 --- /dev/null +++ b/tests/specs/run/fix_js_imports/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload fix_js_imports.ts", + "output": "fix_js_imports.ts.out" +} diff --git a/tests/specs/run/fix_js_imports/amd_like.js b/tests/specs/run/fix_js_imports/amd_like.js new file mode 100644 index 0000000000..f27e505e4a --- /dev/null +++ b/tests/specs/run/fix_js_imports/amd_like.js @@ -0,0 +1,3 @@ +// looks like an AMD module, but isn't +const define = () => {}; +define(["fake_module"], () => {}); diff --git a/tests/specs/run/fix_js_imports/fix_js_imports.ts b/tests/specs/run/fix_js_imports/fix_js_imports.ts new file mode 100644 index 0000000000..07e68a1356 --- /dev/null +++ b/tests/specs/run/fix_js_imports/fix_js_imports.ts @@ -0,0 +1,3 @@ +import * as amdLike from "./amd_like.js"; + +console.log(amdLike); diff --git a/tests/testdata/run/fix_js_imports.ts.out b/tests/specs/run/fix_js_imports/fix_js_imports.ts.out similarity index 100% rename from tests/testdata/run/fix_js_imports.ts.out rename to tests/specs/run/fix_js_imports/fix_js_imports.ts.out diff --git a/tests/specs/run/fix_tsc_file_exists/__test__.jsonc b/tests/specs/run/fix_tsc_file_exists/__test__.jsonc new file mode 100644 index 0000000000..d2b0bda29f --- /dev/null +++ b/tests/specs/run/fix_tsc_file_exists/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload tsc/test.js", + "output": "fix_tsc_file_exists.out" +} diff --git a/tests/testdata/run/fix_tsc_file_exists.out b/tests/specs/run/fix_tsc_file_exists/fix_tsc_file_exists.out similarity index 100% rename from tests/testdata/run/fix_tsc_file_exists.out rename to tests/specs/run/fix_tsc_file_exists/fix_tsc_file_exists.out diff --git a/tests/specs/run/fix_tsc_file_exists/tsc/a.js b/tests/specs/run/fix_tsc_file_exists/tsc/a.js new file mode 100644 index 0000000000..5a7b3ff93c --- /dev/null +++ b/tests/specs/run/fix_tsc_file_exists/tsc/a.js @@ -0,0 +1,2 @@ +import { v4 } from "./d.ts"; +export function a() {} diff --git a/tests/specs/run/fix_tsc_file_exists/tsc/d.ts b/tests/specs/run/fix_tsc_file_exists/tsc/d.ts new file mode 100644 index 0000000000..3c74b8c836 --- /dev/null +++ b/tests/specs/run/fix_tsc_file_exists/tsc/d.ts @@ -0,0 +1,3 @@ +export function v4() { + return "hello"; +} diff --git a/tests/specs/run/fix_tsc_file_exists/tsc/node_modules/b.js b/tests/specs/run/fix_tsc_file_exists/tsc/node_modules/b.js new file mode 100644 index 0000000000..1916609355 --- /dev/null +++ b/tests/specs/run/fix_tsc_file_exists/tsc/node_modules/b.js @@ -0,0 +1,2 @@ +import c from "./c.js"; +export { c }; diff --git a/tests/specs/run/fix_tsc_file_exists/tsc/node_modules/c.js b/tests/specs/run/fix_tsc_file_exists/tsc/node_modules/c.js new file mode 100644 index 0000000000..cff71c44a0 --- /dev/null +++ b/tests/specs/run/fix_tsc_file_exists/tsc/node_modules/c.js @@ -0,0 +1 @@ +export default function c() {} diff --git a/tests/specs/run/fix_tsc_file_exists/tsc/test.js b/tests/specs/run/fix_tsc_file_exists/tsc/test.js new file mode 100644 index 0000000000..b7f46b351f --- /dev/null +++ b/tests/specs/run/fix_tsc_file_exists/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/tests/specs/run/fix_worker_dispatchevent/__test__.jsonc b/tests/specs/run/fix_worker_dispatchevent/__test__.jsonc new file mode 100644 index 0000000000..45e49b87f9 --- /dev/null +++ b/tests/specs/run/fix_worker_dispatchevent/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload fix_worker_dispatchevent.ts", + "output": "fix_worker_dispatchevent.ts.out" +} diff --git a/tests/testdata/run/fix_worker_dispatchevent.ts b/tests/specs/run/fix_worker_dispatchevent/fix_worker_dispatchevent.ts similarity index 100% rename from tests/testdata/run/fix_worker_dispatchevent.ts rename to tests/specs/run/fix_worker_dispatchevent/fix_worker_dispatchevent.ts diff --git a/tests/testdata/run/fix_worker_dispatchevent.ts.out b/tests/specs/run/fix_worker_dispatchevent/fix_worker_dispatchevent.ts.out similarity index 100% rename from tests/testdata/run/fix_worker_dispatchevent.ts.out rename to tests/specs/run/fix_worker_dispatchevent/fix_worker_dispatchevent.ts.out diff --git a/tests/specs/run/followup_dyn_import_resolved/__test__.jsonc b/tests/specs/run/followup_dyn_import_resolved/__test__.jsonc new file mode 100644 index 0000000000..b94e3d8c91 --- /dev/null +++ b/tests/specs/run/followup_dyn_import_resolved/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read followup_dyn_import_resolves/main.ts", + "output": "followup_dyn_import_resolves/main.ts.out" +} diff --git a/tests/testdata/run/followup_dyn_import_resolves/main.ts b/tests/specs/run/followup_dyn_import_resolved/followup_dyn_import_resolves/main.ts similarity index 100% rename from tests/testdata/run/followup_dyn_import_resolves/main.ts rename to tests/specs/run/followup_dyn_import_resolved/followup_dyn_import_resolves/main.ts diff --git a/tests/testdata/run/followup_dyn_import_resolves/main.ts.out b/tests/specs/run/followup_dyn_import_resolved/followup_dyn_import_resolves/main.ts.out similarity index 100% rename from tests/testdata/run/followup_dyn_import_resolves/main.ts.out rename to tests/specs/run/followup_dyn_import_resolved/followup_dyn_import_resolves/main.ts.out diff --git a/tests/specs/run/followup_dyn_import_resolved/followup_dyn_import_resolves/sub1.ts b/tests/specs/run/followup_dyn_import_resolved/followup_dyn_import_resolves/sub1.ts new file mode 100644 index 0000000000..d06c30221b --- /dev/null +++ b/tests/specs/run/followup_dyn_import_resolved/followup_dyn_import_resolves/sub1.ts @@ -0,0 +1,2 @@ +await import("./sub2.ts"); +console.log("sub1"); diff --git a/tests/specs/run/followup_dyn_import_resolved/followup_dyn_import_resolves/sub2.ts b/tests/specs/run/followup_dyn_import_resolved/followup_dyn_import_resolves/sub2.ts new file mode 100644 index 0000000000..cce2b524cd --- /dev/null +++ b/tests/specs/run/followup_dyn_import_resolved/followup_dyn_import_resolves/sub2.ts @@ -0,0 +1 @@ +console.log("sub2"); diff --git a/tests/specs/run/heapstats/__test__.jsonc b/tests/specs/run/heapstats/__test__.jsonc new file mode 100644 index 0000000000..6429d7cf5f --- /dev/null +++ b/tests/specs/run/heapstats/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --v8-flags=--expose-gc heapstats.js", + "output": "heapstats.js.out" +} diff --git a/tests/testdata/run/heapstats.js b/tests/specs/run/heapstats/heapstats.js similarity index 100% rename from tests/testdata/run/heapstats.js rename to tests/specs/run/heapstats/heapstats.js diff --git a/tests/testdata/run/heapstats.js.out b/tests/specs/run/heapstats/heapstats.js.out similarity index 100% rename from tests/testdata/run/heapstats.js.out rename to tests/specs/run/heapstats/heapstats.js.out diff --git a/tests/specs/run/https_import/RootCA.pem b/tests/specs/run/https_import/RootCA.pem new file mode 100644 index 0000000000..c2f84ceebc --- /dev/null +++ b/tests/specs/run/https_import/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/tests/specs/run/https_import/__test__.jsonc b/tests/specs/run/https_import/__test__.jsonc new file mode 100644 index 0000000000..9a37230f27 --- /dev/null +++ b/tests/specs/run/https_import/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --quiet --reload --cert RootCA.pem https_import.ts", + "output": "https_import.ts.out" +} diff --git a/tests/specs/run/https_import/https_import.ts b/tests/specs/run/https_import/https_import.ts new file mode 100644 index 0000000000..d392f4a5d1 --- /dev/null +++ b/tests/specs/run/https_import/https_import.ts @@ -0,0 +1,3 @@ +import { printHello } from "./print_hello.ts"; + +printHello(); diff --git a/tests/testdata/run/import_data_url_imports.ts.out b/tests/specs/run/https_import/https_import.ts.out similarity index 100% rename from tests/testdata/run/import_data_url_imports.ts.out rename to tests/specs/run/https_import/https_import.ts.out diff --git a/tests/specs/run/https_import/print_hello.ts b/tests/specs/run/https_import/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/https_import/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/if_main/__test__.jsonc b/tests/specs/run/if_main/__test__.jsonc new file mode 100644 index 0000000000..f6e2dbf273 --- /dev/null +++ b/tests/specs/run/if_main/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload if_main.ts", + "output": "if_main.ts.out" +} diff --git a/tests/testdata/run/if_main.ts b/tests/specs/run/if_main/if_main.ts similarity index 100% rename from tests/testdata/run/if_main.ts rename to tests/specs/run/if_main/if_main.ts diff --git a/tests/specs/run/if_main/if_main.ts.out b/tests/specs/run/if_main/if_main.ts.out new file mode 100644 index 0000000000..ba2906d066 --- /dev/null +++ b/tests/specs/run/if_main/if_main.ts.out @@ -0,0 +1 @@ +main diff --git a/tests/specs/run/import_attributes_dynamic_error/__test__.jsonc b/tests/specs/run/import_attributes_dynamic_error/__test__.jsonc new file mode 100644 index 0000000000..0a6137a2b5 --- /dev/null +++ b/tests/specs/run/import_attributes_dynamic_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --allow-read dynamic_error.ts", + "output": "dynamic_error.out", + "exitCode": 1 +} diff --git a/tests/specs/run/import_attributes_dynamic_error/data.json b/tests/specs/run/import_attributes_dynamic_error/data.json new file mode 100644 index 0000000000..37b3ee1e0a --- /dev/null +++ b/tests/specs/run/import_attributes_dynamic_error/data.json @@ -0,0 +1,6 @@ +{ + "a": "b", + "c": { + "d": 10 + } +} diff --git a/tests/specs/run/import_attributes_dynamic_error/dynamic_error.out b/tests/specs/run/import_attributes_dynamic_error/dynamic_error.out new file mode 100644 index 0000000000..24f29de72d --- /dev/null +++ b/tests/specs/run/import_attributes_dynamic_error/dynamic_error.out @@ -0,0 +1,4 @@ +error: Uncaught (in promise) TypeError: Attempted to load JSON module without specifying "type": "json" attribute in the import statement. +const data = await import("./data.json"); + ^ + at async [WILDCARD]dynamic_error.ts:1:14 diff --git a/tests/specs/run/import_attributes_dynamic_error/dynamic_error.ts b/tests/specs/run/import_attributes_dynamic_error/dynamic_error.ts new file mode 100644 index 0000000000..2d9c6757f6 --- /dev/null +++ b/tests/specs/run/import_attributes_dynamic_error/dynamic_error.ts @@ -0,0 +1,3 @@ +const data = await import("./data.json"); + +console.log(data); diff --git a/tests/specs/run/import_attributes_dynamic_import/__test__.jsonc b/tests/specs/run/import_attributes_dynamic_import/__test__.jsonc new file mode 100644 index 0000000000..75962e88db --- /dev/null +++ b/tests/specs/run/import_attributes_dynamic_import/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read --check dynamic_import.ts", + "output": "dynamic_import.out" +} diff --git a/tests/specs/run/import_attributes_dynamic_import/data.json b/tests/specs/run/import_attributes_dynamic_import/data.json new file mode 100644 index 0000000000..37b3ee1e0a --- /dev/null +++ b/tests/specs/run/import_attributes_dynamic_import/data.json @@ -0,0 +1,6 @@ +{ + "a": "b", + "c": { + "d": 10 + } +} diff --git a/tests/specs/run/import_attributes_dynamic_import/dynamic_import.out b/tests/specs/run/import_attributes_dynamic_import/dynamic_import.out new file mode 100644 index 0000000000..7a7b4c91fe --- /dev/null +++ b/tests/specs/run/import_attributes_dynamic_import/dynamic_import.out @@ -0,0 +1,2 @@ +[WILDCARD] +[Module: null prototype] { default: { a: "b", c: { d: 10 } } } diff --git a/tests/specs/run/import_attributes_dynamic_import/dynamic_import.ts b/tests/specs/run/import_attributes_dynamic_import/dynamic_import.ts new file mode 100644 index 0000000000..093136fb07 --- /dev/null +++ b/tests/specs/run/import_attributes_dynamic_import/dynamic_import.ts @@ -0,0 +1,3 @@ +const data1 = await import("./data.json", { with: { type: "json" } }); + +console.log(data1); diff --git a/tests/specs/run/import_attributes_static_error/__test__.jsonc b/tests/specs/run/import_attributes_static_error/__test__.jsonc new file mode 100644 index 0000000000..2d08c66d35 --- /dev/null +++ b/tests/specs/run/import_attributes_static_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --allow-read static_error.ts", + "output": "static_error.out", + "exitCode": 1 +} diff --git a/tests/specs/run/import_attributes_static_error/data.json b/tests/specs/run/import_attributes_static_error/data.json new file mode 100644 index 0000000000..37b3ee1e0a --- /dev/null +++ b/tests/specs/run/import_attributes_static_error/data.json @@ -0,0 +1,6 @@ +{ + "a": "b", + "c": { + "d": 10 + } +} diff --git a/tests/specs/run/import_attributes_static_error/static_error.out b/tests/specs/run/import_attributes_static_error/static_error.out new file mode 100644 index 0000000000..29b24b965a --- /dev/null +++ b/tests/specs/run/import_attributes_static_error/static_error.out @@ -0,0 +1,3 @@ +error: Expected a JavaScript or TypeScript module, but identified a Json module. Consider importing Json modules with an import attribute with the type of "json". + Specifier: [WILDCARD]/data.json + at [WILDCARD]static_error.ts:1:18 diff --git a/tests/specs/run/import_attributes_static_error/static_error.ts b/tests/specs/run/import_attributes_static_error/static_error.ts new file mode 100644 index 0000000000..0bc3a93f88 --- /dev/null +++ b/tests/specs/run/import_attributes_static_error/static_error.ts @@ -0,0 +1,3 @@ +import data from "./data.json"; + +console.log(data); diff --git a/tests/specs/run/import_attributes_static_export/__test__.jsonc b/tests/specs/run/import_attributes_static_export/__test__.jsonc new file mode 100644 index 0000000000..05a64aab53 --- /dev/null +++ b/tests/specs/run/import_attributes_static_export/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read static_export.ts", + "output": "static_export.out" +} diff --git a/tests/specs/run/import_attributes_static_export/data.json b/tests/specs/run/import_attributes_static_export/data.json new file mode 100644 index 0000000000..37b3ee1e0a --- /dev/null +++ b/tests/specs/run/import_attributes_static_export/data.json @@ -0,0 +1,6 @@ +{ + "a": "b", + "c": { + "d": 10 + } +} diff --git a/tests/specs/run/import_attributes_static_export/static_export.out b/tests/specs/run/import_attributes_static_export/static_export.out new file mode 100644 index 0000000000..41af79d7c8 --- /dev/null +++ b/tests/specs/run/import_attributes_static_export/static_export.out @@ -0,0 +1 @@ +{ a: "b", c: { d: 10 } } diff --git a/tests/specs/run/import_attributes_static_export/static_export.ts b/tests/specs/run/import_attributes_static_export/static_export.ts new file mode 100644 index 0000000000..ac3ee694f5 --- /dev/null +++ b/tests/specs/run/import_attributes_static_export/static_export.ts @@ -0,0 +1,3 @@ +import data from "./static_reexport.ts"; + +console.log(data); diff --git a/tests/specs/run/import_attributes_static_export/static_reexport.ts b/tests/specs/run/import_attributes_static_export/static_reexport.ts new file mode 100644 index 0000000000..e6175691c6 --- /dev/null +++ b/tests/specs/run/import_attributes_static_export/static_reexport.ts @@ -0,0 +1 @@ +export { default } from "./data.json" with { type: "json" }; diff --git a/tests/specs/run/import_attributes_static_import/__test__.jsonc b/tests/specs/run/import_attributes_static_import/__test__.jsonc new file mode 100644 index 0000000000..4ea39e6d32 --- /dev/null +++ b/tests/specs/run/import_attributes_static_import/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read static_import.ts", + "output": "static_import.out" +} diff --git a/tests/specs/run/import_attributes_static_import/data.json b/tests/specs/run/import_attributes_static_import/data.json new file mode 100644 index 0000000000..37b3ee1e0a --- /dev/null +++ b/tests/specs/run/import_attributes_static_import/data.json @@ -0,0 +1,6 @@ +{ + "a": "b", + "c": { + "d": 10 + } +} diff --git a/tests/specs/run/import_attributes_static_import/static_import.out b/tests/specs/run/import_attributes_static_import/static_import.out new file mode 100644 index 0000000000..e57dffa992 --- /dev/null +++ b/tests/specs/run/import_attributes_static_import/static_import.out @@ -0,0 +1,2 @@ +{ a: "b", c: { d: 10 } } +{ a: "b", c: { d: 10 } } diff --git a/tests/specs/run/import_attributes_static_import/static_import.ts b/tests/specs/run/import_attributes_static_import/static_import.ts new file mode 100644 index 0000000000..f585b893f3 --- /dev/null +++ b/tests/specs/run/import_attributes_static_import/static_import.ts @@ -0,0 +1,5 @@ +import data1 from "./data.json" with { type: "json" }; +import data2 from "./data.json" with { type: "json" }; + +console.log(data1); +console.log(data2); diff --git a/tests/specs/run/import_attributes_type_check/__test__.jsonc b/tests/specs/run/import_attributes_type_check/__test__.jsonc new file mode 100644 index 0000000000..89f6e0a79e --- /dev/null +++ b/tests/specs/run/import_attributes_type_check/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --allow-read --check type_check.ts", + "output": "type_check.out", + "exitCode": 1 +} diff --git a/tests/specs/run/import_attributes_type_check/data.json b/tests/specs/run/import_attributes_type_check/data.json new file mode 100644 index 0000000000..37b3ee1e0a --- /dev/null +++ b/tests/specs/run/import_attributes_type_check/data.json @@ -0,0 +1,6 @@ +{ + "a": "b", + "c": { + "d": 10 + } +} diff --git a/tests/specs/run/import_attributes_type_check/type_check.out b/tests/specs/run/import_attributes_type_check/type_check.out new file mode 100644 index 0000000000..2fc26dae36 --- /dev/null +++ b/tests/specs/run/import_attributes_type_check/type_check.out @@ -0,0 +1,12 @@ +Check file:///[WILDCARD]/type_check.ts +error: TS2339 [ERROR]: Property 'foo' does not exist on type '{ a: string; c: { d: number; }; }'. +console.log(data1.foo); + ~~~ + at [WILDCARD]type_check.ts:5:19 + +TS2339 [ERROR]: Property 'foo' does not exist on type '{ a: string; c: { d: number; }; }'. +console.log(data2.foo); + ~~~ + at [WILDCARD]type_check.ts:6:19 + +Found 2 errors. diff --git a/tests/specs/run/import_attributes_type_check/type_check.ts b/tests/specs/run/import_attributes_type_check/type_check.ts new file mode 100644 index 0000000000..36e47bd5b8 --- /dev/null +++ b/tests/specs/run/import_attributes_type_check/type_check.ts @@ -0,0 +1,6 @@ +import data1 from "./data.json" with { type: "json" }; +// deno-lint-ignore no-import-assertions +import data2 from "./data.json" assert { type: "json" }; + +console.log(data1.foo); +console.log(data2.foo); diff --git a/tests/specs/run/import_blob_url/__test__.jsonc b/tests/specs/run/import_blob_url/__test__.jsonc new file mode 100644 index 0000000000..9ae6b5a423 --- /dev/null +++ b/tests/specs/run/import_blob_url/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload import_blob_url.ts", + "output": "import_blob_url.ts.out" +} diff --git a/tests/testdata/run/import_blob_url.ts b/tests/specs/run/import_blob_url/import_blob_url.ts similarity index 100% rename from tests/testdata/run/import_blob_url.ts rename to tests/specs/run/import_blob_url/import_blob_url.ts diff --git a/tests/testdata/run/import_blob_url.ts.out b/tests/specs/run/import_blob_url/import_blob_url.ts.out similarity index 100% rename from tests/testdata/run/import_blob_url.ts.out rename to tests/specs/run/import_blob_url/import_blob_url.ts.out diff --git a/tests/specs/run/import_blob_url_error_stack/__test__.jsonc b/tests/specs/run/import_blob_url_error_stack/__test__.jsonc new file mode 100644 index 0000000000..56a1489cd7 --- /dev/null +++ b/tests/specs/run/import_blob_url_error_stack/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload import_blob_url_error_stack.ts", + "output": "import_blob_url_error_stack.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/import_blob_url_error_stack.ts b/tests/specs/run/import_blob_url_error_stack/import_blob_url_error_stack.ts similarity index 100% rename from tests/testdata/run/import_blob_url_error_stack.ts rename to tests/specs/run/import_blob_url_error_stack/import_blob_url_error_stack.ts diff --git a/tests/testdata/run/import_blob_url_error_stack.ts.out b/tests/specs/run/import_blob_url_error_stack/import_blob_url_error_stack.ts.out similarity index 100% rename from tests/testdata/run/import_blob_url_error_stack.ts.out rename to tests/specs/run/import_blob_url_error_stack/import_blob_url_error_stack.ts.out diff --git a/tests/specs/run/import_blob_url_import_relative/__test__.jsonc b/tests/specs/run/import_blob_url_import_relative/__test__.jsonc new file mode 100644 index 0000000000..4fda81b311 --- /dev/null +++ b/tests/specs/run/import_blob_url_import_relative/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload import_blob_url_import_relative.ts", + "output": "import_blob_url_import_relative.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/import_blob_url_import_relative.ts b/tests/specs/run/import_blob_url_import_relative/import_blob_url_import_relative.ts similarity index 100% rename from tests/testdata/run/import_blob_url_import_relative.ts rename to tests/specs/run/import_blob_url_import_relative/import_blob_url_import_relative.ts diff --git a/tests/testdata/run/import_blob_url_import_relative.ts.out b/tests/specs/run/import_blob_url_import_relative/import_blob_url_import_relative.ts.out similarity index 100% rename from tests/testdata/run/import_blob_url_import_relative.ts.out rename to tests/specs/run/import_blob_url_import_relative/import_blob_url_import_relative.ts.out diff --git a/tests/specs/run/import_blob_url_imports/__test__.jsonc b/tests/specs/run/import_blob_url_imports/__test__.jsonc new file mode 100644 index 0000000000..511d22a593 --- /dev/null +++ b/tests/specs/run/import_blob_url_imports/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --quiet --reload --allow-net=localhost:4545 import_blob_url_imports.ts", + "output": "import_blob_url_imports.ts.out" +} diff --git a/tests/testdata/run/import_blob_url_imports.ts b/tests/specs/run/import_blob_url_imports/import_blob_url_imports.ts similarity index 100% rename from tests/testdata/run/import_blob_url_imports.ts rename to tests/specs/run/import_blob_url_imports/import_blob_url_imports.ts diff --git a/tests/testdata/run/import_extensionless.ts.out b/tests/specs/run/import_blob_url_imports/import_blob_url_imports.ts.out similarity index 100% rename from tests/testdata/run/import_extensionless.ts.out rename to tests/specs/run/import_blob_url_imports/import_blob_url_imports.ts.out diff --git a/tests/specs/run/import_blob_url_jsx/__test__.jsonc b/tests/specs/run/import_blob_url_jsx/__test__.jsonc new file mode 100644 index 0000000000..985c6f8421 --- /dev/null +++ b/tests/specs/run/import_blob_url_jsx/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload import_blob_url_jsx.ts", + "output": "import_blob_url_jsx.ts.out" +} diff --git a/tests/testdata/run/import_blob_url_jsx.ts b/tests/specs/run/import_blob_url_jsx/import_blob_url_jsx.ts similarity index 100% rename from tests/testdata/run/import_blob_url_jsx.ts rename to tests/specs/run/import_blob_url_jsx/import_blob_url_jsx.ts diff --git a/tests/testdata/run/import_blob_url_jsx.ts.out b/tests/specs/run/import_blob_url_jsx/import_blob_url_jsx.ts.out similarity index 100% rename from tests/testdata/run/import_blob_url_jsx.ts.out rename to tests/specs/run/import_blob_url_jsx/import_blob_url_jsx.ts.out diff --git a/tests/specs/run/import_compression/__test__.jsonc b/tests/specs/run/import_compression/__test__.jsonc new file mode 100644 index 0000000000..c8f7af9e1c --- /dev/null +++ b/tests/specs/run/import_compression/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --quiet --reload --allow-net import_compression/main.ts", + "output": "import_compression/main.out" +} diff --git a/tests/specs/run/import_compression/import_compression/brotli b/tests/specs/run/import_compression/import_compression/brotli new file mode 100644 index 0000000000..65f679d571 --- /dev/null +++ b/tests/specs/run/import_compression/import_compression/brotli @@ -0,0 +1,2 @@ +‹ +€console.log('brotli'); \ No newline at end of file diff --git a/tests/specs/run/import_compression/import_compression/gziped b/tests/specs/run/import_compression/import_compression/gziped new file mode 100644 index 0000000000..9f9a7bc690 Binary files /dev/null and b/tests/specs/run/import_compression/import_compression/gziped differ diff --git a/tests/testdata/run/import_compression/main.out b/tests/specs/run/import_compression/import_compression/main.out similarity index 100% rename from tests/testdata/run/import_compression/main.out rename to tests/specs/run/import_compression/import_compression/main.out diff --git a/tests/testdata/run/import_compression/main.ts b/tests/specs/run/import_compression/import_compression/main.ts similarity index 100% rename from tests/testdata/run/import_compression/main.ts rename to tests/specs/run/import_compression/import_compression/main.ts diff --git a/tests/specs/run/import_data_url/__test__.jsonc b/tests/specs/run/import_data_url/__test__.jsonc new file mode 100644 index 0000000000..95d1c94a34 --- /dev/null +++ b/tests/specs/run/import_data_url/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload import_data_url.ts", + "output": "import_data_url.ts.out" +} diff --git a/tests/testdata/run/import_data_url.ts b/tests/specs/run/import_data_url/import_data_url.ts similarity index 100% rename from tests/testdata/run/import_data_url.ts rename to tests/specs/run/import_data_url/import_data_url.ts diff --git a/tests/testdata/run/import_data_url.ts.out b/tests/specs/run/import_data_url/import_data_url.ts.out similarity index 100% rename from tests/testdata/run/import_data_url.ts.out rename to tests/specs/run/import_data_url/import_data_url.ts.out diff --git a/tests/specs/run/import_data_url_error_stack/__test__.jsonc b/tests/specs/run/import_data_url_error_stack/__test__.jsonc new file mode 100644 index 0000000000..851aae191d --- /dev/null +++ b/tests/specs/run/import_data_url_error_stack/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload import_data_url_error_stack.ts", + "output": "import_data_url_error_stack.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/import_data_url_error_stack.ts b/tests/specs/run/import_data_url_error_stack/import_data_url_error_stack.ts similarity index 100% rename from tests/testdata/run/import_data_url_error_stack.ts rename to tests/specs/run/import_data_url_error_stack/import_data_url_error_stack.ts diff --git a/tests/testdata/run/import_data_url_error_stack.ts.out b/tests/specs/run/import_data_url_error_stack/import_data_url_error_stack.ts.out similarity index 100% rename from tests/testdata/run/import_data_url_error_stack.ts.out rename to tests/specs/run/import_data_url_error_stack/import_data_url_error_stack.ts.out diff --git a/tests/specs/run/import_data_url_import_relative/__test__.jsonc b/tests/specs/run/import_data_url_import_relative/__test__.jsonc new file mode 100644 index 0000000000..b241bc917c --- /dev/null +++ b/tests/specs/run/import_data_url_import_relative/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload import_data_url_import_relative.ts", + "output": "import_data_url_import_relative.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/import_data_url_import_relative.ts b/tests/specs/run/import_data_url_import_relative/import_data_url_import_relative.ts similarity index 100% rename from tests/testdata/run/import_data_url_import_relative.ts rename to tests/specs/run/import_data_url_import_relative/import_data_url_import_relative.ts diff --git a/tests/testdata/run/import_data_url_import_relative.ts.out b/tests/specs/run/import_data_url_import_relative/import_data_url_import_relative.ts.out similarity index 100% rename from tests/testdata/run/import_data_url_import_relative.ts.out rename to tests/specs/run/import_data_url_import_relative/import_data_url_import_relative.ts.out diff --git a/tests/specs/run/import_data_url_imports/__test__.jsonc b/tests/specs/run/import_data_url_imports/__test__.jsonc new file mode 100644 index 0000000000..7fc8df315c --- /dev/null +++ b/tests/specs/run/import_data_url_imports/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --quiet --reload import_data_url_imports.ts", + "output": "import_data_url_imports.ts.out" +} diff --git a/tests/testdata/run/import_data_url_imports.ts b/tests/specs/run/import_data_url_imports/import_data_url_imports.ts similarity index 100% rename from tests/testdata/run/import_data_url_imports.ts rename to tests/specs/run/import_data_url_imports/import_data_url_imports.ts diff --git a/tests/testdata/run/issue13562.ts.out b/tests/specs/run/import_data_url_imports/import_data_url_imports.ts.out similarity index 100% rename from tests/testdata/run/issue13562.ts.out rename to tests/specs/run/import_data_url_imports/import_data_url_imports.ts.out diff --git a/tests/specs/run/import_data_url_jsx/__test__.jsonc b/tests/specs/run/import_data_url_jsx/__test__.jsonc new file mode 100644 index 0000000000..8fb1f9a1d9 --- /dev/null +++ b/tests/specs/run/import_data_url_jsx/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload import_data_url_jsx.ts", + "output": "import_data_url_jsx.ts.out" +} diff --git a/tests/testdata/run/import_data_url_jsx.ts b/tests/specs/run/import_data_url_jsx/import_data_url_jsx.ts similarity index 100% rename from tests/testdata/run/import_data_url_jsx.ts rename to tests/specs/run/import_data_url_jsx/import_data_url_jsx.ts diff --git a/tests/testdata/run/import_data_url_jsx.ts.out b/tests/specs/run/import_data_url_jsx/import_data_url_jsx.ts.out similarity index 100% rename from tests/testdata/run/import_data_url_jsx.ts.out rename to tests/specs/run/import_data_url_jsx/import_data_url_jsx.ts.out diff --git a/tests/specs/run/import_dynamic_data_url/__test__.jsonc b/tests/specs/run/import_dynamic_data_url/__test__.jsonc new file mode 100644 index 0000000000..09ff77f419 --- /dev/null +++ b/tests/specs/run/import_dynamic_data_url/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload import_dynamic_data_url.ts", + "output": "import_dynamic_data_url.ts.out" +} diff --git a/tests/testdata/run/import_dynamic_data_url.ts b/tests/specs/run/import_dynamic_data_url/import_dynamic_data_url.ts similarity index 100% rename from tests/testdata/run/import_dynamic_data_url.ts rename to tests/specs/run/import_dynamic_data_url/import_dynamic_data_url.ts diff --git a/tests/testdata/run/import_dynamic_data_url.ts.out b/tests/specs/run/import_dynamic_data_url/import_dynamic_data_url.ts.out similarity index 100% rename from tests/testdata/run/import_dynamic_data_url.ts.out rename to tests/specs/run/import_dynamic_data_url/import_dynamic_data_url.ts.out diff --git a/tests/specs/run/import_extensionless/__test__.jsonc b/tests/specs/run/import_extensionless/__test__.jsonc new file mode 100644 index 0000000000..cde59b5e22 --- /dev/null +++ b/tests/specs/run/import_extensionless/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --quiet --reload import_extensionless.ts", + "output": "import_extensionless.ts.out" +} diff --git a/tests/testdata/run/import_extensionless.ts b/tests/specs/run/import_extensionless/import_extensionless.ts similarity index 100% rename from tests/testdata/run/import_extensionless.ts rename to tests/specs/run/import_extensionless/import_extensionless.ts diff --git a/tests/specs/run/import_extensionless/import_extensionless.ts.out b/tests/specs/run/import_extensionless/import_extensionless.ts.out new file mode 100644 index 0000000000..e965047ad7 --- /dev/null +++ b/tests/specs/run/import_extensionless/import_extensionless.ts.out @@ -0,0 +1 @@ +Hello diff --git a/tests/specs/run/import_file_with_colon/__test__.jsonc b/tests/specs/run/import_file_with_colon/__test__.jsonc new file mode 100644 index 0000000000..5e6602ab3e --- /dev/null +++ b/tests/specs/run/import_file_with_colon/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --quiet --reload import_file_with_colon.ts", + "output": "import_file_with_colon.ts.out" +} diff --git a/tests/testdata/run/import_file_with_colon.ts b/tests/specs/run/import_file_with_colon/import_file_with_colon.ts similarity index 100% rename from tests/testdata/run/import_file_with_colon.ts rename to tests/specs/run/import_file_with_colon/import_file_with_colon.ts diff --git a/tests/testdata/run/import_file_with_colon.ts.out b/tests/specs/run/import_file_with_colon/import_file_with_colon.ts.out similarity index 100% rename from tests/testdata/run/import_file_with_colon.ts.out rename to tests/specs/run/import_file_with_colon/import_file_with_colon.ts.out diff --git a/tests/specs/run/import_type/__test__.jsonc b/tests/specs/run/import_type/__test__.jsonc new file mode 100644 index 0000000000..2958483d00 --- /dev/null +++ b/tests/specs/run/import_type/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload import_type.ts", + "output": "import_type.ts.out" +} diff --git a/tests/specs/run/import_type/export_types.ts b/tests/specs/run/import_type/export_types.ts new file mode 100644 index 0000000000..18c8ed8810 --- /dev/null +++ b/tests/specs/run/import_type/export_types.ts @@ -0,0 +1,11 @@ +export interface A { + a: string; +} + +export class B implements A { + a = "a"; +} + +export function create(): B { + return new B(); +} diff --git a/tests/specs/run/import_type/import_type.ts b/tests/specs/run/import_type/import_type.ts new file mode 100644 index 0000000000..91baba19aa --- /dev/null +++ b/tests/specs/run/import_type/import_type.ts @@ -0,0 +1,5 @@ +import { type B, create } from "./export_types.ts"; + +const b: B = create(); + +console.log(b); diff --git a/tests/testdata/run/import_type.ts.out b/tests/specs/run/import_type/import_type.ts.out similarity index 100% rename from tests/testdata/run/import_type.ts.out rename to tests/specs/run/import_type/import_type.ts.out diff --git a/tests/specs/run/import_type_no_check/__test__.jsonc b/tests/specs/run/import_type_no_check/__test__.jsonc new file mode 100644 index 0000000000..d858f5fa10 --- /dev/null +++ b/tests/specs/run/import_type_no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --no-check import_type.ts", + "output": "import_type.ts.out" +} diff --git a/tests/specs/run/import_type_no_check/export_types.ts b/tests/specs/run/import_type_no_check/export_types.ts new file mode 100644 index 0000000000..18c8ed8810 --- /dev/null +++ b/tests/specs/run/import_type_no_check/export_types.ts @@ -0,0 +1,11 @@ +export interface A { + a: string; +} + +export class B implements A { + a = "a"; +} + +export function create(): B { + return new B(); +} diff --git a/tests/specs/run/import_type_no_check/import_type.ts b/tests/specs/run/import_type_no_check/import_type.ts new file mode 100644 index 0000000000..91baba19aa --- /dev/null +++ b/tests/specs/run/import_type_no_check/import_type.ts @@ -0,0 +1,5 @@ +import { type B, create } from "./export_types.ts"; + +const b: B = create(); + +console.log(b); diff --git a/tests/specs/run/import_type_no_check/import_type.ts.out b/tests/specs/run/import_type_no_check/import_type.ts.out new file mode 100644 index 0000000000..e35539e352 --- /dev/null +++ b/tests/specs/run/import_type_no_check/import_type.ts.out @@ -0,0 +1 @@ +B { a: "a" } diff --git a/tests/specs/run/inline_js_source_map_2/__test__.jsonc b/tests/specs/run/inline_js_source_map_2/__test__.jsonc new file mode 100644 index 0000000000..99ca6c1aed --- /dev/null +++ b/tests/specs/run/inline_js_source_map_2/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet inline_js_source_map_2.js", + "output": "inline_js_source_map_2.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/inline_js_source_map_2.js b/tests/specs/run/inline_js_source_map_2/inline_js_source_map_2.js similarity index 84% rename from tests/testdata/run/inline_js_source_map_2.js rename to tests/specs/run/inline_js_source_map_2/inline_js_source_map_2.js index d14d906b80..87132ee6a7 100644 --- a/tests/testdata/run/inline_js_source_map_2.js +++ b/tests/specs/run/inline_js_source_map_2/inline_js_source_map_2.js @@ -1,4 +1,4 @@ "use strict"; 1 + 1; throw new Error("Hello world!"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L3J1bi9pbmxpbmVfanNfc291cmNlX21hcF8yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ== \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L3J1bi9pbmxpbmVfanNfc291cmNlX21hcF8yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ== diff --git a/tests/testdata/run/inline_js_source_map_2.js.out b/tests/specs/run/inline_js_source_map_2/inline_js_source_map_2.js.out similarity index 100% rename from tests/testdata/run/inline_js_source_map_2.js.out rename to tests/specs/run/inline_js_source_map_2/inline_js_source_map_2.js.out diff --git a/tests/specs/run/inline_js_source_map_2_with_inline_contents/__test__.jsonc b/tests/specs/run/inline_js_source_map_2_with_inline_contents/__test__.jsonc new file mode 100644 index 0000000000..45fe6eba6d --- /dev/null +++ b/tests/specs/run/inline_js_source_map_2_with_inline_contents/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet inline_js_source_map_2_with_inline_contents.js", + "output": "inline_js_source_map_2_with_inline_contents.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js b/tests/specs/run/inline_js_source_map_2_with_inline_contents/inline_js_source_map_2_with_inline_contents.js similarity index 93% rename from tests/testdata/run/inline_js_source_map_2_with_inline_contents.js rename to tests/specs/run/inline_js_source_map_2_with_inline_contents/inline_js_source_map_2_with_inline_contents.js index 7660cc229b..41bee7fe4d 100644 --- a/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js +++ b/tests/specs/run/inline_js_source_map_2_with_inline_contents/inline_js_source_map_2_with_inline_contents.js @@ -1,4 +1,4 @@ "use strict"; throw new Error("Hello world!"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L3J1bi9pbmxpbmVfanNfc291cmNlX21hcF8yLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIjErMTtcbmludGVyZmFjZSBUZXN0IHtcbiAgaGVsbG86IHN0cmluZztcbn1cblxudGhyb3cgbmV3IEVycm9yKFwiSGVsbG8gd29ybGQhXCIgYXMgdW5rbm93biBhcyBzdHJpbmcpO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ== \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L3J1bi9pbmxpbmVfanNfc291cmNlX21hcF8yLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIjErMTtcbmludGVyZmFjZSBUZXN0IHtcbiAgaGVsbG86IHN0cmluZztcbn1cblxudGhyb3cgbmV3IEVycm9yKFwiSGVsbG8gd29ybGQhXCIgYXMgdW5rbm93biBhcyBzdHJpbmcpO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ== diff --git a/tests/testdata/run/inline_js_source_map_2_with_inline_contents.js.out b/tests/specs/run/inline_js_source_map_2_with_inline_contents/inline_js_source_map_2_with_inline_contents.js.out similarity index 100% rename from tests/testdata/run/inline_js_source_map_2_with_inline_contents.js.out rename to tests/specs/run/inline_js_source_map_2_with_inline_contents/inline_js_source_map_2_with_inline_contents.js.out diff --git a/tests/specs/run/inline_js_source_map_with_contents_from_graph/__test__.jsonc b/tests/specs/run/inline_js_source_map_with_contents_from_graph/__test__.jsonc new file mode 100644 index 0000000000..71dc4d509d --- /dev/null +++ b/tests/specs/run/inline_js_source_map_with_contents_from_graph/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --allow-import --quiet inline_js_source_map_with_contents_from_graph.js", + "output": "inline_js_source_map_with_contents_from_graph.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js b/tests/specs/run/inline_js_source_map_with_contents_from_graph/inline_js_source_map_with_contents_from_graph.js similarity index 86% rename from tests/testdata/run/inline_js_source_map_with_contents_from_graph.js rename to tests/specs/run/inline_js_source_map_with_contents_from_graph/inline_js_source_map_with_contents_from_graph.js index 887f023209..12fa1644df 100644 --- a/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js +++ b/tests/specs/run/inline_js_source_map_with_contents_from_graph/inline_js_source_map_with_contents_from_graph.js @@ -1,4 +1,4 @@ "use strict"; import "http://localhost:4545/run/inline_js_source_map.ts"; throw new Error("Hello world!"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L3J1bi9pbmxpbmVfanNfc291cmNlX21hcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsQ0FBQyxHQUFDLENBQUMsQ0FBQztBQUtKLE1BQU0sSUFBSSxLQUFLLENBQUMsY0FBK0IsQ0FBQyxDQUFDIn0= \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L3J1bi9pbmxpbmVfanNfc291cmNlX21hcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsQ0FBQyxHQUFDLENBQUMsQ0FBQztBQUtKLE1BQU0sSUFBSSxLQUFLLENBQUMsY0FBK0IsQ0FBQyxDQUFDIn0= diff --git a/tests/testdata/run/inline_js_source_map_with_contents_from_graph.js.out b/tests/specs/run/inline_js_source_map_with_contents_from_graph/inline_js_source_map_with_contents_from_graph.js.out similarity index 100% rename from tests/testdata/run/inline_js_source_map_with_contents_from_graph.js.out rename to tests/specs/run/inline_js_source_map_with_contents_from_graph/inline_js_source_map_with_contents_from_graph.js.out diff --git a/tests/specs/run/issue_13562/__test__.jsonc b/tests/specs/run/issue_13562/__test__.jsonc new file mode 100644 index 0000000000..1971d552b6 --- /dev/null +++ b/tests/specs/run/issue_13562/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run issue13562.ts", + "output": "issue13562.ts.out" +} diff --git a/tests/specs/run/issue_13562/issue13562.ts b/tests/specs/run/issue_13562/issue13562.ts new file mode 100644 index 0000000000..51e97629b6 --- /dev/null +++ b/tests/specs/run/issue_13562/issue13562.ts @@ -0,0 +1,3 @@ +import { printHello3 } from "./mod1.ts?q=.json"; + +printHello3(); diff --git a/tests/specs/run/issue_13562/issue13562.ts.out b/tests/specs/run/issue_13562/issue13562.ts.out new file mode 100644 index 0000000000..e965047ad7 --- /dev/null +++ b/tests/specs/run/issue_13562/issue13562.ts.out @@ -0,0 +1 @@ +Hello diff --git a/tests/specs/run/issue_13562/mod1.ts b/tests/specs/run/issue_13562/mod1.ts new file mode 100644 index 0000000000..5e58f432ed --- /dev/null +++ b/tests/specs/run/issue_13562/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/tests/specs/run/issue_13562/print_hello.ts b/tests/specs/run/issue_13562/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/issue_13562/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/issue_13562/subdir2/dynamic_import.ts b/tests/specs/run/issue_13562/subdir2/dynamic_import.ts new file mode 100644 index 0000000000..59beb64c33 --- /dev/null +++ b/tests/specs/run/issue_13562/subdir2/dynamic_import.ts @@ -0,0 +1,4 @@ +(async () => { + const { printHello } = await import("../mod2.ts"); + printHello(); +})(); diff --git a/tests/specs/run/issue_13562/subdir2/mod2.ts b/tests/specs/run/issue_13562/subdir2/mod2.ts new file mode 100644 index 0000000000..9071d0aeb4 --- /dev/null +++ b/tests/specs/run/issue_13562/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/tests/specs/run/js_import_detect/__test__.jsonc b/tests/specs/run/js_import_detect/__test__.jsonc new file mode 100644 index 0000000000..6a648f4763 --- /dev/null +++ b/tests/specs/run/js_import_detect/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload js_import_detect.ts", + "output": "js_import_detect.ts.out", + "exitCode": 0 +} diff --git a/tests/testdata/run/js_import_detect.ts b/tests/specs/run/js_import_detect/js_import_detect.ts similarity index 100% rename from tests/testdata/run/js_import_detect.ts rename to tests/specs/run/js_import_detect/js_import_detect.ts diff --git a/tests/testdata/run/js_import_detect.ts.out b/tests/specs/run/js_import_detect/js_import_detect.ts.out similarity index 100% rename from tests/testdata/run/js_import_detect.ts.out rename to tests/specs/run/js_import_detect/js_import_detect.ts.out diff --git a/tests/specs/run/js_root_with_ts_check/__test__.jsonc b/tests/specs/run/js_root_with_ts_check/__test__.jsonc new file mode 100644 index 0000000000..ebc4d75987 --- /dev/null +++ b/tests/specs/run/js_root_with_ts_check/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --check js_root_with_ts_check.js", + "output": "js_root_with_ts_check.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/js_root_with_ts_check.js b/tests/specs/run/js_root_with_ts_check/js_root_with_ts_check.js similarity index 100% rename from tests/testdata/run/js_root_with_ts_check.js rename to tests/specs/run/js_root_with_ts_check/js_root_with_ts_check.js diff --git a/tests/testdata/run/js_root_with_ts_check.js.out b/tests/specs/run/js_root_with_ts_check/js_root_with_ts_check.js.out similarity index 100% rename from tests/testdata/run/js_root_with_ts_check.js.out rename to tests/specs/run/js_root_with_ts_check/js_root_with_ts_check.js.out diff --git a/tests/specs/run/js_without_extension/__test__.jsonc b/tests/specs/run/js_without_extension/__test__.jsonc new file mode 100644 index 0000000000..0d2aac73b4 --- /dev/null +++ b/tests/specs/run/js_without_extension/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --ext js --check js_without_extension", + "output": "js_without_extension.out", + "exitCode": 0 +} diff --git a/tests/specs/run/js_without_extension/js_without_extension b/tests/specs/run/js_without_extension/js_without_extension new file mode 100644 index 0000000000..4774be3263 --- /dev/null +++ b/tests/specs/run/js_without_extension/js_without_extension @@ -0,0 +1,3 @@ +let i = 123; +i = "hello" +console.log("executing javascript with no extension"); diff --git a/tests/specs/run/js_without_extension/js_without_extension.out b/tests/specs/run/js_without_extension/js_without_extension.out new file mode 100644 index 0000000000..1236c1e534 --- /dev/null +++ b/tests/specs/run/js_without_extension/js_without_extension.out @@ -0,0 +1 @@ +executing javascript with no extension diff --git a/tests/specs/run/jsx_import_from_ts/__test__.jsonc b/tests/specs/run/jsx_import_from_ts/__test__.jsonc new file mode 100644 index 0000000000..0f89205dc1 --- /dev/null +++ b/tests/specs/run/jsx_import_from_ts/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload jsx_import_from_ts.ts", + "output": "jsx_import_from_ts.ts.out" +} diff --git a/tests/specs/run/jsx_import_from_ts/jsx_import_from_ts.App.jsx b/tests/specs/run/jsx_import_from_ts/jsx_import_from_ts.App.jsx new file mode 100644 index 0000000000..649230613c --- /dev/null +++ b/tests/specs/run/jsx_import_from_ts/jsx_import_from_ts.App.jsx @@ -0,0 +1,11 @@ +const React = { + createElement() {}, +}; + +export default function app() { + return ( +
+

asdf

+
+ ); +} diff --git a/tests/testdata/run/jsx_import_from_ts.ts b/tests/specs/run/jsx_import_from_ts/jsx_import_from_ts.ts similarity index 100% rename from tests/testdata/run/jsx_import_from_ts.ts rename to tests/specs/run/jsx_import_from_ts/jsx_import_from_ts.ts diff --git a/tests/testdata/run/jsx_import_from_ts.ts.out b/tests/specs/run/jsx_import_from_ts/jsx_import_from_ts.ts.out similarity index 100% rename from tests/testdata/run/jsx_import_from_ts.ts.out rename to tests/specs/run/jsx_import_from_ts/jsx_import_from_ts.ts.out diff --git a/tests/specs/run/jsx_import_source_error/__test__.jsonc b/tests/specs/run/jsx_import_source_error/__test__.jsonc new file mode 100644 index 0000000000..22b1d29cab --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --config jsx/deno-jsx-error.jsonc --check jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source_error.out", + "exitCode": 1 +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_error/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_error/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno.lock b/tests/specs/run/jsx_import_source_error/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_error/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_error/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/import-map.json b/tests/specs/run/jsx_import_source_error/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_error/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_error/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_error/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_error/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/testdata/run/jsx_import_source_error.out b/tests/specs/run/jsx_import_source_error/jsx_import_source_error.out similarity index 100% rename from tests/testdata/run/jsx_import_source_error.out rename to tests/specs/run/jsx_import_source_error/jsx_import_source_error.out diff --git a/tests/specs/run/jsx_import_source_error/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_error/jsx_import_source_no_pragma.tsx new file mode 100644 index 0000000000..2c756054fb --- /dev/null +++ b/tests/specs/run/jsx_import_source_error/jsx_import_source_no_pragma.tsx @@ -0,0 +1,7 @@ +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_import_map/__test__.jsonc b/tests/specs/run/jsx_import_source_import_map/__test__.jsonc new file mode 100644 index 0000000000..8a62c5243b --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-import-map.jsonc jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source_import_map.out" +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno.lock b/tests/specs/run/jsx_import_source_import_map/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_import_map/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/import-map.json b/tests/specs/run/jsx_import_source_import_map/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_import_map/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map/jsx_import_source_import_map.out b/tests/specs/run/jsx_import_source_import_map/jsx_import_source_import_map.out new file mode 100644 index 0000000000..0d32389677 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx_import_source_import_map.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_import_map/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_import_map/jsx_import_source_no_pragma.tsx new file mode 100644 index 0000000000..2c756054fb --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map/jsx_import_source_no_pragma.tsx @@ -0,0 +1,7 @@ +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/__test__.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/__test__.jsonc new file mode 100644 index 0000000000..b62e7cb6f3 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsxdev-import-map.jsonc jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source_import_map_dev.out" +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno.lock b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map.json b/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_import_map_dev.out b/tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_import_map_dev.out new file mode 100644 index 0000000000..56f514d90c --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_import_map_dev.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-dev-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_no_pragma.tsx new file mode 100644 index 0000000000..2c756054fb --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_no_pragma.tsx @@ -0,0 +1,7 @@ +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/__test__.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/__test__.jsonc new file mode 100644 index 0000000000..ea42654848 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-import-map.jsonc --no-check jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source_import_map.out" +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno.lock b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map.json b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_import_map.out b/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_import_map.out new file mode 100644 index 0000000000..0d32389677 --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_import_map.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_no_pragma.tsx new file mode 100644 index 0000000000..2c756054fb --- /dev/null +++ b/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_no_pragma.tsx @@ -0,0 +1,7 @@ +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/__test__.jsonc b/tests/specs/run/jsx_import_source_no_pragma/__test__.jsonc new file mode 100644 index 0000000000..7678e18f46 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source.out" +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno.lock b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map.json b/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/testdata/run/jsx_import_source.out b/tests/specs/run/jsx_import_source_no_pragma/jsx_import_source.out similarity index 100% rename from tests/testdata/run/jsx_import_source.out rename to tests/specs/run/jsx_import_source_no_pragma/jsx_import_source.out diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_no_pragma/jsx_import_source_no_pragma.tsx new file mode 100644 index 0000000000..2c756054fb --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma/jsx_import_source_no_pragma.tsx @@ -0,0 +1,7 @@ +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/__test__.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/__test__.jsonc new file mode 100644 index 0000000000..8f9ee81f69 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --config jsx/deno-jsxdev.jsonc --no-lock jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source_dev.out" +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno.lock b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map.json b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/testdata/run/jsx_import_source_dev.out b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_dev.out similarity index 100% rename from tests/testdata/run/jsx_import_source_dev.out rename to tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_dev.out diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_no_pragma.tsx new file mode 100644 index 0000000000..2c756054fb --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_no_pragma.tsx @@ -0,0 +1,7 @@ +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/__test__.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/__test__.jsonc new file mode 100644 index 0000000000..12cc9b0764 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --no-check jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source.out" +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno.lock b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map.json b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source.out b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source.out new file mode 100644 index 0000000000..b9555987a6 --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source_no_pragma.tsx new file mode 100644 index 0000000000..2c756054fb --- /dev/null +++ b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source_no_pragma.tsx @@ -0,0 +1,7 @@ +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_pragma/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma/__test__.jsonc new file mode 100644 index 0000000000..9d704c0650 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --allow-import jsx_import_source_pragma.tsx", + "output": "jsx_import_source.out" +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma/jsx_import_source.out b/tests/specs/run/jsx_import_source_pragma/jsx_import_source.out new file mode 100644 index 0000000000..b9555987a6 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma/jsx_import_source.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/testdata/run/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma/jsx_import_source_pragma.tsx similarity index 100% rename from tests/testdata/run/jsx_import_source_pragma.tsx rename to tests/specs/run/jsx_import_source_pragma/jsx_import_source_pragma.tsx diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/__test__.jsonc new file mode 100644 index 0000000000..9eafe51968 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --import-map jsx/import-map.json jsx_import_source_pragma_import_map.tsx", + "output": "jsx_import_source_import_map.out" +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_import_map.out b/tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_import_map.out new file mode 100644 index 0000000000..0d32389677 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_import_map.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime/index.ts diff --git a/tests/testdata/run/jsx_import_source_pragma_import_map.tsx b/tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_pragma_import_map.tsx similarity index 100% rename from tests/testdata/run/jsx_import_source_pragma_import_map.tsx rename to tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_pragma_import_map.tsx diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/__test__.jsonc new file mode 100644 index 0000000000..bb271c0eef --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --import-map jsx/import-map.json --config jsx/deno-jsxdev-import-map.jsonc jsx_import_source_pragma_import_map.tsx", + "output": "jsx_import_source_import_map_dev.out" +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_import_map_dev.out b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_import_map_dev.out new file mode 100644 index 0000000000..56f514d90c --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_import_map_dev.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-dev-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_pragma_import_map.tsx b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_pragma_import_map.tsx new file mode 100644 index 0000000000..548365f182 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_pragma_import_map.tsx @@ -0,0 +1,9 @@ +/** @jsxImportSource jsx */ + +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/__test__.jsonc new file mode 100644 index 0000000000..dd42b71fda --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --import-map jsx/import-map.json --no-check jsx_import_source_pragma_import_map.tsx", + "output": "jsx_import_source_import_map.out" +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_import_map.out b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_import_map.out new file mode 100644 index 0000000000..0d32389677 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_import_map.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_pragma_import_map.tsx b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_pragma_import_map.tsx new file mode 100644 index 0000000000..548365f182 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_pragma_import_map.tsx @@ -0,0 +1,9 @@ +/** @jsxImportSource jsx */ + +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/__test__.jsonc new file mode 100644 index 0000000000..0956b94a76 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --no-check jsx_import_source_pragma.tsx", + "output": "jsx_import_source.out" +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source.out b/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source.out new file mode 100644 index 0000000000..b9555987a6 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source_pragma.tsx new file mode 100644 index 0000000000..c19e53d4ff --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source_pragma.tsx @@ -0,0 +1,9 @@ +/** @jsxImportSource http://localhost:4545/jsx */ + +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/__test__.jsonc new file mode 100644 index 0000000000..aeaf209c3a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --allow-import --config jsx/deno-jsx.jsonc --no-lock jsx_import_source_pragma.tsx", + "output": "jsx_import_source.out" +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source.out b/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source.out new file mode 100644 index 0000000000..b9555987a6 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source_pragma.tsx new file mode 100644 index 0000000000..c19e53d4ff --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source_pragma.tsx @@ -0,0 +1,9 @@ +/** @jsxImportSource http://localhost:4545/jsx */ + +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/__test__.jsonc new file mode 100644 index 0000000000..3e8089fd2c --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --no-check jsx_import_source_pragma.tsx", + "output": "jsx_import_source.out" +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source.out b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source.out new file mode 100644 index 0000000000..b9555987a6 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source_pragma.tsx new file mode 100644 index 0000000000..c19e53d4ff --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source_pragma.tsx @@ -0,0 +1,9 @@ +/** @jsxImportSource http://localhost:4545/jsx */ + +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/__test__.jsonc new file mode 100644 index 0000000000..03ed1af1b6 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --vendor jsx_import_source_pragma.tsx", + "output": "jsx_import_source.out" +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/http_localhost_4545/jsx/#jsx-runtime_62ac8.js b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/http_localhost_4545/jsx/#jsx-runtime_62ac8.js new file mode 100644 index 0000000000..c8f0a908db --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/http_localhost_4545/jsx/#jsx-runtime_62ac8.js @@ -0,0 +1,11 @@ +export function jsx( + _type, + _props, + _key, + _source, + _self, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/manifest.json b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/manifest.json new file mode 100644 index 0000000000..a770c33669 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/manifest.json @@ -0,0 +1,9 @@ +{ + "modules": { + "http://localhost:4545/jsx/jsx-runtime": { + "headers": { + "content-type": "application/javascript" + } + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source.out b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source.out new file mode 100644 index 0000000000..b9555987a6 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source_pragma.tsx new file mode 100644 index 0000000000..c19e53d4ff --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source_pragma.tsx @@ -0,0 +1,9 @@ +/** @jsxImportSource http://localhost:4545/jsx */ + +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/__test__.jsonc new file mode 100644 index 0000000000..56734e4678 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --allow-import --config jsx/deno-jsxdev.jsonc --no-lock jsx_import_source_pragma.tsx", + "output": "jsx_import_source_dev.out" +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_dev.out b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_dev.out new file mode 100644 index 0000000000..38d7a12f05 --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_dev.out @@ -0,0 +1,2 @@ +[WILDCARD] +imported http://localhost:4545/jsx/jsx-dev-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_pragma.tsx new file mode 100644 index 0000000000..c19e53d4ff --- /dev/null +++ b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_pragma.tsx @@ -0,0 +1,9 @@ +/** @jsxImportSource http://localhost:4545/jsx */ + +function A() { + return "hello"; +} + +export function B() { + return ; +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/__test__.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/__test__.jsonc new file mode 100644 index 0000000000..c795a9d8e6 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --check --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-precompile.jsonc jsx_precompile/no_pragma.tsx", + "output": "jsx_precompile/no_pragma.out" +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno.lock b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map.json b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/testdata/run/jsx_precompile/no_pragma.out b/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/no_pragma.out similarity index 67% rename from tests/testdata/run/jsx_precompile/no_pragma.out rename to tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/no_pragma.out index 4379959230..f26984258c 100644 --- a/tests/testdata/run/jsx_precompile/no_pragma.out +++ b/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/no_pragma.out @@ -1,3 +1,3 @@ Download http://localhost:4545/jsx/jsx-precompile/index.ts -Check file:///[WILDCARD]/run/jsx_precompile/no_pragma.tsx +Check file:///[WILDCARD]/jsx_precompile/no_pragma.tsx imported http://localhost:4545/jsx/jsx-precompile/index.ts diff --git a/tests/testdata/run/jsx_precompile/no_pragma.tsx b/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/no_pragma.tsx similarity index 100% rename from tests/testdata/run/jsx_precompile/no_pragma.tsx rename to tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/no_pragma.tsx diff --git a/tests/testdata/run/jsx_precompile/skip.out b/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/skip.out similarity index 100% rename from tests/testdata/run/jsx_precompile/skip.out rename to tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/skip.out diff --git a/tests/testdata/run/jsx_precompile/skip.tsx b/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/skip.tsx similarity index 100% rename from tests/testdata/run/jsx_precompile/skip.tsx rename to tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/skip.tsx diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/__test__.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/__test__.jsonc new file mode 100644 index 0000000000..7163c83d00 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --check --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-precompile-skip.jsonc jsx_precompile/skip.tsx", + "output": "jsx_precompile/skip.out" +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-error.jsonc new file mode 100644 index 0000000000..37cb4dd912 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-error.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "./nonexistent" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-import-map.jsonc new file mode 100644 index 0000000000..5adbfa8b5a --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 0000000000..3c9e4fa1f8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile.jsonc new file mode 100644 index 0000000000..95ae1b9f31 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.json new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.jsonc new file mode 100644 index 0000000000..311409ea37 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev-import-map.jsonc new file mode 100644 index 0000000000..7481d5a2d8 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev-import-map.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev.jsonc new file mode 100644 index 0000000000..ae5bdf9f16 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev.jsonc @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsx": "react-jsxdev", + "jsxImportSource": "http://localhost:4545/jsx" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno.lock b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno.lock new file mode 100644 index 0000000000..011e8fe108 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" + } +} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map-scoped.json new file mode 100644 index 0000000000..9b2005128f --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map.json b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map.json new file mode 100644 index 0000000000..1bfa04e2f0 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", + "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-dev-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-dev-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-precompile/index.ts new file mode 100644 index 0000000000..0d56095e0b --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-precompile/index.ts @@ -0,0 +1,23 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +// deno-lint-ignore-file no-explicit-any +export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; +// deno-lint-ignore-file no-explicit-any +export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; +// deno-lint-ignore-file no-explicit-any +export const jsxEscape = (_value: any) => ""; +console.log("imported", import.meta.url); + +declare global { + namespace JSX { + interface IntrinsicElements { + [tagName: string]: Record; + } + } +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-runtime/index.ts new file mode 100644 index 0000000000..15e2029c8a --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-runtime/index.ts @@ -0,0 +1,12 @@ +// deno-lint-ignore-file no-explicit-any +export function jsx( + _type: any, + _props: any, + _key: any, + _source: any, + _self: any, +) {} +export const jsxs = jsx; +export const jsxDEV = jsx; +export const Fragment = Symbol("Fragment"); +console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.out b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.out new file mode 100644 index 0000000000..f26984258c --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.out @@ -0,0 +1,3 @@ +Download http://localhost:4545/jsx/jsx-precompile/index.ts +Check file:///[WILDCARD]/jsx_precompile/no_pragma.tsx +imported http://localhost:4545/jsx/jsx-precompile/index.ts diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.tsx b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.tsx new file mode 100644 index 0000000000..7ba21d80d2 --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.tsx @@ -0,0 +1,3 @@ +export function A() { + return

hello

; +} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.out b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.out new file mode 100644 index 0000000000..6696c550ca --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.out @@ -0,0 +1,3 @@ +Download http://localhost:4545/jsx/jsx-precompile/index.ts +Check file:///[WILDCARD]/jsx_precompile/skip.tsx +imported http://localhost:4545/jsx/jsx-precompile/index.ts diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.tsx b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.tsx new file mode 100644 index 0000000000..49bc4e2b7a --- /dev/null +++ b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.tsx @@ -0,0 +1,9 @@ +export function A() { + return ( +
+ foo +

hello

+ +
+ ); +} diff --git a/tests/specs/run/lock_check_ok/003_relative_import.ts b/tests/specs/run/lock_check_ok/003_relative_import.ts new file mode 100644 index 0000000000..d392f4a5d1 --- /dev/null +++ b/tests/specs/run/lock_check_ok/003_relative_import.ts @@ -0,0 +1,3 @@ +import { printHello } from "./print_hello.ts"; + +printHello(); diff --git a/tests/specs/run/lock_check_ok/003_relative_import.ts.out b/tests/specs/run/lock_check_ok/003_relative_import.ts.out new file mode 100644 index 0000000000..e965047ad7 --- /dev/null +++ b/tests/specs/run/lock_check_ok/003_relative_import.ts.out @@ -0,0 +1 @@ +Hello diff --git a/tests/specs/run/lock_check_ok/__test__.jsonc b/tests/specs/run/lock_check_ok/__test__.jsonc new file mode 100644 index 0000000000..e8ce4572e4 --- /dev/null +++ b/tests/specs/run/lock_check_ok/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --allow-import --lock=lock_check_ok.json 003_relative_import.ts", + "output": "003_relative_import.ts.out" +} diff --git a/tests/specs/run/lock_check_ok/lock_check_ok.json b/tests/specs/run/lock_check_ok/lock_check_ok.json new file mode 100644 index 0000000000..20f7e20005 --- /dev/null +++ b/tests/specs/run/lock_check_ok/lock_check_ok.json @@ -0,0 +1,4 @@ +{ + "http://127.0.0.1:4545/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/003_relative_import.ts": "a1572e8fd2c2712b33f04aed2561505b5feb2c8696f1f2cded3de7127931b97e" +} diff --git a/tests/specs/run/lock_check_ok/print_hello.ts b/tests/specs/run/lock_check_ok/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/lock_check_ok/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/lock_check_ok2/019_media_types.ts b/tests/specs/run/lock_check_ok2/019_media_types.ts new file mode 100644 index 0000000000..d985bd2496 --- /dev/null +++ b/tests/specs/run/lock_check_ok2/019_media_types.ts @@ -0,0 +1,24 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. + +import { loaded as loadedTs1 } from "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; +import { loaded as loadedTs2 } from "http://localhost:4545/subdir/mt_video_vdn.t2.ts"; +import { loaded as loadedTs3 } from "http://localhost:4545/subdir/mt_video_mp2t.t3.ts"; +import { loaded as loadedTs4 } from "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts"; +import { loaded as loadedJs1 } from "http://localhost:4545/subdir/mt_text_javascript.j1.js"; +import { loaded as loadedJs2 } from "http://localhost:4545/subdir/mt_application_ecmascript.j2.js"; +import { loaded as loadedJs3 } from "http://localhost:4545/subdir/mt_text_ecmascript.j3.js"; +import { loaded as loadedJs4 } from "http://localhost:4545/subdir/mt_application_x_javascript.j4.js"; + +console.log( + "success", + loadedTs1, + loadedTs2, + loadedTs3, + loadedTs4, + loadedJs1, + loadedJs2, + loadedJs3, + loadedJs4, +); diff --git a/tests/specs/run/lock_check_ok2/019_media_types.ts.out b/tests/specs/run/lock_check_ok2/019_media_types.ts.out new file mode 100644 index 0000000000..b3e94678c5 --- /dev/null +++ b/tests/specs/run/lock_check_ok2/019_media_types.ts.out @@ -0,0 +1 @@ +[WILDCARD]success true true true true true true true true diff --git a/tests/specs/run/lock_check_ok2/__test__.jsonc b/tests/specs/run/lock_check_ok2/__test__.jsonc new file mode 100644 index 0000000000..dc790528a2 --- /dev/null +++ b/tests/specs/run/lock_check_ok2/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --lock=lock_check_ok2.json 019_media_types.ts", + "output": "019_media_types.ts.out" +} diff --git a/tests/testdata/run/lock_check_ok2.json b/tests/specs/run/lock_check_ok2/lock_check_ok2.json similarity index 100% rename from tests/testdata/run/lock_check_ok2.json rename to tests/specs/run/lock_check_ok2/lock_check_ok2.json diff --git a/tests/specs/run/lock_v2_check_ok/003_relative_import.ts b/tests/specs/run/lock_v2_check_ok/003_relative_import.ts new file mode 100644 index 0000000000..d392f4a5d1 --- /dev/null +++ b/tests/specs/run/lock_v2_check_ok/003_relative_import.ts @@ -0,0 +1,3 @@ +import { printHello } from "./print_hello.ts"; + +printHello(); diff --git a/tests/specs/run/lock_v2_check_ok/003_relative_import.ts.out b/tests/specs/run/lock_v2_check_ok/003_relative_import.ts.out new file mode 100644 index 0000000000..e965047ad7 --- /dev/null +++ b/tests/specs/run/lock_v2_check_ok/003_relative_import.ts.out @@ -0,0 +1 @@ +Hello diff --git a/tests/specs/run/lock_v2_check_ok/__test__.jsonc b/tests/specs/run/lock_v2_check_ok/__test__.jsonc new file mode 100644 index 0000000000..d7b819d569 --- /dev/null +++ b/tests/specs/run/lock_v2_check_ok/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --quiet --lock=lock_v2_check_ok.json 003_relative_import.ts", + "output": "003_relative_import.ts.out" +} diff --git a/tests/specs/run/lock_v2_check_ok/lock_v2_check_ok.json b/tests/specs/run/lock_v2_check_ok/lock_v2_check_ok.json new file mode 100644 index 0000000000..47a761fbdb --- /dev/null +++ b/tests/specs/run/lock_v2_check_ok/lock_v2_check_ok.json @@ -0,0 +1,7 @@ +{ + "version": "2", + "remote": { + "http://127.0.0.1:4545/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/003_relative_import.ts": "a1572e8fd2c2712b33f04aed2561505b5feb2c8696f1f2cded3de7127931b97e" + } +} diff --git a/tests/specs/run/lock_v2_check_ok/print_hello.ts b/tests/specs/run/lock_v2_check_ok/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/lock_v2_check_ok/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/lock_v2_check_ok2/019_media_types.ts b/tests/specs/run/lock_v2_check_ok2/019_media_types.ts new file mode 100644 index 0000000000..d985bd2496 --- /dev/null +++ b/tests/specs/run/lock_v2_check_ok2/019_media_types.ts @@ -0,0 +1,24 @@ +// When run against the test HTTP server, it will serve different media types +// based on the URL containing `.t#.` strings, which exercises the different +// mapping of media types end to end. + +import { loaded as loadedTs1 } from "http://localhost:4545/subdir/mt_text_typescript.t1.ts"; +import { loaded as loadedTs2 } from "http://localhost:4545/subdir/mt_video_vdn.t2.ts"; +import { loaded as loadedTs3 } from "http://localhost:4545/subdir/mt_video_mp2t.t3.ts"; +import { loaded as loadedTs4 } from "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts"; +import { loaded as loadedJs1 } from "http://localhost:4545/subdir/mt_text_javascript.j1.js"; +import { loaded as loadedJs2 } from "http://localhost:4545/subdir/mt_application_ecmascript.j2.js"; +import { loaded as loadedJs3 } from "http://localhost:4545/subdir/mt_text_ecmascript.j3.js"; +import { loaded as loadedJs4 } from "http://localhost:4545/subdir/mt_application_x_javascript.j4.js"; + +console.log( + "success", + loadedTs1, + loadedTs2, + loadedTs3, + loadedTs4, + loadedJs1, + loadedJs2, + loadedJs3, + loadedJs4, +); diff --git a/tests/specs/run/lock_v2_check_ok2/019_media_types.ts.out b/tests/specs/run/lock_v2_check_ok2/019_media_types.ts.out new file mode 100644 index 0000000000..b3e94678c5 --- /dev/null +++ b/tests/specs/run/lock_v2_check_ok2/019_media_types.ts.out @@ -0,0 +1 @@ +[WILDCARD]success true true true true true true true true diff --git a/tests/specs/run/lock_v2_check_ok2/__test__.jsonc b/tests/specs/run/lock_v2_check_ok2/__test__.jsonc new file mode 100644 index 0000000000..a9430b4bcd --- /dev/null +++ b/tests/specs/run/lock_v2_check_ok2/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --lock=lock_v2_check_ok2.json 019_media_types.ts", + "output": "019_media_types.ts.out" +} diff --git a/tests/testdata/run/lock_v2_check_ok2.json b/tests/specs/run/lock_v2_check_ok2/lock_v2_check_ok2.json similarity index 100% rename from tests/testdata/run/lock_v2_check_ok2.json rename to tests/specs/run/lock_v2_check_ok2/lock_v2_check_ok2.json diff --git a/tests/specs/run/long_data_url_formatting/__test__.jsonc b/tests/specs/run/long_data_url_formatting/__test__.jsonc new file mode 100644 index 0000000000..f7ae56c635 --- /dev/null +++ b/tests/specs/run/long_data_url_formatting/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run long_data_url_formatting.ts", + "output": "long_data_url_formatting.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/long_data_url_formatting.ts b/tests/specs/run/long_data_url_formatting/long_data_url_formatting.ts similarity index 100% rename from tests/testdata/run/long_data_url_formatting.ts rename to tests/specs/run/long_data_url_formatting/long_data_url_formatting.ts diff --git a/tests/testdata/run/long_data_url_formatting.ts.out b/tests/specs/run/long_data_url_formatting/long_data_url_formatting.ts.out similarity index 100% rename from tests/testdata/run/long_data_url_formatting.ts.out rename to tests/specs/run/long_data_url_formatting/long_data_url_formatting.ts.out diff --git a/tests/specs/run/main_module/__test__.jsonc b/tests/specs/run/main_module/__test__.jsonc new file mode 100644 index 0000000000..0d70eddbd9 --- /dev/null +++ b/tests/specs/run/main_module/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload main_module/main.ts", + "output": "main_module/main.out" +} diff --git a/tests/testdata/run/main_module/main.out b/tests/specs/run/main_module/main_module/main.out similarity index 100% rename from tests/testdata/run/main_module/main.out rename to tests/specs/run/main_module/main_module/main.out diff --git a/tests/testdata/run/main_module/main.ts b/tests/specs/run/main_module/main_module/main.ts similarity index 100% rename from tests/testdata/run/main_module/main.ts rename to tests/specs/run/main_module/main_module/main.ts diff --git a/tests/testdata/run/main_module/other.ts b/tests/specs/run/main_module/main_module/other.ts similarity index 100% rename from tests/testdata/run/main_module/other.ts rename to tests/specs/run/main_module/main_module/other.ts diff --git a/tests/specs/run/mts_dmts_mjs/__test__.jsonc b/tests/specs/run/mts_dmts_mjs/__test__.jsonc new file mode 100644 index 0000000000..b50bb4b19b --- /dev/null +++ b/tests/specs/run/mts_dmts_mjs/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run import.mts", + "output": "mts_dmts_mjs.out" +} diff --git a/tests/specs/run/mts_dmts_mjs/import.mts b/tests/specs/run/mts_dmts_mjs/import.mts new file mode 100644 index 0000000000..eeb200f598 --- /dev/null +++ b/tests/specs/run/mts_dmts_mjs/import.mts @@ -0,0 +1,4 @@ +import * as a from "./mod.mjs"; +import { type A } from "./types.d.mts"; + +console.log(a.a as A); diff --git a/tests/specs/run/mts_dmts_mjs/mod.mjs b/tests/specs/run/mts_dmts_mjs/mod.mjs new file mode 100644 index 0000000000..9233cce2f0 --- /dev/null +++ b/tests/specs/run/mts_dmts_mjs/mod.mjs @@ -0,0 +1 @@ +export const a = "a"; diff --git a/tests/testdata/run/mts_dmts_mjs.out b/tests/specs/run/mts_dmts_mjs/mts_dmts_mjs.out similarity index 100% rename from tests/testdata/run/mts_dmts_mjs.out rename to tests/specs/run/mts_dmts_mjs/mts_dmts_mjs.out diff --git a/tests/specs/run/mts_dmts_mjs/types.d.mts b/tests/specs/run/mts_dmts_mjs/types.d.mts new file mode 100644 index 0000000000..28c2821466 --- /dev/null +++ b/tests/specs/run/mts_dmts_mjs/types.d.mts @@ -0,0 +1 @@ +export type A = "a"; diff --git a/tests/specs/run/mts_dmts_mjs_no_check/__test__.jsonc b/tests/specs/run/mts_dmts_mjs_no_check/__test__.jsonc new file mode 100644 index 0000000000..0d36517bc1 --- /dev/null +++ b/tests/specs/run/mts_dmts_mjs_no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --no-check import.mts", + "output": "mts_dmts_mjs.out" +} diff --git a/tests/specs/run/mts_dmts_mjs_no_check/import.mts b/tests/specs/run/mts_dmts_mjs_no_check/import.mts new file mode 100644 index 0000000000..eeb200f598 --- /dev/null +++ b/tests/specs/run/mts_dmts_mjs_no_check/import.mts @@ -0,0 +1,4 @@ +import * as a from "./mod.mjs"; +import { type A } from "./types.d.mts"; + +console.log(a.a as A); diff --git a/tests/specs/run/mts_dmts_mjs_no_check/mod.mjs b/tests/specs/run/mts_dmts_mjs_no_check/mod.mjs new file mode 100644 index 0000000000..9233cce2f0 --- /dev/null +++ b/tests/specs/run/mts_dmts_mjs_no_check/mod.mjs @@ -0,0 +1 @@ +export const a = "a"; diff --git a/tests/specs/run/mts_dmts_mjs_no_check/mts_dmts_mjs.out b/tests/specs/run/mts_dmts_mjs_no_check/mts_dmts_mjs.out new file mode 100644 index 0000000000..7898192261 --- /dev/null +++ b/tests/specs/run/mts_dmts_mjs_no_check/mts_dmts_mjs.out @@ -0,0 +1 @@ +a diff --git a/tests/specs/run/mts_dmts_mjs_no_check/types.d.mts b/tests/specs/run/mts_dmts_mjs_no_check/types.d.mts new file mode 100644 index 0000000000..28c2821466 --- /dev/null +++ b/tests/specs/run/mts_dmts_mjs_no_check/types.d.mts @@ -0,0 +1 @@ +export type A = "a"; diff --git a/tests/specs/run/nested_error/__test__.jsonc b/tests/specs/run/nested_error/__test__.jsonc new file mode 100644 index 0000000000..d167832bae --- /dev/null +++ b/tests/specs/run/nested_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run nested_error/main.ts", + "output": "nested_error/main.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/nested_error/main.ts b/tests/specs/run/nested_error/nested_error/main.ts similarity index 100% rename from tests/testdata/run/nested_error/main.ts rename to tests/specs/run/nested_error/nested_error/main.ts diff --git a/tests/testdata/run/nested_error/main.ts.out b/tests/specs/run/nested_error/nested_error/main.ts.out similarity index 100% rename from tests/testdata/run/nested_error/main.ts.out rename to tests/specs/run/nested_error/nested_error/main.ts.out diff --git a/tests/specs/run/no_check/006_url_imports.ts b/tests/specs/run/no_check/006_url_imports.ts new file mode 100644 index 0000000000..ad2d259156 --- /dev/null +++ b/tests/specs/run/no_check/006_url_imports.ts @@ -0,0 +1,3 @@ +import { printHello } from "./mod2.ts"; +printHello(); +console.log("success"); diff --git a/tests/specs/run/no_check/006_url_imports.ts.out b/tests/specs/run/no_check/006_url_imports.ts.out new file mode 100644 index 0000000000..989ce33e93 --- /dev/null +++ b/tests/specs/run/no_check/006_url_imports.ts.out @@ -0,0 +1,2 @@ +Hello +success diff --git a/tests/specs/run/no_check/__test__.jsonc b/tests/specs/run/no_check/__test__.jsonc new file mode 100644 index 0000000000..696e08e2ad --- /dev/null +++ b/tests/specs/run/no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --quiet --reload --no-check 006_url_imports.ts", + "output": "006_url_imports.ts.out" +} diff --git a/tests/specs/run/no_check/mod2.ts b/tests/specs/run/no_check/mod2.ts new file mode 100644 index 0000000000..ce1adc0e81 --- /dev/null +++ b/tests/specs/run/no_check/mod2.ts @@ -0,0 +1 @@ +export { printHello } from "./print_hello.ts"; diff --git a/tests/specs/run/no_check/print_hello.ts b/tests/specs/run/no_check/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/no_check/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/no_check_decorators/__test__.jsonc b/tests/specs/run/no_check_decorators/__test__.jsonc new file mode 100644 index 0000000000..da50d30a05 --- /dev/null +++ b/tests/specs/run/no_check_decorators/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --no-check decorators/experimental/no_check/main.ts", + "output": "decorators/experimental/no_check/main.out" +} diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/deno.json b/tests/specs/run/no_check_decorators/decorators/experimental/deno.json new file mode 100644 index 0000000000..504cd646e1 --- /dev/null +++ b/tests/specs/run/no_check_decorators/decorators/experimental/deno.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "experimentalDecorators": true + } +} diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.out b/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.out new file mode 100644 index 0000000000..015f7076e8 --- /dev/null +++ b/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.out @@ -0,0 +1,3 @@ +a(): evaluated +a(): called +method diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.ts b/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.ts new file mode 100644 index 0000000000..9f7ec550d5 --- /dev/null +++ b/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.ts @@ -0,0 +1,21 @@ +// deno-lint-ignore-file +function a() { + console.log("a(): evaluated"); + return ( + _target: any, + _propertyKey: string, + _descriptor: PropertyDescriptor, + ) => { + console.log("a(): called"); + }; +} + +class B { + @a() + method() { + console.log("method"); + } +} + +const b = new B(); +b.method(); diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.out b/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.out new file mode 100644 index 0000000000..0fc1d4590e --- /dev/null +++ b/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.out @@ -0,0 +1,7 @@ +@A evaluated +@B evaluated +@B called +@A called +fn() called from @A +fn() called from @B +C.test() called diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.ts b/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.ts new file mode 100644 index 0000000000..40a26bbd4d --- /dev/null +++ b/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.ts @@ -0,0 +1,42 @@ +// deno-lint-ignore-file +function a() { + console.log("@A evaluated"); + return function ( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor, + ) { + console.log("@A called"); + const fn = descriptor.value; + descriptor.value = function () { + console.log("fn() called from @A"); + fn(); + }; + }; +} + +function b() { + console.log("@B evaluated"); + return function ( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor, + ) { + console.log("@B called"); + const fn = descriptor.value; + descriptor.value = function () { + console.log("fn() called from @B"); + fn(); + }; + }; +} + +class C { + @a() + @b() + static test() { + console.log("C.test() called"); + } +} + +C.test(); diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.out b/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.out new file mode 100644 index 0000000000..ea64fbaa63 --- /dev/null +++ b/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.out @@ -0,0 +1,3 @@ +Warning experimentalDecorators compiler option is deprecated and may be removed at any time +Check [WILDCARD] +SomeClass { someField: "asdf" } diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.ts b/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.ts new file mode 100644 index 0000000000..95fba6cd48 --- /dev/null +++ b/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.ts @@ -0,0 +1,14 @@ +// deno-lint-ignore-file + +function Decorate() { + return function (constructor: any): any { + return class extends constructor { + protected someField: string = "asdf"; + }; + }; +} + +@Decorate() +class SomeClass {} + +console.log(new SomeClass()); diff --git a/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.out b/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.out new file mode 100644 index 0000000000..39394952e8 --- /dev/null +++ b/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.out @@ -0,0 +1,3 @@ +starting m with arguments 1 +C.m 1 +ending m diff --git a/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.ts b/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.ts new file mode 100644 index 0000000000..00c8a85025 --- /dev/null +++ b/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.ts @@ -0,0 +1,21 @@ +// deno-lint-ignore no-explicit-any +function logged(value: any, { kind, name }: { kind: string; name: string }) { + if (kind === "method") { + return function (...args: unknown[]) { + console.log(`starting ${name} with arguments ${args.join(", ")}`); + // @ts-ignore this has implicit any type + const ret = value.call(this, ...args); + console.log(`ending ${name}`); + return ret; + }; + } +} + +class C { + @logged + m(arg: number) { + console.log("C.m", arg); + } +} + +new C().m(1); diff --git a/tests/specs/run/no_config_auto_discovery_for_local_script/__test__.jsonc b/tests/specs/run/no_config_auto_discovery_for_local_script/__test__.jsonc new file mode 100644 index 0000000000..0a03dbc228 --- /dev/null +++ b/tests/specs/run/no_config_auto_discovery_for_local_script/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --no-config --check frontend_work.ts", + "output": "no_auto_discovery.out", + "exitCode": 1 +} diff --git a/tests/specs/run/no_config_auto_discovery_for_local_script/frontend_work.ts b/tests/specs/run/no_config_auto_discovery_for_local_script/frontend_work.ts new file mode 100644 index 0000000000..783af44e4c --- /dev/null +++ b/tests/specs/run/no_config_auto_discovery_for_local_script/frontend_work.ts @@ -0,0 +1,4 @@ +function _main() { + console.log(document); +} +console.log("ok"); diff --git a/tests/testdata/run/with_config/no_auto_discovery.out b/tests/specs/run/no_config_auto_discovery_for_local_script/no_auto_discovery.out similarity index 78% rename from tests/testdata/run/with_config/no_auto_discovery.out rename to tests/specs/run/no_config_auto_discovery_for_local_script/no_auto_discovery.out index 59339ebe5f..f45a1097c7 100644 --- a/tests/testdata/run/with_config/no_auto_discovery.out +++ b/tests/specs/run/no_config_auto_discovery_for_local_script/no_auto_discovery.out @@ -1,4 +1,4 @@ error: TS2584 [ERROR]: Cannot find name 'document'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'. console.log(document); ~~~~~~~~ - at [WILDCARD]run/with_config/frontend_work.ts:2:15 + at [WILDCARD]frontend_work.ts:2:15 diff --git a/tests/specs/run/no_lock_flag/__test__.jsonc b/tests/specs/run/no_lock_flag/__test__.jsonc new file mode 100644 index 0000000000..b8485c8459 --- /dev/null +++ b/tests/specs/run/no_lock_flag/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --allow-import --no-lock no_lock_flag/main.ts", + "output": "no_lock_flag/main.out", + "exitCode": 0 +} diff --git a/tests/testdata/run/no_lock_flag/deno.json b/tests/specs/run/no_lock_flag/no_lock_flag/deno.json similarity index 100% rename from tests/testdata/run/no_lock_flag/deno.json rename to tests/specs/run/no_lock_flag/no_lock_flag/deno.json diff --git a/tests/testdata/run/no_lock_flag/deno.lock b/tests/specs/run/no_lock_flag/no_lock_flag/deno.lock similarity index 100% rename from tests/testdata/run/no_lock_flag/deno.lock rename to tests/specs/run/no_lock_flag/no_lock_flag/deno.lock diff --git a/tests/testdata/run/no_lock_flag/main.out b/tests/specs/run/no_lock_flag/no_lock_flag/main.out similarity index 100% rename from tests/testdata/run/no_lock_flag/main.out rename to tests/specs/run/no_lock_flag/no_lock_flag/main.out diff --git a/tests/testdata/run/no_lock_flag/main.ts b/tests/specs/run/no_lock_flag/no_lock_flag/main.ts similarity index 100% rename from tests/testdata/run/no_lock_flag/main.ts rename to tests/specs/run/no_lock_flag/no_lock_flag/main.ts diff --git a/tests/specs/run/no_prompt_flag/__test__.jsonc b/tests/specs/run/no_prompt_flag/__test__.jsonc new file mode 100644 index 0000000000..2342a63e80 --- /dev/null +++ b/tests/specs/run/no_prompt_flag/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --no-prompt no_prompt.ts", + "output": "" +} diff --git a/tests/specs/run/no_prompt_flag/no_prompt.ts b/tests/specs/run/no_prompt_flag/no_prompt.ts new file mode 100644 index 0000000000..17d54b92c1 --- /dev/null +++ b/tests/specs/run/no_prompt_flag/no_prompt.ts @@ -0,0 +1,10 @@ +new Worker("data:,setTimeout(() => Deno.exit(2), 200)", { type: "module" }); + +try { + await new Deno.Command("ps", { + stdout: "inherit", + stderr: "inherit", + }).output(); +} catch { + Deno.exit(0); +} diff --git a/tests/specs/run/node_env_var_allowlist/__test__.jsonc b/tests/specs/run/node_env_var_allowlist/__test__.jsonc new file mode 100644 index 0000000000..055ac62e89 --- /dev/null +++ b/tests/specs/run/node_env_var_allowlist/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --no-prompt node_env_var_allowlist.ts", + "output": "node_env_var_allowlist.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/node_env_var_allowlist.ts b/tests/specs/run/node_env_var_allowlist/node_env_var_allowlist.ts similarity index 100% rename from tests/testdata/run/node_env_var_allowlist.ts rename to tests/specs/run/node_env_var_allowlist/node_env_var_allowlist.ts diff --git a/tests/testdata/run/node_env_var_allowlist.ts.out b/tests/specs/run/node_env_var_allowlist/node_env_var_allowlist.ts.out similarity index 100% rename from tests/testdata/run/node_env_var_allowlist.ts.out rename to tests/specs/run/node_env_var_allowlist/node_env_var_allowlist.ts.out diff --git a/tests/specs/run/onload/__test__.jsonc b/tests/specs/run/onload/__test__.jsonc new file mode 100644 index 0000000000..b17dc665d1 --- /dev/null +++ b/tests/specs/run/onload/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --config deno.json onload/main.ts", + "output": "onload/main.out" +} diff --git a/tests/specs/run/onload/deno.json b/tests/specs/run/onload/deno.json new file mode 100644 index 0000000000..105514e133 --- /dev/null +++ b/tests/specs/run/onload/deno.json @@ -0,0 +1,4 @@ +{ + "lock": false, + "importMap": "../../../../import_map.json" +} diff --git a/tests/testdata/run/onload/imported.ts b/tests/specs/run/onload/onload/imported.ts similarity index 100% rename from tests/testdata/run/onload/imported.ts rename to tests/specs/run/onload/onload/imported.ts diff --git a/tests/testdata/run/onload/main.out b/tests/specs/run/onload/onload/main.out similarity index 100% rename from tests/testdata/run/onload/main.out rename to tests/specs/run/onload/onload/main.out diff --git a/tests/testdata/run/onload/main.ts b/tests/specs/run/onload/onload/main.ts similarity index 100% rename from tests/testdata/run/onload/main.ts rename to tests/specs/run/onload/onload/main.ts diff --git a/tests/testdata/run/onload/nest_imported.ts b/tests/specs/run/onload/onload/nest_imported.ts similarity index 100% rename from tests/testdata/run/onload/nest_imported.ts rename to tests/specs/run/onload/onload/nest_imported.ts diff --git a/tests/specs/run/op_exit_op_set_exit_code_in_worker/__test__.jsonc b/tests/specs/run/op_exit_op_set_exit_code_in_worker/__test__.jsonc new file mode 100644 index 0000000000..664fcb5c15 --- /dev/null +++ b/tests/specs/run/op_exit_op_set_exit_code_in_worker/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --no-check --allow-read op_exit_op_set_exit_code_in_worker.ts", + "output": "", + "exitCode": 21 +} diff --git a/tests/testdata/run/op_exit_op_set_exit_code_in_worker.ts b/tests/specs/run/op_exit_op_set_exit_code_in_worker/op_exit_op_set_exit_code_in_worker.ts similarity index 100% rename from tests/testdata/run/op_exit_op_set_exit_code_in_worker.ts rename to tests/specs/run/op_exit_op_set_exit_code_in_worker/op_exit_op_set_exit_code_in_worker.ts diff --git a/tests/specs/run/op_exit_op_set_exit_code_in_worker/op_exit_op_set_exit_code_worker.js b/tests/specs/run/op_exit_op_set_exit_code_in_worker/op_exit_op_set_exit_code_worker.js new file mode 100644 index 0000000000..9b284c37df --- /dev/null +++ b/tests/specs/run/op_exit_op_set_exit_code_in_worker/op_exit_op_set_exit_code_worker.js @@ -0,0 +1,4 @@ +self.onmessage = () => { + Deno[Deno.internal].core.ops.op_set_exit_code(42); + Deno.exit(); +}; diff --git a/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/__test__.jsonc b/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/__test__.jsonc new file mode 100644 index 0000000000..ac66ccdf14 --- /dev/null +++ b/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run -L debug main.ts", + "output": "main.out", + "exitCode": 1 +} diff --git a/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/deno.json b/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/deno.json new file mode 100644 index 0000000000..36e1765d1a --- /dev/null +++ b/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "dev": "deno run main.ts" + } +} diff --git a/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/main.out b/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/main.out new file mode 100644 index 0000000000..5ab43ac470 --- /dev/null +++ b/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/main.out @@ -0,0 +1,5 @@ +[WILDCARD]Config file found at '[WILDCARD]deno.json' +[WILDCARD] +error: Relative import path "chalk" not prefixed with / or ./ or ../ + hint: If you want to use a JSR or npm package, try running `deno add jsr:chalk` or `deno add npm:chalk` + at file:///[WILDCARD]/main.ts:3:19 diff --git a/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/main.ts b/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/main.ts new file mode 100644 index 0000000000..6016470a10 --- /dev/null +++ b/tests/specs/run/package_json_auto_discovered_for_local_script_arg_with_stop/main.ts @@ -0,0 +1,6 @@ +// This import should fail, because `package.json` is not discovered, as we're +// stopping the discovery when encountering `deno.json`. +import chalk from "chalk"; + +console.log("ok"); +console.log(chalk); diff --git a/tests/specs/run/permission_args/001_hello.js b/tests/specs/run/permission_args/001_hello.js new file mode 100644 index 0000000000..accefceba6 --- /dev/null +++ b/tests/specs/run/permission_args/001_hello.js @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/tests/specs/run/permission_args/__test__.jsonc b/tests/specs/run/permission_args/__test__.jsonc new file mode 100644 index 0000000000..2843ee3955 --- /dev/null +++ b/tests/specs/run/permission_args/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run 001_hello.js --allow-net", + "output": "permission_args.out" +} diff --git a/tests/testdata/run/permission_args.out b/tests/specs/run/permission_args/permission_args.out similarity index 100% rename from tests/testdata/run/permission_args.out rename to tests/specs/run/permission_args/permission_args.out diff --git a/tests/specs/run/permission_args_quiet/001_hello.js b/tests/specs/run/permission_args_quiet/001_hello.js new file mode 100644 index 0000000000..accefceba6 --- /dev/null +++ b/tests/specs/run/permission_args_quiet/001_hello.js @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/tests/specs/run/permission_args_quiet/001_hello.js.out b/tests/specs/run/permission_args_quiet/001_hello.js.out new file mode 100644 index 0000000000..557db03de9 --- /dev/null +++ b/tests/specs/run/permission_args_quiet/001_hello.js.out @@ -0,0 +1 @@ +Hello World diff --git a/tests/specs/run/permission_args_quiet/__test__.jsonc b/tests/specs/run/permission_args_quiet/__test__.jsonc new file mode 100644 index 0000000000..2b98b963e3 --- /dev/null +++ b/tests/specs/run/permission_args_quiet/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet 001_hello.js --allow-net", + "output": "001_hello.js.out" +} diff --git a/tests/specs/run/private_field_presence/__test__.jsonc b/tests/specs/run/private_field_presence/__test__.jsonc new file mode 100644 index 0000000000..982b882896 --- /dev/null +++ b/tests/specs/run/private_field_presence/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload private_field_presence.ts", + "output": "private_field_presence.ts.out" +} diff --git a/tests/testdata/run/private_field_presence.ts b/tests/specs/run/private_field_presence/private_field_presence.ts similarity index 100% rename from tests/testdata/run/private_field_presence.ts rename to tests/specs/run/private_field_presence/private_field_presence.ts diff --git a/tests/testdata/run/private_field_presence.ts.out b/tests/specs/run/private_field_presence/private_field_presence.ts.out similarity index 100% rename from tests/testdata/run/private_field_presence.ts.out rename to tests/specs/run/private_field_presence/private_field_presence.ts.out diff --git a/tests/specs/run/private_field_presence_no_check/__test__.jsonc b/tests/specs/run/private_field_presence_no_check/__test__.jsonc new file mode 100644 index 0000000000..b7a26db256 --- /dev/null +++ b/tests/specs/run/private_field_presence_no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --no-check private_field_presence.ts", + "output": "private_field_presence.ts.out" +} diff --git a/tests/specs/run/private_field_presence_no_check/private_field_presence.ts b/tests/specs/run/private_field_presence_no_check/private_field_presence.ts new file mode 100644 index 0000000000..7ce2840d8e --- /dev/null +++ b/tests/specs/run/private_field_presence_no_check/private_field_presence.ts @@ -0,0 +1,20 @@ +export class Person { + #name: string; + constructor(name: string) { + this.#name = name; + } + + equals(other: unknown) { + return other && + typeof other === "object" && + #name in other && + this.#name === other.#name; + } +} + +const a = new Person("alice"); +const b = new Person("bob"); +const c = new Person("alice"); + +console.log(a.equals(b)); +console.log(a.equals(c)); diff --git a/tests/specs/run/private_field_presence_no_check/private_field_presence.ts.out b/tests/specs/run/private_field_presence_no_check/private_field_presence.ts.out new file mode 100644 index 0000000000..1d474d5255 --- /dev/null +++ b/tests/specs/run/private_field_presence_no_check/private_field_presence.ts.out @@ -0,0 +1,2 @@ +false +true diff --git a/tests/specs/run/proto_exploit/__test__.jsonc b/tests/specs/run/proto_exploit/__test__.jsonc new file mode 100644 index 0000000000..218f38654a --- /dev/null +++ b/tests/specs/run/proto_exploit/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run proto_exploit.js", + "output": "proto_exploit.js.out" +} diff --git a/tests/testdata/run/proto_exploit.js b/tests/specs/run/proto_exploit/proto_exploit.js similarity index 100% rename from tests/testdata/run/proto_exploit.js rename to tests/specs/run/proto_exploit/proto_exploit.js diff --git a/tests/testdata/run/proto_exploit.js.out b/tests/specs/run/proto_exploit/proto_exploit.js.out similarity index 100% rename from tests/testdata/run/proto_exploit.js.out rename to tests/specs/run/proto_exploit/proto_exploit.js.out diff --git a/tests/specs/run/queue_microtask_error/__test__.jsonc b/tests/specs/run/queue_microtask_error/__test__.jsonc new file mode 100644 index 0000000000..30821d67f6 --- /dev/null +++ b/tests/specs/run/queue_microtask_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet queue_microtask_error.ts", + "output": "queue_microtask_error.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/queue_microtask_error.ts b/tests/specs/run/queue_microtask_error/queue_microtask_error.ts similarity index 100% rename from tests/testdata/run/queue_microtask_error.ts rename to tests/specs/run/queue_microtask_error/queue_microtask_error.ts diff --git a/tests/testdata/run/queue_microtask_error.ts.out b/tests/specs/run/queue_microtask_error/queue_microtask_error.ts.out similarity index 100% rename from tests/testdata/run/queue_microtask_error.ts.out rename to tests/specs/run/queue_microtask_error/queue_microtask_error.ts.out diff --git a/tests/specs/run/queue_microtask_error_handled/__test__.jsonc b/tests/specs/run/queue_microtask_error_handled/__test__.jsonc new file mode 100644 index 0000000000..c343acfb41 --- /dev/null +++ b/tests/specs/run/queue_microtask_error_handled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet queue_microtask_error_handled.ts", + "output": "queue_microtask_error_handled.ts.out" +} diff --git a/tests/testdata/run/queue_microtask_error_handled.ts b/tests/specs/run/queue_microtask_error_handled/queue_microtask_error_handled.ts similarity index 100% rename from tests/testdata/run/queue_microtask_error_handled.ts rename to tests/specs/run/queue_microtask_error_handled/queue_microtask_error_handled.ts diff --git a/tests/testdata/run/queue_microtask_error_handled.ts.out b/tests/specs/run/queue_microtask_error_handled/queue_microtask_error_handled.ts.out similarity index 100% rename from tests/testdata/run/queue_microtask_error_handled.ts.out rename to tests/specs/run/queue_microtask_error_handled/queue_microtask_error_handled.ts.out diff --git a/tests/specs/run/reference_types/__test__.jsonc b/tests/specs/run/reference_types/__test__.jsonc new file mode 100644 index 0000000000..4e4bd08b89 --- /dev/null +++ b/tests/specs/run/reference_types/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --quiet reference_types.ts", + "output": "reference_types.ts.out" +} diff --git a/tests/testdata/run/reference_types.ts b/tests/specs/run/reference_types/reference_types.ts similarity index 100% rename from tests/testdata/run/reference_types.ts rename to tests/specs/run/reference_types/reference_types.ts diff --git a/tests/testdata/run/reference_types_remote.ts.out b/tests/specs/run/reference_types/reference_types.ts.out similarity index 100% rename from tests/testdata/run/reference_types_remote.ts.out rename to tests/specs/run/reference_types/reference_types.ts.out diff --git a/tests/specs/run/reference_types_error/__test__.jsonc b/tests/specs/run/reference_types_error/__test__.jsonc new file mode 100644 index 0000000000..08450acc10 --- /dev/null +++ b/tests/specs/run/reference_types_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --config checkjs.tsconfig.json --check reference_types_error.js", + "output": "reference_types_error.js.out", + "exitCode": 1 +} diff --git a/tests/specs/run/reference_types_error/checkjs.tsconfig.json b/tests/specs/run/reference_types_error/checkjs.tsconfig.json new file mode 100644 index 0000000000..08ac60b6cd --- /dev/null +++ b/tests/specs/run/reference_types_error/checkjs.tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} diff --git a/tests/testdata/run/reference_types_error.js b/tests/specs/run/reference_types_error/reference_types_error.js similarity index 100% rename from tests/testdata/run/reference_types_error.js rename to tests/specs/run/reference_types_error/reference_types_error.js diff --git a/tests/testdata/run/reference_types_error.js.out b/tests/specs/run/reference_types_error/reference_types_error.js.out similarity index 100% rename from tests/testdata/run/reference_types_error.js.out rename to tests/specs/run/reference_types_error/reference_types_error.js.out diff --git a/tests/specs/run/reference_types_error_no_check/__test__.jsonc b/tests/specs/run/reference_types_error_no_check/__test__.jsonc new file mode 100644 index 0000000000..78744759d1 --- /dev/null +++ b/tests/specs/run/reference_types_error_no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --no-check reference_types_error.js", + "output": "" +} diff --git a/tests/specs/run/reference_types_error_no_check/reference_types_error.js b/tests/specs/run/reference_types_error_no_check/reference_types_error.js new file mode 100644 index 0000000000..68b6c21364 --- /dev/null +++ b/tests/specs/run/reference_types_error_no_check/reference_types_error.js @@ -0,0 +1,2 @@ +/// +export const a = 1; diff --git a/tests/specs/run/reference_types_error_vendor_dir/__test__.jsonc b/tests/specs/run/reference_types_error_vendor_dir/__test__.jsonc new file mode 100644 index 0000000000..c48dd1d5e1 --- /dev/null +++ b/tests/specs/run/reference_types_error_vendor_dir/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --config checkjs.tsconfig.json --check --vendor reference_types_error.js", + "output": "reference_types_error.js.out", + "exitCode": 1 +} diff --git a/tests/specs/run/reference_types_error_vendor_dir/checkjs.tsconfig.json b/tests/specs/run/reference_types_error_vendor_dir/checkjs.tsconfig.json new file mode 100644 index 0000000000..08ac60b6cd --- /dev/null +++ b/tests/specs/run/reference_types_error_vendor_dir/checkjs.tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} diff --git a/tests/specs/run/reference_types_error_vendor_dir/reference_types_error.js b/tests/specs/run/reference_types_error_vendor_dir/reference_types_error.js new file mode 100644 index 0000000000..68b6c21364 --- /dev/null +++ b/tests/specs/run/reference_types_error_vendor_dir/reference_types_error.js @@ -0,0 +1,2 @@ +/// +export const a = 1; diff --git a/tests/specs/run/reference_types_error_vendor_dir/reference_types_error.js.out b/tests/specs/run/reference_types_error_vendor_dir/reference_types_error.js.out new file mode 100644 index 0000000000..86055f3ac3 --- /dev/null +++ b/tests/specs/run/reference_types_error_vendor_dir/reference_types_error.js.out @@ -0,0 +1,2 @@ +error: Module not found "file:///[WILDCARD]/nonexistent.d.ts". + at file:///[WILDCARD]/reference_types_error.js:1:22 diff --git a/tests/specs/run/references_types_remote/__test__.jsonc b/tests/specs/run/references_types_remote/__test__.jsonc new file mode 100644 index 0000000000..3f7f27c268 --- /dev/null +++ b/tests/specs/run/references_types_remote/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --quiet reference_types_remote.ts", + "output": "reference_types_remote.ts.out" +} diff --git a/tests/testdata/run/reference_types_remote.ts b/tests/specs/run/references_types_remote/reference_types_remote.ts similarity index 100% rename from tests/testdata/run/reference_types_remote.ts rename to tests/specs/run/references_types_remote/reference_types_remote.ts diff --git a/tests/specs/run/references_types_remote/reference_types_remote.ts.out b/tests/specs/run/references_types_remote/reference_types_remote.ts.out new file mode 100644 index 0000000000..417b7b5370 --- /dev/null +++ b/tests/specs/run/references_types_remote/reference_types_remote.ts.out @@ -0,0 +1 @@ +undefined diff --git a/tests/specs/run/rejection_handled/__test__.jsonc b/tests/specs/run/rejection_handled/__test__.jsonc new file mode 100644 index 0000000000..7565a7dd10 --- /dev/null +++ b/tests/specs/run/rejection_handled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --check rejection_handled.ts", + "output": "rejection_handled.out" +} diff --git a/tests/testdata/run/rejection_handled.out b/tests/specs/run/rejection_handled/rejection_handled.out similarity index 100% rename from tests/testdata/run/rejection_handled.out rename to tests/specs/run/rejection_handled/rejection_handled.out diff --git a/tests/testdata/run/rejection_handled.ts b/tests/specs/run/rejection_handled/rejection_handled.ts similarity index 100% rename from tests/testdata/run/rejection_handled.ts rename to tests/specs/run/rejection_handled/rejection_handled.ts diff --git a/tests/specs/run/replace_self/__test__.jsonc b/tests/specs/run/replace_self/__test__.jsonc new file mode 100644 index 0000000000..cfadbf7918 --- /dev/null +++ b/tests/specs/run/replace_self/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run replace_self.js", + "output": "replace_self.js.out" +} diff --git a/tests/testdata/run/replace_self.js b/tests/specs/run/replace_self/replace_self.js similarity index 100% rename from tests/testdata/run/replace_self.js rename to tests/specs/run/replace_self/replace_self.js diff --git a/tests/testdata/run/replace_self.js.out b/tests/specs/run/replace_self/replace_self.js.out similarity index 100% rename from tests/testdata/run/replace_self.js.out rename to tests/specs/run/replace_self/replace_self.js.out diff --git a/tests/specs/run/report_error/__test__.jsonc b/tests/specs/run/report_error/__test__.jsonc new file mode 100644 index 0000000000..0577ad2450 --- /dev/null +++ b/tests/specs/run/report_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet report_error.ts", + "output": "report_error.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/report_error.ts b/tests/specs/run/report_error/report_error.ts similarity index 100% rename from tests/testdata/run/report_error.ts rename to tests/specs/run/report_error/report_error.ts diff --git a/tests/testdata/run/report_error.ts.out b/tests/specs/run/report_error/report_error.ts.out similarity index 100% rename from tests/testdata/run/report_error.ts.out rename to tests/specs/run/report_error/report_error.ts.out diff --git a/tests/specs/run/report_error_end_of_program/__test__.jsonc b/tests/specs/run/report_error_end_of_program/__test__.jsonc new file mode 100644 index 0000000000..c34956b74a --- /dev/null +++ b/tests/specs/run/report_error_end_of_program/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet report_error_end_of_program.ts", + "output": "report_error_end_of_program.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/report_error_end_of_program.ts b/tests/specs/run/report_error_end_of_program/report_error_end_of_program.ts similarity index 100% rename from tests/testdata/run/report_error_end_of_program.ts rename to tests/specs/run/report_error_end_of_program/report_error_end_of_program.ts diff --git a/tests/testdata/run/report_error_end_of_program.ts.out b/tests/specs/run/report_error_end_of_program/report_error_end_of_program.ts.out similarity index 100% rename from tests/testdata/run/report_error_end_of_program.ts.out rename to tests/specs/run/report_error_end_of_program/report_error_end_of_program.ts.out diff --git a/tests/specs/run/report_error_handled/__test__.jsonc b/tests/specs/run/report_error_handled/__test__.jsonc new file mode 100644 index 0000000000..126687b95e --- /dev/null +++ b/tests/specs/run/report_error_handled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet report_error_handled.ts", + "output": "report_error_handled.ts.out" +} diff --git a/tests/testdata/run/report_error_handled.ts b/tests/specs/run/report_error_handled/report_error_handled.ts similarity index 100% rename from tests/testdata/run/report_error_handled.ts rename to tests/specs/run/report_error_handled/report_error_handled.ts diff --git a/tests/testdata/run/report_error_handled.ts.out b/tests/specs/run/report_error_handled/report_error_handled.ts.out similarity index 100% rename from tests/testdata/run/report_error_handled.ts.out rename to tests/specs/run/report_error_handled/report_error_handled.ts.out diff --git a/tests/specs/run/runtime_decorators/__test__.jsonc b/tests/specs/run/runtime_decorators/__test__.jsonc new file mode 100644 index 0000000000..286fd377d8 --- /dev/null +++ b/tests/specs/run/runtime_decorators/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --no-check decorators/experimental/runtime/main.ts", + "output": "decorators/experimental/runtime/main.out" +} diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/deno.json b/tests/specs/run/runtime_decorators/decorators/experimental/deno.json new file mode 100644 index 0000000000..504cd646e1 --- /dev/null +++ b/tests/specs/run/runtime_decorators/decorators/experimental/deno.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "experimentalDecorators": true + } +} diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.out b/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.out new file mode 100644 index 0000000000..015f7076e8 --- /dev/null +++ b/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.out @@ -0,0 +1,3 @@ +a(): evaluated +a(): called +method diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.ts b/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.ts new file mode 100644 index 0000000000..9f7ec550d5 --- /dev/null +++ b/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.ts @@ -0,0 +1,21 @@ +// deno-lint-ignore-file +function a() { + console.log("a(): evaluated"); + return ( + _target: any, + _propertyKey: string, + _descriptor: PropertyDescriptor, + ) => { + console.log("a(): called"); + }; +} + +class B { + @a() + method() { + console.log("method"); + } +} + +const b = new B(); +b.method(); diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.out b/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.out new file mode 100644 index 0000000000..0fc1d4590e --- /dev/null +++ b/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.out @@ -0,0 +1,7 @@ +@A evaluated +@B evaluated +@B called +@A called +fn() called from @A +fn() called from @B +C.test() called diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.ts b/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.ts new file mode 100644 index 0000000000..40a26bbd4d --- /dev/null +++ b/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.ts @@ -0,0 +1,42 @@ +// deno-lint-ignore-file +function a() { + console.log("@A evaluated"); + return function ( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor, + ) { + console.log("@A called"); + const fn = descriptor.value; + descriptor.value = function () { + console.log("fn() called from @A"); + fn(); + }; + }; +} + +function b() { + console.log("@B evaluated"); + return function ( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor, + ) { + console.log("@B called"); + const fn = descriptor.value; + descriptor.value = function () { + console.log("fn() called from @B"); + fn(); + }; + }; +} + +class C { + @a() + @b() + static test() { + console.log("C.test() called"); + } +} + +C.test(); diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.out b/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.out new file mode 100644 index 0000000000..ea64fbaa63 --- /dev/null +++ b/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.out @@ -0,0 +1,3 @@ +Warning experimentalDecorators compiler option is deprecated and may be removed at any time +Check [WILDCARD] +SomeClass { someField: "asdf" } diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.ts b/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.ts new file mode 100644 index 0000000000..95fba6cd48 --- /dev/null +++ b/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.ts @@ -0,0 +1,14 @@ +// deno-lint-ignore-file + +function Decorate() { + return function (constructor: any): any { + return class extends constructor { + protected someField: string = "asdf"; + }; + }; +} + +@Decorate() +class SomeClass {} + +console.log(new SomeClass()); diff --git a/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.out b/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.out new file mode 100644 index 0000000000..39394952e8 --- /dev/null +++ b/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.out @@ -0,0 +1,3 @@ +starting m with arguments 1 +C.m 1 +ending m diff --git a/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.ts b/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.ts new file mode 100644 index 0000000000..00c8a85025 --- /dev/null +++ b/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.ts @@ -0,0 +1,21 @@ +// deno-lint-ignore no-explicit-any +function logged(value: any, { kind, name }: { kind: string; name: string }) { + if (kind === "method") { + return function (...args: unknown[]) { + console.log(`starting ${name} with arguments ${args.join(", ")}`); + // @ts-ignore this has implicit any type + const ret = value.call(this, ...args); + console.log(`ending ${name}`); + return ret; + }; + } +} + +class C { + @logged + m(arg: number) { + console.log("C.m", arg); + } +} + +new C().m(1); diff --git a/tests/specs/run/seed_random/__test__.jsonc b/tests/specs/run/seed_random/__test__.jsonc new file mode 100644 index 0000000000..5a1876d6c3 --- /dev/null +++ b/tests/specs/run/seed_random/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --seed=100 seed_random.js", + "output": "seed_random.js.out" +} diff --git a/tests/testdata/run/seed_random.js b/tests/specs/run/seed_random/seed_random.js similarity index 100% rename from tests/testdata/run/seed_random.js rename to tests/specs/run/seed_random/seed_random.js diff --git a/tests/testdata/run/seed_random.js.out b/tests/specs/run/seed_random/seed_random.js.out similarity index 100% rename from tests/testdata/run/seed_random.js.out rename to tests/specs/run/seed_random/seed_random.js.out diff --git a/tests/specs/run/set_exit_code_0/__test__.jsonc b/tests/specs/run/set_exit_code_0/__test__.jsonc new file mode 100644 index 0000000000..a5866e8c69 --- /dev/null +++ b/tests/specs/run/set_exit_code_0/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --no-check set_exit_code_0.ts", + "output": "", + "exitCode": 0 +} diff --git a/tests/testdata/run/set_exit_code_0.ts b/tests/specs/run/set_exit_code_0/set_exit_code_0.ts similarity index 100% rename from tests/testdata/run/set_exit_code_0.ts rename to tests/specs/run/set_exit_code_0/set_exit_code_0.ts diff --git a/tests/specs/run/set_exit_code_1/__test__.jsonc b/tests/specs/run/set_exit_code_1/__test__.jsonc new file mode 100644 index 0000000000..1ca50c9827 --- /dev/null +++ b/tests/specs/run/set_exit_code_1/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --no-check set_exit_code_1.ts", + "output": "", + "exitCode": 42 +} diff --git a/tests/testdata/run/set_exit_code_1.ts b/tests/specs/run/set_exit_code_1/set_exit_code_1.ts similarity index 100% rename from tests/testdata/run/set_exit_code_1.ts rename to tests/specs/run/set_exit_code_1/set_exit_code_1.ts diff --git a/tests/specs/run/set_exit_code_2/__test__.jsonc b/tests/specs/run/set_exit_code_2/__test__.jsonc new file mode 100644 index 0000000000..af7411f7cb --- /dev/null +++ b/tests/specs/run/set_exit_code_2/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --no-check set_exit_code_2.ts", + "output": "", + "exitCode": 42 +} diff --git a/tests/testdata/run/set_exit_code_2.ts b/tests/specs/run/set_exit_code_2/set_exit_code_2.ts similarity index 100% rename from tests/testdata/run/set_exit_code_2.ts rename to tests/specs/run/set_exit_code_2/set_exit_code_2.ts diff --git a/tests/specs/run/set_timeout_error/__test__.jsonc b/tests/specs/run/set_timeout_error/__test__.jsonc new file mode 100644 index 0000000000..eea730fd87 --- /dev/null +++ b/tests/specs/run/set_timeout_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet set_timeout_error.ts", + "output": "set_timeout_error.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/set_timeout_error.ts b/tests/specs/run/set_timeout_error/set_timeout_error.ts similarity index 100% rename from tests/testdata/run/set_timeout_error.ts rename to tests/specs/run/set_timeout_error/set_timeout_error.ts diff --git a/tests/testdata/run/set_timeout_error.ts.out b/tests/specs/run/set_timeout_error/set_timeout_error.ts.out similarity index 100% rename from tests/testdata/run/set_timeout_error.ts.out rename to tests/specs/run/set_timeout_error/set_timeout_error.ts.out diff --git a/tests/specs/run/set_timeout_error_handled/__test__.jsonc b/tests/specs/run/set_timeout_error_handled/__test__.jsonc new file mode 100644 index 0000000000..39a9424bbc --- /dev/null +++ b/tests/specs/run/set_timeout_error_handled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet set_timeout_error_handled.ts", + "output": "set_timeout_error_handled.ts.out" +} diff --git a/tests/testdata/run/set_timeout_error_handled.ts b/tests/specs/run/set_timeout_error_handled/set_timeout_error_handled.ts similarity index 100% rename from tests/testdata/run/set_timeout_error_handled.ts rename to tests/specs/run/set_timeout_error_handled/set_timeout_error_handled.ts diff --git a/tests/testdata/run/set_timeout_error_handled.ts.out b/tests/specs/run/set_timeout_error_handled/set_timeout_error_handled.ts.out similarity index 100% rename from tests/testdata/run/set_timeout_error_handled.ts.out rename to tests/specs/run/set_timeout_error_handled/set_timeout_error_handled.ts.out diff --git a/tests/specs/run/shebang_swc/__test__.jsonc b/tests/specs/run/shebang_swc/__test__.jsonc new file mode 100644 index 0000000000..65e0b5c9b1 --- /dev/null +++ b/tests/specs/run/shebang_swc/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet shebang.ts", + "output": "shebang.ts.out" +} diff --git a/tests/testdata/run/shebang.ts b/tests/specs/run/shebang_swc/shebang.ts similarity index 100% rename from tests/testdata/run/shebang.ts rename to tests/specs/run/shebang_swc/shebang.ts diff --git a/tests/testdata/run/shebang.ts.out b/tests/specs/run/shebang_swc/shebang.ts.out similarity index 100% rename from tests/testdata/run/shebang.ts.out rename to tests/specs/run/shebang_swc/shebang.ts.out diff --git a/tests/specs/run/shebang_swc/shebang2.ts b/tests/specs/run/shebang_swc/shebang2.ts new file mode 100644 index 0000000000..da0d7bf0c9 --- /dev/null +++ b/tests/specs/run/shebang_swc/shebang2.ts @@ -0,0 +1,3 @@ +#!/usr/bin/env -S deno run + +export default 42; diff --git a/tests/specs/run/shebang_tsc/__test__.jsonc b/tests/specs/run/shebang_tsc/__test__.jsonc new file mode 100644 index 0000000000..f78971d57d --- /dev/null +++ b/tests/specs/run/shebang_tsc/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --check shebang.ts", + "output": "shebang.ts.out" +} diff --git a/tests/specs/run/shebang_tsc/shebang.ts b/tests/specs/run/shebang_tsc/shebang.ts new file mode 100644 index 0000000000..00feb2da0a --- /dev/null +++ b/tests/specs/run/shebang_tsc/shebang.ts @@ -0,0 +1,5 @@ +#!/usr/bin/env -S deno run + +import test from "./shebang2.ts"; + +console.log(test as number); diff --git a/tests/testdata/run/wasm.ts.out b/tests/specs/run/shebang_tsc/shebang.ts.out similarity index 100% rename from tests/testdata/run/wasm.ts.out rename to tests/specs/run/shebang_tsc/shebang.ts.out diff --git a/tests/specs/run/shebang_tsc/shebang2.ts b/tests/specs/run/shebang_tsc/shebang2.ts new file mode 100644 index 0000000000..da0d7bf0c9 --- /dev/null +++ b/tests/specs/run/shebang_tsc/shebang2.ts @@ -0,0 +1,3 @@ +#!/usr/bin/env -S deno run + +export default 42; diff --git a/tests/specs/run/shebang_with_json_imports_swc/__test__.jsonc b/tests/specs/run/shebang_with_json_imports_swc/__test__.jsonc new file mode 100644 index 0000000000..90592757fe --- /dev/null +++ b/tests/specs/run/shebang_with_json_imports_swc/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --no-check json_with_shebang.ts", + "output": "json_with_shebang.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/shebang_with_json_imports_swc/json_with_shebang.json b/tests/specs/run/shebang_with_json_imports_swc/json_with_shebang.json new file mode 100644 index 0000000000..b695e44571 --- /dev/null +++ b/tests/specs/run/shebang_with_json_imports_swc/json_with_shebang.json @@ -0,0 +1,4 @@ +#!/usr/env -S deno run +{ + "test": null +} diff --git a/tests/specs/run/shebang_with_json_imports_swc/json_with_shebang.ts b/tests/specs/run/shebang_with_json_imports_swc/json_with_shebang.ts new file mode 100644 index 0000000000..9524026bce --- /dev/null +++ b/tests/specs/run/shebang_with_json_imports_swc/json_with_shebang.ts @@ -0,0 +1,3 @@ +import json from "./json_with_shebang.json" with { type: "json" }; + +console.log(json); diff --git a/tests/specs/run/shebang_with_json_imports_swc/json_with_shebang.ts.out b/tests/specs/run/shebang_with_json_imports_swc/json_with_shebang.ts.out new file mode 100644 index 0000000000..23eb03720e --- /dev/null +++ b/tests/specs/run/shebang_with_json_imports_swc/json_with_shebang.ts.out @@ -0,0 +1 @@ +error: Uncaught SyntaxError: Unexpected token '#', "#!/usr/env"... is not valid JSON diff --git a/tests/specs/run/shebang_with_json_imports_tsc/__test__.jsonc b/tests/specs/run/shebang_with_json_imports_tsc/__test__.jsonc new file mode 100644 index 0000000000..7fbb8a5d35 --- /dev/null +++ b/tests/specs/run/shebang_with_json_imports_tsc/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet json_with_shebang.ts", + "output": "json_with_shebang.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/shebang_with_json_imports_tsc/json_with_shebang.json b/tests/specs/run/shebang_with_json_imports_tsc/json_with_shebang.json new file mode 100644 index 0000000000..b695e44571 --- /dev/null +++ b/tests/specs/run/shebang_with_json_imports_tsc/json_with_shebang.json @@ -0,0 +1,4 @@ +#!/usr/env -S deno run +{ + "test": null +} diff --git a/tests/specs/run/shebang_with_json_imports_tsc/json_with_shebang.ts b/tests/specs/run/shebang_with_json_imports_tsc/json_with_shebang.ts new file mode 100644 index 0000000000..9524026bce --- /dev/null +++ b/tests/specs/run/shebang_with_json_imports_tsc/json_with_shebang.ts @@ -0,0 +1,3 @@ +import json from "./json_with_shebang.json" with { type: "json" }; + +console.log(json); diff --git a/tests/specs/run/shebang_with_json_imports_tsc/json_with_shebang.ts.out b/tests/specs/run/shebang_with_json_imports_tsc/json_with_shebang.ts.out new file mode 100644 index 0000000000..23eb03720e --- /dev/null +++ b/tests/specs/run/shebang_with_json_imports_tsc/json_with_shebang.ts.out @@ -0,0 +1 @@ +error: Uncaught SyntaxError: Unexpected token '#', "#!/usr/env"... is not valid JSON diff --git a/tests/specs/run/single_compile_with_reload/__test__.jsonc b/tests/specs/run/single_compile_with_reload/__test__.jsonc new file mode 100644 index 0000000000..3e2e043790 --- /dev/null +++ b/tests/specs/run/single_compile_with_reload/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --allow-read single_compile_with_reload.ts", + "output": "single_compile_with_reload.ts.out" +} diff --git a/tests/specs/run/single_compile_with_reload/mod1.ts b/tests/specs/run/single_compile_with_reload/mod1.ts new file mode 100644 index 0000000000..5e58f432ed --- /dev/null +++ b/tests/specs/run/single_compile_with_reload/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/tests/specs/run/single_compile_with_reload/print_hello.ts b/tests/specs/run/single_compile_with_reload/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/single_compile_with_reload/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/testdata/run/single_compile_with_reload.ts b/tests/specs/run/single_compile_with_reload/single_compile_with_reload.ts similarity index 100% rename from tests/testdata/run/single_compile_with_reload.ts rename to tests/specs/run/single_compile_with_reload/single_compile_with_reload.ts diff --git a/tests/testdata/run/single_compile_with_reload.ts.out b/tests/specs/run/single_compile_with_reload/single_compile_with_reload.ts.out similarity index 100% rename from tests/testdata/run/single_compile_with_reload.ts.out rename to tests/specs/run/single_compile_with_reload/single_compile_with_reload.ts.out diff --git a/tests/specs/run/single_compile_with_reload/single_compile_with_reload_dyn.ts b/tests/specs/run/single_compile_with_reload/single_compile_with_reload_dyn.ts new file mode 100644 index 0000000000..c69556be15 --- /dev/null +++ b/tests/specs/run/single_compile_with_reload/single_compile_with_reload_dyn.ts @@ -0,0 +1,11 @@ +import { printHello3, returnsFoo2, returnsHi } from "./mod1.ts"; + +printHello3(); + +if (returnsHi() !== "Hi") { + throw Error("Unexpected"); +} + +if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); +} diff --git a/tests/specs/run/single_compile_with_reload/single_compile_with_reload_worker.ts b/tests/specs/run/single_compile_with_reload/single_compile_with_reload_worker.ts new file mode 100644 index 0000000000..103cafe20c --- /dev/null +++ b/tests/specs/run/single_compile_with_reload/single_compile_with_reload_worker.ts @@ -0,0 +1,3 @@ +console.log("Hello from worker"); +postMessage(null); +close(); diff --git a/tests/specs/run/single_compile_with_reload/subdir2/dynamic_import.ts b/tests/specs/run/single_compile_with_reload/subdir2/dynamic_import.ts new file mode 100644 index 0000000000..59beb64c33 --- /dev/null +++ b/tests/specs/run/single_compile_with_reload/subdir2/dynamic_import.ts @@ -0,0 +1,4 @@ +(async () => { + const { printHello } = await import("../mod2.ts"); + printHello(); +})(); diff --git a/tests/specs/run/single_compile_with_reload/subdir2/mod2.ts b/tests/specs/run/single_compile_with_reload/subdir2/mod2.ts new file mode 100644 index 0000000000..9071d0aeb4 --- /dev/null +++ b/tests/specs/run/single_compile_with_reload/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/tests/specs/run/spawn_stdout_inherit/__test__.jsonc b/tests/specs/run/spawn_stdout_inherit/__test__.jsonc new file mode 100644 index 0000000000..4dd5fe54ce --- /dev/null +++ b/tests/specs/run/spawn_stdout_inherit/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet -A spawn_stdout_inherit.ts", + "output": "spawn_stdout_inherit.ts.out" +} diff --git a/tests/testdata/run/spawn_stdout_inherit.ts b/tests/specs/run/spawn_stdout_inherit/spawn_stdout_inherit.ts similarity index 100% rename from tests/testdata/run/spawn_stdout_inherit.ts rename to tests/specs/run/spawn_stdout_inherit/spawn_stdout_inherit.ts diff --git a/tests/testdata/run/spawn_stdout_inherit.ts.out b/tests/specs/run/spawn_stdout_inherit/spawn_stdout_inherit.ts.out similarity index 100% rename from tests/testdata/run/spawn_stdout_inherit.ts.out rename to tests/specs/run/spawn_stdout_inherit/spawn_stdout_inherit.ts.out diff --git a/tests/specs/run/stdin_read_all/__test__.jsonc b/tests/specs/run/stdin_read_all/__test__.jsonc new file mode 100644 index 0000000000..6fc035aabd --- /dev/null +++ b/tests/specs/run/stdin_read_all/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet stdin_read_all.ts", + "output": "stdin_read_all.out", + "input": "01234567890123456789012345678901234567890123456789" +} diff --git a/tests/testdata/run/stdin_read_all.out b/tests/specs/run/stdin_read_all/stdin_read_all.out similarity index 100% rename from tests/testdata/run/stdin_read_all.out rename to tests/specs/run/stdin_read_all/stdin_read_all.out diff --git a/tests/testdata/run/stdin_read_all.ts b/tests/specs/run/stdin_read_all/stdin_read_all.ts similarity index 100% rename from tests/testdata/run/stdin_read_all.ts rename to tests/specs/run/stdin_read_all/stdin_read_all.ts diff --git a/tests/specs/run/stdout_write_all/__test__.jsonc b/tests/specs/run/stdout_write_all/__test__.jsonc new file mode 100644 index 0000000000..2057f4a115 --- /dev/null +++ b/tests/specs/run/stdout_write_all/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet stdout_write_all.ts", + "output": "stdout_write_all.out" +} diff --git a/tests/testdata/run/stdout_write_all.out b/tests/specs/run/stdout_write_all/stdout_write_all.out similarity index 100% rename from tests/testdata/run/stdout_write_all.out rename to tests/specs/run/stdout_write_all/stdout_write_all.out diff --git a/tests/testdata/run/stdout_write_all.ts b/tests/specs/run/stdout_write_all/stdout_write_all.ts similarity index 100% rename from tests/testdata/run/stdout_write_all.ts rename to tests/specs/run/stdout_write_all/stdout_write_all.ts diff --git a/tests/specs/run/stdout_write_sync_async/__test__.jsonc b/tests/specs/run/stdout_write_sync_async/__test__.jsonc new file mode 100644 index 0000000000..5032ca015f --- /dev/null +++ b/tests/specs/run/stdout_write_sync_async/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet stdout_write_sync_async.ts", + "output": "stdout_write_sync_async.out" +} diff --git a/tests/testdata/run/stdout_write_sync_async.out b/tests/specs/run/stdout_write_sync_async/stdout_write_sync_async.out similarity index 100% rename from tests/testdata/run/stdout_write_sync_async.out rename to tests/specs/run/stdout_write_sync_async/stdout_write_sync_async.out diff --git a/tests/testdata/run/stdout_write_sync_async.ts b/tests/specs/run/stdout_write_sync_async/stdout_write_sync_async.ts similarity index 100% rename from tests/testdata/run/stdout_write_sync_async.ts rename to tests/specs/run/stdout_write_sync_async/stdout_write_sync_async.ts diff --git a/tests/specs/run/swc_syntax_error/__test__.jsonc b/tests/specs/run/swc_syntax_error/__test__.jsonc new file mode 100644 index 0000000000..842a4fcf8e --- /dev/null +++ b/tests/specs/run/swc_syntax_error/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --check swc_syntax_error.ts", + "output": "swc_syntax_error.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/swc_syntax_error.ts b/tests/specs/run/swc_syntax_error/swc_syntax_error.ts similarity index 100% rename from tests/testdata/run/swc_syntax_error.ts rename to tests/specs/run/swc_syntax_error/swc_syntax_error.ts diff --git a/tests/testdata/run/swc_syntax_error.ts.out b/tests/specs/run/swc_syntax_error/swc_syntax_error.ts.out similarity index 100% rename from tests/testdata/run/swc_syntax_error.ts.out rename to tests/specs/run/swc_syntax_error/swc_syntax_error.ts.out diff --git a/tests/specs/run/test_and_bench_are_noops_in_run/__test__.jsonc b/tests/specs/run/test_and_bench_are_noops_in_run/__test__.jsonc new file mode 100644 index 0000000000..3d8d2ba56e --- /dev/null +++ b/tests/specs/run/test_and_bench_are_noops_in_run/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run test_and_bench_in_run.js", + "output": "" +} diff --git a/tests/testdata/run/test_and_bench_in_run.js b/tests/specs/run/test_and_bench_are_noops_in_run/test_and_bench_in_run.js similarity index 100% rename from tests/testdata/run/test_and_bench_in_run.js rename to tests/specs/run/test_and_bench_are_noops_in_run/test_and_bench_in_run.js diff --git a/tests/specs/run/tls_connecttls/RootCA.pem b/tests/specs/run/tls_connecttls/RootCA.pem new file mode 100644 index 0000000000..c2f84ceebc --- /dev/null +++ b/tests/specs/run/tls_connecttls/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/tests/specs/run/tls_connecttls/__test__.jsonc b/tests/specs/run/tls_connecttls/__test__.jsonc new file mode 100644 index 0000000000..2e8f88339d --- /dev/null +++ b/tests/specs/run/tls_connecttls/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-net --allow-read --cert RootCA.pem --config deno.json tls_connecttls.js", + "output": "tls.out" +} diff --git a/tests/specs/run/tls_connecttls/deno.json b/tests/specs/run/tls_connecttls/deno.json new file mode 100644 index 0000000000..105514e133 --- /dev/null +++ b/tests/specs/run/tls_connecttls/deno.json @@ -0,0 +1,4 @@ +{ + "lock": false, + "importMap": "../../../../import_map.json" +} diff --git a/tests/specs/run/tls_connecttls/localhost.crt b/tests/specs/run/tls_connecttls/localhost.crt new file mode 100644 index 0000000000..a71ae9050f --- /dev/null +++ b/tests/specs/run/tls_connecttls/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/tests/specs/run/tls_connecttls/localhost.key b/tests/specs/run/tls_connecttls/localhost.key new file mode 100644 index 0000000000..42774c9771 --- /dev/null +++ b/tests/specs/run/tls_connecttls/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/tests/specs/run/tls_connecttls/textproto.ts b/tests/specs/run/tls_connecttls/textproto.ts new file mode 100644 index 0000000000..9e0f5f5f0a --- /dev/null +++ b/tests/specs/run/tls_connecttls/textproto.ts @@ -0,0 +1,170 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/** **Deprecated**. Use `TextLineStream` from `std/steams` for line-by-line text reading instead. + * + * A reader for dealing with low level text based protocols. + * + * Based on + * [net/textproto](https://github.com/golang/go/tree/master/src/net/textproto). + * + * @deprecated (will be removed after 0.159.0) Use `TextLineStream` from `std/steams` for line-by-line text reading instead. + * @module + */ + +import type { BufReader, ReadLineResult } from "@std/io/buf-reader"; +import { concat } from "@std/bytes/concat"; + +// Constants created for DRY +const CHAR_SPACE: number = " ".charCodeAt(0); +const CHAR_TAB: number = "\t".charCodeAt(0); +const CHAR_COLON: number = ":".charCodeAt(0); + +const WHITESPACES: Array = [CHAR_SPACE, CHAR_TAB]; + +const decoder = new TextDecoder(); + +// FROM https://github.com/denoland/deno/blob/b34628a26ab0187a827aa4ebe256e23178e25d39/cli/js/web/headers.ts#L9 +const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/g; + +function str(buf: Uint8Array | null | undefined): string { + return !buf ? "" : decoder.decode(buf); +} + +/** + * @deprecated (will be removed after 0.159.0) Use `TextLineStream` from `std/steams` for line-by-line text reading instead. + */ +export class TextProtoReader { + constructor(readonly r: BufReader) {} + + /** readLine() reads a single line from the TextProtoReader, + * eliding the final \n or \r\n from the returned string. + */ + async readLine(): Promise { + const s = await this.readLineSlice(); + return s === null ? null : str(s); + } + + /** ReadMimeHeader reads a MIME-style header from r. + * The header is a sequence of possibly continued Key: Value lines + * ending in a blank line. + * The returned map m maps CanonicalMIMEHeaderKey(key) to a + * sequence of values in the same order encountered in the input. + * + * For example, consider this input: + * + * My-Key: Value 1 + * Long-Key: Even + * Longer Value + * My-Key: Value 2 + * + * Given that input, ReadMIMEHeader returns the map: + * + * map[string][]string{ + * "My-Key": {"Value 1", "Value 2"}, + * "Long-Key": {"Even Longer Value"}, + * } + */ + async readMimeHeader(): Promise { + const m = new Headers(); + let line: Uint8Array | undefined; + + // The first line cannot start with a leading space. + let buf = await this.r.peek(1); + if (buf === null) { + return null; + } else if (WHITESPACES.includes(buf[0])) { + line = (await this.readLineSlice()) as Uint8Array; + } + + buf = await this.r.peek(1); + if (buf === null) { + throw new Deno.errors.UnexpectedEof(); + } else if (WHITESPACES.includes(buf[0])) { + throw new Deno.errors.InvalidData( + `malformed MIME header initial line: ${str(line)}`, + ); + } + + while (true) { + const kv = await this.readLineSlice(); // readContinuedLineSlice + if (kv === null) throw new Deno.errors.UnexpectedEof(); + if (kv.byteLength === 0) return m; + + // Key ends at first colon + let i = kv.indexOf(CHAR_COLON); + if (i < 0) { + throw new Deno.errors.InvalidData( + `malformed MIME header line: ${str(kv)}`, + ); + } + + //let key = canonicalMIMEHeaderKey(kv.subarray(0, endKey)); + const key = str(kv.subarray(0, i)); + + // As per RFC 7230 field-name is a token, + // tokens consist of one or more chars. + // We could throw `Deno.errors.InvalidData` here, + // but better to be liberal in what we + // accept, so if we get an empty key, skip it. + if (key == "") { + continue; + } + + // Skip initial spaces in value. + i++; // skip colon + while ( + i < kv.byteLength && + (WHITESPACES.includes(kv[i])) + ) { + i++; + } + const value = str(kv.subarray(i)).replace( + invalidHeaderCharRegex, + encodeURI, + ); + + // In case of invalid header we swallow the error + // example: "Audio Mode" => invalid due to space in the key + try { + m.append(key, value); + } catch { + // Pass + } + } + } + + async readLineSlice(): Promise { + let line = new Uint8Array(0); + let r: ReadLineResult | null = null; + + do { + r = await this.r.readLine(); + // TODO(ry): + // This skipSpace() is definitely misplaced, but I don't know where it + // comes from nor how to fix it. + + //TODO(SmashingQuasar): Kept skipSpace to preserve behavior but it should be looked into to check if it makes sense when this is used. + + if (r !== null && this.skipSpace(r.line) !== 0) { + line = concat([line, r.line]); + } + } while (r !== null && r.more); + + return r === null ? null : line; + } + + skipSpace(l: Uint8Array): number { + let n = 0; + + for (const val of l) { + if (!WHITESPACES.includes(val)) { + n++; + } + } + + return n; + } +} diff --git a/tests/testdata/run/tls.out b/tests/specs/run/tls_connecttls/tls.out similarity index 100% rename from tests/testdata/run/tls.out rename to tests/specs/run/tls_connecttls/tls.out diff --git a/tests/testdata/run/tls_connecttls.js b/tests/specs/run/tls_connecttls/tls_connecttls.js similarity index 94% rename from tests/testdata/run/tls_connecttls.js rename to tests/specs/run/tls_connecttls/tls_connecttls.js index 07b361f9ce..686b13aea3 100644 --- a/tests/testdata/run/tls_connecttls.js +++ b/tests/specs/run/tls_connecttls/tls_connecttls.js @@ -12,8 +12,8 @@ const port = 3505; const listener = Deno.listenTls({ hostname, port, - cert: Deno.readTextFileSync("./tls/localhost.crt"), - key: Deno.readTextFileSync("./tls/localhost.key"), + cert: Deno.readTextFileSync("./localhost.crt"), + key: Deno.readTextFileSync("./localhost.key"), }); const response = encoder.encode( diff --git a/tests/specs/run/tls_starttls/RootCA.pem b/tests/specs/run/tls_starttls/RootCA.pem new file mode 100644 index 0000000000..c2f84ceebc --- /dev/null +++ b/tests/specs/run/tls_starttls/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/tests/specs/run/tls_starttls/__test__.jsonc b/tests/specs/run/tls_starttls/__test__.jsonc new file mode 100644 index 0000000000..4c1fe6324d --- /dev/null +++ b/tests/specs/run/tls_starttls/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-net --allow-read --cert RootCA.pem --config deno.json tls_starttls.js", + "output": "tls.out" +} diff --git a/tests/specs/run/tls_starttls/deno.json b/tests/specs/run/tls_starttls/deno.json new file mode 100644 index 0000000000..105514e133 --- /dev/null +++ b/tests/specs/run/tls_starttls/deno.json @@ -0,0 +1,4 @@ +{ + "lock": false, + "importMap": "../../../../import_map.json" +} diff --git a/tests/specs/run/tls_starttls/localhost.crt b/tests/specs/run/tls_starttls/localhost.crt new file mode 100644 index 0000000000..a71ae9050f --- /dev/null +++ b/tests/specs/run/tls_starttls/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/tests/specs/run/tls_starttls/localhost.key b/tests/specs/run/tls_starttls/localhost.key new file mode 100644 index 0000000000..42774c9771 --- /dev/null +++ b/tests/specs/run/tls_starttls/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/tests/specs/run/tls_starttls/textproto.ts b/tests/specs/run/tls_starttls/textproto.ts new file mode 100644 index 0000000000..9e0f5f5f0a --- /dev/null +++ b/tests/specs/run/tls_starttls/textproto.ts @@ -0,0 +1,170 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/** **Deprecated**. Use `TextLineStream` from `std/steams` for line-by-line text reading instead. + * + * A reader for dealing with low level text based protocols. + * + * Based on + * [net/textproto](https://github.com/golang/go/tree/master/src/net/textproto). + * + * @deprecated (will be removed after 0.159.0) Use `TextLineStream` from `std/steams` for line-by-line text reading instead. + * @module + */ + +import type { BufReader, ReadLineResult } from "@std/io/buf-reader"; +import { concat } from "@std/bytes/concat"; + +// Constants created for DRY +const CHAR_SPACE: number = " ".charCodeAt(0); +const CHAR_TAB: number = "\t".charCodeAt(0); +const CHAR_COLON: number = ":".charCodeAt(0); + +const WHITESPACES: Array = [CHAR_SPACE, CHAR_TAB]; + +const decoder = new TextDecoder(); + +// FROM https://github.com/denoland/deno/blob/b34628a26ab0187a827aa4ebe256e23178e25d39/cli/js/web/headers.ts#L9 +const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/g; + +function str(buf: Uint8Array | null | undefined): string { + return !buf ? "" : decoder.decode(buf); +} + +/** + * @deprecated (will be removed after 0.159.0) Use `TextLineStream` from `std/steams` for line-by-line text reading instead. + */ +export class TextProtoReader { + constructor(readonly r: BufReader) {} + + /** readLine() reads a single line from the TextProtoReader, + * eliding the final \n or \r\n from the returned string. + */ + async readLine(): Promise { + const s = await this.readLineSlice(); + return s === null ? null : str(s); + } + + /** ReadMimeHeader reads a MIME-style header from r. + * The header is a sequence of possibly continued Key: Value lines + * ending in a blank line. + * The returned map m maps CanonicalMIMEHeaderKey(key) to a + * sequence of values in the same order encountered in the input. + * + * For example, consider this input: + * + * My-Key: Value 1 + * Long-Key: Even + * Longer Value + * My-Key: Value 2 + * + * Given that input, ReadMIMEHeader returns the map: + * + * map[string][]string{ + * "My-Key": {"Value 1", "Value 2"}, + * "Long-Key": {"Even Longer Value"}, + * } + */ + async readMimeHeader(): Promise { + const m = new Headers(); + let line: Uint8Array | undefined; + + // The first line cannot start with a leading space. + let buf = await this.r.peek(1); + if (buf === null) { + return null; + } else if (WHITESPACES.includes(buf[0])) { + line = (await this.readLineSlice()) as Uint8Array; + } + + buf = await this.r.peek(1); + if (buf === null) { + throw new Deno.errors.UnexpectedEof(); + } else if (WHITESPACES.includes(buf[0])) { + throw new Deno.errors.InvalidData( + `malformed MIME header initial line: ${str(line)}`, + ); + } + + while (true) { + const kv = await this.readLineSlice(); // readContinuedLineSlice + if (kv === null) throw new Deno.errors.UnexpectedEof(); + if (kv.byteLength === 0) return m; + + // Key ends at first colon + let i = kv.indexOf(CHAR_COLON); + if (i < 0) { + throw new Deno.errors.InvalidData( + `malformed MIME header line: ${str(kv)}`, + ); + } + + //let key = canonicalMIMEHeaderKey(kv.subarray(0, endKey)); + const key = str(kv.subarray(0, i)); + + // As per RFC 7230 field-name is a token, + // tokens consist of one or more chars. + // We could throw `Deno.errors.InvalidData` here, + // but better to be liberal in what we + // accept, so if we get an empty key, skip it. + if (key == "") { + continue; + } + + // Skip initial spaces in value. + i++; // skip colon + while ( + i < kv.byteLength && + (WHITESPACES.includes(kv[i])) + ) { + i++; + } + const value = str(kv.subarray(i)).replace( + invalidHeaderCharRegex, + encodeURI, + ); + + // In case of invalid header we swallow the error + // example: "Audio Mode" => invalid due to space in the key + try { + m.append(key, value); + } catch { + // Pass + } + } + } + + async readLineSlice(): Promise { + let line = new Uint8Array(0); + let r: ReadLineResult | null = null; + + do { + r = await this.r.readLine(); + // TODO(ry): + // This skipSpace() is definitely misplaced, but I don't know where it + // comes from nor how to fix it. + + //TODO(SmashingQuasar): Kept skipSpace to preserve behavior but it should be looked into to check if it makes sense when this is used. + + if (r !== null && this.skipSpace(r.line) !== 0) { + line = concat([line, r.line]); + } + } while (r !== null && r.more); + + return r === null ? null : line; + } + + skipSpace(l: Uint8Array): number { + let n = 0; + + for (const val of l) { + if (!WHITESPACES.includes(val)) { + n++; + } + } + + return n; + } +} diff --git a/tests/specs/run/tls_starttls/tls.out b/tests/specs/run/tls_starttls/tls.out new file mode 100644 index 0000000000..c8e8a135c9 --- /dev/null +++ b/tests/specs/run/tls_starttls/tls.out @@ -0,0 +1 @@ +DONE diff --git a/tests/testdata/run/tls_starttls.js b/tests/specs/run/tls_starttls/tls_starttls.js similarity index 94% rename from tests/testdata/run/tls_starttls.js rename to tests/specs/run/tls_starttls/tls_starttls.js index 8e7ac03ee6..cd5718ff5a 100644 --- a/tests/testdata/run/tls_starttls.js +++ b/tests/specs/run/tls_starttls/tls_starttls.js @@ -13,8 +13,8 @@ const port = 3504; const listener = Deno.listenTls({ hostname, port, - cert: Deno.readTextFileSync("./tls/localhost.crt"), - key: Deno.readTextFileSync("./tls/localhost.key"), + cert: Deno.readTextFileSync("./localhost.crt"), + key: Deno.readTextFileSync("./localhost.key"), }); const response = encoder.encode( diff --git a/tests/specs/run/top_level_await/__test__.jsonc b/tests/specs/run/top_level_await/__test__.jsonc new file mode 100644 index 0000000000..25537db5f4 --- /dev/null +++ b/tests/specs/run/top_level_await/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read top_level_await/top_level_await.js", + "output": "top_level_await/top_level_await.out" +} diff --git a/tests/specs/run/top_level_await/hello.txt b/tests/specs/run/top_level_await/hello.txt new file mode 100644 index 0000000000..6769dd60bd --- /dev/null +++ b/tests/specs/run/top_level_await/hello.txt @@ -0,0 +1 @@ +Hello world! \ No newline at end of file diff --git a/tests/testdata/run/top_level_await/circular.js b/tests/specs/run/top_level_await/top_level_await/circular.js similarity index 100% rename from tests/testdata/run/top_level_await/circular.js rename to tests/specs/run/top_level_await/top_level_await/circular.js diff --git a/tests/testdata/run/top_level_await/circular.out b/tests/specs/run/top_level_await/top_level_await/circular.out similarity index 100% rename from tests/testdata/run/top_level_await/circular.out rename to tests/specs/run/top_level_await/top_level_await/circular.out diff --git a/tests/specs/run/top_level_await/top_level_await/loop.js b/tests/specs/run/top_level_await/top_level_await/loop.js new file mode 100644 index 0000000000..f229e03f61 --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/loop.js @@ -0,0 +1,20 @@ +const importsDir = Deno.readDirSync( + Deno.realPathSync("./top_level_await/tla2"), +); + +const resolvedPaths = []; + +for (const { name } of importsDir) { + const filePath = Deno.realPathSync(`./top_level_await/tla2/${name}`); + resolvedPaths.push(filePath); +} + +resolvedPaths.sort(); + +for (const filePath of resolvedPaths) { + console.log("loading", filePath); + const mod = await import(`file://${filePath}`); + console.log("loaded", mod); +} + +console.log("all loaded"); diff --git a/tests/testdata/run/top_level_await/loop.out b/tests/specs/run/top_level_await/top_level_await/loop.out similarity index 100% rename from tests/testdata/run/top_level_await/loop.out rename to tests/specs/run/top_level_await/top_level_await/loop.out diff --git a/tests/testdata/run/top_level_await/nested.out b/tests/specs/run/top_level_await/top_level_await/nested.out similarity index 100% rename from tests/testdata/run/top_level_await/nested.out rename to tests/specs/run/top_level_await/top_level_await/nested.out diff --git a/tests/testdata/run/top_level_await/nested/a.js b/tests/specs/run/top_level_await/top_level_await/nested/a.js similarity index 100% rename from tests/testdata/run/top_level_await/nested/a.js rename to tests/specs/run/top_level_await/top_level_await/nested/a.js diff --git a/tests/testdata/run/top_level_await/nested/b.js b/tests/specs/run/top_level_await/top_level_await/nested/b.js similarity index 100% rename from tests/testdata/run/top_level_await/nested/b.js rename to tests/specs/run/top_level_await/top_level_await/nested/b.js diff --git a/tests/testdata/run/top_level_await/nested/main.js b/tests/specs/run/top_level_await/top_level_await/nested/main.js similarity index 100% rename from tests/testdata/run/top_level_await/nested/main.js rename to tests/specs/run/top_level_await/top_level_await/nested/main.js diff --git a/tests/testdata/run/top_level_await/order.js b/tests/specs/run/top_level_await/top_level_await/order.js similarity index 100% rename from tests/testdata/run/top_level_await/order.js rename to tests/specs/run/top_level_await/top_level_await/order.js diff --git a/tests/testdata/run/top_level_await/order.out b/tests/specs/run/top_level_await/top_level_await/order.out similarity index 100% rename from tests/testdata/run/top_level_await/order.out rename to tests/specs/run/top_level_await/top_level_await/order.out diff --git a/tests/specs/run/top_level_await/top_level_await/tla/a.js b/tests/specs/run/top_level_await/top_level_await/tla/a.js new file mode 100644 index 0000000000..c3ef3f7dbc --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/tests/specs/run/top_level_await/top_level_await/tla/b.js b/tests/specs/run/top_level_await/top_level_await/tla/b.js new file mode 100644 index 0000000000..3271c92d8f --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/tests/specs/run/top_level_await/top_level_await/tla/c.js b/tests/specs/run/top_level_await/top_level_await/tla/c.js new file mode 100644 index 0000000000..806eb0a8be --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/tests/specs/run/top_level_await/top_level_await/tla/d.js b/tests/specs/run/top_level_await/top_level_await/tla/d.js new file mode 100644 index 0000000000..283ebf817f --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/tests/specs/run/top_level_await/top_level_await/tla/order.js b/tests/specs/run/top_level_await/top_level_await/tla/order.js new file mode 100644 index 0000000000..f213a562ce --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/tests/specs/run/top_level_await/top_level_await/tla/parent.js b/tests/specs/run/top_level_await/top_level_await/tla/parent.js new file mode 100644 index 0000000000..1ecc154634 --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/tests/specs/run/top_level_await/top_level_await/tla2/a.js b/tests/specs/run/top_level_await/top_level_await/tla2/a.js new file mode 100644 index 0000000000..d07bcb94db --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await/top_level_await/tla2/b.js b/tests/specs/run/top_level_await/top_level_await/tla2/b.js new file mode 100644 index 0000000000..68e357c1e9 --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await/top_level_await/tla3/b.js b/tests/specs/run/top_level_await/top_level_await/tla3/b.js new file mode 100644 index 0000000000..d0349545e9 --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/tests/specs/run/top_level_await/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await/top_level_await/tla3/timeout_loop.js new file mode 100644 index 0000000000..860e6cd2ae --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/tests/specs/run/top_level_await/top_level_await/top_level_await.js b/tests/specs/run/top_level_await/top_level_await/top_level_await.js new file mode 100644 index 0000000000..31c83caedc --- /dev/null +++ b/tests/specs/run/top_level_await/top_level_await/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/tests/testdata/run/top_level_await/top_level_await.out b/tests/specs/run/top_level_await/top_level_await/top_level_await.out similarity index 100% rename from tests/testdata/run/top_level_await/top_level_await.out rename to tests/specs/run/top_level_await/top_level_await/top_level_await.out diff --git a/tests/testdata/run/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await/top_level_await/top_level_await.ts similarity index 100% rename from tests/testdata/run/top_level_await/top_level_await.ts rename to tests/specs/run/top_level_await/top_level_await/top_level_await.ts diff --git a/tests/testdata/run/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await/top_level_await/top_level_for_await.js similarity index 100% rename from tests/testdata/run/top_level_await/top_level_for_await.js rename to tests/specs/run/top_level_await/top_level_await/top_level_for_await.js diff --git a/tests/testdata/run/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await/top_level_await/top_level_for_await.out similarity index 100% rename from tests/testdata/run/top_level_await/top_level_for_await.out rename to tests/specs/run/top_level_await/top_level_await/top_level_for_await.out diff --git a/tests/testdata/run/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await/top_level_await/top_level_for_await.ts similarity index 100% rename from tests/testdata/run/top_level_await/top_level_for_await.ts rename to tests/specs/run/top_level_await/top_level_await/top_level_for_await.ts diff --git a/tests/testdata/run/top_level_await/unresolved.js b/tests/specs/run/top_level_await/top_level_await/unresolved.js similarity index 100% rename from tests/testdata/run/top_level_await/unresolved.js rename to tests/specs/run/top_level_await/top_level_await/unresolved.js diff --git a/tests/testdata/run/top_level_await/unresolved.out b/tests/specs/run/top_level_await/top_level_await/unresolved.out similarity index 100% rename from tests/testdata/run/top_level_await/unresolved.out rename to tests/specs/run/top_level_await/top_level_await/unresolved.out diff --git a/tests/specs/run/top_level_await_circular/__test__.jsonc b/tests/specs/run/top_level_await_circular/__test__.jsonc new file mode 100644 index 0000000000..3e236b2107 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --allow-read top_level_await/circular.js", + "output": "top_level_await/circular.out", + "exitCode": 1 +} diff --git a/tests/specs/run/top_level_await_circular/top_level_await/circular.js b/tests/specs/run/top_level_await_circular/top_level_await/circular.js new file mode 100644 index 0000000000..ff2964b6a5 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/circular.js @@ -0,0 +1,8 @@ +import { foo } from "./tla3/timeout_loop.js"; + +export const collection = []; + +const mod = await import("./tla3/b.js"); + +console.log("foo in main", foo); +console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/circular.out b/tests/specs/run/top_level_await_circular/top_level_await/circular.out new file mode 100644 index 0000000000..c889789613 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/circular.out @@ -0,0 +1,10 @@ +timeout loop 0 +timeout loop 1 +timeout loop 2 +timeout loop 3 +timeout loop 4 +timeout loop 5 +error: Top-level await promise never resolved +const mod = await import("./tla3/b.js"); + ^ + at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_circular/top_level_await/loop.js b/tests/specs/run/top_level_await_circular/top_level_await/loop.js new file mode 100644 index 0000000000..f229e03f61 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/loop.js @@ -0,0 +1,20 @@ +const importsDir = Deno.readDirSync( + Deno.realPathSync("./top_level_await/tla2"), +); + +const resolvedPaths = []; + +for (const { name } of importsDir) { + const filePath = Deno.realPathSync(`./top_level_await/tla2/${name}`); + resolvedPaths.push(filePath); +} + +resolvedPaths.sort(); + +for (const filePath of resolvedPaths) { + console.log("loading", filePath); + const mod = await import(`file://${filePath}`); + console.log("loaded", mod); +} + +console.log("all loaded"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/loop.out b/tests/specs/run/top_level_await_circular/top_level_await/loop.out new file mode 100644 index 0000000000..1bdffbf660 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/loop.out @@ -0,0 +1,5 @@ +loading [WILDCARD]a.js +loaded [Module: null prototype] { default: [class Foo] } +loading [WILDCARD]b.js +loaded [Module: null prototype] { default: [class Bar] } +all loaded diff --git a/tests/specs/run/top_level_await_circular/top_level_await/nested.out b/tests/specs/run/top_level_await_circular/top_level_await/nested.out new file mode 100644 index 0000000000..8a1218a102 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/nested.out @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/tests/specs/run/top_level_await_circular/top_level_await/nested/a.js b/tests/specs/run/top_level_await_circular/top_level_await/nested/a.js new file mode 100644 index 0000000000..74837d4ba1 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/nested/a.js @@ -0,0 +1,3 @@ +console.log(2); +await import("./b.js"); +console.log(4); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/nested/b.js b/tests/specs/run/top_level_await_circular/top_level_await/nested/b.js new file mode 100644 index 0000000000..3bd241b50e --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/nested/b.js @@ -0,0 +1 @@ +console.log(3); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/nested/main.js b/tests/specs/run/top_level_await_circular/top_level_await/nested/main.js new file mode 100644 index 0000000000..ed46a47175 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/nested/main.js @@ -0,0 +1,3 @@ +console.log(1); +await import("./a.js"); +console.log(5); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/order.js b/tests/specs/run/top_level_await_circular/top_level_await/order.js new file mode 100644 index 0000000000..30659cdfbf --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/order.js @@ -0,0 +1,21 @@ +// Ported from Node +// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs + +const { default: order } = await import("./tla/parent.js"); + +console.log("order", JSON.stringify(order)); + +if ( + !( + order[0] === "order" && + order[1] === "b" && + order[2] === "c" && + order[3] === "d" && + order[4] === "a" && + order[5] === "parent" + ) +) { + throw new Error("TLA wrong order"); +} + +console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/order.out b/tests/specs/run/top_level_await_circular/top_level_await/order.out new file mode 100644 index 0000000000..4cc27858cf --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/order.out @@ -0,0 +1,2 @@ +order ["order","b","c","d","a","parent"] +TLA order correct diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/a.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/a.js new file mode 100644 index 0000000000..c3ef3f7dbc --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/b.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/b.js new file mode 100644 index 0000000000..3271c92d8f --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/c.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/c.js new file mode 100644 index 0000000000..806eb0a8be --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/d.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/d.js new file mode 100644 index 0000000000..283ebf817f --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/order.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/order.js new file mode 100644 index 0000000000..f213a562ce --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/parent.js new file mode 100644 index 0000000000..1ecc154634 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_circular/top_level_await/tla2/a.js new file mode 100644 index 0000000000..d07bcb94db --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_circular/top_level_await/tla2/b.js new file mode 100644 index 0000000000..68e357c1e9 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_circular/top_level_await/tla3/b.js new file mode 100644 index 0000000000..d0349545e9 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_circular/top_level_await/tla3/timeout_loop.js new file mode 100644 index 0000000000..860e6cd2ae --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/tests/testdata/run/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.js similarity index 100% rename from tests/testdata/run/top_level_await/top_level_await.js rename to tests/specs/run/top_level_await_circular/top_level_await/top_level_await.js diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.out new file mode 100644 index 0000000000..4b65d15fe3 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.out @@ -0,0 +1,3 @@ +Hello world! + +write 12 diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.ts new file mode 100644 index 0000000000..8d47ceb21e --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.ts @@ -0,0 +1,3 @@ +const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); +const n: number = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.js new file mode 100644 index 0000000000..a330f6c711 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.js @@ -0,0 +1,10 @@ +function* asyncGenerator() { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.out new file mode 100644 index 0000000000..4539bbf2d2 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.out @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.ts new file mode 100644 index 0000000000..9179322d78 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.ts @@ -0,0 +1,10 @@ +async function* asyncGenerator(): AsyncIterableIterator { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_circular/top_level_await/unresolved.js b/tests/specs/run/top_level_await_circular/top_level_await/unresolved.js new file mode 100644 index 0000000000..231a8cd634 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/unresolved.js @@ -0,0 +1 @@ +await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/unresolved.out b/tests/specs/run/top_level_await_circular/top_level_await/unresolved.out new file mode 100644 index 0000000000..1f4ea5d382 --- /dev/null +++ b/tests/specs/run/top_level_await_circular/top_level_await/unresolved.out @@ -0,0 +1,4 @@ +error: Top-level await promise never resolved +await new Promise(() => {}); +^ + at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_await_loop/__test__.jsonc b/tests/specs/run/top_level_await_loop/__test__.jsonc new file mode 100644 index 0000000000..b2f5c84c03 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read top_level_await/loop.js", + "output": "top_level_await/loop.out" +} diff --git a/tests/specs/run/top_level_await_loop/top_level_await/circular.js b/tests/specs/run/top_level_await_loop/top_level_await/circular.js new file mode 100644 index 0000000000..ff2964b6a5 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/circular.js @@ -0,0 +1,8 @@ +import { foo } from "./tla3/timeout_loop.js"; + +export const collection = []; + +const mod = await import("./tla3/b.js"); + +console.log("foo in main", foo); +console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/circular.out b/tests/specs/run/top_level_await_loop/top_level_await/circular.out new file mode 100644 index 0000000000..c889789613 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/circular.out @@ -0,0 +1,10 @@ +timeout loop 0 +timeout loop 1 +timeout loop 2 +timeout loop 3 +timeout loop 4 +timeout loop 5 +error: Top-level await promise never resolved +const mod = await import("./tla3/b.js"); + ^ + at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_loop/top_level_await/loop.js b/tests/specs/run/top_level_await_loop/top_level_await/loop.js new file mode 100644 index 0000000000..f229e03f61 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/loop.js @@ -0,0 +1,20 @@ +const importsDir = Deno.readDirSync( + Deno.realPathSync("./top_level_await/tla2"), +); + +const resolvedPaths = []; + +for (const { name } of importsDir) { + const filePath = Deno.realPathSync(`./top_level_await/tla2/${name}`); + resolvedPaths.push(filePath); +} + +resolvedPaths.sort(); + +for (const filePath of resolvedPaths) { + console.log("loading", filePath); + const mod = await import(`file://${filePath}`); + console.log("loaded", mod); +} + +console.log("all loaded"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/loop.out b/tests/specs/run/top_level_await_loop/top_level_await/loop.out new file mode 100644 index 0000000000..1bdffbf660 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/loop.out @@ -0,0 +1,5 @@ +loading [WILDCARD]a.js +loaded [Module: null prototype] { default: [class Foo] } +loading [WILDCARD]b.js +loaded [Module: null prototype] { default: [class Bar] } +all loaded diff --git a/tests/specs/run/top_level_await_loop/top_level_await/nested.out b/tests/specs/run/top_level_await_loop/top_level_await/nested.out new file mode 100644 index 0000000000..8a1218a102 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/nested.out @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/tests/specs/run/top_level_await_loop/top_level_await/nested/a.js b/tests/specs/run/top_level_await_loop/top_level_await/nested/a.js new file mode 100644 index 0000000000..74837d4ba1 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/nested/a.js @@ -0,0 +1,3 @@ +console.log(2); +await import("./b.js"); +console.log(4); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/nested/b.js b/tests/specs/run/top_level_await_loop/top_level_await/nested/b.js new file mode 100644 index 0000000000..3bd241b50e --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/nested/b.js @@ -0,0 +1 @@ +console.log(3); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/nested/main.js b/tests/specs/run/top_level_await_loop/top_level_await/nested/main.js new file mode 100644 index 0000000000..ed46a47175 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/nested/main.js @@ -0,0 +1,3 @@ +console.log(1); +await import("./a.js"); +console.log(5); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/order.js b/tests/specs/run/top_level_await_loop/top_level_await/order.js new file mode 100644 index 0000000000..30659cdfbf --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/order.js @@ -0,0 +1,21 @@ +// Ported from Node +// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs + +const { default: order } = await import("./tla/parent.js"); + +console.log("order", JSON.stringify(order)); + +if ( + !( + order[0] === "order" && + order[1] === "b" && + order[2] === "c" && + order[3] === "d" && + order[4] === "a" && + order[5] === "parent" + ) +) { + throw new Error("TLA wrong order"); +} + +console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/order.out b/tests/specs/run/top_level_await_loop/top_level_await/order.out new file mode 100644 index 0000000000..4cc27858cf --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/order.out @@ -0,0 +1,2 @@ +order ["order","b","c","d","a","parent"] +TLA order correct diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/a.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/a.js new file mode 100644 index 0000000000..c3ef3f7dbc --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/b.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/b.js new file mode 100644 index 0000000000..3271c92d8f --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/c.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/c.js new file mode 100644 index 0000000000..806eb0a8be --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/d.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/d.js new file mode 100644 index 0000000000..283ebf817f --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/order.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/order.js new file mode 100644 index 0000000000..f213a562ce --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/parent.js new file mode 100644 index 0000000000..1ecc154634 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_loop/top_level_await/tla2/a.js new file mode 100644 index 0000000000..d07bcb94db --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_loop/top_level_await/tla2/b.js new file mode 100644 index 0000000000..68e357c1e9 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_loop/top_level_await/tla3/b.js new file mode 100644 index 0000000000..d0349545e9 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_loop/top_level_await/tla3/timeout_loop.js new file mode 100644 index 0000000000..860e6cd2ae --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.js new file mode 100644 index 0000000000..ea319ea124 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.js @@ -0,0 +1,3 @@ +const buf = await Deno.readFile("./assets/hello.txt"); +const n = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.out new file mode 100644 index 0000000000..4b65d15fe3 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.out @@ -0,0 +1,3 @@ +Hello world! + +write 12 diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.ts new file mode 100644 index 0000000000..8d47ceb21e --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.ts @@ -0,0 +1,3 @@ +const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); +const n: number = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.js new file mode 100644 index 0000000000..a330f6c711 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.js @@ -0,0 +1,10 @@ +function* asyncGenerator() { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.out new file mode 100644 index 0000000000..4539bbf2d2 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.out @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.ts new file mode 100644 index 0000000000..9179322d78 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.ts @@ -0,0 +1,10 @@ +async function* asyncGenerator(): AsyncIterableIterator { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_loop/top_level_await/unresolved.js b/tests/specs/run/top_level_await_loop/top_level_await/unresolved.js new file mode 100644 index 0000000000..231a8cd634 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/unresolved.js @@ -0,0 +1 @@ +await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/unresolved.out b/tests/specs/run/top_level_await_loop/top_level_await/unresolved.out new file mode 100644 index 0000000000..1f4ea5d382 --- /dev/null +++ b/tests/specs/run/top_level_await_loop/top_level_await/unresolved.out @@ -0,0 +1,4 @@ +error: Top-level await promise never resolved +await new Promise(() => {}); +^ + at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_await_nested/__test__.jsonc b/tests/specs/run/top_level_await_nested/__test__.jsonc new file mode 100644 index 0000000000..376180ecdc --- /dev/null +++ b/tests/specs/run/top_level_await_nested/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read top_level_await/nested/main.js", + "output": "top_level_await/nested.out" +} diff --git a/tests/specs/run/top_level_await_nested/top_level_await/circular.js b/tests/specs/run/top_level_await_nested/top_level_await/circular.js new file mode 100644 index 0000000000..ff2964b6a5 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/circular.js @@ -0,0 +1,8 @@ +import { foo } from "./tla3/timeout_loop.js"; + +export const collection = []; + +const mod = await import("./tla3/b.js"); + +console.log("foo in main", foo); +console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/circular.out b/tests/specs/run/top_level_await_nested/top_level_await/circular.out new file mode 100644 index 0000000000..c889789613 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/circular.out @@ -0,0 +1,10 @@ +timeout loop 0 +timeout loop 1 +timeout loop 2 +timeout loop 3 +timeout loop 4 +timeout loop 5 +error: Top-level await promise never resolved +const mod = await import("./tla3/b.js"); + ^ + at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/testdata/run/top_level_await/loop.js b/tests/specs/run/top_level_await_nested/top_level_await/loop.js similarity index 100% rename from tests/testdata/run/top_level_await/loop.js rename to tests/specs/run/top_level_await_nested/top_level_await/loop.js diff --git a/tests/specs/run/top_level_await_nested/top_level_await/loop.out b/tests/specs/run/top_level_await_nested/top_level_await/loop.out new file mode 100644 index 0000000000..1bdffbf660 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/loop.out @@ -0,0 +1,5 @@ +loading [WILDCARD]a.js +loaded [Module: null prototype] { default: [class Foo] } +loading [WILDCARD]b.js +loaded [Module: null prototype] { default: [class Bar] } +all loaded diff --git a/tests/specs/run/top_level_await_nested/top_level_await/nested.out b/tests/specs/run/top_level_await_nested/top_level_await/nested.out new file mode 100644 index 0000000000..8a1218a102 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/nested.out @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/tests/specs/run/top_level_await_nested/top_level_await/nested/a.js b/tests/specs/run/top_level_await_nested/top_level_await/nested/a.js new file mode 100644 index 0000000000..74837d4ba1 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/nested/a.js @@ -0,0 +1,3 @@ +console.log(2); +await import("./b.js"); +console.log(4); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/nested/b.js b/tests/specs/run/top_level_await_nested/top_level_await/nested/b.js new file mode 100644 index 0000000000..3bd241b50e --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/nested/b.js @@ -0,0 +1 @@ +console.log(3); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/nested/main.js b/tests/specs/run/top_level_await_nested/top_level_await/nested/main.js new file mode 100644 index 0000000000..ed46a47175 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/nested/main.js @@ -0,0 +1,3 @@ +console.log(1); +await import("./a.js"); +console.log(5); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/order.js b/tests/specs/run/top_level_await_nested/top_level_await/order.js new file mode 100644 index 0000000000..30659cdfbf --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/order.js @@ -0,0 +1,21 @@ +// Ported from Node +// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs + +const { default: order } = await import("./tla/parent.js"); + +console.log("order", JSON.stringify(order)); + +if ( + !( + order[0] === "order" && + order[1] === "b" && + order[2] === "c" && + order[3] === "d" && + order[4] === "a" && + order[5] === "parent" + ) +) { + throw new Error("TLA wrong order"); +} + +console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/order.out b/tests/specs/run/top_level_await_nested/top_level_await/order.out new file mode 100644 index 0000000000..4cc27858cf --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/order.out @@ -0,0 +1,2 @@ +order ["order","b","c","d","a","parent"] +TLA order correct diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/a.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/a.js new file mode 100644 index 0000000000..c3ef3f7dbc --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/b.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/b.js new file mode 100644 index 0000000000..3271c92d8f --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/c.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/c.js new file mode 100644 index 0000000000..806eb0a8be --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/d.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/d.js new file mode 100644 index 0000000000..283ebf817f --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/order.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/order.js new file mode 100644 index 0000000000..f213a562ce --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/parent.js new file mode 100644 index 0000000000..1ecc154634 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_nested/top_level_await/tla2/a.js new file mode 100644 index 0000000000..d07bcb94db --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_nested/top_level_await/tla2/b.js new file mode 100644 index 0000000000..68e357c1e9 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_nested/top_level_await/tla3/b.js new file mode 100644 index 0000000000..d0349545e9 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_nested/top_level_await/tla3/timeout_loop.js new file mode 100644 index 0000000000..860e6cd2ae --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.js new file mode 100644 index 0000000000..ea319ea124 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.js @@ -0,0 +1,3 @@ +const buf = await Deno.readFile("./assets/hello.txt"); +const n = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.out new file mode 100644 index 0000000000..4b65d15fe3 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.out @@ -0,0 +1,3 @@ +Hello world! + +write 12 diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.ts new file mode 100644 index 0000000000..8d47ceb21e --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.ts @@ -0,0 +1,3 @@ +const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); +const n: number = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.js new file mode 100644 index 0000000000..a330f6c711 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.js @@ -0,0 +1,10 @@ +function* asyncGenerator() { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.out new file mode 100644 index 0000000000..4539bbf2d2 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.out @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.ts new file mode 100644 index 0000000000..9179322d78 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.ts @@ -0,0 +1,10 @@ +async function* asyncGenerator(): AsyncIterableIterator { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_nested/top_level_await/unresolved.js b/tests/specs/run/top_level_await_nested/top_level_await/unresolved.js new file mode 100644 index 0000000000..231a8cd634 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/unresolved.js @@ -0,0 +1 @@ +await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/unresolved.out b/tests/specs/run/top_level_await_nested/top_level_await/unresolved.out new file mode 100644 index 0000000000..1f4ea5d382 --- /dev/null +++ b/tests/specs/run/top_level_await_nested/top_level_await/unresolved.out @@ -0,0 +1,4 @@ +error: Top-level await promise never resolved +await new Promise(() => {}); +^ + at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_await_order/__test__.jsonc b/tests/specs/run/top_level_await_order/__test__.jsonc new file mode 100644 index 0000000000..65d00d607d --- /dev/null +++ b/tests/specs/run/top_level_await_order/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read top_level_await/order.js", + "output": "top_level_await/order.out" +} diff --git a/tests/specs/run/top_level_await_order/top_level_await/circular.js b/tests/specs/run/top_level_await_order/top_level_await/circular.js new file mode 100644 index 0000000000..ff2964b6a5 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/circular.js @@ -0,0 +1,8 @@ +import { foo } from "./tla3/timeout_loop.js"; + +export const collection = []; + +const mod = await import("./tla3/b.js"); + +console.log("foo in main", foo); +console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_order/top_level_await/circular.out b/tests/specs/run/top_level_await_order/top_level_await/circular.out new file mode 100644 index 0000000000..c889789613 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/circular.out @@ -0,0 +1,10 @@ +timeout loop 0 +timeout loop 1 +timeout loop 2 +timeout loop 3 +timeout loop 4 +timeout loop 5 +error: Top-level await promise never resolved +const mod = await import("./tla3/b.js"); + ^ + at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_order/top_level_await/loop.js b/tests/specs/run/top_level_await_order/top_level_await/loop.js new file mode 100644 index 0000000000..415db5ec78 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/loop.js @@ -0,0 +1,20 @@ +const importsDir = Deno.readDirSync( + Deno.realPathSync("./run/top_level_await/tla2"), +); + +const resolvedPaths = []; + +for (const { name } of importsDir) { + const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); + resolvedPaths.push(filePath); +} + +resolvedPaths.sort(); + +for (const filePath of resolvedPaths) { + console.log("loading", filePath); + const mod = await import(`file://${filePath}`); + console.log("loaded", mod); +} + +console.log("all loaded"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/loop.out b/tests/specs/run/top_level_await_order/top_level_await/loop.out new file mode 100644 index 0000000000..1bdffbf660 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/loop.out @@ -0,0 +1,5 @@ +loading [WILDCARD]a.js +loaded [Module: null prototype] { default: [class Foo] } +loading [WILDCARD]b.js +loaded [Module: null prototype] { default: [class Bar] } +all loaded diff --git a/tests/specs/run/top_level_await_order/top_level_await/nested.out b/tests/specs/run/top_level_await_order/top_level_await/nested.out new file mode 100644 index 0000000000..8a1218a102 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/nested.out @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/tests/specs/run/top_level_await_order/top_level_await/nested/a.js b/tests/specs/run/top_level_await_order/top_level_await/nested/a.js new file mode 100644 index 0000000000..74837d4ba1 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/nested/a.js @@ -0,0 +1,3 @@ +console.log(2); +await import("./b.js"); +console.log(4); diff --git a/tests/specs/run/top_level_await_order/top_level_await/nested/b.js b/tests/specs/run/top_level_await_order/top_level_await/nested/b.js new file mode 100644 index 0000000000..3bd241b50e --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/nested/b.js @@ -0,0 +1 @@ +console.log(3); diff --git a/tests/specs/run/top_level_await_order/top_level_await/nested/main.js b/tests/specs/run/top_level_await_order/top_level_await/nested/main.js new file mode 100644 index 0000000000..ed46a47175 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/nested/main.js @@ -0,0 +1,3 @@ +console.log(1); +await import("./a.js"); +console.log(5); diff --git a/tests/specs/run/top_level_await_order/top_level_await/order.js b/tests/specs/run/top_level_await_order/top_level_await/order.js new file mode 100644 index 0000000000..30659cdfbf --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/order.js @@ -0,0 +1,21 @@ +// Ported from Node +// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs + +const { default: order } = await import("./tla/parent.js"); + +console.log("order", JSON.stringify(order)); + +if ( + !( + order[0] === "order" && + order[1] === "b" && + order[2] === "c" && + order[3] === "d" && + order[4] === "a" && + order[5] === "parent" + ) +) { + throw new Error("TLA wrong order"); +} + +console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/order.out b/tests/specs/run/top_level_await_order/top_level_await/order.out new file mode 100644 index 0000000000..4cc27858cf --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/order.out @@ -0,0 +1,2 @@ +order ["order","b","c","d","a","parent"] +TLA order correct diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/a.js b/tests/specs/run/top_level_await_order/top_level_await/tla/a.js new file mode 100644 index 0000000000..c3ef3f7dbc --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/b.js b/tests/specs/run/top_level_await_order/top_level_await/tla/b.js new file mode 100644 index 0000000000..3271c92d8f --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/c.js b/tests/specs/run/top_level_await_order/top_level_await/tla/c.js new file mode 100644 index 0000000000..806eb0a8be --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/d.js b/tests/specs/run/top_level_await_order/top_level_await/tla/d.js new file mode 100644 index 0000000000..283ebf817f --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/order.js b/tests/specs/run/top_level_await_order/top_level_await/tla/order.js new file mode 100644 index 0000000000..f213a562ce --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_order/top_level_await/tla/parent.js new file mode 100644 index 0000000000..1ecc154634 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_order/top_level_await/tla2/a.js new file mode 100644 index 0000000000..d07bcb94db --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_order/top_level_await/tla2/b.js new file mode 100644 index 0000000000..68e357c1e9 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_order/top_level_await/tla3/b.js new file mode 100644 index 0000000000..d0349545e9 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_order/top_level_await/tla3/timeout_loop.js new file mode 100644 index 0000000000..860e6cd2ae --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_order/top_level_await/top_level_await.js new file mode 100644 index 0000000000..ea319ea124 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/top_level_await.js @@ -0,0 +1,3 @@ +const buf = await Deno.readFile("./assets/hello.txt"); +const n = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_order/top_level_await/top_level_await.out new file mode 100644 index 0000000000..4b65d15fe3 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/top_level_await.out @@ -0,0 +1,3 @@ +Hello world! + +write 12 diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_order/top_level_await/top_level_await.ts new file mode 100644 index 0000000000..8d47ceb21e --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/top_level_await.ts @@ -0,0 +1,3 @@ +const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); +const n: number = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.js new file mode 100644 index 0000000000..a330f6c711 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.js @@ -0,0 +1,10 @@ +function* asyncGenerator() { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.out new file mode 100644 index 0000000000..4539bbf2d2 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.out @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.ts new file mode 100644 index 0000000000..9179322d78 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.ts @@ -0,0 +1,10 @@ +async function* asyncGenerator(): AsyncIterableIterator { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_order/top_level_await/unresolved.js b/tests/specs/run/top_level_await_order/top_level_await/unresolved.js new file mode 100644 index 0000000000..231a8cd634 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/unresolved.js @@ -0,0 +1 @@ +await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_order/top_level_await/unresolved.out b/tests/specs/run/top_level_await_order/top_level_await/unresolved.out new file mode 100644 index 0000000000..1f4ea5d382 --- /dev/null +++ b/tests/specs/run/top_level_await_order/top_level_await/unresolved.out @@ -0,0 +1,4 @@ +error: Top-level await promise never resolved +await new Promise(() => {}); +^ + at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_await_ts/__test__.jsonc b/tests/specs/run/top_level_await_ts/__test__.jsonc new file mode 100644 index 0000000000..15f937df19 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --allow-read top_level_await/top_level_await.ts", + "output": "top_level_await/top_level_await.out" +} diff --git a/tests/specs/run/top_level_await_ts/hello.txt b/tests/specs/run/top_level_await_ts/hello.txt new file mode 100644 index 0000000000..6769dd60bd --- /dev/null +++ b/tests/specs/run/top_level_await_ts/hello.txt @@ -0,0 +1 @@ +Hello world! \ No newline at end of file diff --git a/tests/specs/run/top_level_await_ts/top_level_await/circular.js b/tests/specs/run/top_level_await_ts/top_level_await/circular.js new file mode 100644 index 0000000000..ff2964b6a5 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/circular.js @@ -0,0 +1,8 @@ +import { foo } from "./tla3/timeout_loop.js"; + +export const collection = []; + +const mod = await import("./tla3/b.js"); + +console.log("foo in main", foo); +console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/circular.out b/tests/specs/run/top_level_await_ts/top_level_await/circular.out new file mode 100644 index 0000000000..c889789613 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/circular.out @@ -0,0 +1,10 @@ +timeout loop 0 +timeout loop 1 +timeout loop 2 +timeout loop 3 +timeout loop 4 +timeout loop 5 +error: Top-level await promise never resolved +const mod = await import("./tla3/b.js"); + ^ + at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_ts/top_level_await/loop.js b/tests/specs/run/top_level_await_ts/top_level_await/loop.js new file mode 100644 index 0000000000..415db5ec78 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/loop.js @@ -0,0 +1,20 @@ +const importsDir = Deno.readDirSync( + Deno.realPathSync("./run/top_level_await/tla2"), +); + +const resolvedPaths = []; + +for (const { name } of importsDir) { + const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); + resolvedPaths.push(filePath); +} + +resolvedPaths.sort(); + +for (const filePath of resolvedPaths) { + console.log("loading", filePath); + const mod = await import(`file://${filePath}`); + console.log("loaded", mod); +} + +console.log("all loaded"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/loop.out b/tests/specs/run/top_level_await_ts/top_level_await/loop.out new file mode 100644 index 0000000000..1bdffbf660 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/loop.out @@ -0,0 +1,5 @@ +loading [WILDCARD]a.js +loaded [Module: null prototype] { default: [class Foo] } +loading [WILDCARD]b.js +loaded [Module: null prototype] { default: [class Bar] } +all loaded diff --git a/tests/specs/run/top_level_await_ts/top_level_await/nested.out b/tests/specs/run/top_level_await_ts/top_level_await/nested.out new file mode 100644 index 0000000000..8a1218a102 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/nested.out @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/tests/specs/run/top_level_await_ts/top_level_await/nested/a.js b/tests/specs/run/top_level_await_ts/top_level_await/nested/a.js new file mode 100644 index 0000000000..74837d4ba1 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/nested/a.js @@ -0,0 +1,3 @@ +console.log(2); +await import("./b.js"); +console.log(4); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/nested/b.js b/tests/specs/run/top_level_await_ts/top_level_await/nested/b.js new file mode 100644 index 0000000000..3bd241b50e --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/nested/b.js @@ -0,0 +1 @@ +console.log(3); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/nested/main.js b/tests/specs/run/top_level_await_ts/top_level_await/nested/main.js new file mode 100644 index 0000000000..ed46a47175 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/nested/main.js @@ -0,0 +1,3 @@ +console.log(1); +await import("./a.js"); +console.log(5); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/order.js b/tests/specs/run/top_level_await_ts/top_level_await/order.js new file mode 100644 index 0000000000..30659cdfbf --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/order.js @@ -0,0 +1,21 @@ +// Ported from Node +// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs + +const { default: order } = await import("./tla/parent.js"); + +console.log("order", JSON.stringify(order)); + +if ( + !( + order[0] === "order" && + order[1] === "b" && + order[2] === "c" && + order[3] === "d" && + order[4] === "a" && + order[5] === "parent" + ) +) { + throw new Error("TLA wrong order"); +} + +console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/order.out b/tests/specs/run/top_level_await_ts/top_level_await/order.out new file mode 100644 index 0000000000..4cc27858cf --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/order.out @@ -0,0 +1,2 @@ +order ["order","b","c","d","a","parent"] +TLA order correct diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/a.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/a.js new file mode 100644 index 0000000000..c3ef3f7dbc --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/b.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/b.js new file mode 100644 index 0000000000..3271c92d8f --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/c.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/c.js new file mode 100644 index 0000000000..806eb0a8be --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/d.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/d.js new file mode 100644 index 0000000000..283ebf817f --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/order.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/order.js new file mode 100644 index 0000000000..f213a562ce --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/parent.js new file mode 100644 index 0000000000..1ecc154634 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_ts/top_level_await/tla2/a.js new file mode 100644 index 0000000000..d07bcb94db --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_ts/top_level_await/tla2/b.js new file mode 100644 index 0000000000..68e357c1e9 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_ts/top_level_await/tla3/b.js new file mode 100644 index 0000000000..d0349545e9 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_ts/top_level_await/tla3/timeout_loop.js new file mode 100644 index 0000000000..860e6cd2ae --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.js new file mode 100644 index 0000000000..ea319ea124 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.js @@ -0,0 +1,3 @@ +const buf = await Deno.readFile("./assets/hello.txt"); +const n = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.out new file mode 100644 index 0000000000..4b65d15fe3 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.out @@ -0,0 +1,3 @@ +Hello world! + +write 12 diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.ts new file mode 100644 index 0000000000..48f66545ac --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/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/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.js new file mode 100644 index 0000000000..a330f6c711 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.js @@ -0,0 +1,10 @@ +function* asyncGenerator() { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.out new file mode 100644 index 0000000000..4539bbf2d2 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.out @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.ts new file mode 100644 index 0000000000..9179322d78 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.ts @@ -0,0 +1,10 @@ +async function* asyncGenerator(): AsyncIterableIterator { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_ts/top_level_await/unresolved.js b/tests/specs/run/top_level_await_ts/top_level_await/unresolved.js new file mode 100644 index 0000000000..231a8cd634 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/unresolved.js @@ -0,0 +1 @@ +await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/unresolved.out b/tests/specs/run/top_level_await_ts/top_level_await/unresolved.out new file mode 100644 index 0000000000..1f4ea5d382 --- /dev/null +++ b/tests/specs/run/top_level_await_ts/top_level_await/unresolved.out @@ -0,0 +1,4 @@ +error: Top-level await promise never resolved +await new Promise(() => {}); +^ + at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_await_unresolved/__test__.jsonc b/tests/specs/run/top_level_await_unresolved/__test__.jsonc new file mode 100644 index 0000000000..a92774c1b8 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run top_level_await/unresolved.js", + "output": "top_level_await/unresolved.out", + "exitCode": 1 +} diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/circular.js b/tests/specs/run/top_level_await_unresolved/top_level_await/circular.js new file mode 100644 index 0000000000..ff2964b6a5 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/circular.js @@ -0,0 +1,8 @@ +import { foo } from "./tla3/timeout_loop.js"; + +export const collection = []; + +const mod = await import("./tla3/b.js"); + +console.log("foo in main", foo); +console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/circular.out b/tests/specs/run/top_level_await_unresolved/top_level_await/circular.out new file mode 100644 index 0000000000..c889789613 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/circular.out @@ -0,0 +1,10 @@ +timeout loop 0 +timeout loop 1 +timeout loop 2 +timeout loop 3 +timeout loop 4 +timeout loop 5 +error: Top-level await promise never resolved +const mod = await import("./tla3/b.js"); + ^ + at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/loop.js b/tests/specs/run/top_level_await_unresolved/top_level_await/loop.js new file mode 100644 index 0000000000..415db5ec78 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/loop.js @@ -0,0 +1,20 @@ +const importsDir = Deno.readDirSync( + Deno.realPathSync("./run/top_level_await/tla2"), +); + +const resolvedPaths = []; + +for (const { name } of importsDir) { + const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); + resolvedPaths.push(filePath); +} + +resolvedPaths.sort(); + +for (const filePath of resolvedPaths) { + console.log("loading", filePath); + const mod = await import(`file://${filePath}`); + console.log("loaded", mod); +} + +console.log("all loaded"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/loop.out b/tests/specs/run/top_level_await_unresolved/top_level_await/loop.out new file mode 100644 index 0000000000..1bdffbf660 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/loop.out @@ -0,0 +1,5 @@ +loading [WILDCARD]a.js +loaded [Module: null prototype] { default: [class Foo] } +loading [WILDCARD]b.js +loaded [Module: null prototype] { default: [class Bar] } +all loaded diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/nested.out b/tests/specs/run/top_level_await_unresolved/top_level_await/nested.out new file mode 100644 index 0000000000..8a1218a102 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/nested.out @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/nested/a.js b/tests/specs/run/top_level_await_unresolved/top_level_await/nested/a.js new file mode 100644 index 0000000000..74837d4ba1 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/nested/a.js @@ -0,0 +1,3 @@ +console.log(2); +await import("./b.js"); +console.log(4); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/nested/b.js b/tests/specs/run/top_level_await_unresolved/top_level_await/nested/b.js new file mode 100644 index 0000000000..3bd241b50e --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/nested/b.js @@ -0,0 +1 @@ +console.log(3); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/nested/main.js b/tests/specs/run/top_level_await_unresolved/top_level_await/nested/main.js new file mode 100644 index 0000000000..ed46a47175 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/nested/main.js @@ -0,0 +1,3 @@ +console.log(1); +await import("./a.js"); +console.log(5); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/order.js b/tests/specs/run/top_level_await_unresolved/top_level_await/order.js new file mode 100644 index 0000000000..30659cdfbf --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/order.js @@ -0,0 +1,21 @@ +// Ported from Node +// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs + +const { default: order } = await import("./tla/parent.js"); + +console.log("order", JSON.stringify(order)); + +if ( + !( + order[0] === "order" && + order[1] === "b" && + order[2] === "c" && + order[3] === "d" && + order[4] === "a" && + order[5] === "parent" + ) +) { + throw new Error("TLA wrong order"); +} + +console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/order.out b/tests/specs/run/top_level_await_unresolved/top_level_await/order.out new file mode 100644 index 0000000000..4cc27858cf --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/order.out @@ -0,0 +1,2 @@ +order ["order","b","c","d","a","parent"] +TLA order correct diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/a.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/a.js new file mode 100644 index 0000000000..c3ef3f7dbc --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/b.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/b.js new file mode 100644 index 0000000000..3271c92d8f --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/c.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/c.js new file mode 100644 index 0000000000..806eb0a8be --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/d.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/d.js new file mode 100644 index 0000000000..283ebf817f --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/order.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/order.js new file mode 100644 index 0000000000..f213a562ce --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/parent.js new file mode 100644 index 0000000000..1ecc154634 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/a.js new file mode 100644 index 0000000000..d07bcb94db --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/b.js new file mode 100644 index 0000000000..68e357c1e9 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/b.js new file mode 100644 index 0000000000..d0349545e9 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/timeout_loop.js new file mode 100644 index 0000000000..860e6cd2ae --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.js new file mode 100644 index 0000000000..ea319ea124 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.js @@ -0,0 +1,3 @@ +const buf = await Deno.readFile("./assets/hello.txt"); +const n = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.out new file mode 100644 index 0000000000..4b65d15fe3 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.out @@ -0,0 +1,3 @@ +Hello world! + +write 12 diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.ts new file mode 100644 index 0000000000..8d47ceb21e --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.ts @@ -0,0 +1,3 @@ +const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); +const n: number = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.js new file mode 100644 index 0000000000..a330f6c711 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.js @@ -0,0 +1,10 @@ +function* asyncGenerator() { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.out new file mode 100644 index 0000000000..4539bbf2d2 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.out @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.ts new file mode 100644 index 0000000000..9179322d78 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.ts @@ -0,0 +1,10 @@ +async function* asyncGenerator(): AsyncIterableIterator { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.js b/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.js new file mode 100644 index 0000000000..231a8cd634 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.js @@ -0,0 +1 @@ +await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.out b/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.out new file mode 100644 index 0000000000..1f4ea5d382 --- /dev/null +++ b/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.out @@ -0,0 +1,4 @@ +error: Top-level await promise never resolved +await new Promise(() => {}); +^ + at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_for_await/__test__.jsonc b/tests/specs/run/top_level_for_await/__test__.jsonc new file mode 100644 index 0000000000..198008560b --- /dev/null +++ b/tests/specs/run/top_level_for_await/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet top_level_await/top_level_for_await.js", + "output": "top_level_await/top_level_for_await.out" +} diff --git a/tests/specs/run/top_level_for_await/top_level_await/circular.js b/tests/specs/run/top_level_for_await/top_level_await/circular.js new file mode 100644 index 0000000000..ff2964b6a5 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/circular.js @@ -0,0 +1,8 @@ +import { foo } from "./tla3/timeout_loop.js"; + +export const collection = []; + +const mod = await import("./tla3/b.js"); + +console.log("foo in main", foo); +console.log("mod", mod); diff --git a/tests/specs/run/top_level_for_await/top_level_await/circular.out b/tests/specs/run/top_level_for_await/top_level_await/circular.out new file mode 100644 index 0000000000..c889789613 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/circular.out @@ -0,0 +1,10 @@ +timeout loop 0 +timeout loop 1 +timeout loop 2 +timeout loop 3 +timeout loop 4 +timeout loop 5 +error: Top-level await promise never resolved +const mod = await import("./tla3/b.js"); + ^ + at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_for_await/top_level_await/loop.js b/tests/specs/run/top_level_for_await/top_level_await/loop.js new file mode 100644 index 0000000000..415db5ec78 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/loop.js @@ -0,0 +1,20 @@ +const importsDir = Deno.readDirSync( + Deno.realPathSync("./run/top_level_await/tla2"), +); + +const resolvedPaths = []; + +for (const { name } of importsDir) { + const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); + resolvedPaths.push(filePath); +} + +resolvedPaths.sort(); + +for (const filePath of resolvedPaths) { + console.log("loading", filePath); + const mod = await import(`file://${filePath}`); + console.log("loaded", mod); +} + +console.log("all loaded"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/loop.out b/tests/specs/run/top_level_for_await/top_level_await/loop.out new file mode 100644 index 0000000000..1bdffbf660 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/loop.out @@ -0,0 +1,5 @@ +loading [WILDCARD]a.js +loaded [Module: null prototype] { default: [class Foo] } +loading [WILDCARD]b.js +loaded [Module: null prototype] { default: [class Bar] } +all loaded diff --git a/tests/specs/run/top_level_for_await/top_level_await/nested.out b/tests/specs/run/top_level_for_await/top_level_await/nested.out new file mode 100644 index 0000000000..8a1218a102 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/nested.out @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/tests/specs/run/top_level_for_await/top_level_await/nested/a.js b/tests/specs/run/top_level_for_await/top_level_await/nested/a.js new file mode 100644 index 0000000000..74837d4ba1 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/nested/a.js @@ -0,0 +1,3 @@ +console.log(2); +await import("./b.js"); +console.log(4); diff --git a/tests/specs/run/top_level_for_await/top_level_await/nested/b.js b/tests/specs/run/top_level_for_await/top_level_await/nested/b.js new file mode 100644 index 0000000000..3bd241b50e --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/nested/b.js @@ -0,0 +1 @@ +console.log(3); diff --git a/tests/specs/run/top_level_for_await/top_level_await/nested/main.js b/tests/specs/run/top_level_for_await/top_level_await/nested/main.js new file mode 100644 index 0000000000..ed46a47175 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/nested/main.js @@ -0,0 +1,3 @@ +console.log(1); +await import("./a.js"); +console.log(5); diff --git a/tests/specs/run/top_level_for_await/top_level_await/order.js b/tests/specs/run/top_level_for_await/top_level_await/order.js new file mode 100644 index 0000000000..30659cdfbf --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/order.js @@ -0,0 +1,21 @@ +// Ported from Node +// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs + +const { default: order } = await import("./tla/parent.js"); + +console.log("order", JSON.stringify(order)); + +if ( + !( + order[0] === "order" && + order[1] === "b" && + order[2] === "c" && + order[3] === "d" && + order[4] === "a" && + order[5] === "parent" + ) +) { + throw new Error("TLA wrong order"); +} + +console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/order.out b/tests/specs/run/top_level_for_await/top_level_await/order.out new file mode 100644 index 0000000000..4cc27858cf --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/order.out @@ -0,0 +1,2 @@ +order ["order","b","c","d","a","parent"] +TLA order correct diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/a.js b/tests/specs/run/top_level_for_await/top_level_await/tla/a.js new file mode 100644 index 0000000000..c3ef3f7dbc --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/b.js b/tests/specs/run/top_level_for_await/top_level_await/tla/b.js new file mode 100644 index 0000000000..3271c92d8f --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/c.js b/tests/specs/run/top_level_for_await/top_level_await/tla/c.js new file mode 100644 index 0000000000..806eb0a8be --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/d.js b/tests/specs/run/top_level_for_await/top_level_await/tla/d.js new file mode 100644 index 0000000000..283ebf817f --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/order.js b/tests/specs/run/top_level_for_await/top_level_await/tla/order.js new file mode 100644 index 0000000000..f213a562ce --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/parent.js b/tests/specs/run/top_level_for_await/top_level_await/tla/parent.js new file mode 100644 index 0000000000..1ecc154634 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla2/a.js b/tests/specs/run/top_level_for_await/top_level_await/tla2/a.js new file mode 100644 index 0000000000..d07bcb94db --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla2/b.js b/tests/specs/run/top_level_for_await/top_level_await/tla2/b.js new file mode 100644 index 0000000000..68e357c1e9 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla3/b.js b/tests/specs/run/top_level_for_await/top_level_await/tla3/b.js new file mode 100644 index 0000000000..d0349545e9 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_for_await/top_level_await/tla3/timeout_loop.js new file mode 100644 index 0000000000..860e6cd2ae --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_await.js b/tests/specs/run/top_level_for_await/top_level_await/top_level_await.js new file mode 100644 index 0000000000..ea319ea124 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/top_level_await.js @@ -0,0 +1,3 @@ +const buf = await Deno.readFile("./assets/hello.txt"); +const n = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_await.out b/tests/specs/run/top_level_for_await/top_level_await/top_level_await.out new file mode 100644 index 0000000000..4b65d15fe3 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/top_level_await.out @@ -0,0 +1,3 @@ +Hello world! + +write 12 diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_await.ts b/tests/specs/run/top_level_for_await/top_level_await/top_level_await.ts new file mode 100644 index 0000000000..8d47ceb21e --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/top_level_await.ts @@ -0,0 +1,3 @@ +const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); +const n: number = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.js new file mode 100644 index 0000000000..a330f6c711 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.js @@ -0,0 +1,10 @@ +function* asyncGenerator() { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.out new file mode 100644 index 0000000000..4539bbf2d2 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.out @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.ts new file mode 100644 index 0000000000..9179322d78 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.ts @@ -0,0 +1,10 @@ +async function* asyncGenerator(): AsyncIterableIterator { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_for_await/top_level_await/unresolved.js b/tests/specs/run/top_level_for_await/top_level_await/unresolved.js new file mode 100644 index 0000000000..231a8cd634 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/unresolved.js @@ -0,0 +1 @@ +await new Promise(() => {}); diff --git a/tests/specs/run/top_level_for_await/top_level_await/unresolved.out b/tests/specs/run/top_level_for_await/top_level_await/unresolved.out new file mode 100644 index 0000000000..1f4ea5d382 --- /dev/null +++ b/tests/specs/run/top_level_for_await/top_level_await/unresolved.out @@ -0,0 +1,4 @@ +error: Top-level await promise never resolved +await new Promise(() => {}); +^ + at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_for_await_ts/__test__.jsonc b/tests/specs/run/top_level_for_await_ts/__test__.jsonc new file mode 100644 index 0000000000..22314e8e0d --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet top_level_await/top_level_for_await.ts", + "output": "top_level_await/top_level_for_await.out" +} diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/circular.js b/tests/specs/run/top_level_for_await_ts/top_level_await/circular.js new file mode 100644 index 0000000000..ff2964b6a5 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/circular.js @@ -0,0 +1,8 @@ +import { foo } from "./tla3/timeout_loop.js"; + +export const collection = []; + +const mod = await import("./tla3/b.js"); + +console.log("foo in main", foo); +console.log("mod", mod); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/circular.out b/tests/specs/run/top_level_for_await_ts/top_level_await/circular.out new file mode 100644 index 0000000000..c889789613 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/circular.out @@ -0,0 +1,10 @@ +timeout loop 0 +timeout loop 1 +timeout loop 2 +timeout loop 3 +timeout loop 4 +timeout loop 5 +error: Top-level await promise never resolved +const mod = await import("./tla3/b.js"); + ^ + at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/loop.js b/tests/specs/run/top_level_for_await_ts/top_level_await/loop.js new file mode 100644 index 0000000000..415db5ec78 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/loop.js @@ -0,0 +1,20 @@ +const importsDir = Deno.readDirSync( + Deno.realPathSync("./run/top_level_await/tla2"), +); + +const resolvedPaths = []; + +for (const { name } of importsDir) { + const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); + resolvedPaths.push(filePath); +} + +resolvedPaths.sort(); + +for (const filePath of resolvedPaths) { + console.log("loading", filePath); + const mod = await import(`file://${filePath}`); + console.log("loaded", mod); +} + +console.log("all loaded"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/loop.out b/tests/specs/run/top_level_for_await_ts/top_level_await/loop.out new file mode 100644 index 0000000000..1bdffbf660 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/loop.out @@ -0,0 +1,5 @@ +loading [WILDCARD]a.js +loaded [Module: null prototype] { default: [class Foo] } +loading [WILDCARD]b.js +loaded [Module: null prototype] { default: [class Bar] } +all loaded diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/nested.out b/tests/specs/run/top_level_for_await_ts/top_level_await/nested.out new file mode 100644 index 0000000000..8a1218a102 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/nested.out @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/nested/a.js b/tests/specs/run/top_level_for_await_ts/top_level_await/nested/a.js new file mode 100644 index 0000000000..74837d4ba1 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/nested/a.js @@ -0,0 +1,3 @@ +console.log(2); +await import("./b.js"); +console.log(4); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/nested/b.js b/tests/specs/run/top_level_for_await_ts/top_level_await/nested/b.js new file mode 100644 index 0000000000..3bd241b50e --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/nested/b.js @@ -0,0 +1 @@ +console.log(3); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/nested/main.js b/tests/specs/run/top_level_for_await_ts/top_level_await/nested/main.js new file mode 100644 index 0000000000..ed46a47175 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/nested/main.js @@ -0,0 +1,3 @@ +console.log(1); +await import("./a.js"); +console.log(5); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/order.js b/tests/specs/run/top_level_for_await_ts/top_level_await/order.js new file mode 100644 index 0000000000..30659cdfbf --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/order.js @@ -0,0 +1,21 @@ +// Ported from Node +// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs + +const { default: order } = await import("./tla/parent.js"); + +console.log("order", JSON.stringify(order)); + +if ( + !( + order[0] === "order" && + order[1] === "b" && + order[2] === "c" && + order[3] === "d" && + order[4] === "a" && + order[5] === "parent" + ) +) { + throw new Error("TLA wrong order"); +} + +console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/order.out b/tests/specs/run/top_level_for_await_ts/top_level_await/order.out new file mode 100644 index 0000000000..4cc27858cf --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/order.out @@ -0,0 +1,2 @@ +order ["order","b","c","d","a","parent"] +TLA order correct diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/a.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/a.js new file mode 100644 index 0000000000..c3ef3f7dbc --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/a.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("b"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/b.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/b.js new file mode 100644 index 0000000000..3271c92d8f --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/b.js @@ -0,0 +1,7 @@ +import order from "./order.js"; + +await new Promise((resolve) => { + setTimeout(resolve, 200); +}); + +order.push("a"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/c.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/c.js new file mode 100644 index 0000000000..806eb0a8be --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/c.js @@ -0,0 +1,3 @@ +import order from "./order.js"; + +order.push("c"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/d.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/d.js new file mode 100644 index 0000000000..283ebf817f --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/d.js @@ -0,0 +1,8 @@ +import order from "./order.js"; + +const end = Date.now() + 500; +while (end < Date.now()) { + // pass +} + +order.push("d"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/order.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/order.js new file mode 100644 index 0000000000..f213a562ce --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/order.js @@ -0,0 +1 @@ +export default ["order"]; diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/parent.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/parent.js new file mode 100644 index 0000000000..1ecc154634 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/parent.js @@ -0,0 +1,9 @@ +import order from "./order.js"; +import "./a.js"; +import "./b.js"; +import "./c.js"; +import "./d.js"; + +order.push("parent"); + +export default order; diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/a.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/a.js new file mode 100644 index 0000000000..d07bcb94db --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/a.js @@ -0,0 +1,5 @@ +export default class Foo { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/b.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/b.js new file mode 100644 index 0000000000..68e357c1e9 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/b.js @@ -0,0 +1,5 @@ +export default class Bar { + constructor(message) { + this.message = message; + } +} diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/b.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/b.js new file mode 100644 index 0000000000..d0349545e9 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/b.js @@ -0,0 +1,7 @@ +import { foo } from "./timeout_loop.js"; +import { collection } from "../circular.js"; + +console.log("collection in b", collection); +console.log("foo in b", foo); + +export const a = "a"; diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/timeout_loop.js new file mode 100644 index 0000000000..860e6cd2ae --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/timeout_loop.js @@ -0,0 +1,23 @@ +export const foo = "foo"; + +export function delay(ms) { + return new Promise((res) => + setTimeout(() => { + res(); + }, ms) + ); +} + +let i = 0; + +async function timeoutLoop() { + await delay(1000); + console.log("timeout loop", i); + i++; + if (i > 5) { + return; + } + timeoutLoop(); +} + +timeoutLoop(); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.js b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.js new file mode 100644 index 0000000000..ea319ea124 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.js @@ -0,0 +1,3 @@ +const buf = await Deno.readFile("./assets/hello.txt"); +const n = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.out b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.out new file mode 100644 index 0000000000..4b65d15fe3 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.out @@ -0,0 +1,3 @@ +Hello world! + +write 12 diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.ts b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.ts new file mode 100644 index 0000000000..8d47ceb21e --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.ts @@ -0,0 +1,3 @@ +const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); +const n: number = await Deno.stdout.write(buf); +console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.js new file mode 100644 index 0000000000..a330f6c711 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.js @@ -0,0 +1,10 @@ +function* asyncGenerator() { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.out new file mode 100644 index 0000000000..4539bbf2d2 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.out @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.ts new file mode 100644 index 0000000000..9179322d78 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.ts @@ -0,0 +1,10 @@ +async function* asyncGenerator(): AsyncIterableIterator { + let i = 0; + while (i < 3) { + yield i++; + } +} + +for await (const num of asyncGenerator()) { + console.log(num); +} diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.js b/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.js new file mode 100644 index 0000000000..231a8cd634 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.js @@ -0,0 +1 @@ +await new Promise(() => {}); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.out b/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.out new file mode 100644 index 0000000000..1f4ea5d382 --- /dev/null +++ b/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.out @@ -0,0 +1,4 @@ +error: Top-level await promise never resolved +await new Promise(() => {}); +^ + at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/ts_decorators/__test__.jsonc b/tests/specs/run/ts_decorators/__test__.jsonc new file mode 100644 index 0000000000..96e7cdf308 --- /dev/null +++ b/tests/specs/run/ts_decorators/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --check decorators/experimental/ts/main.ts", + "output": "decorators/experimental/ts/main.out" +} diff --git a/tests/specs/run/ts_decorators/decorators/experimental/deno.json b/tests/specs/run/ts_decorators/decorators/experimental/deno.json new file mode 100644 index 0000000000..504cd646e1 --- /dev/null +++ b/tests/specs/run/ts_decorators/decorators/experimental/deno.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "experimentalDecorators": true + } +} diff --git a/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.out b/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.out new file mode 100644 index 0000000000..015f7076e8 --- /dev/null +++ b/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.out @@ -0,0 +1,3 @@ +a(): evaluated +a(): called +method diff --git a/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.ts b/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.ts new file mode 100644 index 0000000000..9f7ec550d5 --- /dev/null +++ b/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.ts @@ -0,0 +1,21 @@ +// deno-lint-ignore-file +function a() { + console.log("a(): evaluated"); + return ( + _target: any, + _propertyKey: string, + _descriptor: PropertyDescriptor, + ) => { + console.log("a(): called"); + }; +} + +class B { + @a() + method() { + console.log("method"); + } +} + +const b = new B(); +b.method(); diff --git a/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.out b/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.out new file mode 100644 index 0000000000..0fc1d4590e --- /dev/null +++ b/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.out @@ -0,0 +1,7 @@ +@A evaluated +@B evaluated +@B called +@A called +fn() called from @A +fn() called from @B +C.test() called diff --git a/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.ts b/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.ts new file mode 100644 index 0000000000..40a26bbd4d --- /dev/null +++ b/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.ts @@ -0,0 +1,42 @@ +// deno-lint-ignore-file +function a() { + console.log("@A evaluated"); + return function ( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor, + ) { + console.log("@A called"); + const fn = descriptor.value; + descriptor.value = function () { + console.log("fn() called from @A"); + fn(); + }; + }; +} + +function b() { + console.log("@B evaluated"); + return function ( + target: any, + propertyKey: string, + descriptor: PropertyDescriptor, + ) { + console.log("@B called"); + const fn = descriptor.value; + descriptor.value = function () { + console.log("fn() called from @B"); + fn(); + }; + }; +} + +class C { + @a() + @b() + static test() { + console.log("C.test() called"); + } +} + +C.test(); diff --git a/tests/specs/run/ts_decorators/decorators/experimental/ts/main.out b/tests/specs/run/ts_decorators/decorators/experimental/ts/main.out new file mode 100644 index 0000000000..ea64fbaa63 --- /dev/null +++ b/tests/specs/run/ts_decorators/decorators/experimental/ts/main.out @@ -0,0 +1,3 @@ +Warning experimentalDecorators compiler option is deprecated and may be removed at any time +Check [WILDCARD] +SomeClass { someField: "asdf" } diff --git a/tests/specs/run/ts_decorators/decorators/experimental/ts/main.ts b/tests/specs/run/ts_decorators/decorators/experimental/ts/main.ts new file mode 100644 index 0000000000..95fba6cd48 --- /dev/null +++ b/tests/specs/run/ts_decorators/decorators/experimental/ts/main.ts @@ -0,0 +1,14 @@ +// deno-lint-ignore-file + +function Decorate() { + return function (constructor: any): any { + return class extends constructor { + protected someField: string = "asdf"; + }; + }; +} + +@Decorate() +class SomeClass {} + +console.log(new SomeClass()); diff --git a/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.out b/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.out new file mode 100644 index 0000000000..39394952e8 --- /dev/null +++ b/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.out @@ -0,0 +1,3 @@ +starting m with arguments 1 +C.m 1 +ending m diff --git a/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.ts b/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.ts new file mode 100644 index 0000000000..00c8a85025 --- /dev/null +++ b/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.ts @@ -0,0 +1,21 @@ +// deno-lint-ignore no-explicit-any +function logged(value: any, { kind, name }: { kind: string; name: string }) { + if (kind === "method") { + return function (...args: unknown[]) { + console.log(`starting ${name} with arguments ${args.join(", ")}`); + // @ts-ignore this has implicit any type + const ret = value.call(this, ...args); + console.log(`ending ${name}`); + return ret; + }; + } +} + +class C { + @logged + m(arg: number) { + console.log("C.m", arg); + } +} + +new C().m(1); diff --git a/tests/specs/run/ts_import_from_js/005_more_imports.ts b/tests/specs/run/ts_import_from_js/005_more_imports.ts new file mode 100644 index 0000000000..c69556be15 --- /dev/null +++ b/tests/specs/run/ts_import_from_js/005_more_imports.ts @@ -0,0 +1,11 @@ +import { printHello3, returnsFoo2, returnsHi } from "./mod1.ts"; + +printHello3(); + +if (returnsHi() !== "Hi") { + throw Error("Unexpected"); +} + +if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); +} diff --git a/tests/specs/run/ts_import_from_js/__test__.jsonc b/tests/specs/run/ts_import_from_js/__test__.jsonc new file mode 100644 index 0000000000..de11873cbc --- /dev/null +++ b/tests/specs/run/ts_import_from_js/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --quiet --reload ts_import_from_js/main.js", + "output": "ts_import_from_js/main.out" +} diff --git a/tests/specs/run/ts_import_from_js/mod1.ts b/tests/specs/run/ts_import_from_js/mod1.ts new file mode 100644 index 0000000000..5e58f432ed --- /dev/null +++ b/tests/specs/run/ts_import_from_js/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/tests/specs/run/ts_import_from_js/mod2.ts b/tests/specs/run/ts_import_from_js/mod2.ts new file mode 100644 index 0000000000..ce1adc0e81 --- /dev/null +++ b/tests/specs/run/ts_import_from_js/mod2.ts @@ -0,0 +1 @@ +export { printHello } from "./print_hello.ts"; diff --git a/tests/specs/run/ts_import_from_js/print_hello.ts b/tests/specs/run/ts_import_from_js/print_hello.ts new file mode 100644 index 0000000000..b9c0ad5275 --- /dev/null +++ b/tests/specs/run/ts_import_from_js/print_hello.ts @@ -0,0 +1,3 @@ +export function printHello() { + console.log("Hello"); +} diff --git a/tests/specs/run/ts_import_from_js/subdir2/dynamic_import.ts b/tests/specs/run/ts_import_from_js/subdir2/dynamic_import.ts new file mode 100644 index 0000000000..59beb64c33 --- /dev/null +++ b/tests/specs/run/ts_import_from_js/subdir2/dynamic_import.ts @@ -0,0 +1,4 @@ +(async () => { + const { printHello } = await import("../mod2.ts"); + printHello(); +})(); diff --git a/tests/specs/run/ts_import_from_js/subdir2/mod2.ts b/tests/specs/run/ts_import_from_js/subdir2/mod2.ts new file mode 100644 index 0000000000..9071d0aeb4 --- /dev/null +++ b/tests/specs/run/ts_import_from_js/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/tests/testdata/run/ts_import_from_js/deps.js b/tests/specs/run/ts_import_from_js/ts_import_from_js/deps.js similarity index 100% rename from tests/testdata/run/ts_import_from_js/deps.js rename to tests/specs/run/ts_import_from_js/ts_import_from_js/deps.js diff --git a/tests/testdata/run/ts_import_from_js/main.js b/tests/specs/run/ts_import_from_js/ts_import_from_js/main.js similarity index 100% rename from tests/testdata/run/ts_import_from_js/main.js rename to tests/specs/run/ts_import_from_js/ts_import_from_js/main.js diff --git a/tests/testdata/run/ts_import_from_js/main.out b/tests/specs/run/ts_import_from_js/ts_import_from_js/main.out similarity index 100% rename from tests/testdata/run/ts_import_from_js/main.out rename to tests/specs/run/ts_import_from_js/ts_import_from_js/main.out diff --git a/tests/specs/run/ts_type_imports/__test__.jsonc b/tests/specs/run/ts_type_imports/__test__.jsonc new file mode 100644 index 0000000000..e9a925d1a8 --- /dev/null +++ b/tests/specs/run/ts_type_imports/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --check ts_type_imports.ts", + "output": "ts_type_imports.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/ts_type_imports.ts b/tests/specs/run/ts_type_imports/ts_type_imports.ts similarity index 100% rename from tests/testdata/run/ts_type_imports.ts rename to tests/specs/run/ts_type_imports/ts_type_imports.ts diff --git a/tests/testdata/run/ts_type_imports.ts.out b/tests/specs/run/ts_type_imports/ts_type_imports.ts.out similarity index 100% rename from tests/testdata/run/ts_type_imports.ts.out rename to tests/specs/run/ts_type_imports/ts_type_imports.ts.out diff --git a/tests/specs/run/ts_type_imports/ts_type_imports_foo.ts b/tests/specs/run/ts_type_imports/ts_type_imports_foo.ts new file mode 100644 index 0000000000..db20773f63 --- /dev/null +++ b/tests/specs/run/ts_type_imports/ts_type_imports_foo.ts @@ -0,0 +1 @@ +export type Foo = Map; diff --git a/tests/specs/run/ts_type_only_import/__test__.jsonc b/tests/specs/run/ts_type_only_import/__test__.jsonc new file mode 100644 index 0000000000..977a6aba7a --- /dev/null +++ b/tests/specs/run/ts_type_only_import/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --check ts_type_only_import.ts", + "output": "ts_type_only_import.ts.out" +} diff --git a/tests/specs/run/ts_type_only_import/ts_type_only_import.d.ts b/tests/specs/run/ts_type_only_import/ts_type_only_import.d.ts new file mode 100644 index 0000000000..d48e4b48ab --- /dev/null +++ b/tests/specs/run/ts_type_only_import/ts_type_only_import.d.ts @@ -0,0 +1,3 @@ +export interface HelloWorld { + a: string; +} diff --git a/tests/testdata/run/ts_type_only_import.ts b/tests/specs/run/ts_type_only_import/ts_type_only_import.ts similarity index 100% rename from tests/testdata/run/ts_type_only_import.ts rename to tests/specs/run/ts_type_only_import/ts_type_only_import.ts diff --git a/tests/testdata/run/ts_type_only_import.ts.out b/tests/specs/run/ts_type_only_import/ts_type_only_import.ts.out similarity index 100% rename from tests/testdata/run/ts_type_only_import.ts.out rename to tests/specs/run/ts_type_only_import/ts_type_only_import.ts.out diff --git a/tests/specs/run/ts_without_extension/__test__.jsonc b/tests/specs/run/ts_without_extension/__test__.jsonc new file mode 100644 index 0000000000..a6c713bf5a --- /dev/null +++ b/tests/specs/run/ts_without_extension/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --ext ts --check ts_without_extension", + "output": "ts_without_extension.out", + "exitCode": 0 +} diff --git a/tests/specs/run/ts_without_extension/ts_without_extension b/tests/specs/run/ts_without_extension/ts_without_extension new file mode 100644 index 0000000000..f10891d7a2 --- /dev/null +++ b/tests/specs/run/ts_without_extension/ts_without_extension @@ -0,0 +1,3 @@ +interface Lollipop {} + +console.log("executing typescript with no extension"); diff --git a/tests/specs/run/ts_without_extension/ts_without_extension.out b/tests/specs/run/ts_without_extension/ts_without_extension.out new file mode 100644 index 0000000000..4f02dd4c33 --- /dev/null +++ b/tests/specs/run/ts_without_extension/ts_without_extension.out @@ -0,0 +1,2 @@ +Check [WILDCARD]/ts_without_extension +executing typescript with no extension diff --git a/tests/specs/run/tsx_imports/046_jsx_test.tsx b/tests/specs/run/tsx_imports/046_jsx_test.tsx new file mode 100644 index 0000000000..5ed3ff2fab --- /dev/null +++ b/tests/specs/run/tsx_imports/046_jsx_test.tsx @@ -0,0 +1,14 @@ +declare global { + export namespace JSX { + interface IntrinsicElements { + [elemName: string]: any; + } + } +} +const React = { + createElement(factory: any, props: any, ...children: any[]) { + return { factory, props, children }; + }, +}; +const View = () =>
land
; +console.log(); diff --git a/tests/specs/run/tsx_imports/__test__.jsonc b/tests/specs/run/tsx_imports/__test__.jsonc new file mode 100644 index 0000000000..2026804add --- /dev/null +++ b/tests/specs/run/tsx_imports/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --check tsx_imports/tsx_imports.ts", + "output": "tsx_imports/tsx_imports.ts.out" +} diff --git a/tests/testdata/run/tsx_imports/Component.tsx b/tests/specs/run/tsx_imports/tsx_imports/Component.tsx similarity index 100% rename from tests/testdata/run/tsx_imports/Component.tsx rename to tests/specs/run/tsx_imports/tsx_imports/Component.tsx diff --git a/tests/testdata/run/tsx_imports/tsx_imports.ts b/tests/specs/run/tsx_imports/tsx_imports/tsx_imports.ts similarity index 100% rename from tests/testdata/run/tsx_imports/tsx_imports.ts rename to tests/specs/run/tsx_imports/tsx_imports/tsx_imports.ts diff --git a/tests/testdata/run/tsx_imports/tsx_imports.ts.out b/tests/specs/run/tsx_imports/tsx_imports/tsx_imports.ts.out similarity index 100% rename from tests/testdata/run/tsx_imports/tsx_imports.ts.out rename to tests/specs/run/tsx_imports/tsx_imports/tsx_imports.ts.out diff --git a/tests/specs/run/type_definitions/__test__.jsonc b/tests/specs/run/type_definitions/__test__.jsonc new file mode 100644 index 0000000000..5030612a51 --- /dev/null +++ b/tests/specs/run/type_definitions/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload type_definitions.ts", + "output": "type_definitions.ts.out" +} diff --git a/tests/testdata/run/type_definitions.ts b/tests/specs/run/type_definitions/type_definitions.ts similarity index 56% rename from tests/testdata/run/type_definitions.ts rename to tests/specs/run/type_definitions/type_definitions.ts index 5948427219..0297c7e3d5 100644 --- a/tests/testdata/run/type_definitions.ts +++ b/tests/specs/run/type_definitions/type_definitions.ts @@ -1,11 +1,11 @@ // deno-lint-ignore-file // @deno-types="../type_definitions/foo.d.ts" -import { foo } from "../type_definitions/foo.js"; +import { foo } from "./type_definitions/foo.js"; // @deno-types="../type_definitions/fizz.d.ts" -import "../type_definitions/fizz.js"; +import "./type_definitions/fizz.js"; -import * as qat from "../type_definitions/qat.ts"; +import * as qat from "./type_definitions/qat.ts"; console.log(foo); console.log(fizz); diff --git a/tests/testdata/run/type_definitions.ts.out b/tests/specs/run/type_definitions/type_definitions.ts.out similarity index 100% rename from tests/testdata/run/type_definitions.ts.out rename to tests/specs/run/type_definitions/type_definitions.ts.out diff --git a/tests/specs/run/type_definitions/type_definitions/bar.d.ts b/tests/specs/run/type_definitions/type_definitions/bar.d.ts new file mode 100644 index 0000000000..d43335dbb5 --- /dev/null +++ b/tests/specs/run/type_definitions/type_definitions/bar.d.ts @@ -0,0 +1,7 @@ +/// + +declare namespace bar { + export class Bar { + baz: string; + } +} diff --git a/tests/specs/run/type_definitions/type_definitions/bar.js b/tests/specs/run/type_definitions/type_definitions/bar.js new file mode 100644 index 0000000000..e9c2e5193c --- /dev/null +++ b/tests/specs/run/type_definitions/type_definitions/bar.js @@ -0,0 +1,5 @@ +export class Bar { + constructor() { + this.baz = "baz"; + } +} diff --git a/tests/specs/run/type_definitions/type_definitions/fizz.d.ts b/tests/specs/run/type_definitions/type_definitions/fizz.d.ts new file mode 100644 index 0000000000..34eb41b960 --- /dev/null +++ b/tests/specs/run/type_definitions/type_definitions/fizz.d.ts @@ -0,0 +1,2 @@ +/** A global value. */ +declare const fizz: string; diff --git a/tests/specs/run/type_definitions/type_definitions/fizz.js b/tests/specs/run/type_definitions/type_definitions/fizz.js new file mode 100644 index 0000000000..852162c940 --- /dev/null +++ b/tests/specs/run/type_definitions/type_definitions/fizz.js @@ -0,0 +1 @@ +globalThis.fizz = "fizz"; diff --git a/tests/specs/run/type_definitions/type_definitions/foo.d.ts b/tests/specs/run/type_definitions/type_definitions/foo.d.ts new file mode 100644 index 0000000000..ce39201e1b --- /dev/null +++ b/tests/specs/run/type_definitions/type_definitions/foo.d.ts @@ -0,0 +1,2 @@ +/** An exported value. */ +export const foo: string; diff --git a/tests/specs/run/type_definitions/type_definitions/foo.js b/tests/specs/run/type_definitions/type_definitions/foo.js new file mode 100644 index 0000000000..61d366eb25 --- /dev/null +++ b/tests/specs/run/type_definitions/type_definitions/foo.js @@ -0,0 +1 @@ +export const foo = "foo"; diff --git a/tests/specs/run/type_definitions/type_definitions/qat.ts b/tests/specs/run/type_definitions/type_definitions/qat.ts new file mode 100644 index 0000000000..6196c9d387 --- /dev/null +++ b/tests/specs/run/type_definitions/type_definitions/qat.ts @@ -0,0 +1 @@ +export const qat = "qat"; diff --git a/tests/specs/run/type_definitions_for_export/__test__.jsonc b/tests/specs/run/type_definitions_for_export/__test__.jsonc new file mode 100644 index 0000000000..cf32bc9609 --- /dev/null +++ b/tests/specs/run/type_definitions_for_export/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --reload --check type_definitions_for_export.ts", + "output": "type_definitions_for_export.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/type_definitions_for_export/export_type_def.ts b/tests/specs/run/type_definitions_for_export/export_type_def.ts new file mode 100644 index 0000000000..e33b70a644 --- /dev/null +++ b/tests/specs/run/type_definitions_for_export/export_type_def.ts @@ -0,0 +1,2 @@ +// @deno-types="./type_definitions/foo.d.ts" +export { foo } from "./type_definitions/foo.js"; diff --git a/tests/specs/run/type_definitions_for_export/type_definitions/bar.d.ts b/tests/specs/run/type_definitions_for_export/type_definitions/bar.d.ts new file mode 100644 index 0000000000..d43335dbb5 --- /dev/null +++ b/tests/specs/run/type_definitions_for_export/type_definitions/bar.d.ts @@ -0,0 +1,7 @@ +/// + +declare namespace bar { + export class Bar { + baz: string; + } +} diff --git a/tests/specs/run/type_definitions_for_export/type_definitions/bar.js b/tests/specs/run/type_definitions_for_export/type_definitions/bar.js new file mode 100644 index 0000000000..e9c2e5193c --- /dev/null +++ b/tests/specs/run/type_definitions_for_export/type_definitions/bar.js @@ -0,0 +1,5 @@ +export class Bar { + constructor() { + this.baz = "baz"; + } +} diff --git a/tests/specs/run/type_definitions_for_export/type_definitions/fizz.d.ts b/tests/specs/run/type_definitions_for_export/type_definitions/fizz.d.ts new file mode 100644 index 0000000000..34eb41b960 --- /dev/null +++ b/tests/specs/run/type_definitions_for_export/type_definitions/fizz.d.ts @@ -0,0 +1,2 @@ +/** A global value. */ +declare const fizz: string; diff --git a/tests/specs/run/type_definitions_for_export/type_definitions/fizz.js b/tests/specs/run/type_definitions_for_export/type_definitions/fizz.js new file mode 100644 index 0000000000..852162c940 --- /dev/null +++ b/tests/specs/run/type_definitions_for_export/type_definitions/fizz.js @@ -0,0 +1 @@ +globalThis.fizz = "fizz"; diff --git a/tests/specs/run/type_definitions_for_export/type_definitions/foo.d.ts b/tests/specs/run/type_definitions_for_export/type_definitions/foo.d.ts new file mode 100644 index 0000000000..ce39201e1b --- /dev/null +++ b/tests/specs/run/type_definitions_for_export/type_definitions/foo.d.ts @@ -0,0 +1,2 @@ +/** An exported value. */ +export const foo: string; diff --git a/tests/specs/run/type_definitions_for_export/type_definitions/foo.js b/tests/specs/run/type_definitions_for_export/type_definitions/foo.js new file mode 100644 index 0000000000..61d366eb25 --- /dev/null +++ b/tests/specs/run/type_definitions_for_export/type_definitions/foo.js @@ -0,0 +1 @@ +export const foo = "foo"; diff --git a/tests/specs/run/type_definitions_for_export/type_definitions/qat.ts b/tests/specs/run/type_definitions_for_export/type_definitions/qat.ts new file mode 100644 index 0000000000..6196c9d387 --- /dev/null +++ b/tests/specs/run/type_definitions_for_export/type_definitions/qat.ts @@ -0,0 +1 @@ +export const qat = "qat"; diff --git a/tests/testdata/run/type_definitions_for_export.ts b/tests/specs/run/type_definitions_for_export/type_definitions_for_export.ts similarity index 100% rename from tests/testdata/run/type_definitions_for_export.ts rename to tests/specs/run/type_definitions_for_export/type_definitions_for_export.ts diff --git a/tests/testdata/run/type_definitions_for_export.ts.out b/tests/specs/run/type_definitions_for_export/type_definitions_for_export.ts.out similarity index 100% rename from tests/testdata/run/type_definitions_for_export.ts.out rename to tests/specs/run/type_definitions_for_export/type_definitions_for_export.ts.out diff --git a/tests/specs/run/type_directives_01/__test__.jsonc b/tests/specs/run/type_directives_01/__test__.jsonc new file mode 100644 index 0000000000..08826b776e --- /dev/null +++ b/tests/specs/run/type_directives_01/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --check=all -L debug type_directives_01.ts", + "output": "type_directives_01.ts.out" +} diff --git a/tests/testdata/run/type_directives_01.ts b/tests/specs/run/type_directives_01/type_directives_01.ts similarity index 100% rename from tests/testdata/run/type_directives_01.ts rename to tests/specs/run/type_directives_01/type_directives_01.ts diff --git a/tests/testdata/run/type_directives_01.ts.out b/tests/specs/run/type_directives_01/type_directives_01.ts.out similarity index 100% rename from tests/testdata/run/type_directives_01.ts.out rename to tests/specs/run/type_directives_01/type_directives_01.ts.out diff --git a/tests/specs/run/type_directives_02/__test__.jsonc b/tests/specs/run/type_directives_02/__test__.jsonc new file mode 100644 index 0000000000..e731e393e1 --- /dev/null +++ b/tests/specs/run/type_directives_02/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --check=all -L debug type_directives_02.ts", + "output": "type_directives_02.ts.out" +} diff --git a/tests/specs/run/type_directives_02/type_directives_02.ts b/tests/specs/run/type_directives_02/type_directives_02.ts new file mode 100644 index 0000000000..f829c0cec3 --- /dev/null +++ b/tests/specs/run/type_directives_02/type_directives_02.ts @@ -0,0 +1,3 @@ +import * as foo from "./type_reference.js"; + +console.log(foo.foo); diff --git a/tests/specs/run/type_directives_02/type_directives_02.ts.out b/tests/specs/run/type_directives_02/type_directives_02.ts.out new file mode 100644 index 0000000000..d9bd381504 --- /dev/null +++ b/tests/specs/run/type_directives_02/type_directives_02.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +DEBUG TS - host.getSourceFile("file:///[WILDCARD]/type_reference.d.ts", Latest) +[WILDCARD] \ No newline at end of file diff --git a/tests/specs/run/type_directives_02/type_reference.d.ts b/tests/specs/run/type_directives_02/type_reference.d.ts new file mode 100644 index 0000000000..f9b8de5ede --- /dev/null +++ b/tests/specs/run/type_directives_02/type_reference.d.ts @@ -0,0 +1 @@ +export const foo: "foo"; diff --git a/tests/specs/run/type_directives_02/type_reference.js b/tests/specs/run/type_directives_02/type_reference.js new file mode 100644 index 0000000000..917d891980 --- /dev/null +++ b/tests/specs/run/type_directives_02/type_reference.js @@ -0,0 +1,3 @@ +/// + +export const foo = "foo"; diff --git a/tests/specs/run/type_headers_deno_types/__test__.jsonc b/tests/specs/run/type_headers_deno_types/__test__.jsonc new file mode 100644 index 0000000000..1a95fa2d45 --- /dev/null +++ b/tests/specs/run/type_headers_deno_types/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-import --reload --check type_headers_deno_types.ts", + "output": "type_headers_deno_types.ts.out" +} diff --git a/tests/testdata/run/type_headers_deno_types.ts b/tests/specs/run/type_headers_deno_types/type_headers_deno_types.ts similarity index 100% rename from tests/testdata/run/type_headers_deno_types.ts rename to tests/specs/run/type_headers_deno_types/type_headers_deno_types.ts diff --git a/tests/testdata/run/type_headers_deno_types.ts.out b/tests/specs/run/type_headers_deno_types/type_headers_deno_types.ts.out similarity index 100% rename from tests/testdata/run/type_headers_deno_types.ts.out rename to tests/specs/run/type_headers_deno_types/type_headers_deno_types.ts.out diff --git a/tests/specs/run/unbuffered_stderr/__test__.jsonc b/tests/specs/run/unbuffered_stderr/__test__.jsonc new file mode 100644 index 0000000000..4b8a091f24 --- /dev/null +++ b/tests/specs/run/unbuffered_stderr/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload unbuffered_stderr.ts", + "output": "unbuffered_stderr.ts.out" +} diff --git a/tests/testdata/run/unbuffered_stderr.ts b/tests/specs/run/unbuffered_stderr/unbuffered_stderr.ts similarity index 100% rename from tests/testdata/run/unbuffered_stderr.ts rename to tests/specs/run/unbuffered_stderr/unbuffered_stderr.ts diff --git a/tests/testdata/run/unbuffered_stderr.ts.out b/tests/specs/run/unbuffered_stderr/unbuffered_stderr.ts.out similarity index 100% rename from tests/testdata/run/unbuffered_stderr.ts.out rename to tests/specs/run/unbuffered_stderr/unbuffered_stderr.ts.out diff --git a/tests/specs/run/unbuffered_stdout/__test__.jsonc b/tests/specs/run/unbuffered_stdout/__test__.jsonc new file mode 100644 index 0000000000..4225e9d0a2 --- /dev/null +++ b/tests/specs/run/unbuffered_stdout/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload unbuffered_stdout.ts", + "output": "unbuffered_stdout.ts.out" +} diff --git a/tests/testdata/run/unbuffered_stdout.ts b/tests/specs/run/unbuffered_stdout/unbuffered_stdout.ts similarity index 100% rename from tests/testdata/run/unbuffered_stdout.ts rename to tests/specs/run/unbuffered_stdout/unbuffered_stdout.ts diff --git a/tests/testdata/run/unbuffered_stdout.ts.out b/tests/specs/run/unbuffered_stdout/unbuffered_stdout.ts.out similarity index 100% rename from tests/testdata/run/unbuffered_stdout.ts.out rename to tests/specs/run/unbuffered_stdout/unbuffered_stdout.ts.out diff --git a/tests/specs/run/unhandled_rejection/__test__.jsonc b/tests/specs/run/unhandled_rejection/__test__.jsonc new file mode 100644 index 0000000000..3a22292062 --- /dev/null +++ b/tests/specs/run/unhandled_rejection/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --check unhandled_rejection.ts", + "output": "unhandled_rejection.ts.out" +} diff --git a/tests/testdata/run/unhandled_rejection.ts b/tests/specs/run/unhandled_rejection/unhandled_rejection.ts similarity index 100% rename from tests/testdata/run/unhandled_rejection.ts rename to tests/specs/run/unhandled_rejection/unhandled_rejection.ts diff --git a/tests/specs/run/unhandled_rejection/unhandled_rejection.ts.out b/tests/specs/run/unhandled_rejection/unhandled_rejection.ts.out new file mode 100644 index 0000000000..fc5a3915f6 --- /dev/null +++ b/tests/specs/run/unhandled_rejection/unhandled_rejection.ts.out @@ -0,0 +1,9 @@ +[WILDCARD] +unhandled rejection at: Promise { + Error: bar not available + at new Foo (file:///[WILDCARD]/unhandled_rejection.ts:8:20) + at file:///[WILDCARD]/unhandled_rejection.ts:12:1 +} reason: Error: bar not available + at new Foo (file:///[WILDCARD]/unhandled_rejection.ts:8:20) + at file:///[WILDCARD]/unhandled_rejection.ts:12:1 +unhandled rejection at: Promise { undefined } reason: undefined diff --git a/tests/specs/run/unhandled_rejection_dynamic_import/__test__.jsonc b/tests/specs/run/unhandled_rejection_dynamic_import/__test__.jsonc new file mode 100644 index 0000000000..6ca0d093b9 --- /dev/null +++ b/tests/specs/run/unhandled_rejection_dynamic_import/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --allow-read unhandled_rejection_dynamic_import/main.ts", + "output": "unhandled_rejection_dynamic_import/main.ts.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import/import.ts b/tests/specs/run/unhandled_rejection_dynamic_import/unhandled_rejection_dynamic_import/import.ts similarity index 100% rename from tests/testdata/run/unhandled_rejection_dynamic_import/import.ts rename to tests/specs/run/unhandled_rejection_dynamic_import/unhandled_rejection_dynamic_import/import.ts diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import/main.ts b/tests/specs/run/unhandled_rejection_dynamic_import/unhandled_rejection_dynamic_import/main.ts similarity index 100% rename from tests/testdata/run/unhandled_rejection_dynamic_import/main.ts rename to tests/specs/run/unhandled_rejection_dynamic_import/unhandled_rejection_dynamic_import/main.ts diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import/main.ts.out b/tests/specs/run/unhandled_rejection_dynamic_import/unhandled_rejection_dynamic_import/main.ts.out similarity index 100% rename from tests/testdata/run/unhandled_rejection_dynamic_import/main.ts.out rename to tests/specs/run/unhandled_rejection_dynamic_import/unhandled_rejection_dynamic_import/main.ts.out diff --git a/tests/specs/run/unhandled_rejection_dynamic_import2/__test__.jsonc b/tests/specs/run/unhandled_rejection_dynamic_import2/__test__.jsonc new file mode 100644 index 0000000000..a4e588f463 --- /dev/null +++ b/tests/specs/run/unhandled_rejection_dynamic_import2/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read unhandled_rejection_dynamic_import2/main.ts", + "output": "unhandled_rejection_dynamic_import2/main.ts.out" +} diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import2/import.ts b/tests/specs/run/unhandled_rejection_dynamic_import2/unhandled_rejection_dynamic_import2/import.ts similarity index 100% rename from tests/testdata/run/unhandled_rejection_dynamic_import2/import.ts rename to tests/specs/run/unhandled_rejection_dynamic_import2/unhandled_rejection_dynamic_import2/import.ts diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts b/tests/specs/run/unhandled_rejection_dynamic_import2/unhandled_rejection_dynamic_import2/main.ts similarity index 100% rename from tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts rename to tests/specs/run/unhandled_rejection_dynamic_import2/unhandled_rejection_dynamic_import2/main.ts diff --git a/tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts.out b/tests/specs/run/unhandled_rejection_dynamic_import2/unhandled_rejection_dynamic_import2/main.ts.out similarity index 100% rename from tests/testdata/run/unhandled_rejection_dynamic_import2/main.ts.out rename to tests/specs/run/unhandled_rejection_dynamic_import2/unhandled_rejection_dynamic_import2/main.ts.out diff --git a/tests/specs/run/unhandled_rejection_sync_error/__test__.jsonc b/tests/specs/run/unhandled_rejection_sync_error/__test__.jsonc new file mode 100644 index 0000000000..3f09f9c369 --- /dev/null +++ b/tests/specs/run/unhandled_rejection_sync_error/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --check unhandled_rejection_sync_error.ts", + "output": "unhandled_rejection_sync_error.ts.out" +} diff --git a/tests/testdata/run/unhandled_rejection_sync_error.ts b/tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts similarity index 100% rename from tests/testdata/run/unhandled_rejection_sync_error.ts rename to tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts diff --git a/tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts.out b/tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts.out new file mode 100644 index 0000000000..0c1115ef24 --- /dev/null +++ b/tests/specs/run/unhandled_rejection_sync_error/unhandled_rejection_sync_error.ts.out @@ -0,0 +1,6 @@ +[WILDCARD] +unhandled rejection at: Promise { + Error: boom! + at file:///[WILDCARD]unhandled_rejection_sync_error.ts:6:7 +} reason: Error: boom! + at file:///[WILDCARD]unhandled_rejection_sync_error.ts:6:7 diff --git a/tests/specs/run/unsafe_proto/__test__.jsonc b/tests/specs/run/unsafe_proto/__test__.jsonc new file mode 100644 index 0000000000..d1c608b515 --- /dev/null +++ b/tests/specs/run/unsafe_proto/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run -A unsafe_proto/main.js", + "output": "unsafe_proto/main.out", + "exitCode": 0 +} diff --git a/tests/testdata/run/unsafe_proto/main.js b/tests/specs/run/unsafe_proto/unsafe_proto/main.js similarity index 100% rename from tests/testdata/run/unsafe_proto/main.js rename to tests/specs/run/unsafe_proto/unsafe_proto/main.js diff --git a/tests/testdata/run/unsafe_proto/main.out b/tests/specs/run/unsafe_proto/unsafe_proto/main.out similarity index 100% rename from tests/testdata/run/unsafe_proto/main.out rename to tests/specs/run/unsafe_proto/unsafe_proto/main.out diff --git a/tests/testdata/run/unsafe_proto/main_with_unsafe_proto_flag.out b/tests/specs/run/unsafe_proto/unsafe_proto/main_with_unsafe_proto_flag.out similarity index 100% rename from tests/testdata/run/unsafe_proto/main_with_unsafe_proto_flag.out rename to tests/specs/run/unsafe_proto/unsafe_proto/main_with_unsafe_proto_flag.out diff --git a/tests/testdata/run/unsafe_proto/worker.js b/tests/specs/run/unsafe_proto/unsafe_proto/worker.js similarity index 100% rename from tests/testdata/run/unsafe_proto/worker.js rename to tests/specs/run/unsafe_proto/unsafe_proto/worker.js diff --git a/tests/specs/run/unsafe_proto_flag/__test__.jsonc b/tests/specs/run/unsafe_proto_flag/__test__.jsonc new file mode 100644 index 0000000000..8bd2b56ffc --- /dev/null +++ b/tests/specs/run/unsafe_proto_flag/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run -A --unstable-unsafe-proto unsafe_proto/main.js", + "output": "unsafe_proto/main_with_unsafe_proto_flag.out", + "exitCode": 0 +} diff --git a/tests/specs/run/unsafe_proto_flag/unsafe_proto/main.js b/tests/specs/run/unsafe_proto_flag/unsafe_proto/main.js new file mode 100644 index 0000000000..eb95c55a03 --- /dev/null +++ b/tests/specs/run/unsafe_proto_flag/unsafe_proto/main.js @@ -0,0 +1,5 @@ +console.log(Object.hasOwn(Object.prototype, "__proto__")); + +new Worker(import.meta.resolve("./worker.js"), { + type: "module", +}); diff --git a/tests/specs/run/unsafe_proto_flag/unsafe_proto/main.out b/tests/specs/run/unsafe_proto_flag/unsafe_proto/main.out new file mode 100644 index 0000000000..4b095fd0ff --- /dev/null +++ b/tests/specs/run/unsafe_proto_flag/unsafe_proto/main.out @@ -0,0 +1,2 @@ +false +false diff --git a/tests/specs/run/unsafe_proto_flag/unsafe_proto/main_with_unsafe_proto_flag.out b/tests/specs/run/unsafe_proto_flag/unsafe_proto/main_with_unsafe_proto_flag.out new file mode 100644 index 0000000000..bb101b641b --- /dev/null +++ b/tests/specs/run/unsafe_proto_flag/unsafe_proto/main_with_unsafe_proto_flag.out @@ -0,0 +1,2 @@ +true +true diff --git a/tests/specs/run/unsafe_proto_flag/unsafe_proto/worker.js b/tests/specs/run/unsafe_proto_flag/unsafe_proto/worker.js new file mode 100644 index 0000000000..b22bc87139 --- /dev/null +++ b/tests/specs/run/unsafe_proto_flag/unsafe_proto/worker.js @@ -0,0 +1,2 @@ +console.log(Object.hasOwn(Object.prototype, "__proto__")); +close(); diff --git a/tests/specs/run/unstable_broadcast_channel_disabled/__test__.jsonc b/tests/specs/run/unstable_broadcast_channel_disabled/__test__.jsonc new file mode 100644 index 0000000000..fa12c9f91d --- /dev/null +++ b/tests/specs/run/unstable_broadcast_channel_disabled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read unstable_broadcast_channel.js", + "output": "unstable_broadcast_channel.disabled.out" +} diff --git a/tests/testdata/run/unstable_broadcast_channel.disabled.out b/tests/specs/run/unstable_broadcast_channel_disabled/unstable_broadcast_channel.disabled.out similarity index 100% rename from tests/testdata/run/unstable_broadcast_channel.disabled.out rename to tests/specs/run/unstable_broadcast_channel_disabled/unstable_broadcast_channel.disabled.out diff --git a/tests/testdata/run/unstable_broadcast_channel.js b/tests/specs/run/unstable_broadcast_channel_disabled/unstable_broadcast_channel.js similarity index 100% rename from tests/testdata/run/unstable_broadcast_channel.js rename to tests/specs/run/unstable_broadcast_channel_disabled/unstable_broadcast_channel.js diff --git a/tests/specs/run/unstable_broadcast_channel_enabled/__test__.jsonc b/tests/specs/run/unstable_broadcast_channel_enabled/__test__.jsonc new file mode 100644 index 0000000000..f93c7785a4 --- /dev/null +++ b/tests/specs/run/unstable_broadcast_channel_enabled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read --unstable-broadcast-channel unstable_broadcast_channel.js", + "output": "unstable_broadcast_channel.enabled.out" +} diff --git a/tests/testdata/run/unstable_broadcast_channel.enabled.out b/tests/specs/run/unstable_broadcast_channel_enabled/unstable_broadcast_channel.enabled.out similarity index 100% rename from tests/testdata/run/unstable_broadcast_channel.enabled.out rename to tests/specs/run/unstable_broadcast_channel_enabled/unstable_broadcast_channel.enabled.out diff --git a/tests/specs/run/unstable_broadcast_channel_enabled/unstable_broadcast_channel.js b/tests/specs/run/unstable_broadcast_channel_enabled/unstable_broadcast_channel.js new file mode 100644 index 0000000000..b8576aa22f --- /dev/null +++ b/tests/specs/run/unstable_broadcast_channel_enabled/unstable_broadcast_channel.js @@ -0,0 +1,10 @@ +const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main"; + +console.log(scope, globalThis.BroadcastChannel); + +if (scope === "worker") { + postMessage("done"); +} else { + const worker = new Worker(`${import.meta.url}#worker`, { type: "module" }); + worker.onmessage = () => Deno.exit(0); +} diff --git a/tests/specs/run/unstable_cron_disabled/__test__.jsonc b/tests/specs/run/unstable_cron_disabled/__test__.jsonc new file mode 100644 index 0000000000..be89db40b5 --- /dev/null +++ b/tests/specs/run/unstable_cron_disabled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read unstable_cron.js", + "output": "unstable_cron.disabled.out" +} diff --git a/tests/testdata/run/unstable_cron.disabled.out b/tests/specs/run/unstable_cron_disabled/unstable_cron.disabled.out similarity index 100% rename from tests/testdata/run/unstable_cron.disabled.out rename to tests/specs/run/unstable_cron_disabled/unstable_cron.disabled.out diff --git a/tests/testdata/run/unstable_cron.js b/tests/specs/run/unstable_cron_disabled/unstable_cron.js similarity index 100% rename from tests/testdata/run/unstable_cron.js rename to tests/specs/run/unstable_cron_disabled/unstable_cron.js diff --git a/tests/specs/run/unstable_cron_enabled/__test__.jsonc b/tests/specs/run/unstable_cron_enabled/__test__.jsonc new file mode 100644 index 0000000000..07a37e3fef --- /dev/null +++ b/tests/specs/run/unstable_cron_enabled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read --unstable-cron unstable_cron.js", + "output": "unstable_cron.enabled.out" +} diff --git a/tests/testdata/run/unstable_cron.enabled.out b/tests/specs/run/unstable_cron_enabled/unstable_cron.enabled.out similarity index 100% rename from tests/testdata/run/unstable_cron.enabled.out rename to tests/specs/run/unstable_cron_enabled/unstable_cron.enabled.out diff --git a/tests/specs/run/unstable_cron_enabled/unstable_cron.js b/tests/specs/run/unstable_cron_enabled/unstable_cron.js new file mode 100644 index 0000000000..3114f6e555 --- /dev/null +++ b/tests/specs/run/unstable_cron_enabled/unstable_cron.js @@ -0,0 +1,10 @@ +const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main"; + +console.log(scope, Deno.cron); + +if (scope === "worker") { + postMessage("done"); +} else { + const worker = new Worker(`${import.meta.url}#worker`, { type: "module" }); + worker.onmessage = () => Deno.exit(0); +} diff --git a/tests/specs/run/unstable_kv_disabled/__test__.jsonc b/tests/specs/run/unstable_kv_disabled/__test__.jsonc new file mode 100644 index 0000000000..6521c180d8 --- /dev/null +++ b/tests/specs/run/unstable_kv_disabled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read unstable_kv.js", + "output": "unstable_kv.disabled.out" +} diff --git a/tests/testdata/run/unstable_kv.disabled.out b/tests/specs/run/unstable_kv_disabled/unstable_kv.disabled.out similarity index 100% rename from tests/testdata/run/unstable_kv.disabled.out rename to tests/specs/run/unstable_kv_disabled/unstable_kv.disabled.out diff --git a/tests/testdata/run/unstable_kv.js b/tests/specs/run/unstable_kv_disabled/unstable_kv.js similarity index 100% rename from tests/testdata/run/unstable_kv.js rename to tests/specs/run/unstable_kv_disabled/unstable_kv.js diff --git a/tests/specs/run/unstable_kv_enabled/__test__.jsonc b/tests/specs/run/unstable_kv_enabled/__test__.jsonc new file mode 100644 index 0000000000..6e9fea1000 --- /dev/null +++ b/tests/specs/run/unstable_kv_enabled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read --unstable-kv unstable_kv.js", + "output": "unstable_kv.enabled.out" +} diff --git a/tests/testdata/run/unstable_kv.enabled.out b/tests/specs/run/unstable_kv_enabled/unstable_kv.enabled.out similarity index 100% rename from tests/testdata/run/unstable_kv.enabled.out rename to tests/specs/run/unstable_kv_enabled/unstable_kv.enabled.out diff --git a/tests/specs/run/unstable_kv_enabled/unstable_kv.js b/tests/specs/run/unstable_kv_enabled/unstable_kv.js new file mode 100644 index 0000000000..17c0e05aa5 --- /dev/null +++ b/tests/specs/run/unstable_kv_enabled/unstable_kv.js @@ -0,0 +1,14 @@ +const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main"; + +console.log(scope, Deno.AtomicOperation); +console.log(scope, Deno.Kv); +console.log(scope, Deno.KvListIterator); +console.log(scope, Deno.KvU64); +console.log(scope, Deno.openKv); + +if (scope === "worker") { + postMessage("done"); +} else { + const worker = new Worker(`${import.meta.url}#worker`, { type: "module" }); + worker.onmessage = () => Deno.exit(0); +} diff --git a/tests/specs/run/unstable_net_disabled/__test__.jsonc b/tests/specs/run/unstable_net_disabled/__test__.jsonc new file mode 100644 index 0000000000..6bccb2ef6c --- /dev/null +++ b/tests/specs/run/unstable_net_disabled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read unstable_net.js", + "output": "unstable_net.disabled.out" +} diff --git a/tests/testdata/run/unstable_net.disabled.out b/tests/specs/run/unstable_net_disabled/unstable_net.disabled.out similarity index 100% rename from tests/testdata/run/unstable_net.disabled.out rename to tests/specs/run/unstable_net_disabled/unstable_net.disabled.out diff --git a/tests/testdata/run/unstable_net.js b/tests/specs/run/unstable_net_disabled/unstable_net.js similarity index 100% rename from tests/testdata/run/unstable_net.js rename to tests/specs/run/unstable_net_disabled/unstable_net.js diff --git a/tests/specs/run/unstable_net_enabled/__test__.jsonc b/tests/specs/run/unstable_net_enabled/__test__.jsonc new file mode 100644 index 0000000000..8e9696f44a --- /dev/null +++ b/tests/specs/run/unstable_net_enabled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read --unstable-net unstable_net.js", + "output": "unstable_net.enabled.out" +} diff --git a/tests/testdata/run/unstable_net.enabled.out b/tests/specs/run/unstable_net_enabled/unstable_net.enabled.out similarity index 100% rename from tests/testdata/run/unstable_net.enabled.out rename to tests/specs/run/unstable_net_enabled/unstable_net.enabled.out diff --git a/tests/specs/run/unstable_net_enabled/unstable_net.js b/tests/specs/run/unstable_net_enabled/unstable_net.js new file mode 100644 index 0000000000..4492b202b1 --- /dev/null +++ b/tests/specs/run/unstable_net_enabled/unstable_net.js @@ -0,0 +1,11 @@ +const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main"; + +console.log(scope, Deno.listenDatagram); +console.log(scope, globalThis.WebSocketStream); + +if (scope === "worker") { + postMessage("done"); +} else { + const worker = new Worker(`${import.meta.url}#worker`, { type: "module" }); + worker.onmessage = () => Deno.exit(0); +} diff --git a/tests/specs/run/unstable_worker/__test__.jsonc b/tests/specs/run/unstable_worker/__test__.jsonc new file mode 100644 index 0000000000..7a6e9bfbe0 --- /dev/null +++ b/tests/specs/run/unstable_worker/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --reload --quiet --allow-read unstable_worker.ts", + "output": "unstable_worker.ts.out" +} diff --git a/tests/testdata/run/unstable_worker.ts b/tests/specs/run/unstable_worker/unstable_worker.ts similarity index 62% rename from tests/testdata/run/unstable_worker.ts rename to tests/specs/run/unstable_worker/unstable_worker.ts index d111d2c7e3..b0554c5b21 100644 --- a/tests/testdata/run/unstable_worker.ts +++ b/tests/specs/run/unstable_worker/unstable_worker.ts @@ -1,5 +1,5 @@ const w = new Worker( - import.meta.resolve("../workers/worker_unstable.ts"), + import.meta.resolve("./worker_unstable.ts"), { type: "module", name: "Unstable Worker" }, ); diff --git a/tests/testdata/run/unstable_worker.ts.out b/tests/specs/run/unstable_worker/unstable_worker.ts.out similarity index 100% rename from tests/testdata/run/unstable_worker.ts.out rename to tests/specs/run/unstable_worker/unstable_worker.ts.out diff --git a/tests/specs/run/unstable_worker/worker_unstable.ts b/tests/specs/run/unstable_worker/worker_unstable.ts new file mode 100644 index 0000000000..219f34e7b8 --- /dev/null +++ b/tests/specs/run/unstable_worker/worker_unstable.ts @@ -0,0 +1,5 @@ +console.log(Deno.permissions.query); +console.log(Deno.consoleSize); +self.onmessage = () => { + self.close(); +}; diff --git a/tests/specs/run/unstable_worker_options_disabled/__test__.jsonc b/tests/specs/run/unstable_worker_options_disabled/__test__.jsonc new file mode 100644 index 0000000000..30087244ec --- /dev/null +++ b/tests/specs/run/unstable_worker_options_disabled/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload --allow-read unstable_worker_options.js", + "output": "unstable_worker_options.disabled.out", + "exitCode": 70 +} diff --git a/tests/testdata/run/unstable_worker_options.disabled.out b/tests/specs/run/unstable_worker_options_disabled/unstable_worker_options.disabled.out similarity index 100% rename from tests/testdata/run/unstable_worker_options.disabled.out rename to tests/specs/run/unstable_worker_options_disabled/unstable_worker_options.disabled.out diff --git a/tests/testdata/run/unstable_worker_options.js b/tests/specs/run/unstable_worker_options_disabled/unstable_worker_options.js similarity index 100% rename from tests/testdata/run/unstable_worker_options.js rename to tests/specs/run/unstable_worker_options_disabled/unstable_worker_options.js diff --git a/tests/specs/run/unstable_worker_options_enabled/__test__.jsonc b/tests/specs/run/unstable_worker_options_enabled/__test__.jsonc new file mode 100644 index 0000000000..1d397c5f24 --- /dev/null +++ b/tests/specs/run/unstable_worker_options_enabled/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read --unstable-worker-options unstable_worker_options.js", + "output": "unstable_worker_options.enabled.out" +} diff --git a/tests/testdata/run/unstable_worker_options.enabled.out b/tests/specs/run/unstable_worker_options_enabled/unstable_worker_options.enabled.out similarity index 100% rename from tests/testdata/run/unstable_worker_options.enabled.out rename to tests/specs/run/unstable_worker_options_enabled/unstable_worker_options.enabled.out diff --git a/tests/specs/run/unstable_worker_options_enabled/unstable_worker_options.js b/tests/specs/run/unstable_worker_options_enabled/unstable_worker_options.js new file mode 100644 index 0000000000..213eb3ee67 --- /dev/null +++ b/tests/specs/run/unstable_worker_options_enabled/unstable_worker_options.js @@ -0,0 +1,19 @@ +const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main"; + +new Worker(`data:application/javascript;base64,${btoa(`postMessage("ok");`)}`, { + type: "module", + deno: { + permissions: { + read: true, + }, + }, +}).onmessage = ({ data }) => { + console.log(scope, data); + + if (scope === "main") { + const worker = new Worker(`${import.meta.url}#worker`, { type: "module" }); + worker.onmessage = () => Deno.exit(0); + } else { + postMessage("done"); + } +}; diff --git a/tests/specs/run/unsupported_dynamic_import_scheme/__test__.jsonc b/tests/specs/run/unsupported_dynamic_import_scheme/__test__.jsonc new file mode 100644 index 0000000000..7f71dcebae --- /dev/null +++ b/tests/specs/run/unsupported_dynamic_import_scheme/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "eval import('xxx:')", + "output": "unsupported_dynamic_import_scheme.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/unsupported_dynamic_import_scheme.out b/tests/specs/run/unsupported_dynamic_import_scheme/unsupported_dynamic_import_scheme.out similarity index 100% rename from tests/testdata/run/unsupported_dynamic_import_scheme.out rename to tests/specs/run/unsupported_dynamic_import_scheme/unsupported_dynamic_import_scheme.out diff --git a/tests/specs/run/v8_flags_env_run/__test__.jsonc b/tests/specs/run/v8_flags_env_run/__test__.jsonc new file mode 100644 index 0000000000..39ea666b84 --- /dev/null +++ b/tests/specs/run/v8_flags_env_run/__test__.jsonc @@ -0,0 +1,7 @@ +{ + "args": "run v8_flags.js", + "output": "v8_flags.js.out", + "envs": { + "DENO_V8_FLAGS": "--expose-gc" + } +} diff --git a/tests/testdata/run/v8_flags.js b/tests/specs/run/v8_flags_env_run/v8_flags.js similarity index 100% rename from tests/testdata/run/v8_flags.js rename to tests/specs/run/v8_flags_env_run/v8_flags.js diff --git a/tests/testdata/run/v8_flags.js.out b/tests/specs/run/v8_flags_env_run/v8_flags.js.out similarity index 100% rename from tests/testdata/run/v8_flags.js.out rename to tests/specs/run/v8_flags_env_run/v8_flags.js.out diff --git a/tests/specs/run/v8_flags_run/__test__.jsonc b/tests/specs/run/v8_flags_run/__test__.jsonc new file mode 100644 index 0000000000..ff21fb8c5b --- /dev/null +++ b/tests/specs/run/v8_flags_run/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --v8-flags=--expose-gc v8_flags.js", + "output": "v8_flags.js.out" +} diff --git a/tests/specs/run/v8_flags_run/v8_flags.js b/tests/specs/run/v8_flags_run/v8_flags.js new file mode 100644 index 0000000000..f7999c4afd --- /dev/null +++ b/tests/specs/run/v8_flags_run/v8_flags.js @@ -0,0 +1 @@ +console.log(typeof gc); diff --git a/tests/specs/run/v8_flags_run/v8_flags.js.out b/tests/specs/run/v8_flags_run/v8_flags.js.out new file mode 100644 index 0000000000..e2dbde096f --- /dev/null +++ b/tests/specs/run/v8_flags_run/v8_flags.js.out @@ -0,0 +1 @@ +function diff --git a/tests/specs/run/v8_flags_unrecognized/__test__.jsonc b/tests/specs/run/v8_flags_unrecognized/__test__.jsonc new file mode 100644 index 0000000000..93472d0d74 --- /dev/null +++ b/tests/specs/run/v8_flags_unrecognized/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "repl --v8-flags=--foo,bar,--trace-gc,-baz", + "output": "v8_flags_unrecognized.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/v8_flags_unrecognized.out b/tests/specs/run/v8_flags_unrecognized/v8_flags_unrecognized.out similarity index 100% rename from tests/testdata/run/v8_flags_unrecognized.out rename to tests/specs/run/v8_flags_unrecognized/v8_flags_unrecognized.out diff --git a/tests/specs/run/v8_help/__test__.jsonc b/tests/specs/run/v8_help/__test__.jsonc new file mode 100644 index 0000000000..90cbeb2748 --- /dev/null +++ b/tests/specs/run/v8_help/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "repl --v8-flags=--help", + "output": "v8_help.out" +} diff --git a/tests/testdata/run/v8_help.out b/tests/specs/run/v8_help/v8_help.out similarity index 100% rename from tests/testdata/run/v8_help.out rename to tests/specs/run/v8_help/v8_help.out diff --git a/tests/specs/run/wasm/__test__.jsonc b/tests/specs/run/wasm/__test__.jsonc new file mode 100644 index 0000000000..a3c6f58b2b --- /dev/null +++ b/tests/specs/run/wasm/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet wasm.ts", + "output": "wasm.ts.out" +} diff --git a/tests/testdata/run/wasm.ts b/tests/specs/run/wasm/wasm.ts similarity index 100% rename from tests/testdata/run/wasm.ts rename to tests/specs/run/wasm/wasm.ts diff --git a/tests/specs/run/wasm/wasm.ts.out b/tests/specs/run/wasm/wasm.ts.out new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/tests/specs/run/wasm/wasm.ts.out @@ -0,0 +1 @@ +42 diff --git a/tests/specs/run/wasm_async/__test__.jsonc b/tests/specs/run/wasm_async/__test__.jsonc new file mode 100644 index 0000000000..583da86e01 --- /dev/null +++ b/tests/specs/run/wasm_async/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run wasm_async.js", + "output": "wasm_async.out" +} diff --git a/tests/testdata/run/wasm_async.js b/tests/specs/run/wasm_async/wasm_async.js similarity index 100% rename from tests/testdata/run/wasm_async.js rename to tests/specs/run/wasm_async/wasm_async.js diff --git a/tests/testdata/run/wasm_async.out b/tests/specs/run/wasm_async/wasm_async.out similarity index 100% rename from tests/testdata/run/wasm_async.out rename to tests/specs/run/wasm_async/wasm_async.out diff --git a/tests/specs/run/wasm_shared/__test__.jsonc b/tests/specs/run/wasm_shared/__test__.jsonc new file mode 100644 index 0000000000..1b6ececa75 --- /dev/null +++ b/tests/specs/run/wasm_shared/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet wasm_shared.ts", + "output": "wasm_shared.out" +} diff --git a/tests/specs/run/wasm_shared/wasm_shared.out b/tests/specs/run/wasm_shared/wasm_shared.out new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/testdata/run/wasm_shared.ts b/tests/specs/run/wasm_shared/wasm_shared.ts similarity index 100% rename from tests/testdata/run/wasm_shared.ts rename to tests/specs/run/wasm_shared/wasm_shared.ts diff --git a/tests/specs/run/wasm_streaming_panic_test/__test__.jsonc b/tests/specs/run/wasm_streaming_panic_test/__test__.jsonc new file mode 100644 index 0000000000..e22e1f98a8 --- /dev/null +++ b/tests/specs/run/wasm_streaming_panic_test/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run wasm_streaming_panic_test.js", + "output": "wasm_streaming_panic_test.js.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/wasm_streaming_panic_test.js b/tests/specs/run/wasm_streaming_panic_test/wasm_streaming_panic_test.js similarity index 100% rename from tests/testdata/run/wasm_streaming_panic_test.js rename to tests/specs/run/wasm_streaming_panic_test/wasm_streaming_panic_test.js diff --git a/tests/testdata/run/wasm_streaming_panic_test.js.out b/tests/specs/run/wasm_streaming_panic_test/wasm_streaming_panic_test.js.out similarity index 100% rename from tests/testdata/run/wasm_streaming_panic_test.js.out rename to tests/specs/run/wasm_streaming_panic_test/wasm_streaming_panic_test.js.out diff --git a/tests/specs/run/wasm_unreachable/__test__.jsonc b/tests/specs/run/wasm_unreachable/__test__.jsonc new file mode 100644 index 0000000000..cd6165629c --- /dev/null +++ b/tests/specs/run/wasm_unreachable/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --allow-read wasm_unreachable.js", + "output": "wasm_unreachable.out", + "exitCode": 1 +} diff --git a/tests/specs/run/wasm_unreachable/unreachable.wasm b/tests/specs/run/wasm_unreachable/unreachable.wasm new file mode 100644 index 0000000000..a4110ee393 Binary files /dev/null and b/tests/specs/run/wasm_unreachable/unreachable.wasm differ diff --git a/tests/testdata/run/wasm_unreachable.js b/tests/specs/run/wasm_unreachable/wasm_unreachable.js similarity index 82% rename from tests/testdata/run/wasm_unreachable.js rename to tests/specs/run/wasm_unreachable/wasm_unreachable.js index d6a4f59dbc..36aab0d84f 100644 --- a/tests/testdata/run/wasm_unreachable.js +++ b/tests/specs/run/wasm_unreachable/wasm_unreachable.js @@ -1,5 +1,5 @@ // WebAssembly module containing a single function with an unreachable instruction -const binary = await Deno.readFile("./assets/unreachable.wasm"); +const binary = await Deno.readFile("./unreachable.wasm"); const module = new WebAssembly.Module(binary); const instance = new WebAssembly.Instance(module); diff --git a/tests/testdata/run/wasm_unreachable.out b/tests/specs/run/wasm_unreachable/wasm_unreachable.out similarity index 100% rename from tests/testdata/run/wasm_unreachable.out rename to tests/specs/run/wasm_unreachable/wasm_unreachable.out diff --git a/tests/specs/run/wasm_url/__test__.jsonc b/tests/specs/run/wasm_url/__test__.jsonc new file mode 100644 index 0000000000..a776527b1f --- /dev/null +++ b/tests/specs/run/wasm_url/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --allow-net=localhost:4545 wasm_url.js", + "output": "wasm_url.out", + "exitCode": 1 +} diff --git a/tests/testdata/run/wasm_url.js b/tests/specs/run/wasm_url/wasm_url.js similarity index 100% rename from tests/testdata/run/wasm_url.js rename to tests/specs/run/wasm_url/wasm_url.js diff --git a/tests/testdata/run/wasm_url.out b/tests/specs/run/wasm_url/wasm_url.out similarity index 100% rename from tests/testdata/run/wasm_url.out rename to tests/specs/run/wasm_url/wasm_url.out diff --git a/tests/specs/run/weakref/__test__.jsonc b/tests/specs/run/weakref/__test__.jsonc new file mode 100644 index 0000000000..1a5808ec7b --- /dev/null +++ b/tests/specs/run/weakref/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload weakref.ts", + "output": "weakref.ts.out" +} diff --git a/tests/testdata/run/weakref.ts b/tests/specs/run/weakref/weakref.ts similarity index 100% rename from tests/testdata/run/weakref.ts rename to tests/specs/run/weakref/weakref.ts diff --git a/tests/testdata/run/weakref.ts.out b/tests/specs/run/weakref/weakref.ts.out similarity index 100% rename from tests/testdata/run/weakref.ts.out rename to tests/specs/run/weakref/weakref.ts.out diff --git a/tests/specs/run/webstorage_serialization/__test__.jsonc b/tests/specs/run/webstorage_serialization/__test__.jsonc new file mode 100644 index 0000000000..4362a84b26 --- /dev/null +++ b/tests/specs/run/webstorage_serialization/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run webstorage/serialization.ts", + "output": "webstorage/serialization.ts.out" +} diff --git a/tests/specs/run/webstorage_serialization/webstorage/config_a.jsonc b/tests/specs/run/webstorage_serialization/webstorage/config_a.jsonc new file mode 100644 index 0000000000..875cb60012 --- /dev/null +++ b/tests/specs/run/webstorage_serialization/webstorage/config_a.jsonc @@ -0,0 +1,3 @@ +{ + "compilerOptions": {} +} diff --git a/tests/specs/run/webstorage_serialization/webstorage/config_b.jsonc b/tests/specs/run/webstorage_serialization/webstorage/config_b.jsonc new file mode 100644 index 0000000000..875cb60012 --- /dev/null +++ b/tests/specs/run/webstorage_serialization/webstorage/config_b.jsonc @@ -0,0 +1,3 @@ +{ + "compilerOptions": {} +} diff --git a/tests/specs/run/webstorage_serialization/webstorage/fixture.ts b/tests/specs/run/webstorage_serialization/webstorage/fixture.ts new file mode 100644 index 0000000000..cf4bd9f1f1 --- /dev/null +++ b/tests/specs/run/webstorage_serialization/webstorage/fixture.ts @@ -0,0 +1,2 @@ +import "./logger.ts"; +import "./setter.ts"; diff --git a/tests/specs/run/webstorage_serialization/webstorage/logger.ts b/tests/specs/run/webstorage_serialization/webstorage/logger.ts new file mode 100644 index 0000000000..feadd39eb6 --- /dev/null +++ b/tests/specs/run/webstorage_serialization/webstorage/logger.ts @@ -0,0 +1 @@ +console.log(globalThis.localStorage); diff --git a/tests/testdata/run/webstorage/serialization.ts b/tests/specs/run/webstorage_serialization/webstorage/serialization.ts similarity index 100% rename from tests/testdata/run/webstorage/serialization.ts rename to tests/specs/run/webstorage_serialization/webstorage/serialization.ts diff --git a/tests/testdata/run/webstorage/serialization.ts.out b/tests/specs/run/webstorage_serialization/webstorage/serialization.ts.out similarity index 100% rename from tests/testdata/run/webstorage/serialization.ts.out rename to tests/specs/run/webstorage_serialization/webstorage/serialization.ts.out diff --git a/tests/specs/run/webstorage_serialization/webstorage/setter.ts b/tests/specs/run/webstorage_serialization/webstorage/setter.ts new file mode 100644 index 0000000000..cf5a7bfaf6 --- /dev/null +++ b/tests/specs/run/webstorage_serialization/webstorage/setter.ts @@ -0,0 +1 @@ +globalThis.localStorage.setItem("hello", "deno"); diff --git a/tests/specs/run/worker_close_in_wasm_reactions/__test__.jsonc b/tests/specs/run/worker_close_in_wasm_reactions/__test__.jsonc new file mode 100644 index 0000000000..104b547564 --- /dev/null +++ b/tests/specs/run/worker_close_in_wasm_reactions/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read worker_close_in_wasm_reactions.js", + "output": "worker_close_in_wasm_reactions.js.out" +} diff --git a/tests/specs/run/worker_close_in_wasm_reactions/close_in_wasm_reactions.js b/tests/specs/run/worker_close_in_wasm_reactions/close_in_wasm_reactions.js new file mode 100644 index 0000000000..abe5731085 --- /dev/null +++ b/tests/specs/run/worker_close_in_wasm_reactions/close_in_wasm_reactions.js @@ -0,0 +1,21 @@ +// https://github.com/denoland/deno/issues/12263 +// Test for a panic that happens when a worker is closed in the reactions of a +// WASM async operation. + +// The minimum valid wasm module, plus two additional zero bytes. +const buffer = new Uint8Array([ + 0x00, + 0x61, + 0x73, + 0x6D, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, +]); +WebAssembly.compile(buffer).catch((err) => { + console.log("Error:", err); + self.close(); +}); diff --git a/tests/testdata/run/worker_close_in_wasm_reactions.js b/tests/specs/run/worker_close_in_wasm_reactions/worker_close_in_wasm_reactions.js similarity index 80% rename from tests/testdata/run/worker_close_in_wasm_reactions.js rename to tests/specs/run/worker_close_in_wasm_reactions/worker_close_in_wasm_reactions.js index 95f34e944d..828320a240 100644 --- a/tests/testdata/run/worker_close_in_wasm_reactions.js +++ b/tests/specs/run/worker_close_in_wasm_reactions/worker_close_in_wasm_reactions.js @@ -5,6 +5,6 @@ // WASM async operation. new Worker( - import.meta.resolve("../workers/close_in_wasm_reactions.js"), + import.meta.resolve("./close_in_wasm_reactions.js"), { type: "module" }, ); diff --git a/tests/testdata/run/worker_close_in_wasm_reactions.js.out b/tests/specs/run/worker_close_in_wasm_reactions/worker_close_in_wasm_reactions.js.out similarity index 100% rename from tests/testdata/run/worker_close_in_wasm_reactions.js.out rename to tests/specs/run/worker_close_in_wasm_reactions/worker_close_in_wasm_reactions.js.out diff --git a/tests/specs/run/worker_close_nested/__test__.jsonc b/tests/specs/run/worker_close_nested/__test__.jsonc new file mode 100644 index 0000000000..5cce107c7a --- /dev/null +++ b/tests/specs/run/worker_close_nested/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read worker_close_nested.js", + "output": "worker_close_nested.js.out" +} diff --git a/tests/specs/run/worker_close_nested/close_nested_child.js b/tests/specs/run/worker_close_nested/close_nested_child.js new file mode 100644 index 0000000000..97980c689e --- /dev/null +++ b/tests/specs/run/worker_close_nested/close_nested_child.js @@ -0,0 +1,8 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +console.log("Starting the child worker"); + +setTimeout(() => { + console.log("The child worker survived the death of the parent!!!"); + Deno.exit(1); +}, 2000); diff --git a/tests/specs/run/worker_close_nested/close_nested_parent.js b/tests/specs/run/worker_close_nested/close_nested_parent.js new file mode 100644 index 0000000000..d1fe47553e --- /dev/null +++ b/tests/specs/run/worker_close_nested/close_nested_parent.js @@ -0,0 +1,13 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +console.log("Starting the parent worker"); + +new Worker( + import.meta.resolve("./close_nested_child.js"), + { type: "module" }, +); + +self.addEventListener("message", () => { + console.log("Closing"); + self.close(); +}); diff --git a/tests/testdata/run/worker_close_nested.js b/tests/specs/run/worker_close_nested/worker_close_nested.js similarity index 89% rename from tests/testdata/run/worker_close_nested.js rename to tests/specs/run/worker_close_nested/worker_close_nested.js index 37b6ed9c9a..8d9c88d1cf 100644 --- a/tests/testdata/run/worker_close_nested.js +++ b/tests/specs/run/worker_close_nested/worker_close_nested.js @@ -6,7 +6,7 @@ console.log("Starting the main thread"); const worker = new Worker( - import.meta.resolve("../workers/close_nested_parent.js"), + import.meta.resolve("./close_nested_parent.js"), { type: "module" }, ); diff --git a/tests/testdata/run/worker_close_nested.js.out b/tests/specs/run/worker_close_nested/worker_close_nested.js.out similarity index 100% rename from tests/testdata/run/worker_close_nested.js.out rename to tests/specs/run/worker_close_nested/worker_close_nested.js.out diff --git a/tests/specs/run/worker_close_race/__test__.jsonc b/tests/specs/run/worker_close_race/__test__.jsonc new file mode 100644 index 0000000000..bdb9665f7e --- /dev/null +++ b/tests/specs/run/worker_close_race/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read worker_close_race.js", + "output": "worker_close_race.js.out" +} diff --git a/tests/specs/run/worker_close_race/close_race_worker.js b/tests/specs/run/worker_close_race/close_race_worker.js new file mode 100644 index 0000000000..6964be34a0 --- /dev/null +++ b/tests/specs/run/worker_close_race/close_race_worker.js @@ -0,0 +1,6 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +setTimeout(() => { + self.postMessage(""); + self.close(); +}, 500); diff --git a/tests/testdata/run/worker_close_race.js b/tests/specs/run/worker_close_race/worker_close_race.js similarity index 85% rename from tests/testdata/run/worker_close_race.js rename to tests/specs/run/worker_close_race/worker_close_race.js index 1da8324259..188cd9ed88 100644 --- a/tests/testdata/run/worker_close_race.js +++ b/tests/specs/run/worker_close_race/worker_close_race.js @@ -5,7 +5,7 @@ // `Worker.prototype.terminate()`. const worker = new Worker( - import.meta.resolve("../workers/close_race_worker.js"), + import.meta.resolve("./close_race_worker.js"), { type: "module" }, ); diff --git a/tests/specs/run/worker_close_race/worker_close_race.js.out b/tests/specs/run/worker_close_race/worker_close_race.js.out new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/specs/run/worker_drop_handle_race/__test__.jsonc b/tests/specs/run/worker_drop_handle_race/__test__.jsonc new file mode 100644 index 0000000000..cc600d5ef4 --- /dev/null +++ b/tests/specs/run/worker_drop_handle_race/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --quiet --reload --allow-read worker_drop_handle_race.js", + "output": "worker_drop_handle_race.js.out", + "exitCode": 1 +} diff --git a/tests/specs/run/worker_drop_handle_race/drop_handle_race.js b/tests/specs/run/worker_drop_handle_race/drop_handle_race.js new file mode 100644 index 0000000000..30676a600a --- /dev/null +++ b/tests/specs/run/worker_drop_handle_race/drop_handle_race.js @@ -0,0 +1,3 @@ +setTimeout(() => { + throw new Error(); +}, 1000); diff --git a/tests/testdata/run/worker_drop_handle_race.js b/tests/specs/run/worker_drop_handle_race/worker_drop_handle_race.js similarity index 88% rename from tests/testdata/run/worker_drop_handle_race.js rename to tests/specs/run/worker_drop_handle_race/worker_drop_handle_race.js index 731a369648..ef9bcbe072 100644 --- a/tests/testdata/run/worker_drop_handle_race.js +++ b/tests/specs/run/worker_drop_handle_race/worker_drop_handle_race.js @@ -7,6 +7,6 @@ // The exception thrown in the worker will not terminate the worker, but it will // propagate to the main thread and cause it to exit. new Worker( - import.meta.resolve("../workers/drop_handle_race.js"), + import.meta.resolve("./drop_handle_race.js"), { type: "module" }, ); diff --git a/tests/testdata/run/worker_drop_handle_race.js.out b/tests/specs/run/worker_drop_handle_race/worker_drop_handle_race.js.out similarity index 79% rename from tests/testdata/run/worker_drop_handle_race.js.out rename to tests/specs/run/worker_drop_handle_race/worker_drop_handle_race.js.out index 0820f164e5..a1c2e30ad4 100644 --- a/tests/testdata/run/worker_drop_handle_race.js.out +++ b/tests/specs/run/worker_drop_handle_race/worker_drop_handle_race.js.out @@ -1,7 +1,7 @@ error: Uncaught (in worker "") Error throw new Error(); ^ - at [WILDCARD]/workers/drop_handle_race.js:2:9 + at [WILDCARD]/drop_handle_race.js:2:9 at [WILDCARD] error: Uncaught (in promise) Error: Unhandled error in child worker. at Worker.#pollControl [WILDCARD] diff --git a/tests/specs/run/worker_drop_handle_race_terminate/__test__.jsonc b/tests/specs/run/worker_drop_handle_race_terminate/__test__.jsonc new file mode 100644 index 0000000000..e752074ebf --- /dev/null +++ b/tests/specs/run/worker_drop_handle_race_terminate/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run worker_drop_handle_race_terminate.js", + "output": "worker_drop_handle_race_terminate.js.out" +} diff --git a/tests/testdata/run/worker_drop_handle_race_terminate.js b/tests/specs/run/worker_drop_handle_race_terminate/worker_drop_handle_race_terminate.js similarity index 100% rename from tests/testdata/run/worker_drop_handle_race_terminate.js rename to tests/specs/run/worker_drop_handle_race_terminate/worker_drop_handle_race_terminate.js diff --git a/tests/testdata/run/worker_drop_handle_race_terminate.js.out b/tests/specs/run/worker_drop_handle_race_terminate/worker_drop_handle_race_terminate.js.out similarity index 100% rename from tests/testdata/run/worker_drop_handle_race_terminate.js.out rename to tests/specs/run/worker_drop_handle_race_terminate/worker_drop_handle_race_terminate.js.out diff --git a/tests/specs/run/worker_event_handler_test/__test__.jsonc b/tests/specs/run/worker_event_handler_test/__test__.jsonc new file mode 100644 index 0000000000..c07fca97c6 --- /dev/null +++ b/tests/specs/run/worker_event_handler_test/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read worker_event_handler_test.js", + "output": "worker_event_handler_test.js.out" +} diff --git a/tests/testdata/run/worker_event_handler_test.js b/tests/specs/run/worker_event_handler_test/worker_event_handler_test.js similarity index 51% rename from tests/testdata/run/worker_event_handler_test.js rename to tests/specs/run/worker_event_handler_test/worker_event_handler_test.js index a91b0ec0b1..91c5ba9469 100644 --- a/tests/testdata/run/worker_event_handler_test.js +++ b/tests/specs/run/worker_event_handler_test/worker_event_handler_test.js @@ -1,5 +1,5 @@ const w = new Worker( - import.meta.resolve("../workers/worker_event_handlers.js"), + import.meta.resolve("./worker_event_handlers.js"), { type: "module" }, ); w.postMessage({}); diff --git a/tests/testdata/run/worker_event_handler_test.js.out b/tests/specs/run/worker_event_handler_test/worker_event_handler_test.js.out similarity index 100% rename from tests/testdata/run/worker_event_handler_test.js.out rename to tests/specs/run/worker_event_handler_test/worker_event_handler_test.js.out diff --git a/tests/specs/run/worker_event_handler_test/worker_event_handlers.js b/tests/specs/run/worker_event_handler_test/worker_event_handlers.js new file mode 100644 index 0000000000..5e457cd2e3 --- /dev/null +++ b/tests/specs/run/worker_event_handler_test/worker_event_handlers.js @@ -0,0 +1,26 @@ +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) => { + // Take the last 100 characters so the filename doesn't get truncated + // depending on the dev's FS structure. + args = args.map((v) => typeof v == "string" ? v.slice(-100) : v); + 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/tests/specs/run/worker_message_before_close/__test__.jsonc b/tests/specs/run/worker_message_before_close/__test__.jsonc new file mode 100644 index 0000000000..ae2d65b919 --- /dev/null +++ b/tests/specs/run/worker_message_before_close/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --allow-read worker_message_before_close.js", + "output": "worker_message_before_close.js.out" +} diff --git a/tests/specs/run/worker_message_before_close/message_before_close.js b/tests/specs/run/worker_message_before_close/message_before_close.js new file mode 100644 index 0000000000..9364b6d824 --- /dev/null +++ b/tests/specs/run/worker_message_before_close/message_before_close.js @@ -0,0 +1,4 @@ +onmessage = () => { + postMessage({}); + close(); +}; diff --git a/tests/testdata/run/worker_message_before_close.js b/tests/specs/run/worker_message_before_close/worker_message_before_close.js similarity index 89% rename from tests/testdata/run/worker_message_before_close.js rename to tests/specs/run/worker_message_before_close/worker_message_before_close.js index 569388b9bb..d613bd1cac 100644 --- a/tests/testdata/run/worker_message_before_close.js +++ b/tests/specs/run/worker_message_before_close/worker_message_before_close.js @@ -2,7 +2,7 @@ const messagesReceived = new Set(); for (let i = 0; i < 4; i++) { const worker = new Worker( - import.meta.resolve("../workers/message_before_close.js"), + import.meta.resolve("./message_before_close.js"), { type: "module", name: String(i) }, ); diff --git a/tests/testdata/run/worker_message_before_close.js.out b/tests/specs/run/worker_message_before_close/worker_message_before_close.js.out similarity index 100% rename from tests/testdata/run/worker_message_before_close.js.out rename to tests/specs/run/worker_message_before_close/worker_message_before_close.js.out diff --git a/tests/testdata/run/014_duplicate_import.ts b/tests/testdata/run/014_duplicate_import.ts deleted file mode 100644 index c7dd881cf0..0000000000 --- a/tests/testdata/run/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/tests/testdata/run/020_json_modules.ts b/tests/testdata/run/020_json_modules.ts deleted file mode 100644 index b4ae606654..0000000000 --- a/tests/testdata/run/020_json_modules.ts +++ /dev/null @@ -1,2 +0,0 @@ -import config from "../subdir/config.json"; -console.log(JSON.stringify(config)); diff --git a/tests/testdata/run/021_mjs_modules.ts b/tests/testdata/run/021_mjs_modules.ts deleted file mode 100644 index 838cd2c382..0000000000 --- a/tests/testdata/run/021_mjs_modules.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { isMod5 } from "../subdir/mod5.mjs"; -console.log(isMod5); diff --git a/tests/testdata/run/035_cached_only_flag.out b/tests/testdata/run/035_cached_only_flag.out deleted file mode 100644 index f677ec9153..0000000000 --- a/tests/testdata/run/035_cached_only_flag.out +++ /dev/null @@ -1 +0,0 @@ -error: Specifier not found in cache: "http://127.0.0.1:4545/run/019_media_types.ts", --cached-only is specified. diff --git a/tests/testdata/run/044_bad_resource.ts b/tests/testdata/run/044_bad_resource.ts deleted file mode 100644 index b956a3e3f2..0000000000 --- a/tests/testdata/run/044_bad_resource.ts +++ /dev/null @@ -1,3 +0,0 @@ -const file = await Deno.open("./run/044_bad_resource.ts", { read: true }); -file.close(); -await file.seek(10, 0); diff --git a/tests/testdata/run/config_json_import.ts b/tests/testdata/run/config_json_import.ts deleted file mode 100644 index 7141f14950..0000000000 --- a/tests/testdata/run/config_json_import.ts +++ /dev/null @@ -1,2 +0,0 @@ -import config from "../jsx/deno-jsx.json" with { type: "json" }; -console.log(config); diff --git a/tests/testdata/run/error_002.ts b/tests/testdata/run/error_002.ts deleted file mode 100644 index 5f8179bbeb..0000000000 --- a/tests/testdata/run/error_002.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { throwsError } from "../subdir/mod1.ts"; - -function foo() { - throwsError(); -} - -foo(); diff --git a/tests/testdata/run/error_015_dynamic_import_permissions.js b/tests/testdata/run/error_015_dynamic_import_permissions.js deleted file mode 100644 index bdf423b59c..0000000000 --- a/tests/testdata/run/error_015_dynamic_import_permissions.js +++ /dev/null @@ -1,3 +0,0 @@ -(async () => { - await import("" + "http://example.com/subdir/mod4.js"); -})(); diff --git a/tests/testdata/run/error_no_check.ts b/tests/testdata/run/error_no_check.ts deleted file mode 100644 index 2da01e639a..0000000000 --- a/tests/testdata/run/error_no_check.ts +++ /dev/null @@ -1 +0,0 @@ -export { AnInterface, isAnInterface } from "../subdir/type_and_code.ts"; diff --git a/tests/testdata/run/error_no_check.ts.out b/tests/testdata/run/error_no_check.ts.out deleted file mode 100644 index 78f478045d..0000000000 --- a/tests/testdata/run/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/tests/testdata/run/error_type_definitions.ts b/tests/testdata/run/error_type_definitions.ts deleted file mode 100644 index 86675cbaae..0000000000 --- a/tests/testdata/run/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/tests/testdata/run/fix_emittable_skipped.js b/tests/testdata/run/fix_emittable_skipped.js deleted file mode 100644 index a4ccc9efda..0000000000 --- a/tests/testdata/run/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/tests/testdata/run/fix_js_import_js.ts b/tests/testdata/run/fix_js_import_js.ts deleted file mode 100644 index 0f01877cd8..0000000000 --- a/tests/testdata/run/fix_js_import_js.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { isMod4 } from "../subdir/mod6.js"; - -console.log(isMod4); diff --git a/tests/testdata/run/fix_js_imports.ts b/tests/testdata/run/fix_js_imports.ts deleted file mode 100644 index 6ed13bae30..0000000000 --- a/tests/testdata/run/fix_js_imports.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as amdLike from "../subdir/amd_like.js"; - -console.log(amdLike); diff --git a/tests/testdata/run/import_type.ts b/tests/testdata/run/import_type.ts deleted file mode 100644 index 22c639cbcf..0000000000 --- a/tests/testdata/run/import_type.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { type B, create } from "../subdir/export_types.ts"; - -const b: B = create(); - -console.log(b); diff --git a/tests/testdata/run/issue13562.ts b/tests/testdata/run/issue13562.ts deleted file mode 100644 index afbf69f99e..0000000000 --- a/tests/testdata/run/issue13562.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { printHello3 } from "../subdir/mod1.ts?q=.json"; - -printHello3(); diff --git a/tests/testdata/run/lock_check_ok.json b/tests/testdata/run/lock_check_ok.json deleted file mode 100644 index 94de0f6307..0000000000 --- a/tests/testdata/run/lock_check_ok.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/run/003_relative_import.ts": "a1572e8fd2c2712b33f04aed2561505b5feb2c8696f1f2cded3de7127931b97e" -} diff --git a/tests/testdata/run/lock_v2_check_ok.json b/tests/testdata/run/lock_v2_check_ok.json deleted file mode 100644 index 63bec862a7..0000000000 --- a/tests/testdata/run/lock_v2_check_ok.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "2", - "remote": { - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/run/003_relative_import.ts": "a1572e8fd2c2712b33f04aed2561505b5feb2c8696f1f2cded3de7127931b97e" - } -} diff --git a/tests/testdata/run/type_directives_02.ts b/tests/testdata/run/type_directives_02.ts deleted file mode 100644 index 0c59346e2b..0000000000 --- a/tests/testdata/run/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/tests/testdata/run/type_directives_02.ts.out b/tests/testdata/run/type_directives_02.ts.out deleted file mode 100644 index b064483b41..0000000000 --- a/tests/testdata/run/type_directives_02.ts.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] -DEBUG TS - host.getSourceFile("file:///[WILDCARD]/subdir/type_reference.d.ts", Latest) -[WILDCARD] \ No newline at end of file diff --git a/tests/testdata/run/unhandled_rejection.ts.out b/tests/testdata/run/unhandled_rejection.ts.out deleted file mode 100644 index 6ab1667dc1..0000000000 --- a/tests/testdata/run/unhandled_rejection.ts.out +++ /dev/null @@ -1,9 +0,0 @@ -[WILDCARD] -unhandled rejection at: Promise { - Error: bar not available - at new Foo (file:///[WILDCARD]/testdata/run/unhandled_rejection.ts:8:20) - at file:///[WILDCARD]/testdata/run/unhandled_rejection.ts:12:1 -} reason: Error: bar not available - at new Foo (file:///[WILDCARD]/testdata/run/unhandled_rejection.ts:8:20) - at file:///[WILDCARD]/testdata/run/unhandled_rejection.ts:12:1 -unhandled rejection at: Promise { undefined } reason: undefined diff --git a/tests/testdata/run/unhandled_rejection_sync_error.ts.out b/tests/testdata/run/unhandled_rejection_sync_error.ts.out deleted file mode 100644 index e178373f03..0000000000 --- a/tests/testdata/run/unhandled_rejection_sync_error.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD] -unhandled rejection at: Promise { - Error: boom! - at file:///[WILDCARD]testdata/run/unhandled_rejection_sync_error.ts:6:7 -} reason: Error: boom! - at file:///[WILDCARD]testdata/run/unhandled_rejection_sync_error.ts:6:7 diff --git a/tests/testdata/run/with_package_json/with_stop/main.out b/tests/testdata/run/with_package_json/with_stop/main.out deleted file mode 100644 index 44098a2d86..0000000000 --- a/tests/testdata/run/with_package_json/with_stop/main.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD]Config file found at '[WILDCARD]with_package_json[WILDCARD]with_stop[WILDCARD]some[WILDCARD]nested[WILDCARD]deno.json' -[WILDCARD] -error: Relative import path "chalk" not prefixed with / or ./ or ../ - hint: If you want to use a JSR or npm package, try running `deno add jsr:chalk` or `deno add npm:chalk` - at file:///[WILDCARD]with_package_json/with_stop/some/nested/dir/main.ts:3:19 diff --git a/tools/lint.js b/tools/lint.js index b591cae0ba..cc595c2b13 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -219,7 +219,7 @@ async function ensureNoNewITests() { "pm_tests.rs": 0, "publish_tests.rs": 0, "repl_tests.rs": 0, - "run_tests.rs": 331, + "run_tests.rs": 24, "shared_library_tests.rs": 0, "task_tests.rs": 2, "test_tests.rs": 0,