diff --git a/Cargo.lock b/Cargo.lock index 6a3f9fd76e..29a526ec67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2633,9 +2633,9 @@ checksum = "c007b1ae3abe1cb6f85a16305acd418b7ca6343b953633fee2b76d8f108b830f" [[package]] name = "file_test_runner" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66e9ef00f9f6b82b030b7a9d659030f73498921d4c021b0772e75dfd7090d80" +checksum = "5f33b00489de0a5fd03df89aefe9fa55da5da3c1a207ea19cd381d1de7e6204b" dependencies = [ "anyhow", "crossbeam-channel", diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 5552f6f315..5393d15893 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -43,7 +43,7 @@ deno_lockfile.workspace = true deno_terminal.workspace = true deno_tls.workspace = true fastwebsockets = { workspace = true, features = ["upgrade", "unstable-split"] } -file_test_runner = "0.4.0" +file_test_runner = "0.4.1" flaky_test = "=0.1.0" http.workspace = true http-body-util.workspace = true diff --git a/tests/integration/bench_tests.rs b/tests/integration/bench_tests.rs index 3306a0f968..d588f5b437 100644 --- a/tests/integration/bench_tests.rs +++ b/tests/integration/bench_tests.rs @@ -3,223 +3,11 @@ use deno_core::serde_json::json; use deno_core::url::Url; use test_util as util; -use test_util::itest; -use test_util::itest_flaky; use util::assert_contains; use util::assert_not_contains; -use util::env_vars_for_npm_tests; use util::TestContext; use util::TestContextBuilder; -itest!(overloads { - args: "bench bench/overloads.ts", - exit_code: 0, - output: "bench/overloads.out", -}); - -itest!(meta { - args: "bench bench/meta.ts", - exit_code: 0, - output: "bench/meta.out", -}); - -itest!(pass { - args: "bench bench/pass.ts", - exit_code: 0, - output: "bench/pass.out", -}); - -itest!(ignore { - args: "bench bench/ignore.ts", - exit_code: 0, - output: "bench/ignore.out", -}); - -itest!(ignore_permissions { - args: "bench bench/ignore_permissions.ts", - exit_code: 0, - output: "bench/ignore_permissions.out", -}); - -itest!(fail { - args: "bench bench/fail.ts", - exit_code: 1, - output: "bench/fail.out", -}); - -itest!(bench_formatting { - args: "bench bench/bench_formatting.ts", - exit_code: 0, - output: "bench/bench_formatting.out", -}); - -itest!(collect { - args: "bench --ignore=bench/collect/ignore bench/collect", - exit_code: 0, - output: "bench/collect.out", -}); - -itest!(load_unload { - args: "bench bench/load_unload.ts", - exit_code: 0, - output: "bench/load_unload.out", -}); - -itest!(interval { - args: "bench bench/interval.ts", - exit_code: 0, - output: "bench/interval.out", -}); - -itest!(quiet { - args: "bench --quiet bench/quiet.ts", - exit_code: 0, - output: "bench/quiet.out", -}); - -itest!(only { - args: "bench bench/only.ts", - exit_code: 1, - output: "bench/only.out", -}); - -itest!(multifile_summary { - args: "bench bench/group_baseline.ts bench/pass.ts bench/multiple_group.ts", - exit_code: 0, - output: "bench/multifile_summary.out", -}); - -itest!(no_check { - args: "bench --no-check bench/no_check.ts", - exit_code: 1, - output: "bench/no_check.out", -}); - -itest!(allow_all { - args: "bench --allow-all bench/allow_all.ts", - exit_code: 0, - output: "bench/allow_all.out", -}); - -itest!(allow_none { - args: "bench bench/allow_none.ts", - exit_code: 1, - output: "bench/allow_none.out", -}); - -itest!(exit_sanitizer { - args: "bench bench/exit_sanitizer.ts", - output: "bench/exit_sanitizer.out", - exit_code: 1, -}); - -itest!(clear_timeout { - args: "bench bench/clear_timeout.ts", - exit_code: 0, - output: "bench/clear_timeout.out", -}); - -itest!(finally_timeout { - args: "bench bench/finally_timeout.ts", - exit_code: 1, - output: "bench/finally_timeout.out", -}); - -itest!(before_unload_prevent_default { - args: "bench --quiet bench/before_unload_prevent_default.ts", - output: "bench/before_unload_prevent_default.out", -}); - -itest!(group_baseline { - args: "bench bench/group_baseline.ts", - exit_code: 0, - output: "bench/group_baseline.out", -}); - -itest!(unresolved_promise { - args: "bench bench/unresolved_promise.ts", - exit_code: 1, - output: "bench/unresolved_promise.out", -}); - -itest!(unhandled_rejection { - args: "bench bench/unhandled_rejection.ts", - exit_code: 1, - output: "bench/unhandled_rejection.out", -}); - -itest!(filter { - args: "bench --filter=foo bench/filter", - exit_code: 0, - output: "bench/filter.out", -}); - -itest!(no_run { - args: "bench --no-run bench/no_run.ts", - output: "bench/no_run.out", - exit_code: 1, -}); - -itest!(no_prompt_by_default { - args: "bench --quiet bench/no_prompt_by_default.ts", - exit_code: 1, - output: "bench/no_prompt_by_default.out", -}); - -itest!(no_prompt_with_denied_perms { - args: "bench --quiet --allow-read bench/no_prompt_with_denied_perms.ts", - exit_code: 1, - output: "bench/no_prompt_with_denied_perms.out", -}); - -itest!(check_local_by_default { - args: "bench --quiet bench/check_local_by_default.ts", - output: "bench/check_local_by_default.out", - http_server: true, -}); - -itest!(check_local_by_default2 { - args: "bench --quiet bench/check_local_by_default2.ts", - output: "bench/check_local_by_default2.out", - http_server: true, - exit_code: 1, -}); - -itest!(bench_explicit_start_end { - args: "bench --quiet -A bench/explicit_start_and_end.ts", - output: "bench/explicit_start_and_end.out", - exit_code: 1, -}); - -itest_flaky!(bench_explicit_start_end_low_precision { - args: "bench --quiet -A bench/explicit_start_and_end_low_precision.ts", - output: "bench/explicit_start_and_end_low_precision.out", -}); - -itest!(bench_with_config { - args: "bench --config bench/collect/deno.jsonc bench/collect", - exit_code: 0, - output: "bench/collect.out", -}); - -itest!(bench_with_config2 { - args: "bench --config bench/collect/deno2.jsonc bench/collect", - exit_code: 0, - output: "bench/collect2.out", -}); - -itest!(bench_with_malformed_config { - args: "bench --config bench/collect/deno.malformed.jsonc", - exit_code: 1, - output: "bench/collect_with_malformed_config.out", -}); - -itest!(json_output { - args: "bench --json bench/pass.ts", - exit_code: 0, - output: "bench/pass.json.out", -}); - #[test] fn recursive_permissions_pledge() { let context = TestContext::default(); @@ -248,31 +36,6 @@ fn file_protocol() { .assert_matches_file("bench/file_protocol.out"); } -itest!(package_json_basic { - args: "bench", - output: "package_json/basic/lib.bench.out", - envs: env_vars_for_npm_tests(), - http_server: true, - cwd: Some("package_json/basic"), - copy_temp_dir: Some("package_json/basic"), - exit_code: 0, -}); - -itest!(bench_lock { - args: "bench", - http_server: true, - cwd: Some("lockfile/basic"), - exit_code: 10, - output: "lockfile/basic/fail.out", -}); - -itest!(bench_no_lock { - args: "bench --no-lock", - http_server: true, - cwd: Some("lockfile/basic"), - output: "lockfile/basic/bench.nolock.out", -}); - #[test] fn conditionally_loads_type_graph() { let context = TestContext::default(); diff --git a/tests/integration/cache_tests.rs b/tests/integration/cache_tests.rs index ff206c654f..5711b0f2eb 100644 --- a/tests/integration/cache_tests.rs +++ b/tests/integration/cache_tests.rs @@ -1,53 +1,8 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use test_util::env_vars_for_npm_tests; -use test_util::itest; use test_util::TestContext; use test_util::TestContextBuilder; -itest!(_037_fetch_multiple { - args: "cache --reload --check=all run/fetch/test.ts run/fetch/other.ts", - http_server: true, - output: "cache/037_fetch_multiple.out", -}); - -itest!(_095_cache_with_bare_import { - args: "cache cache/095_cache_with_bare_import.ts", - output: "cache/095_cache_with_bare_import.ts.out", - exit_code: 1, -}); - -itest!(cache_extensionless { - args: "cache --reload --check=all http://localhost:4545/subdir/no_js_ext", - output: "cache/cache_extensionless.out", - http_server: true, -}); - -itest!(cache_random_extension { - args: - "cache --reload --check=all http://localhost:4545/subdir/no_js_ext@1.0.0", - output: "cache/cache_random_extension.out", - http_server: true, -}); - -itest!(performance_stats { - args: "cache --reload --check=all --log-level debug run/002_hello.ts", - output: "cache/performance_stats.out", -}); - -itest!(redirect_cache { - http_server: true, - args: - "cache --reload --check=all http://localhost:4548/subdir/redirects/a.ts", - output: "cache/redirect_cache.out", -}); - -itest!(ignore_require { - args: "cache --reload --no-check cache/ignore_require.js", - output_str: Some(""), - exit_code: 0, -}); - // This test only runs on linux, because it hardcodes the XDG_CACHE_HOME env var // which is only used on linux. #[cfg(target_os = "linux")] @@ -71,33 +26,6 @@ fn xdg_cache_home_dir() { assert!(xdg_cache_home.read_dir().count() > 0); } -itest!(check_local_by_default { - args: "cache --quiet cache/check_local_by_default.ts", - output: "cache/check_local_by_default.out", - http_server: true, -}); - -itest!(check_local_by_default2 { - args: "cache --quiet cache/check_local_by_default2.ts", - output: "cache/check_local_by_default2.out", - http_server: true, -}); - -itest!(json_import { - // should not error - args: "cache --quiet cache/json_import/main.ts", -}); - -itest!(package_json_basic { - args: "cache main.ts", - output: "package_json/basic/main.cache.out", - envs: env_vars_for_npm_tests(), - http_server: true, - cwd: Some("package_json/basic"), - copy_temp_dir: Some("package_json/basic"), - exit_code: 0, -}); - #[test] fn cache_matching_package_json_dep_should_not_install_all() { let context = TestContextBuilder::for_npm().use_temp_cwd().build(); diff --git a/tests/integration/check_tests.rs b/tests/integration/check_tests.rs index 72fb2d9b72..78ab859f92 100644 --- a/tests/integration/check_tests.rs +++ b/tests/integration/check_tests.rs @@ -6,24 +6,6 @@ use util::env_vars_for_npm_tests; use util::TestContext; use util::TestContextBuilder; -itest!(_095_check_with_bare_import { - args: "check cache/095_cache_with_bare_import.ts", - output: "cache/095_cache_with_bare_import.ts.out", - exit_code: 1, -}); - -itest!(check_extensionless { - args: "check --reload http://localhost:4545/subdir/no_js_ext", - output: "cache/cache_extensionless.out", - http_server: true, -}); - -itest!(check_random_extension { - args: "check --reload http://localhost:4545/subdir/no_js_ext@1.0.0", - output: "cache/cache_random_extension.out", - http_server: true, -}); - itest!(check_all { args: "check --quiet --all check/all/check_all.ts", output: "check/all/check_all.out", @@ -145,12 +127,6 @@ itest!(check_imported_files_listed_in_exclude_option { exit_code: 1, }); -itest!(check_with_excluded_file_specified { - args: "check lib/types.d.ts", - cwd: Some("check/excluded_file_specified/"), - output: "check/excluded_file_specified/check.out", -}); - #[test] fn cache_switching_config_then_no_config() { let context = TestContext::default(); @@ -279,13 +255,6 @@ itest!(check_dts { exit_code: 1, }); -itest!(check_types_dts { - args: "check main.ts", - cwd: Some("check/types_dts/"), - output: "check/types_dts/main.out", - exit_code: 0, -}); - itest!(package_json_basic { args: "check main.ts", output: "package_json/basic/main.check.out", diff --git a/tests/integration/doc_tests.rs b/tests/integration/doc_tests.rs index 8ebc46f32c..605166ac20 100644 --- a/tests/integration/doc_tests.rs +++ b/tests/integration/doc_tests.rs @@ -106,21 +106,6 @@ itest!(deno_doc_invalid_url { exit_code: 1, }); -itest!(doc_lock { - args: "doc main.ts", - http_server: true, - cwd: Some("lockfile/basic"), - exit_code: 10, - output: "lockfile/basic/fail.out", -}); - -itest!(doc_no_lock { - args: "doc --no-lock main.ts", - http_server: true, - cwd: Some("lockfile/basic"), - output: "lockfile/basic/doc.nolock.out", -}); - #[test] fn deno_doc_html() { let context = TestContext::default(); diff --git a/tests/integration/info_tests.rs b/tests/integration/info_tests.rs index 4697cc2b8c..a2e3c2d4f1 100644 --- a/tests/integration/info_tests.rs +++ b/tests/integration/info_tests.rs @@ -100,21 +100,6 @@ itest!(info_missing_module { output: "info/info_missing_module.out", }); -itest!(info_lock { - args: "info main.ts", - http_server: true, - cwd: Some("lockfile/basic"), - exit_code: 10, - output: "lockfile/basic/fail.out", -}); - -itest!(info_no_lock { - args: "info --no-lock main.ts", - http_server: true, - cwd: Some("lockfile/basic"), - output: "lockfile/basic/info.nolock.out", -}); - itest!(info_recursive_modules { args: "info --quiet info/info_recursive_imports_test.ts", output: "info/info_recursive_imports_test.out", diff --git a/tests/integration/lint_tests.rs b/tests/integration/lint_tests.rs index a55fb1ef4b..c0b1b4286e 100644 --- a/tests/integration/lint_tests.rs +++ b/tests/integration/lint_tests.rs @@ -213,48 +213,6 @@ fn lint_with_glob_config_and_flags() { assert_contains!(output, "Checked 2 files"); } -itest!(no_slow_types { - args: "lint", - output: "lint/no_slow_types/no_slow_types.out", - cwd: Some("lint/no_slow_types"), - exit_code: 1, -}); - -itest!(no_slow_types_entrypoint { - args: "lint a.ts", - output: "lint/no_slow_types/no_slow_types_entrypoint.out", - cwd: Some("lint/no_slow_types"), - exit_code: 1, -}); - -itest!(no_slow_types_non_entrypoint { - args: "lint d.ts", - output_str: Some("Checked 1 file\n"), - cwd: Some("lint/no_slow_types"), - exit_code: 0, -}); - -itest!(no_slow_types_excluded { - args: "lint --rules-exclude=no-slow-types", - output_str: Some("Checked 4 files\n"), - cwd: Some("lint/no_slow_types"), - exit_code: 0, -}); - -itest!(no_slow_types_non_package { - args: "lint --config=deno.non-package.json", - output_str: Some("Checked 4 files\n"), - cwd: Some("lint/no_slow_types"), - exit_code: 0, -}); - -itest!(no_slow_types_workspace { - args: "lint", - output: "lint/no_slow_types_workspace/output.out", - cwd: Some("lint/no_slow_types_workspace"), - exit_code: 1, -}); - #[test] fn opt_out_top_level_exclude_via_lint_unexclude() { let context = TestContextBuilder::new().use_temp_cwd().build(); diff --git a/tests/integration/publish_tests.rs b/tests/integration/publish_tests.rs index a033f5d070..26acbd2449 100644 --- a/tests/integration/publish_tests.rs +++ b/tests/integration/publish_tests.rs @@ -5,81 +5,11 @@ use std::process::Command; use deno_core::serde_json::json; use test_util::assert_contains; use test_util::assert_not_contains; -use test_util::env_vars_for_jsr_npm_tests; use test_util::env_vars_for_jsr_provenance_tests; use test_util::env_vars_for_jsr_tests; use test_util::env_vars_for_jsr_tests_with_git_check; -use test_util::env_vars_for_npm_tests; -use test_util::itest; use test_util::TestContextBuilder; -itest!(no_token { - args: "publish", - cwd: Some("publish/missing_deno_json"), - output: "publish/no_token.out", - envs: env_vars_for_jsr_tests(), - exit_code: 1, -}); - -itest!(missing_deno_json { - args: "publish --token 'sadfasdf'", - output: "publish/missing_deno_json.out", - cwd: Some("publish/missing_deno_json"), - envs: env_vars_for_jsr_tests(), - exit_code: 1, -}); - -itest!(has_slow_types { - args: "publish --token 'sadfasdf'", - output: "publish/has_slow_types.out", - cwd: Some("publish/has_slow_types"), - envs: env_vars_for_jsr_tests(), - exit_code: 1, -}); - -itest!(allow_slow_types { - args: "publish --allow-slow-types --token 'sadfasdf'", - output: "publish/allow_slow_types.out", - cwd: Some("publish/has_slow_types"), - envs: env_vars_for_jsr_tests(), - http_server: true, - exit_code: 0, -}); - -itest!(invalid_path { - args: "publish --token 'sadfasdf'", - output: "publish/invalid_path.out", - cwd: Some("publish/invalid_path"), - envs: env_vars_for_jsr_tests(), - exit_code: 1, -}); - -itest!(symlink { - args: "publish --token 'sadfasdf' --dry-run", - output: "publish/symlink.out", - cwd: Some("publish/symlink"), - envs: env_vars_for_jsr_tests(), - exit_code: 0, -}); - -itest!(invalid_import { - args: "publish --token 'sadfasdf' --dry-run", - output: "publish/invalid_import.out", - cwd: Some("publish/invalid_import"), - envs: env_vars_for_jsr_npm_tests(), - exit_code: 1, - http_server: true, -}); - -itest!(invalid_import_esm_sh_suggestion { - args: "publish --token 'sadfasdf' --dry-run", - output: "publish/invalid_import_esm_sh_suggestion.out", - cwd: Some("publish/invalid_import_esm_sh_suggestion"), - envs: env_vars_for_jsr_npm_tests(), - exit_code: 1, - http_server: true, -}); - #[test] fn publish_non_exported_files_using_import_map() { let context = publish_context_builder().build(); @@ -139,191 +69,19 @@ fn publish_warning_not_in_graph() { ); } -itest!(javascript_missing_decl_file { - args: "publish --token 'sadfasdf'", - output: "publish/javascript_missing_decl_file.out", - cwd: Some("publish/javascript_missing_decl_file"), - envs: env_vars_for_jsr_tests(), - exit_code: 0, - http_server: true, -}); - -itest!(unanalyzable_dynamic_import { - args: "publish --token 'sadfasdf'", - output: "publish/unanalyzable_dynamic_import.out", - cwd: Some("publish/unanalyzable_dynamic_import"), - envs: env_vars_for_jsr_tests(), - exit_code: 0, - http_server: true, -}); - -itest!(javascript_decl_file { - args: "publish --token 'sadfasdf'", - output: "publish/javascript_decl_file.out", - cwd: Some("publish/javascript_decl_file"), - envs: env_vars_for_jsr_tests(), - http_server: true, - exit_code: 0, -}); - -itest!(package_json { - args: "publish --token 'sadfasdf'", - output: "publish/package_json.out", - cwd: Some("publish/package_json"), - envs: env_vars_for_jsr_npm_tests(), - http_server: true, -}); - -itest!(successful { - args: "publish --token 'sadfasdf'", - output: "publish/successful.out", - cwd: Some("publish/successful"), - envs: env_vars_for_jsr_tests(), - http_server: true, -}); - -itest!(provenance { - args: "publish", - output: "publish/successful_provenance.out", - cwd: Some("publish/successful"), - envs: env_vars_for_jsr_provenance_tests(), - http_server: true, -}); - -itest!(no_check { - args: "publish --token 'sadfasdf' --no-check", - // still type checks the slow types output though - output: "publish/successful_no_check.out", - cwd: Some("publish/successful"), - envs: env_vars_for_jsr_tests(), - http_server: true, -}); - -itest!(node_specifier { - args: "publish --token 'sadfasdf'", - output: "publish/node_specifier.out", - cwd: Some("publish/node_specifier"), - envs: env_vars_for_jsr_tests() - .into_iter() - .chain(env_vars_for_npm_tests().into_iter()) - .collect(), - http_server: true, -}); - -itest!(config_file_jsonc { - args: "publish --token 'sadfasdf'", - output: "publish/deno_jsonc.out", - cwd: Some("publish/deno_jsonc"), - envs: env_vars_for_jsr_tests(), - http_server: true, -}); - -itest!(workspace_all { - args: "publish --token 'sadfasdf'", - output: "publish/workspace.out", - cwd: Some("publish/workspace"), - envs: env_vars_for_jsr_tests(), - http_server: true, -}); - -itest!(workspace_individual { - args: "publish --token 'sadfasdf'", - output: "publish/workspace_individual.out", - cwd: Some("publish/workspace/bar"), - envs: env_vars_for_jsr_tests(), - http_server: true, -}); - -itest!(dry_run { - args: "publish --token 'sadfasdf' --dry-run", - cwd: Some("publish/successful"), - output: "publish/dry_run.out", - envs: env_vars_for_jsr_tests(), - http_server: true, -}); - -itest!(config_flag { - args: "publish --token 'sadfasdf' --config=successful/deno.json", - output: "publish/successful.out", - cwd: Some("publish"), - envs: env_vars_for_jsr_tests(), - http_server: true, -}); - -itest!(bare_node_builtins { - args: "publish --token 'sadfasdf' --dry-run --unstable-bare-node-builtins", - output: "publish/bare_node_builtins.out", - cwd: Some("publish/bare_node_builtins"), - envs: env_vars_for_jsr_npm_tests(), - http_server: true, -}); - -itest!(bare_node_builtins_warning_no_warnings { - args: "publish --token 'sadfasdf' --dry-run --unstable-bare-node-builtins", - output: "publish/bare_node_builtins_no_warnings.out", - cwd: Some("publish/bare_node_builtins"), - envs: env_vars_for_jsr_npm_tests() - .into_iter() - .chain( - vec![( - "DENO_DISABLE_PEDANTIC_NODE_WARNINGS".to_string(), - "1".to_string() - )] - .into_iter() - ) - .collect(), - http_server: true, -}); - -itest!(sloppy_imports { - args: "publish --token 'sadfasdf' --dry-run --unstable-sloppy-imports", - output: "publish/sloppy_imports.out", - cwd: Some("publish/sloppy_imports"), - envs: env_vars_for_jsr_tests(), - http_server: true, -}); - -itest!(sloppy_imports_not_enabled { - args: "publish --token 'sadfasdf' --dry-run", - output: "publish/sloppy_imports_not_enabled.out", - cwd: Some("publish/sloppy_imports"), - envs: env_vars_for_jsr_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(sloppy_imports_no_warnings { - args: "publish --token 'sadfasdf' --dry-run --unstable-sloppy-imports", - output: "publish/sloppy_imports_no_warnings.out", - cwd: Some("publish/sloppy_imports"), - envs: env_vars_for_jsr_tests() - .into_iter() - .chain( - vec![( - "DENO_DISABLE_PEDANTIC_NODE_WARNINGS".to_string(), - "1".to_string() - )] - .into_iter() - ) - .collect(), - http_server: true, -}); - -itest!(jsr_jsonc { - args: "publish --token 'sadfasdf'", - cwd: Some("publish/jsr_jsonc"), - output: "publish/jsr_jsonc/mod.out", - envs: env_vars_for_jsr_tests(), - http_server: true, -}); - -itest!(unsupported_jsx_tsx { - args: "publish --token 'sadfasdf'", - cwd: Some("publish/unsupported_jsx_tsx"), - output: "publish/unsupported_jsx_tsx/mod.out", - envs: env_vars_for_jsr_npm_tests(), - http_server: true, -}); +#[test] +fn provenance() { + TestContextBuilder::new() + .use_http_server() + .envs(env_vars_for_jsr_provenance_tests()) + .cwd("publish/successful") + .build() + .new_command() + .args("publish") + .run() + .assert_exit_code(0) + .assert_matches_file("publish/successful_provenance.out"); +} #[test] fn ignores_gitignore() { @@ -629,20 +387,6 @@ fn not_includes_vendor_dir_only_when_vendor_true() { } } -fn publish_context_builder() -> TestContextBuilder { - TestContextBuilder::new() - .use_http_server() - .envs(env_vars_for_jsr_tests()) - .use_temp_cwd() -} - -fn publish_context_builder_with_git_checks() -> TestContextBuilder { - TestContextBuilder::new() - .use_http_server() - .envs(env_vars_for_jsr_tests_with_git_check()) - .use_temp_cwd() -} - #[test] fn allow_dirty() { let context = publish_context_builder_with_git_checks().build(); @@ -739,3 +483,17 @@ fn allow_dirty_dry_run() { let output = output.combined_output(); assert_contains!(output, "Aborting due to uncommitted changes. Check in source code or run with --allow-dirty"); } + +fn publish_context_builder() -> TestContextBuilder { + TestContextBuilder::new() + .use_http_server() + .envs(env_vars_for_jsr_tests()) + .use_temp_cwd() +} + +fn publish_context_builder_with_git_checks() -> TestContextBuilder { + TestContextBuilder::new() + .use_http_server() + .envs(env_vars_for_jsr_tests_with_git_check()) + .use_temp_cwd() +} diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index eec10f64fe..4d91162680 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -3439,17 +3439,6 @@ itest!(config_not_auto_discovered_for_remote_script { http_server: true, }); -itest!(package_json_auto_discovered_for_local_script_arg { - args: "run -L debug -A no_deno_json/main.ts", - output: "run/with_package_json/no_deno_json/main.out", - // notice this is not in no_deno_json - cwd: Some("run/with_package_json/"), - // prevent creating a node_modules dir in the code directory - copy_temp_dir: Some("run/with_package_json/"), - envs: env_vars_for_npm_tests(), - 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!( @@ -3464,36 +3453,6 @@ itest!( } ); -itest!(package_json_not_auto_discovered_no_config { - args: "run -L debug -A --no-config noconfig.ts", - output: "run/with_package_json/no_deno_json/noconfig.out", - cwd: Some("run/with_package_json/no_deno_json/"), -}); - -itest!(package_json_not_auto_discovered_no_npm { - args: "run -L debug -A --no-npm noconfig.ts", - output: "run/with_package_json/no_deno_json/noconfig.out", - cwd: Some("run/with_package_json/no_deno_json/"), -}); - -itest!(package_json_not_auto_discovered_env_var { - args: "run -L debug -A noconfig.ts", - output: "run/with_package_json/no_deno_json/noconfig.out", - cwd: Some("run/with_package_json/no_deno_json/"), - envs: vec![("DENO_NO_PACKAGE_JSON".to_string(), "1".to_string())], -}); - -itest!( - package_json_auto_discovered_node_modules_relative_package_json { - args: "run -A main.js", - output: "run/with_package_json/no_deno_json/sub_dir/main.out", - cwd: Some("run/with_package_json/no_deno_json/sub_dir"), - copy_temp_dir: Some("run/with_package_json/no_deno_json/"), - envs: env_vars_for_npm_tests(), - http_server: true, - } -); - itest!(package_json_auto_discovered_for_npm_binary { args: "run -L debug -A npm:@denotest/bin/cli-esm this is a test", output: "run/with_package_json/npm_binary/main.out", @@ -3503,14 +3462,6 @@ itest!(package_json_auto_discovered_for_npm_binary { http_server: true, }); -itest!(package_json_auto_discovered_no_package_json_imports { - // this should not use --quiet because we should ensure no package.json install occurs - args: "run -A no_package_json_imports.ts", - output: "run/with_package_json/no_deno_json/no_package_json_imports.out", - cwd: Some("run/with_package_json/no_deno_json"), - copy_temp_dir: Some("run/with_package_json/no_deno_json"), -}); - #[test] fn package_json_with_deno_json() { let context = TestContextBuilder::for_npm() diff --git a/tests/integration/test_tests.rs b/tests/integration/test_tests.rs index 2bf2b31099..fe9eb83c54 100644 --- a/tests/integration/test_tests.rs +++ b/tests/integration/test_tests.rs @@ -584,21 +584,6 @@ itest!(package_json_basic { exit_code: 0, }); -itest!(test_lock { - args: "test", - http_server: true, - cwd: Some("lockfile/basic"), - exit_code: 10, - output: "lockfile/basic/fail.out", -}); - -itest!(test_no_lock { - args: "test --no-lock", - http_server: true, - cwd: Some("lockfile/basic"), - output: "lockfile/basic/test.nolock.out", -}); - itest!(test_replace_timers { args: "test test/replace_timers.js", output: "test/replace_timers.js.out", @@ -676,12 +661,6 @@ fn conditionally_loads_type_graph() { assert_not_contains!(output.combined_output(), "type_reference.d.ts"); } -itest!(test_include_relative_pattern_dot_slash { - args: "test", - output: "test/relative_pattern_dot_slash/output.out", - cwd: Some("test/relative_pattern_dot_slash"), -}); - #[test] fn opt_out_top_level_exclude_via_test_unexclude() { let context = TestContextBuilder::new().use_temp_cwd().build(); diff --git a/tests/specs/README.md b/tests/specs/README.md index 55880fe23d..5711b41d50 100644 --- a/tests/specs/README.md +++ b/tests/specs/README.md @@ -78,6 +78,7 @@ a "steps" array. - `output` - Path to use to assert the output. - `cleanDenoDir` (boolean) - Whether to empty the deno_dir before running the step. +- `flaky` - Step should be repeated until success a maximum of 3 times. - `if` (`"windows"`, `"linux"`, `"mac"`, `"unix"`) - Whether to run this step. - `exitCode` (number) - Expected exit code. diff --git a/tests/specs/bench/allow_all/__test__.jsonc b/tests/specs/bench/allow_all/__test__.jsonc new file mode 100644 index 0000000000..dcc5cc421b --- /dev/null +++ b/tests/specs/bench/allow_all/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench --allow-all allow_all.ts", + "output": "allow_all.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/allow_all/allow_all.out b/tests/specs/bench/allow_all/allow_all.out new file mode 100644 index 0000000000..0c6a8a034b --- /dev/null +++ b/tests/specs/bench/allow_all/allow_all.out @@ -0,0 +1,23 @@ +[WILDCARD] +Check [WILDLINE]/allow_all.ts +cpu: [WILDLINE] +runtime: deno [WILDLINE] ([WILDLINE]) + +[WILDLINE]/allow_all.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +------------------------------------------------------------------ ----------------------------- +read false [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +read true [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +write false [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +write true [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +net false [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +net true [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +env false [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +env true [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +run false [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +run true [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +ffi false [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +ffi true [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +hrtime false [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] +hrtime true [WILDLINE] [WILDLINE]/iter[WILDLINE]([WILDLINE] … [WILDLINE]) [WILDLINE] + diff --git a/tests/testdata/bench/allow_all.ts b/tests/specs/bench/allow_all/allow_all.ts similarity index 92% rename from tests/testdata/bench/allow_all.ts rename to tests/specs/bench/allow_all/allow_all.ts index b31aaf397f..9747fb4142 100644 --- a/tests/testdata/bench/allow_all.ts +++ b/tests/specs/bench/allow_all/allow_all.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "../../../tests/util/std/assert/mod.ts"; +import { assertEquals } from "jsr:@std/assert"; const permissions: Deno.PermissionName[] = [ "read", diff --git a/tests/specs/bench/allow_none/__test__.jsonc b/tests/specs/bench/allow_none/__test__.jsonc new file mode 100644 index 0000000000..9ae51f75bc --- /dev/null +++ b/tests/specs/bench/allow_none/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench allow_none.ts", + "output": "allow_none.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/allow_none/allow_none.out b/tests/specs/bench/allow_none/allow_none.out new file mode 100644 index 0000000000..cfe86adcbc --- /dev/null +++ b/tests/specs/bench/allow_none/allow_none.out @@ -0,0 +1,22 @@ +Check [WILDLINE]/allow_none.ts +cpu: [WILDLINE] +runtime: deno [WILDLINE] ([WILDLINE]) + +[WILDLINE]/allow_none.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +read error: PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] +write error: PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] +net error: PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] +env error: PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] +run error: PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] +ffi error: PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] +hrtime error: PermissionDenied: Can't escalate parent thread permissions +[WILDCARD] +error: Bench failed diff --git a/tests/testdata/bench/allow_none.ts b/tests/specs/bench/allow_none/allow_none.ts similarity index 73% rename from tests/testdata/bench/allow_none.ts rename to tests/specs/bench/allow_none/allow_none.ts index 0cf3c27ef8..77f86f2564 100644 --- a/tests/testdata/bench/allow_none.ts +++ b/tests/specs/bench/allow_none/allow_none.ts @@ -1,5 +1,3 @@ -import { unreachable } from "../../../tests/util/std/assert/mod.ts"; - const permissions: Deno.PermissionName[] = [ "read", "write", @@ -17,7 +15,7 @@ for (const name of permissions) { [name]: true, }, fn() { - unreachable(); + throw new Error("unreachable"); }, }); } diff --git a/tests/specs/bench/before_unload_prevent_default/__test__.jsonc b/tests/specs/bench/before_unload_prevent_default/__test__.jsonc new file mode 100644 index 0000000000..5253af5dfe --- /dev/null +++ b/tests/specs/bench/before_unload_prevent_default/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "bench --quiet before_unload_prevent_default.ts", + "output": "before_unload_prevent_default.out" +} diff --git a/tests/specs/bench/before_unload_prevent_default/before_unload_prevent_default.out b/tests/specs/bench/before_unload_prevent_default/before_unload_prevent_default.out new file mode 100644 index 0000000000..dcb6d81948 --- /dev/null +++ b/tests/specs/bench/before_unload_prevent_default/before_unload_prevent_default.out @@ -0,0 +1,7 @@ +cpu: [WILDCARD] +runtime: deno [WILDCARD] + +[WILDCARD]/before_unload_prevent_default.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] diff --git a/tests/testdata/bench/before_unload_prevent_default.ts b/tests/specs/bench/before_unload_prevent_default/before_unload_prevent_default.ts similarity index 100% rename from tests/testdata/bench/before_unload_prevent_default.ts rename to tests/specs/bench/before_unload_prevent_default/before_unload_prevent_default.ts diff --git a/tests/specs/bench/bench_explicit_start_end/__test__.jsonc b/tests/specs/bench/bench_explicit_start_end/__test__.jsonc new file mode 100644 index 0000000000..e8e5bf8c2f --- /dev/null +++ b/tests/specs/bench/bench_explicit_start_end/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench --quiet -A explicit_start_and_end.ts", + "output": "explicit_start_and_end.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/bench_explicit_start_end/explicit_start_and_end.out b/tests/specs/bench/bench_explicit_start_end/explicit_start_and_end.out new file mode 100644 index 0000000000..fa118540c9 --- /dev/null +++ b/tests/specs/bench/bench_explicit_start_end/explicit_start_and_end.out @@ -0,0 +1,25 @@ +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/explicit_start_and_end.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +------------------------------------------------------------------- ----------------------------- +start and end [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +start only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +end only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +double start error: TypeError: BenchContext::start() has already been invoked. + t.start(); + ^ + at BenchContext.start ([WILDCARD]) + at [WILDCARD]/explicit_start_and_end.ts:[WILDCARD] +double end error: TypeError: BenchContext::end() has already been invoked. + t.end(); + ^ + at BenchContext.end ([WILDCARD]) + at [WILDCARD]/explicit_start_and_end.ts:[WILDCARD] +captured error: TypeError: The benchmark which this context belongs to is not being executed. + captured!.start(); + ^ + at BenchContext.start ([WILDCARD]) + at [WILDCARD]/explicit_start_and_end.ts:[WILDCARD] +error: Bench failed diff --git a/tests/testdata/bench/explicit_start_and_end.ts b/tests/specs/bench/bench_explicit_start_end/explicit_start_and_end.ts similarity index 100% rename from tests/testdata/bench/explicit_start_and_end.ts rename to tests/specs/bench/bench_explicit_start_end/explicit_start_and_end.ts diff --git a/tests/specs/bench/bench_formatting/__test__.jsonc b/tests/specs/bench/bench_formatting/__test__.jsonc new file mode 100644 index 0000000000..1f1d893940 --- /dev/null +++ b/tests/specs/bench/bench_formatting/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench bench_formatting.ts", + "output": "bench_formatting.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/bench_formatting/bench_formatting.out b/tests/specs/bench/bench_formatting/bench_formatting.out new file mode 100644 index 0000000000..79617a32df --- /dev/null +++ b/tests/specs/bench/bench_formatting/bench_formatting.out @@ -0,0 +1,8 @@ +Check [WILDCARD]/bench_formatting.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/bench_formatting.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +[WILDCARD] [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] \ No newline at end of file diff --git a/tests/testdata/bench/bench_formatting.ts b/tests/specs/bench/bench_formatting/bench_formatting.ts similarity index 100% rename from tests/testdata/bench/bench_formatting.ts rename to tests/specs/bench/bench_formatting/bench_formatting.ts diff --git a/tests/specs/bench/check_local_by_default/__test__.jsonc b/tests/specs/bench/check_local_by_default/__test__.jsonc new file mode 100644 index 0000000000..76dd80b7bd --- /dev/null +++ b/tests/specs/bench/check_local_by_default/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "bench --quiet check_local_by_default.ts", + "output": "check_local_by_default.out" +} diff --git a/tests/specs/bench/check_local_by_default/check_local_by_default.out b/tests/specs/bench/check_local_by_default/check_local_by_default.out new file mode 100644 index 0000000000..63a6b5fa55 --- /dev/null +++ b/tests/specs/bench/check_local_by_default/check_local_by_default.out @@ -0,0 +1,6 @@ +[WILDCARD] + +[WILDCARD]/check_local_by_default.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- + diff --git a/tests/testdata/bench/check_local_by_default.ts b/tests/specs/bench/check_local_by_default/check_local_by_default.ts similarity index 100% rename from tests/testdata/bench/check_local_by_default.ts rename to tests/specs/bench/check_local_by_default/check_local_by_default.ts diff --git a/tests/specs/bench/check_local_by_default2/__test__.jsonc b/tests/specs/bench/check_local_by_default2/__test__.jsonc new file mode 100644 index 0000000000..5f2366d1e1 --- /dev/null +++ b/tests/specs/bench/check_local_by_default2/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench --quiet check_local_by_default2.ts", + "output": "check_local_by_default2.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/check_local_by_default2/check_local_by_default2.out b/tests/specs/bench/check_local_by_default2/check_local_by_default2.out new file mode 100644 index 0000000000..089b17f4b8 --- /dev/null +++ b/tests/specs/bench/check_local_by_default2/check_local_by_default2.out @@ -0,0 +1,4 @@ +error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'. +const b: "b" = 12; + ^ + at [WILDCARD]/check_local_by_default2.ts:3:7 diff --git a/tests/testdata/bench/check_local_by_default2.ts b/tests/specs/bench/check_local_by_default2/check_local_by_default2.ts similarity index 100% rename from tests/testdata/bench/check_local_by_default2.ts rename to tests/specs/bench/check_local_by_default2/check_local_by_default2.ts diff --git a/tests/specs/bench/clear_timeout/__test__.jsonc b/tests/specs/bench/clear_timeout/__test__.jsonc new file mode 100644 index 0000000000..4535c931d9 --- /dev/null +++ b/tests/specs/bench/clear_timeout/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench clear_timeout.ts", + "output": "clear_timeout.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/clear_timeout/clear_timeout.out b/tests/specs/bench/clear_timeout/clear_timeout.out new file mode 100644 index 0000000000..48a31378b7 --- /dev/null +++ b/tests/specs/bench/clear_timeout/clear_timeout.out @@ -0,0 +1,10 @@ +Check [WILDCARD]/clear_timeout.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/clear_timeout.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] diff --git a/tests/testdata/bench/clear_timeout.ts b/tests/specs/bench/clear_timeout/clear_timeout.ts similarity index 100% rename from tests/testdata/bench/clear_timeout.ts rename to tests/specs/bench/clear_timeout/clear_timeout.ts diff --git a/tests/specs/bench/collect/__test__.jsonc b/tests/specs/bench/collect/__test__.jsonc new file mode 100644 index 0000000000..e5aabd82d7 --- /dev/null +++ b/tests/specs/bench/collect/__test__.jsonc @@ -0,0 +1,19 @@ +{ + "steps": [{ + "args": "bench --ignore=collect/ignore collect", + "output": "collect.out" + }, { + "cleanDenoDir": true, + "args": "bench --config collect/deno.jsonc collect", + "output": "collect.out" + }, { + "cleanDenoDir": true, + "args": "bench --config collect/deno2.jsonc collect", + "output": "collect2.out" + }, { + "cleanDenoDir": true, + "args": "bench --config collect/deno.malformed.jsonc", + "exitCode": 1, + "output": "collect_with_malformed_config.out" + }] +} diff --git a/tests/testdata/bench/collect.out b/tests/specs/bench/collect/collect.out similarity index 70% rename from tests/testdata/bench/collect.out rename to tests/specs/bench/collect/collect.out index 03c75922b7..0d3f7a8ffe 100644 --- a/tests/testdata/bench/collect.out +++ b/tests/specs/bench/collect/collect.out @@ -1,18 +1,18 @@ -Check [WILDCARD]/bench/collect/bench.ts -Check [WILDCARD]/bench/collect/include/2_bench.ts -Check [WILDCARD]/bench/collect/include/bench.ts +Check [WILDCARD]/collect/bench.ts +Check [WILDCARD]/collect/include/2_bench.ts +Check [WILDCARD]/collect/include/bench.ts cpu: [WILDCARD] runtime: deno [WILDCARD] ([WILDCARD]) -[WILDCARD]/bench/collect/bench.ts +[WILDCARD]/collect/bench.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- -[WILDCARD]/bench/collect/include/2_bench.ts +[WILDCARD]/collect/include/2_bench.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- -[WILDCARD]/bench/collect/include/bench.ts +[WILDCARD]/collect/include/bench.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- diff --git a/tests/testdata/bench/collect/bench.ts b/tests/specs/bench/collect/collect/bench.ts similarity index 100% rename from tests/testdata/bench/collect/bench.ts rename to tests/specs/bench/collect/collect/bench.ts diff --git a/tests/testdata/bench/collect/deno.jsonc b/tests/specs/bench/collect/collect/deno.jsonc similarity index 100% rename from tests/testdata/bench/collect/deno.jsonc rename to tests/specs/bench/collect/collect/deno.jsonc diff --git a/tests/testdata/bench/collect/deno.malformed.jsonc b/tests/specs/bench/collect/collect/deno.malformed.jsonc similarity index 100% rename from tests/testdata/bench/collect/deno.malformed.jsonc rename to tests/specs/bench/collect/collect/deno.malformed.jsonc diff --git a/tests/testdata/bench/collect/deno2.jsonc b/tests/specs/bench/collect/collect/deno2.jsonc similarity index 100% rename from tests/testdata/bench/collect/deno2.jsonc rename to tests/specs/bench/collect/collect/deno2.jsonc diff --git a/tests/testdata/bench/collect/ignore/bench.ts b/tests/specs/bench/collect/collect/ignore/bench.ts similarity index 100% rename from tests/testdata/bench/collect/ignore/bench.ts rename to tests/specs/bench/collect/collect/ignore/bench.ts diff --git a/tests/testdata/bench/collect/include/2_bench.ts b/tests/specs/bench/collect/collect/include/2_bench.ts similarity index 100% rename from tests/testdata/bench/collect/include/2_bench.ts rename to tests/specs/bench/collect/collect/include/2_bench.ts diff --git a/tests/testdata/bench/collect/include/bench.ts b/tests/specs/bench/collect/collect/include/bench.ts similarity index 100% rename from tests/testdata/bench/collect/include/bench.ts rename to tests/specs/bench/collect/collect/include/bench.ts diff --git a/tests/testdata/bench/collect2.out b/tests/specs/bench/collect/collect2.out similarity index 72% rename from tests/testdata/bench/collect2.out rename to tests/specs/bench/collect/collect2.out index 00b8bfc0d3..49ceee9968 100644 --- a/tests/testdata/bench/collect2.out +++ b/tests/specs/bench/collect/collect2.out @@ -1,13 +1,13 @@ -Check [WILDCARD]/bench/collect/bench.ts -Check [WILDCARD]/bench/collect/include/bench.ts +Check [WILDCARD]/collect/bench.ts +Check [WILDCARD]/collect/include/bench.ts cpu: [WILDCARD] runtime: deno [WILDCARD] ([WILDCARD]) -[WILDCARD]/bench/collect/bench.ts +[WILDCARD]/collect/bench.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- -[WILDCARD]/bench/collect/include/bench.ts +[WILDCARD]/collect/include/bench.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- diff --git a/tests/testdata/bench/collect_with_malformed_config.out b/tests/specs/bench/collect/collect_with_malformed_config.out similarity index 100% rename from tests/testdata/bench/collect_with_malformed_config.out rename to tests/specs/bench/collect/collect_with_malformed_config.out diff --git a/tests/specs/bench/exit_sanitizer/__test__.jsonc b/tests/specs/bench/exit_sanitizer/__test__.jsonc new file mode 100644 index 0000000000..a145316517 --- /dev/null +++ b/tests/specs/bench/exit_sanitizer/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench exit_sanitizer.ts", + "output": "exit_sanitizer.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/exit_sanitizer/exit_sanitizer.out b/tests/specs/bench/exit_sanitizer/exit_sanitizer.out new file mode 100644 index 0000000000..eefc86e607 --- /dev/null +++ b/tests/specs/bench/exit_sanitizer/exit_sanitizer.out @@ -0,0 +1,14 @@ +Check [WILDCARD]/exit_sanitizer.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/exit_sanitizer.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +exit(0) error: Error: Bench attempted to exit with exit code: 0 +[WILDCARD] +exit(1) error: Error: Bench attempted to exit with exit code: 1 +[WILDCARD] +exit(2) error: Error: Bench attempted to exit with exit code: 2 +[WILDCARD] +error: Bench failed diff --git a/tests/testdata/bench/exit_sanitizer.ts b/tests/specs/bench/exit_sanitizer/exit_sanitizer.ts similarity index 100% rename from tests/testdata/bench/exit_sanitizer.ts rename to tests/specs/bench/exit_sanitizer/exit_sanitizer.ts diff --git a/tests/specs/bench/explicit_start_and_end_low_precision/__test__.jsonc b/tests/specs/bench/explicit_start_and_end_low_precision/__test__.jsonc new file mode 100644 index 0000000000..2cd093f3fd --- /dev/null +++ b/tests/specs/bench/explicit_start_and_end_low_precision/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench --quiet -A main.bench.ts", + "output": "main.bench.out", + "flaky": true +} diff --git a/tests/testdata/bench/explicit_start_and_end_low_precision.out b/tests/specs/bench/explicit_start_and_end_low_precision/main.bench.out similarity index 91% rename from tests/testdata/bench/explicit_start_and_end_low_precision.out rename to tests/specs/bench/explicit_start_and_end_low_precision/main.bench.out index 6dc66cfcc3..516c001b1a 100644 --- a/tests/testdata/bench/explicit_start_and_end_low_precision.out +++ b/tests/specs/bench/explicit_start_and_end_low_precision/main.bench.out @@ -1,7 +1,7 @@ cpu: [WILDCARD] runtime: deno [WILDCARD] ([WILDCARD]) -[WILDCARD]/explicit_start_and_end_low_precision.ts +[WILDCARD]/main.bench.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------------- ----------------------------- noop with start and end [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] diff --git a/tests/testdata/bench/explicit_start_and_end_low_precision.ts b/tests/specs/bench/explicit_start_and_end_low_precision/main.bench.ts similarity index 100% rename from tests/testdata/bench/explicit_start_and_end_low_precision.ts rename to tests/specs/bench/explicit_start_and_end_low_precision/main.bench.ts diff --git a/tests/specs/bench/fail/__test__.jsonc b/tests/specs/bench/fail/__test__.jsonc new file mode 100644 index 0000000000..18748c31e8 --- /dev/null +++ b/tests/specs/bench/fail/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench fail.ts", + "output": "fail.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/fail/fail.out b/tests/specs/bench/fail/fail.out new file mode 100644 index 0000000000..03f04cf4fb --- /dev/null +++ b/tests/specs/bench/fail/fail.out @@ -0,0 +1,28 @@ +Check [WILDCARD]/fail.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/fail.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +bench0 error: Error +[WILDCARD] +bench1 error: Error +[WILDCARD] +bench2 error: Error +[WILDCARD] +bench3 error: Error +[WILDCARD] +bench4 error: Error +[WILDCARD] +bench5 error: Error +[WILDCARD] +bench6 error: Error +[WILDCARD] +bench7 error: Error +[WILDCARD] +bench8 error: Error +[WILDCARD] +bench9 error: Error +[WILDCARD] +error: Bench failed diff --git a/tests/testdata/bench/fail.ts b/tests/specs/bench/fail/fail.ts similarity index 100% rename from tests/testdata/bench/fail.ts rename to tests/specs/bench/fail/fail.ts diff --git a/tests/specs/bench/filter/__test__.jsonc b/tests/specs/bench/filter/__test__.jsonc new file mode 100644 index 0000000000..685ee9571b --- /dev/null +++ b/tests/specs/bench/filter/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "bench --filter=foo", + "output": "filter.out" +} diff --git a/tests/testdata/bench/filter/a_bench.ts b/tests/specs/bench/filter/a_bench.ts similarity index 100% rename from tests/testdata/bench/filter/a_bench.ts rename to tests/specs/bench/filter/a_bench.ts diff --git a/tests/testdata/bench/filter/b_bench.ts b/tests/specs/bench/filter/b_bench.ts similarity index 100% rename from tests/testdata/bench/filter/b_bench.ts rename to tests/specs/bench/filter/b_bench.ts diff --git a/tests/testdata/bench/filter/c_bench.ts b/tests/specs/bench/filter/c_bench.ts similarity index 100% rename from tests/testdata/bench/filter/c_bench.ts rename to tests/specs/bench/filter/c_bench.ts diff --git a/tests/testdata/bench/filter.out b/tests/specs/bench/filter/filter.out similarity index 100% rename from tests/testdata/bench/filter.out rename to tests/specs/bench/filter/filter.out diff --git a/tests/specs/bench/filter_group_header/main.out b/tests/specs/bench/filter_group_header/main.out index efe157f6cb..5791538fe4 100644 --- a/tests/specs/bench/filter_group_header/main.out +++ b/tests/specs/bench/filter_group_header/main.out @@ -7,7 +7,7 @@ benchmark time (avg) iter/s (min … max) p75 --------------------------------------------------------------- ----------------------------- group G1 -G1-B [WILDCARD] +G1-B [WILDCARD] group G2 -G2-B [WILDCARD] \ No newline at end of file +G2-B [WILDCARD] \ No newline at end of file diff --git a/tests/specs/bench/finally_timeout/__test__.jsonc b/tests/specs/bench/finally_timeout/__test__.jsonc new file mode 100644 index 0000000000..6215372046 --- /dev/null +++ b/tests/specs/bench/finally_timeout/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench finally_timeout.ts", + "output": "finally_timeout.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/finally_timeout/finally_timeout.out b/tests/specs/bench/finally_timeout/finally_timeout.out new file mode 100644 index 0000000000..cefa187600 --- /dev/null +++ b/tests/specs/bench/finally_timeout/finally_timeout.out @@ -0,0 +1,11 @@ +Check [WILDCARD]/finally_timeout.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/finally_timeout.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +error error: Error: fail +[WILDCARD] +success [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +error: Bench failed diff --git a/tests/testdata/bench/finally_timeout.ts b/tests/specs/bench/finally_timeout/finally_timeout.ts similarity index 100% rename from tests/testdata/bench/finally_timeout.ts rename to tests/specs/bench/finally_timeout/finally_timeout.ts diff --git a/tests/specs/bench/group_baseline/__test__.jsonc b/tests/specs/bench/group_baseline/__test__.jsonc new file mode 100644 index 0000000000..5874b40c8d --- /dev/null +++ b/tests/specs/bench/group_baseline/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench group_baseline.ts", + "output": "group_baseline.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/group_baseline/group_baseline.out b/tests/specs/bench/group_baseline/group_baseline.out new file mode 100644 index 0000000000..54a6cd3591 --- /dev/null +++ b/tests/specs/bench/group_baseline/group_baseline.out @@ -0,0 +1,20 @@ +[WILDCARD]/group_baseline.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +-------------------------------------------------------------------- ----------------------------- +noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] + +summary + noo[WILDCARD] + [WILDCARD]x [WILDCARD] than noo[WILDCARD] + +group url +noop3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +parse url 2x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +parse url 200x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] + +summary + parse url 2x + [WILDCARD]x slower than noop3 + [WILDCARD]x faster than parse url 200x + diff --git a/tests/testdata/bench/group_baseline.ts b/tests/specs/bench/group_baseline/group_baseline.ts similarity index 100% rename from tests/testdata/bench/group_baseline.ts rename to tests/specs/bench/group_baseline/group_baseline.ts diff --git a/tests/specs/bench/ignore/__test__.jsonc b/tests/specs/bench/ignore/__test__.jsonc new file mode 100644 index 0000000000..97053bb798 --- /dev/null +++ b/tests/specs/bench/ignore/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench ignore.ts", + "output": "ignore.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/ignore/ignore.out b/tests/specs/bench/ignore/ignore.out new file mode 100644 index 0000000000..d74a0c181c --- /dev/null +++ b/tests/specs/bench/ignore/ignore.out @@ -0,0 +1,8 @@ +Check [WILDCARD]/ignore.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/ignore.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- + diff --git a/tests/testdata/bench/ignore.ts b/tests/specs/bench/ignore/ignore.ts similarity index 100% rename from tests/testdata/bench/ignore.ts rename to tests/specs/bench/ignore/ignore.ts diff --git a/tests/specs/bench/ignore_permissions/__test__.jsonc b/tests/specs/bench/ignore_permissions/__test__.jsonc new file mode 100644 index 0000000000..592ab02408 --- /dev/null +++ b/tests/specs/bench/ignore_permissions/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench ignore_permissions.ts", + "output": "ignore_permissions.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/ignore_permissions/ignore_permissions.out b/tests/specs/bench/ignore_permissions/ignore_permissions.out new file mode 100644 index 0000000000..eb577fecc7 --- /dev/null +++ b/tests/specs/bench/ignore_permissions/ignore_permissions.out @@ -0,0 +1,8 @@ +Check [WILDCARD]/ignore_permissions.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/ignore_permissions.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- + diff --git a/tests/testdata/bench/ignore_permissions.ts b/tests/specs/bench/ignore_permissions/ignore_permissions.ts similarity index 100% rename from tests/testdata/bench/ignore_permissions.ts rename to tests/specs/bench/ignore_permissions/ignore_permissions.ts diff --git a/tests/specs/bench/interval/__test__.jsonc b/tests/specs/bench/interval/__test__.jsonc new file mode 100644 index 0000000000..f4e89c1b5d --- /dev/null +++ b/tests/specs/bench/interval/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench interval.ts", + "output": "interval.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/interval/interval.out b/tests/specs/bench/interval/interval.out new file mode 100644 index 0000000000..11e440940a --- /dev/null +++ b/tests/specs/bench/interval/interval.out @@ -0,0 +1,8 @@ +Check [WILDCARD]/interval.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/interval.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- + diff --git a/tests/testdata/bench/interval.ts b/tests/specs/bench/interval/interval.ts similarity index 100% rename from tests/testdata/bench/interval.ts rename to tests/specs/bench/interval/interval.ts diff --git a/tests/specs/bench/json_output/__test__.jsonc b/tests/specs/bench/json_output/__test__.jsonc new file mode 100644 index 0000000000..fa0dadcd0b --- /dev/null +++ b/tests/specs/bench/json_output/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench --json pass.ts", + "output": "pass.json.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/json_output/pass.json.out b/tests/specs/bench/json_output/pass.json.out new file mode 100644 index 0000000000..53259e7585 --- /dev/null +++ b/tests/specs/bench/json_output/pass.json.out @@ -0,0 +1,28 @@ +Check file:///[WILDCARD]/pass.ts +{ + "runtime": "Deno/[WILDCARD]", + "cpu": "[WILDCARD]", + "benches": [ + { + "origin": "file:///[WILDCARD]/pass.ts", + "group": null, + "name": "bench0", + "baseline": false, + "results": [ + { + "ok": { + "n": [WILDCARD], + "min": [WILDCARD], + "max": [WILDCARD], + "avg": [WILDCARD], + "p75": [WILDCARD], + "p99": [WILDCARD], + "p995": [WILDCARD], + "p999": [WILDCARD] + } + } + ] + }, +[WILDCARD] + ] +} diff --git a/tests/testdata/bench/pass.ts b/tests/specs/bench/json_output/pass.ts similarity index 100% rename from tests/testdata/bench/pass.ts rename to tests/specs/bench/json_output/pass.ts diff --git a/tests/specs/bench/load_unload/__test__.jsonc b/tests/specs/bench/load_unload/__test__.jsonc new file mode 100644 index 0000000000..8837d3d804 --- /dev/null +++ b/tests/specs/bench/load_unload/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench load_unload.ts", + "output": "load_unload.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/load_unload/load_unload.out b/tests/specs/bench/load_unload/load_unload.out new file mode 100644 index 0000000000..99e4389ac8 --- /dev/null +++ b/tests/specs/bench/load_unload/load_unload.out @@ -0,0 +1,8 @@ +Check [WILDCARD]/load_unload.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/load_unload.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +bench [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] diff --git a/tests/testdata/bench/load_unload.ts b/tests/specs/bench/load_unload/load_unload.ts similarity index 100% rename from tests/testdata/bench/load_unload.ts rename to tests/specs/bench/load_unload/load_unload.ts diff --git a/tests/specs/bench/meta/__test__.jsonc b/tests/specs/bench/meta/__test__.jsonc new file mode 100644 index 0000000000..10a4ff3a42 --- /dev/null +++ b/tests/specs/bench/meta/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench meta.ts", + "output": "meta.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/meta/meta.out b/tests/specs/bench/meta/meta.out new file mode 100644 index 0000000000..75a75984ef --- /dev/null +++ b/tests/specs/bench/meta/meta.out @@ -0,0 +1,10 @@ +Check [WILDCARD]/meta.ts +import.meta.main: false +import.meta.url: [WILDCARD]/meta.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/meta.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- + diff --git a/tests/testdata/bench/meta.ts b/tests/specs/bench/meta/meta.ts similarity index 100% rename from tests/testdata/bench/meta.ts rename to tests/specs/bench/meta/meta.ts diff --git a/tests/specs/bench/multifile_summary/__test__.jsonc b/tests/specs/bench/multifile_summary/__test__.jsonc new file mode 100644 index 0000000000..757af150be --- /dev/null +++ b/tests/specs/bench/multifile_summary/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench group_baseline.ts pass.ts multiple_group.ts", + "output": "multifile_summary.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/multifile_summary/group_baseline.ts b/tests/specs/bench/multifile_summary/group_baseline.ts new file mode 100644 index 0000000000..a86f6455ca --- /dev/null +++ b/tests/specs/bench/multifile_summary/group_baseline.ts @@ -0,0 +1,15 @@ +Deno.bench("noop", () => {}); +Deno.bench("noop2", { baseline: true }, () => {}); + +Deno.bench("noop3", { group: "url" }, () => {}); + +Deno.bench("parse url 2x", { group: "url", baseline: true }, () => { + new URL("https://deno.land/std/http/server.ts"); + new URL("https://deno.land/std/http/server.ts"); +}); + +Deno.bench("parse url 200x", { group: "url" }, () => { + for (let i = 0; i < 200; i++) { + new URL("https://deno.land/std/http/server.ts"); + } +}); diff --git a/tests/specs/bench/multifile_summary/multifile_summary.out b/tests/specs/bench/multifile_summary/multifile_summary.out new file mode 100644 index 0000000000..c0439ebba8 --- /dev/null +++ b/tests/specs/bench/multifile_summary/multifile_summary.out @@ -0,0 +1,64 @@ +Check [WILDCARD]/group_baseline.ts +Check [WILDCARD]/pass.ts +Check [WILDCARD]/multiple_group.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/group_baseline.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +-------------------------------------------------------------------- ----------------------------- +noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] + +summary + noo[WILDCARD] + [WILDCARD]x [WILDCARD] than noo[WILDCARD] + +group url +noop3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +parse url 2x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +parse url 200x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] + +summary + parse url 2x + [WILDLINE]x slower than noop3 + [WILDLINE]x faster than parse url 200x + + +[WILDLINE]/pass.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench4 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench5 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench6 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench7 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench8 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench9 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] + + +[WILDLINE]/multiple_group.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +-------------------------------------------------------------------- ----------------------------- + +group noop +noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] + +summary + noo[WILDCARD] + [WILDCARD]x [WILDCARD] than noo[WILDCARD] + +group url +noop3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +parse url 2x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +parse url 200x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] + +summary + parse url 2x + [WILDCARD]x slower than noop3 + [WILDCARD]x faster than parse url 200x + diff --git a/tests/testdata/bench/multiple_group.ts b/tests/specs/bench/multifile_summary/multiple_group.ts similarity index 100% rename from tests/testdata/bench/multiple_group.ts rename to tests/specs/bench/multifile_summary/multiple_group.ts diff --git a/tests/specs/bench/multifile_summary/pass.ts b/tests/specs/bench/multifile_summary/pass.ts new file mode 100644 index 0000000000..48348d4476 --- /dev/null +++ b/tests/specs/bench/multifile_summary/pass.ts @@ -0,0 +1,10 @@ +Deno.bench("bench0", () => {}); +Deno.bench("bench1", () => {}); +Deno.bench("bench2", () => {}); +Deno.bench("bench3", () => {}); +Deno.bench("bench4", () => {}); +Deno.bench("bench5", () => {}); +Deno.bench("bench6", () => {}); +Deno.bench("bench7", () => {}); +Deno.bench("bench8", () => {}); +Deno.bench("bench9", () => {}); diff --git a/tests/specs/bench/no_check/__test__.jsonc b/tests/specs/bench/no_check/__test__.jsonc new file mode 100644 index 0000000000..d031e52def --- /dev/null +++ b/tests/specs/bench/no_check/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench --no-check no_check.ts", + "output": "no_check.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/no_check/no_check.out b/tests/specs/bench/no_check/no_check.out new file mode 100644 index 0000000000..c373c812c4 --- /dev/null +++ b/tests/specs/bench/no_check/no_check.out @@ -0,0 +1,9 @@ +error: (in promise) TypeError: Cannot read properties of undefined (reading 'fn') +Deno.bench(); + ^ + at [WILDCARD] + at [WILDCARD]/no_check.ts:1:6 +This error was not caught from a benchmark and caused the bench runner to fail on the referenced module. +It most likely originated from a dangling promise, event/timeout handler or top-level code. + +error: Bench failed diff --git a/tests/testdata/bench/no_check.ts b/tests/specs/bench/no_check/no_check.ts similarity index 100% rename from tests/testdata/bench/no_check.ts rename to tests/specs/bench/no_check/no_check.ts diff --git a/tests/specs/bench/no_prompt_by_default/__test__.jsonc b/tests/specs/bench/no_prompt_by_default/__test__.jsonc new file mode 100644 index 0000000000..e3f4127da9 --- /dev/null +++ b/tests/specs/bench/no_prompt_by_default/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench --quiet no_prompt_by_default.ts", + "output": "no_prompt_by_default.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/no_prompt_by_default/no_prompt_by_default.out b/tests/specs/bench/no_prompt_by_default/no_prompt_by_default.out new file mode 100644 index 0000000000..7c5f2b5c2e --- /dev/null +++ b/tests/specs/bench/no_prompt_by_default/no_prompt_by_default.out @@ -0,0 +1,9 @@ +[WILDCARD]cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/no_prompt_by_default.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +no prompt error: PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag +[WILDCARD] +error: Bench failed diff --git a/tests/testdata/bench/no_prompt_by_default.ts b/tests/specs/bench/no_prompt_by_default/no_prompt_by_default.ts similarity index 100% rename from tests/testdata/bench/no_prompt_by_default.ts rename to tests/specs/bench/no_prompt_by_default/no_prompt_by_default.ts diff --git a/tests/specs/bench/no_prompt_with_denied_perms/__test__.jsonc b/tests/specs/bench/no_prompt_with_denied_perms/__test__.jsonc new file mode 100644 index 0000000000..a06645249a --- /dev/null +++ b/tests/specs/bench/no_prompt_with_denied_perms/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench --quiet --allow-read no_prompt_with_denied_perms.ts", + "output": "no_prompt_with_denied_perms.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/no_prompt_with_denied_perms/no_prompt_with_denied_perms.out b/tests/specs/bench/no_prompt_with_denied_perms/no_prompt_with_denied_perms.out new file mode 100644 index 0000000000..bbdd2ac462 --- /dev/null +++ b/tests/specs/bench/no_prompt_with_denied_perms/no_prompt_with_denied_perms.out @@ -0,0 +1,9 @@ +[WILDCARD]cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/no_prompt_with_denied_perms.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +no prompt error: PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag +[WILDCARD] +error: Bench failed diff --git a/tests/testdata/bench/no_prompt_with_denied_perms.ts b/tests/specs/bench/no_prompt_with_denied_perms/no_prompt_with_denied_perms.ts similarity index 100% rename from tests/testdata/bench/no_prompt_with_denied_perms.ts rename to tests/specs/bench/no_prompt_with_denied_perms/no_prompt_with_denied_perms.ts diff --git a/tests/specs/bench/no_run/__test__.jsonc b/tests/specs/bench/no_run/__test__.jsonc new file mode 100644 index 0000000000..159f6fd5a0 --- /dev/null +++ b/tests/specs/bench/no_run/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench --no-run no_run.ts", + "output": "no_run.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/no_run/no_run.out b/tests/specs/bench/no_run/no_run.out new file mode 100644 index 0000000000..77ce18366a --- /dev/null +++ b/tests/specs/bench/no_run/no_run.out @@ -0,0 +1,5 @@ +Check [WILDCARD]/no_run.ts +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const _value: string = 1; + ~~~~~~ + at [WILDCARD]/no_run.ts:1:7 diff --git a/tests/testdata/bench/no_run.ts b/tests/specs/bench/no_run/no_run.ts similarity index 100% rename from tests/testdata/bench/no_run.ts rename to tests/specs/bench/no_run/no_run.ts diff --git a/tests/specs/bench/only/__test__.jsonc b/tests/specs/bench/only/__test__.jsonc new file mode 100644 index 0000000000..7d50a6dec2 --- /dev/null +++ b/tests/specs/bench/only/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench only.ts", + "output": "only.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/only/only.out b/tests/specs/bench/only/only.out new file mode 100644 index 0000000000..e3332d174a --- /dev/null +++ b/tests/specs/bench/only/only.out @@ -0,0 +1,9 @@ +Check [WILDCARD]/only.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/only.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +error: Bench failed because the "only" option was used diff --git a/tests/testdata/bench/only.ts b/tests/specs/bench/only/only.ts similarity index 100% rename from tests/testdata/bench/only.ts rename to tests/specs/bench/only/only.ts diff --git a/tests/specs/bench/overloads/__test__.jsonc b/tests/specs/bench/overloads/__test__.jsonc new file mode 100644 index 0000000000..ae0fe0a07a --- /dev/null +++ b/tests/specs/bench/overloads/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench overloads.ts", + "output": "overloads.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/overloads/overloads.out b/tests/specs/bench/overloads/overloads.out new file mode 100644 index 0000000000..21f8759dd5 --- /dev/null +++ b/tests/specs/bench/overloads/overloads.out @@ -0,0 +1,12 @@ +Check [WILDCARD]/overloads.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/overloads.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench4 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] diff --git a/tests/testdata/bench/overloads.ts b/tests/specs/bench/overloads/overloads.ts similarity index 100% rename from tests/testdata/bench/overloads.ts rename to tests/specs/bench/overloads/overloads.ts diff --git a/tests/specs/bench/package_json/__test__.jsonc b/tests/specs/bench/package_json/__test__.jsonc new file mode 100644 index 0000000000..001cc8b54e --- /dev/null +++ b/tests/specs/bench/package_json/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "tempDir": true, + "args": "bench", + "output": "lib.bench.out" +} diff --git a/tests/testdata/package_json/basic/lib.bench.out b/tests/specs/bench/package_json/lib.bench.out similarity index 100% rename from tests/testdata/package_json/basic/lib.bench.out rename to tests/specs/bench/package_json/lib.bench.out diff --git a/tests/testdata/package_json/basic/lib.bench.ts b/tests/specs/bench/package_json/lib.bench.ts similarity index 100% rename from tests/testdata/package_json/basic/lib.bench.ts rename to tests/specs/bench/package_json/lib.bench.ts diff --git a/tests/specs/bench/package_json/lib.ts b/tests/specs/bench/package_json/lib.ts new file mode 100644 index 0000000000..1deed81f7e --- /dev/null +++ b/tests/specs/bench/package_json/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/bench/package_json/package.json b/tests/specs/bench/package_json/package.json new file mode 100644 index 0000000000..54ca824d64 --- /dev/null +++ b/tests/specs/bench/package_json/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/bench/pass/__test__.jsonc b/tests/specs/bench/pass/__test__.jsonc new file mode 100644 index 0000000000..797684ec62 --- /dev/null +++ b/tests/specs/bench/pass/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench pass.ts", + "output": "pass.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/pass/pass.out b/tests/specs/bench/pass/pass.out new file mode 100644 index 0000000000..4be2b87234 --- /dev/null +++ b/tests/specs/bench/pass/pass.out @@ -0,0 +1,17 @@ +Check [WILDCARD]/pass.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/pass.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench4 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench5 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench6 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench7 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench8 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +bench9 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] diff --git a/tests/specs/bench/pass/pass.ts b/tests/specs/bench/pass/pass.ts new file mode 100644 index 0000000000..48348d4476 --- /dev/null +++ b/tests/specs/bench/pass/pass.ts @@ -0,0 +1,10 @@ +Deno.bench("bench0", () => {}); +Deno.bench("bench1", () => {}); +Deno.bench("bench2", () => {}); +Deno.bench("bench3", () => {}); +Deno.bench("bench4", () => {}); +Deno.bench("bench5", () => {}); +Deno.bench("bench6", () => {}); +Deno.bench("bench7", () => {}); +Deno.bench("bench8", () => {}); +Deno.bench("bench9", () => {}); diff --git a/tests/specs/bench/quiet/__test__.jsonc b/tests/specs/bench/quiet/__test__.jsonc new file mode 100644 index 0000000000..a220e9936f --- /dev/null +++ b/tests/specs/bench/quiet/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench --quiet quiet.ts", + "output": "quiet.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/quiet/quiet.out b/tests/specs/bench/quiet/quiet.out new file mode 100644 index 0000000000..fa9166d65b --- /dev/null +++ b/tests/specs/bench/quiet/quiet.out @@ -0,0 +1,10 @@ +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/quiet.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +------------------------------------------------------------------- ----------------------------- +console.log [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +console.error [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +console.info [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +console.warn [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] diff --git a/tests/testdata/bench/quiet.ts b/tests/specs/bench/quiet/quiet.ts similarity index 100% rename from tests/testdata/bench/quiet.ts rename to tests/specs/bench/quiet/quiet.ts diff --git a/tests/specs/bench/unhandled_rejection/__test__.jsonc b/tests/specs/bench/unhandled_rejection/__test__.jsonc new file mode 100644 index 0000000000..0576136ef7 --- /dev/null +++ b/tests/specs/bench/unhandled_rejection/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench unhandled_rejection.ts", + "output": "unhandled_rejection.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/unhandled_rejection/unhandled_rejection.out b/tests/specs/bench/unhandled_rejection/unhandled_rejection.out new file mode 100644 index 0000000000..b95b9ab8be --- /dev/null +++ b/tests/specs/bench/unhandled_rejection/unhandled_rejection.out @@ -0,0 +1,11 @@ +Check [WILDCARD]/unhandled_rejection.ts +error: (in promise) Error: rejection + reject(new Error("rejection")); + ^ + at [WILDCARD]/unhandled_rejection.ts:2:10 + at new Promise () + at [WILDCARD]/unhandled_rejection.ts:1:1 +This error was not caught from a benchmark and caused the bench runner to fail on the referenced module. +It most likely originated from a dangling promise, event/timeout handler or top-level code. + +error: Bench failed diff --git a/tests/testdata/bench/unhandled_rejection.ts b/tests/specs/bench/unhandled_rejection/unhandled_rejection.ts similarity index 100% rename from tests/testdata/bench/unhandled_rejection.ts rename to tests/specs/bench/unhandled_rejection/unhandled_rejection.ts diff --git a/tests/specs/bench/unresolved_promise/__test__.jsonc b/tests/specs/bench/unresolved_promise/__test__.jsonc new file mode 100644 index 0000000000..487e46b3d7 --- /dev/null +++ b/tests/specs/bench/unresolved_promise/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench unresolved_promise.ts", + "output": "unresolved_promise.out", + "exitCode": 1 +} diff --git a/tests/specs/bench/unresolved_promise/unresolved_promise.out b/tests/specs/bench/unresolved_promise/unresolved_promise.out new file mode 100644 index 0000000000..92d29f399b --- /dev/null +++ b/tests/specs/bench/unresolved_promise/unresolved_promise.out @@ -0,0 +1,9 @@ +Check [WILDCARD]/unresolved_promise.ts +error: Top-level await promise never resolved +await new Promise((_resolve, _reject) => {}); +^ + at ([WILDCARD]/unresolved_promise.ts:1:1) +This error was not caught from a benchmark and caused the bench runner to fail on the referenced module. +It most likely originated from a dangling promise, event/timeout handler or top-level code. + +error: Bench failed diff --git a/tests/testdata/bench/unresolved_promise.ts b/tests/specs/bench/unresolved_promise/unresolved_promise.ts similarity index 100% rename from tests/testdata/bench/unresolved_promise.ts rename to tests/specs/bench/unresolved_promise/unresolved_promise.ts diff --git a/tests/specs/cache/check_local_by_default/__test__.jsonc b/tests/specs/cache/check_local_by_default/__test__.jsonc new file mode 100644 index 0000000000..e6d0829fd5 --- /dev/null +++ b/tests/specs/cache/check_local_by_default/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "cache --quiet check_local_by_default.ts", + "output": "check_local_by_default.out" +} diff --git a/tests/testdata/publish/invalid_path/path with spaces.txt b/tests/specs/cache/check_local_by_default/check_local_by_default.out similarity index 100% rename from tests/testdata/publish/invalid_path/path with spaces.txt rename to tests/specs/cache/check_local_by_default/check_local_by_default.out diff --git a/tests/testdata/cache/check_local_by_default.ts b/tests/specs/cache/check_local_by_default/check_local_by_default.ts similarity index 100% rename from tests/testdata/cache/check_local_by_default.ts rename to tests/specs/cache/check_local_by_default/check_local_by_default.ts diff --git a/tests/specs/cache/check_local_by_default2/__test__.jsonc b/tests/specs/cache/check_local_by_default2/__test__.jsonc new file mode 100644 index 0000000000..a9e70dcd94 --- /dev/null +++ b/tests/specs/cache/check_local_by_default2/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "cache --quiet check_local_by_default2.ts", + "output": "check_local_by_default2.out" +} diff --git a/tests/specs/cache/check_local_by_default2/check_local_by_default2.out b/tests/specs/cache/check_local_by_default2/check_local_by_default2.out new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/testdata/cache/check_local_by_default2.ts b/tests/specs/cache/check_local_by_default2/check_local_by_default2.ts similarity index 100% rename from tests/testdata/cache/check_local_by_default2.ts rename to tests/specs/cache/check_local_by_default2/check_local_by_default2.ts diff --git a/tests/specs/cache/extensionless/__test__.jsonc b/tests/specs/cache/extensionless/__test__.jsonc new file mode 100644 index 0000000000..837f26eccc --- /dev/null +++ b/tests/specs/cache/extensionless/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "cache --reload --check=all http://localhost:4545/subdir/no_js_ext", + "output": "cache_extensionless.out" +} diff --git a/tests/testdata/cache/cache_extensionless.out b/tests/specs/cache/extensionless/cache_extensionless.out similarity index 100% rename from tests/testdata/cache/cache_extensionless.out rename to tests/specs/cache/extensionless/cache_extensionless.out diff --git a/tests/specs/cache/fetch_multiple/__test__.jsonc b/tests/specs/cache/fetch_multiple/__test__.jsonc new file mode 100644 index 0000000000..a5cf411131 --- /dev/null +++ b/tests/specs/cache/fetch_multiple/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "cache --reload --check=all test.ts other.ts", + "output": "fetch_multiple.out" +} diff --git a/tests/specs/cache/fetch_multiple/fetch_multiple.out b/tests/specs/cache/fetch_multiple/fetch_multiple.out new file mode 100644 index 0000000000..1cd3639ecf --- /dev/null +++ b/tests/specs/cache/fetch_multiple/fetch_multiple.out @@ -0,0 +1,5 @@ +Download http://localhost:4545/subdir/mod2.ts +Download http://localhost:4545/subdir/mt_text_typescript.t1.ts +Download http://localhost:4545/subdir/print_hello.ts +Check [WILDCARD]/fetch_multiple/test.ts +Check [WILDCARD]/fetch_multiple/other.ts diff --git a/tests/testdata/run/fetch/other.ts b/tests/specs/cache/fetch_multiple/other.ts similarity index 100% rename from tests/testdata/run/fetch/other.ts rename to tests/specs/cache/fetch_multiple/other.ts diff --git a/tests/testdata/run/fetch/test.ts b/tests/specs/cache/fetch_multiple/test.ts similarity index 100% rename from tests/testdata/run/fetch/test.ts rename to tests/specs/cache/fetch_multiple/test.ts diff --git a/tests/specs/cache/ignore_require/__test__.jsonc b/tests/specs/cache/ignore_require/__test__.jsonc new file mode 100644 index 0000000000..e6d0093c7e --- /dev/null +++ b/tests/specs/cache/ignore_require/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "cache --reload --no-check ignore_require.js", + "output": "" +} diff --git a/tests/testdata/cache/ignore_require.js b/tests/specs/cache/ignore_require/ignore_require.js similarity index 100% rename from tests/testdata/cache/ignore_require.js rename to tests/specs/cache/ignore_require/ignore_require.js diff --git a/tests/specs/cache/json_import/__test__.jsonc b/tests/specs/cache/json_import/__test__.jsonc new file mode 100644 index 0000000000..fdc3459c3f --- /dev/null +++ b/tests/specs/cache/json_import/__test__.jsonc @@ -0,0 +1,5 @@ +{ + // should not error + "args": "cache --quiet main.ts", + "output": "[WILDCARD]" +} diff --git a/tests/testdata/cache/json_import/main.ts b/tests/specs/cache/json_import/main.ts similarity index 100% rename from tests/testdata/cache/json_import/main.ts rename to tests/specs/cache/json_import/main.ts diff --git a/tests/testdata/cache/json_import/test.json b/tests/specs/cache/json_import/test.json similarity index 100% rename from tests/testdata/cache/json_import/test.json rename to tests/specs/cache/json_import/test.json diff --git a/tests/specs/cache/package_json/__test__.jsonc b/tests/specs/cache/package_json/__test__.jsonc new file mode 100644 index 0000000000..b25ac147d6 --- /dev/null +++ b/tests/specs/cache/package_json/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "tempDir": true, + "args": "cache main.ts", + "output": "main.cache.out" +} diff --git a/tests/specs/cache/package_json/lib.ts b/tests/specs/cache/package_json/lib.ts new file mode 100644 index 0000000000..1deed81f7e --- /dev/null +++ b/tests/specs/cache/package_json/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/testdata/package_json/basic/main.cache.out b/tests/specs/cache/package_json/main.cache.out similarity index 100% rename from tests/testdata/package_json/basic/main.cache.out rename to tests/specs/cache/package_json/main.cache.out diff --git a/tests/specs/cache/package_json/main.ts b/tests/specs/cache/package_json/main.ts new file mode 100644 index 0000000000..e241f30026 --- /dev/null +++ b/tests/specs/cache/package_json/main.ts @@ -0,0 +1,3 @@ +import { getValue } from "./lib.ts"; + +console.log(getValue()); diff --git a/tests/specs/cache/package_json/package.json b/tests/specs/cache/package_json/package.json new file mode 100644 index 0000000000..54ca824d64 --- /dev/null +++ b/tests/specs/cache/package_json/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/cache/performance_stats/__test__.jsonc b/tests/specs/cache/performance_stats/__test__.jsonc new file mode 100644 index 0000000000..f4d37b8036 --- /dev/null +++ b/tests/specs/cache/performance_stats/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "cache --reload --check=all --log-level debug hello.ts", + "output": "performance_stats.out" +} diff --git a/tests/specs/cache/performance_stats/hello.ts b/tests/specs/cache/performance_stats/hello.ts new file mode 100644 index 0000000000..accefceba6 --- /dev/null +++ b/tests/specs/cache/performance_stats/hello.ts @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/tests/specs/cache/performance_stats/performance_stats.out b/tests/specs/cache/performance_stats/performance_stats.out new file mode 100644 index 0000000000..141829ee6c --- /dev/null +++ b/tests/specs/cache/performance_stats/performance_stats.out @@ -0,0 +1,16 @@ +[WILDCARD] +DEBUG RS - [WILDCARD] - Compilation statistics: + Files: [WILDCARD] + Nodes: [WILDCARD] + Identifiers: [WILDCARD] + Symbols: [WILDCARD] + Types: [WILDCARD] + Instantiations: [WILDCARD] + Parse time: [WILDCARD] + Bind time: [WILDCARD] + Check time: [WILDCARD] + Emit time: [WILDCARD] + Total TS time: [WILDCARD] + Compile time: [WILDCARD] + +[WILDCARD] diff --git a/tests/specs/cache/random_extension/__test__.jsonc b/tests/specs/cache/random_extension/__test__.jsonc new file mode 100644 index 0000000000..7b847a77d9 --- /dev/null +++ b/tests/specs/cache/random_extension/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "cache --reload --check=all http://localhost:4545/subdir/no_js_ext@1.0.0", + "output": "cache_random_extension.out" +} diff --git a/tests/testdata/cache/cache_random_extension.out b/tests/specs/cache/random_extension/cache_random_extension.out similarity index 100% rename from tests/testdata/cache/cache_random_extension.out rename to tests/specs/cache/random_extension/cache_random_extension.out diff --git a/tests/specs/cache/redirect/__test__.jsonc b/tests/specs/cache/redirect/__test__.jsonc new file mode 100644 index 0000000000..251bc61749 --- /dev/null +++ b/tests/specs/cache/redirect/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "cache --reload --check=all http://localhost:4548/subdir/redirects/a.ts", + "output": "redirect_cache.out" +} diff --git a/tests/testdata/cache/redirect_cache.out b/tests/specs/cache/redirect/redirect_cache.out similarity index 100% rename from tests/testdata/cache/redirect_cache.out rename to tests/specs/cache/redirect/redirect_cache.out diff --git a/tests/testdata/cache/095_cache_with_bare_import.ts b/tests/specs/cache/with_bare_import/095_cache_with_bare_import.ts similarity index 100% rename from tests/testdata/cache/095_cache_with_bare_import.ts rename to tests/specs/cache/with_bare_import/095_cache_with_bare_import.ts diff --git a/tests/specs/cache/with_bare_import/095_cache_with_bare_import.ts.out b/tests/specs/cache/with_bare_import/095_cache_with_bare_import.ts.out new file mode 100644 index 0000000000..2668a6e083 --- /dev/null +++ b/tests/specs/cache/with_bare_import/095_cache_with_bare_import.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ + at file:///[WILDCARD]/095_cache_with_bare_import.ts:[WILDCARD] diff --git a/tests/specs/cache/with_bare_import/__test__.jsonc b/tests/specs/cache/with_bare_import/__test__.jsonc new file mode 100644 index 0000000000..0ff2d09cb7 --- /dev/null +++ b/tests/specs/cache/with_bare_import/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "cache 095_cache_with_bare_import.ts", + "output": "095_cache_with_bare_import.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/check/check_types_dts/__test__.jsonc b/tests/specs/check/check_types_dts/__test__.jsonc new file mode 100644 index 0000000000..7f620daa27 --- /dev/null +++ b/tests/specs/check/check_types_dts/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "check main.ts", + "output": "main.out", + "exitCode": 0 +} diff --git a/tests/testdata/check/types_dts/deno.json b/tests/specs/check/check_types_dts/deno.json similarity index 100% rename from tests/testdata/check/types_dts/deno.json rename to tests/specs/check/check_types_dts/deno.json diff --git a/tests/specs/check/check_types_dts/main.out b/tests/specs/check/check_types_dts/main.out new file mode 100644 index 0000000000..b8fb00c4fa --- /dev/null +++ b/tests/specs/check/check_types_dts/main.out @@ -0,0 +1 @@ +Check file:///[WILDCARD]/main.ts diff --git a/tests/testdata/check/types_dts/main.ts b/tests/specs/check/check_types_dts/main.ts similarity index 100% rename from tests/testdata/check/types_dts/main.ts rename to tests/specs/check/check_types_dts/main.ts diff --git a/tests/testdata/check/types_dts/types.d.ts b/tests/specs/check/check_types_dts/types.d.ts similarity index 100% rename from tests/testdata/check/types_dts/types.d.ts rename to tests/specs/check/check_types_dts/types.d.ts diff --git a/tests/specs/check/check_with_excluded_file_specified/__test__.jsonc b/tests/specs/check/check_with_excluded_file_specified/__test__.jsonc new file mode 100644 index 0000000000..212ab8fb3a --- /dev/null +++ b/tests/specs/check/check_with_excluded_file_specified/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "check lib/types.d.ts", + "output": "check.out" +} diff --git a/tests/testdata/check/excluded_file_specified/check.out b/tests/specs/check/check_with_excluded_file_specified/check.out similarity index 100% rename from tests/testdata/check/excluded_file_specified/check.out rename to tests/specs/check/check_with_excluded_file_specified/check.out diff --git a/tests/testdata/check/excluded_file_specified/deno.json b/tests/specs/check/check_with_excluded_file_specified/deno.json similarity index 100% rename from tests/testdata/check/excluded_file_specified/deno.json rename to tests/specs/check/check_with_excluded_file_specified/deno.json diff --git a/tests/testdata/check/excluded_file_specified/lib/types.d.ts b/tests/specs/check/check_with_excluded_file_specified/lib/types.d.ts similarity index 100% rename from tests/testdata/check/excluded_file_specified/lib/types.d.ts rename to tests/specs/check/check_with_excluded_file_specified/lib/types.d.ts diff --git a/tests/specs/check/extensionless/__test__.jsonc b/tests/specs/check/extensionless/__test__.jsonc new file mode 100644 index 0000000000..670680b7d9 --- /dev/null +++ b/tests/specs/check/extensionless/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "check --reload --all http://localhost:4545/subdir/no_js_ext", + "output": "check.out" +} diff --git a/tests/specs/check/extensionless/check.out b/tests/specs/check/extensionless/check.out new file mode 100644 index 0000000000..3694c67cb7 --- /dev/null +++ b/tests/specs/check/extensionless/check.out @@ -0,0 +1,2 @@ +[WILDCARD] +Check http://localhost:4545/subdir/no_js_ext diff --git a/tests/specs/check/random_extension/__test__.jsonc b/tests/specs/check/random_extension/__test__.jsonc new file mode 100644 index 0000000000..f504c1d2b4 --- /dev/null +++ b/tests/specs/check/random_extension/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "check --reload --all http://localhost:4545/subdir/no_js_ext@1.0.0", + "output": "output.out" +} diff --git a/tests/specs/check/random_extension/output.out b/tests/specs/check/random_extension/output.out new file mode 100644 index 0000000000..745a2e0e31 --- /dev/null +++ b/tests/specs/check/random_extension/output.out @@ -0,0 +1,2 @@ +[WILDCARD] +Check http://localhost:4545/subdir/no_js_ext@1.0.0 diff --git a/tests/specs/check/with_bare_import/095_cache_with_bare_import.ts b/tests/specs/check/with_bare_import/095_cache_with_bare_import.ts new file mode 100644 index 0000000000..c0748305d5 --- /dev/null +++ b/tests/specs/check/with_bare_import/095_cache_with_bare_import.ts @@ -0,0 +1 @@ +import "foo"; diff --git a/tests/specs/check/with_bare_import/095_cache_with_bare_import.ts.out b/tests/specs/check/with_bare_import/095_cache_with_bare_import.ts.out new file mode 100644 index 0000000000..2668a6e083 --- /dev/null +++ b/tests/specs/check/with_bare_import/095_cache_with_bare_import.ts.out @@ -0,0 +1,2 @@ +[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ + at file:///[WILDCARD]/095_cache_with_bare_import.ts:[WILDCARD] diff --git a/tests/specs/check/with_bare_import/__test__.jsonc b/tests/specs/check/with_bare_import/__test__.jsonc new file mode 100644 index 0000000000..c32a66ad2c --- /dev/null +++ b/tests/specs/check/with_bare_import/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "check 095_cache_with_bare_import.ts", + "output": "095_cache_with_bare_import.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/lint/no_slow_types/__test__.jsonc b/tests/specs/lint/no_slow_types/__test__.jsonc new file mode 100644 index 0000000000..2a5a340328 --- /dev/null +++ b/tests/specs/lint/no_slow_types/__test__.jsonc @@ -0,0 +1,17 @@ +{ + "steps": [{ + "args": "lint", + "output": "no_slow_types.out", + "exitCode": 1 + }, { + "args": "lint --rules-exclude=no-slow-types", + "output": "Checked 4 files\n" + }, { + "args": "lint --config=deno.non-package.json", + "output": "Checked 4 files\n" + }, { + // non-entrypoint + "args": "lint d.ts", + "output": "Checked 1 file\n" + }] +} diff --git a/tests/testdata/lint/no_slow_types/a.ts b/tests/specs/lint/no_slow_types/a.ts similarity index 100% rename from tests/testdata/lint/no_slow_types/a.ts rename to tests/specs/lint/no_slow_types/a.ts diff --git a/tests/testdata/lint/no_slow_types/b.ts b/tests/specs/lint/no_slow_types/b.ts similarity index 100% rename from tests/testdata/lint/no_slow_types/b.ts rename to tests/specs/lint/no_slow_types/b.ts diff --git a/tests/testdata/lint/no_slow_types/c.ts b/tests/specs/lint/no_slow_types/c.ts similarity index 100% rename from tests/testdata/lint/no_slow_types/c.ts rename to tests/specs/lint/no_slow_types/c.ts diff --git a/tests/testdata/lint/no_slow_types/d.ts b/tests/specs/lint/no_slow_types/d.ts similarity index 100% rename from tests/testdata/lint/no_slow_types/d.ts rename to tests/specs/lint/no_slow_types/d.ts diff --git a/tests/testdata/lint/no_slow_types/deno.json b/tests/specs/lint/no_slow_types/deno.json similarity index 100% rename from tests/testdata/lint/no_slow_types/deno.json rename to tests/specs/lint/no_slow_types/deno.json diff --git a/tests/testdata/lint/no_slow_types/deno.non-package.json b/tests/specs/lint/no_slow_types/deno.non-package.json similarity index 100% rename from tests/testdata/lint/no_slow_types/deno.non-package.json rename to tests/specs/lint/no_slow_types/deno.non-package.json diff --git a/tests/testdata/lint/no_slow_types/no_slow_types.out b/tests/specs/lint/no_slow_types/no_slow_types.out similarity index 100% rename from tests/testdata/lint/no_slow_types/no_slow_types.out rename to tests/specs/lint/no_slow_types/no_slow_types.out diff --git a/tests/testdata/lint/no_slow_types/no_slow_types_entrypoint.out b/tests/specs/lint/no_slow_types/no_slow_types_entrypoint.out similarity index 100% rename from tests/testdata/lint/no_slow_types/no_slow_types_entrypoint.out rename to tests/specs/lint/no_slow_types/no_slow_types_entrypoint.out diff --git a/tests/specs/lint/no_slow_types_entrypoint/__test__.jsonc b/tests/specs/lint/no_slow_types_entrypoint/__test__.jsonc new file mode 100644 index 0000000000..2ba74c03fd --- /dev/null +++ b/tests/specs/lint/no_slow_types_entrypoint/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint a.ts", + "output": "no_slow_types_entrypoint.out", + "exitCode": 1 +} diff --git a/tests/testdata/lint/no_slow_types_workspace/a/mod.ts b/tests/specs/lint/no_slow_types_entrypoint/a.ts similarity index 100% rename from tests/testdata/lint/no_slow_types_workspace/a/mod.ts rename to tests/specs/lint/no_slow_types_entrypoint/a.ts diff --git a/tests/testdata/lint/no_slow_types_workspace/a/b.ts b/tests/specs/lint/no_slow_types_entrypoint/b.ts similarity index 100% rename from tests/testdata/lint/no_slow_types_workspace/a/b.ts rename to tests/specs/lint/no_slow_types_entrypoint/b.ts diff --git a/tests/specs/lint/no_slow_types_entrypoint/c.ts b/tests/specs/lint/no_slow_types_entrypoint/c.ts new file mode 100644 index 0000000000..517aa3d211 --- /dev/null +++ b/tests/specs/lint/no_slow_types_entrypoint/c.ts @@ -0,0 +1,4 @@ +// this one won't error because it's not an export +export function addC(a: number, b: number) { + return a + b; +} diff --git a/tests/testdata/lint/no_slow_types_workspace/a/d.ts b/tests/specs/lint/no_slow_types_entrypoint/d.ts similarity index 100% rename from tests/testdata/lint/no_slow_types_workspace/a/d.ts rename to tests/specs/lint/no_slow_types_entrypoint/d.ts diff --git a/tests/specs/lint/no_slow_types_entrypoint/deno.json b/tests/specs/lint/no_slow_types_entrypoint/deno.json new file mode 100644 index 0000000000..2fd0af5f0f --- /dev/null +++ b/tests/specs/lint/no_slow_types_entrypoint/deno.json @@ -0,0 +1,8 @@ +{ + "name": "@pkg/pkg", + "version": "1.0.0", + "exports": { + "./a": "./a.ts", + "./b": "./b.ts" + } +} diff --git a/tests/specs/lint/no_slow_types_entrypoint/deno.non-package.json b/tests/specs/lint/no_slow_types_entrypoint/deno.non-package.json new file mode 100644 index 0000000000..2c63c08510 --- /dev/null +++ b/tests/specs/lint/no_slow_types_entrypoint/deno.non-package.json @@ -0,0 +1,2 @@ +{ +} diff --git a/tests/specs/lint/no_slow_types_entrypoint/no_slow_types.out b/tests/specs/lint/no_slow_types_entrypoint/no_slow_types.out new file mode 100644 index 0000000000..5828906e76 --- /dev/null +++ b/tests/specs/lint/no_slow_types_entrypoint/no_slow_types.out @@ -0,0 +1,35 @@ +error[no-slow-types]: missing explicit return type in the public API + --> [WILDCARD]a.ts:1:17 + | +1 | export function add(a: number, b: number) { + | ^^^ this function is missing an explicit return type + = hint: add an explicit return type to the function + + info: all functions in the public API must have an explicit return type + docs: https://jsr.io/go/slow-type-missing-explicit-return-type + + +error[no-slow-types]: missing explicit return type in the public API + --> [WILDCARD]b.ts:1:17 + | +1 | export function addB(a: number, b: number) { + | ^^^^ this function is missing an explicit return type + = hint: add an explicit return type to the function + + info: all functions in the public API must have an explicit return type + docs: https://jsr.io/go/slow-type-missing-explicit-return-type + + +error[no-slow-types]: missing explicit return type in the public API + --> [WILDCARD]d.ts:2:17 + | +2 | export function addD(a: number, b: number) { + | ^^^^ this function is missing an explicit return type + = hint: add an explicit return type to the function + + info: all functions in the public API must have an explicit return type + docs: https://jsr.io/go/slow-type-missing-explicit-return-type + + +Found 3 problems +Checked 4 files diff --git a/tests/specs/lint/no_slow_types_entrypoint/no_slow_types_entrypoint.out b/tests/specs/lint/no_slow_types_entrypoint/no_slow_types_entrypoint.out new file mode 100644 index 0000000000..b8c1013bf0 --- /dev/null +++ b/tests/specs/lint/no_slow_types_entrypoint/no_slow_types_entrypoint.out @@ -0,0 +1,35 @@ +error[no-slow-types]: missing explicit return type in the public API + --> [WILDCARD]a.ts:1:17 + | +1 | export function add(a: number, b: number) { + | ^^^ this function is missing an explicit return type + = hint: add an explicit return type to the function + + info: all functions in the public API must have an explicit return type + docs: https://jsr.io/go/slow-type-missing-explicit-return-type + + +error[no-slow-types]: missing explicit return type in the public API + --> [WILDCARD]b.ts:1:17 + | +1 | export function addB(a: number, b: number) { + | ^^^^ this function is missing an explicit return type + = hint: add an explicit return type to the function + + info: all functions in the public API must have an explicit return type + docs: https://jsr.io/go/slow-type-missing-explicit-return-type + + +error[no-slow-types]: missing explicit return type in the public API + --> [WILDCARD]d.ts:2:17 + | +2 | export function addD(a: number, b: number) { + | ^^^^ this function is missing an explicit return type + = hint: add an explicit return type to the function + + info: all functions in the public API must have an explicit return type + docs: https://jsr.io/go/slow-type-missing-explicit-return-type + + +Found 3 problems +Checked 1 file diff --git a/tests/specs/lint/no_slow_types_workspace/__test__.jsonc b/tests/specs/lint/no_slow_types_workspace/__test__.jsonc new file mode 100644 index 0000000000..7128e116c5 --- /dev/null +++ b/tests/specs/lint/no_slow_types_workspace/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "lint", + "output": "output.out", + "exitCode": 1 +} diff --git a/tests/specs/lint/no_slow_types_workspace/a/b.ts b/tests/specs/lint/no_slow_types_workspace/a/b.ts new file mode 100644 index 0000000000..b96a794894 --- /dev/null +++ b/tests/specs/lint/no_slow_types_workspace/a/b.ts @@ -0,0 +1,5 @@ +export function addB(a: number, b: number) { + return a + b; +} + +export * from "./d.ts"; diff --git a/tests/specs/lint/no_slow_types_workspace/a/d.ts b/tests/specs/lint/no_slow_types_workspace/a/d.ts new file mode 100644 index 0000000000..babe9d81b5 --- /dev/null +++ b/tests/specs/lint/no_slow_types_workspace/a/d.ts @@ -0,0 +1,4 @@ +// this one is re-exported via b.ts +export function addD(a: number, b: number) { + return a + b; +} diff --git a/tests/testdata/lint/no_slow_types_workspace/a/deno.json b/tests/specs/lint/no_slow_types_workspace/a/deno.json similarity index 100% rename from tests/testdata/lint/no_slow_types_workspace/a/deno.json rename to tests/specs/lint/no_slow_types_workspace/a/deno.json diff --git a/tests/specs/lint/no_slow_types_workspace/a/mod.ts b/tests/specs/lint/no_slow_types_workspace/a/mod.ts new file mode 100644 index 0000000000..3b399665dc --- /dev/null +++ b/tests/specs/lint/no_slow_types_workspace/a/mod.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number) { + return a + b; +} diff --git a/tests/testdata/lint/no_slow_types_workspace/b/deno.json b/tests/specs/lint/no_slow_types_workspace/b/deno.json similarity index 100% rename from tests/testdata/lint/no_slow_types_workspace/b/deno.json rename to tests/specs/lint/no_slow_types_workspace/b/deno.json diff --git a/tests/testdata/lint/no_slow_types_workspace/b/mod.ts b/tests/specs/lint/no_slow_types_workspace/b/mod.ts similarity index 100% rename from tests/testdata/lint/no_slow_types_workspace/b/mod.ts rename to tests/specs/lint/no_slow_types_workspace/b/mod.ts diff --git a/tests/testdata/lint/no_slow_types_workspace/c/deno.json b/tests/specs/lint/no_slow_types_workspace/c/deno.json similarity index 100% rename from tests/testdata/lint/no_slow_types_workspace/c/deno.json rename to tests/specs/lint/no_slow_types_workspace/c/deno.json diff --git a/tests/testdata/lint/no_slow_types_workspace/c/mod_c.ts b/tests/specs/lint/no_slow_types_workspace/c/mod_c.ts similarity index 100% rename from tests/testdata/lint/no_slow_types_workspace/c/mod_c.ts rename to tests/specs/lint/no_slow_types_workspace/c/mod_c.ts diff --git a/tests/testdata/lint/no_slow_types_workspace/deno.json b/tests/specs/lint/no_slow_types_workspace/deno.json similarity index 100% rename from tests/testdata/lint/no_slow_types_workspace/deno.json rename to tests/specs/lint/no_slow_types_workspace/deno.json diff --git a/tests/testdata/lint/no_slow_types_workspace/output.out b/tests/specs/lint/no_slow_types_workspace/output.out similarity index 100% rename from tests/testdata/lint/no_slow_types_workspace/output.out rename to tests/specs/lint/no_slow_types_workspace/output.out diff --git a/tests/specs/lockfile/no_lock/__test__.jsonc b/tests/specs/lockfile/no_lock/__test__.jsonc new file mode 100644 index 0000000000..60bbd17e0a --- /dev/null +++ b/tests/specs/lockfile/no_lock/__test__.jsonc @@ -0,0 +1,31 @@ +{ + "steps": [{ + "args": "info main.ts", + "output": "fail_initial.out", + "exitCode": 10 + }, { + "args": "info --no-lock main.ts", + "output": "info.nolock.out" + }, { + "args": "bench", + "output": "fail.out", + "exitCode": 10 + }, { + "args": "bench --no-lock", + "output": "bench.nolock.out" + }, { + "args": "doc main.ts", + "exitCode": 10, + "output": "fail.out" + }, { + "args": "doc --no-lock main.ts", + "output": "doc.nolock.out" + }, { + "args": "test", + "exitCode": 10, + "output": "fail.out" + }, { + "args": "test --no-lock", + "output": "test.nolock.out" + }] +} diff --git a/tests/testdata/lockfile/basic/bench.nolock.out b/tests/specs/lockfile/no_lock/bench.nolock.out similarity index 62% rename from tests/testdata/lockfile/basic/bench.nolock.out rename to tests/specs/lockfile/no_lock/bench.nolock.out index 83e4de242b..351efc9709 100644 --- a/tests/testdata/lockfile/basic/bench.nolock.out +++ b/tests/specs/lockfile/no_lock/bench.nolock.out @@ -1,4 +1,3 @@ -Download http://localhost:4545/lockfile/basic/mod.ts Check file:///[WILDCARD]/main.bench.ts cpu: [WILDCARD] runtime: [WILDCARD] diff --git a/tests/testdata/lockfile/basic/deno.json b/tests/specs/lockfile/no_lock/deno.json similarity index 100% rename from tests/testdata/lockfile/basic/deno.json rename to tests/specs/lockfile/no_lock/deno.json diff --git a/tests/testdata/lockfile/basic/deno.lock b/tests/specs/lockfile/no_lock/deno.lock similarity index 100% rename from tests/testdata/lockfile/basic/deno.lock rename to tests/specs/lockfile/no_lock/deno.lock diff --git a/tests/specs/lockfile/no_lock/doc.nolock.out b/tests/specs/lockfile/no_lock/doc.nolock.out new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/specs/lockfile/no_lock/fail.out b/tests/specs/lockfile/no_lock/fail.out new file mode 100644 index 0000000000..4c2b044238 --- /dev/null +++ b/tests/specs/lockfile/no_lock/fail.out @@ -0,0 +1,3 @@ +error: The source code is invalid, as it does not match the expected hash in the lock file. + Specifier: [WILDCARD]mod.ts + Lock file: [WILDCARD]deno.lock diff --git a/tests/testdata/lockfile/basic/fail.out b/tests/specs/lockfile/no_lock/fail_initial.out similarity index 100% rename from tests/testdata/lockfile/basic/fail.out rename to tests/specs/lockfile/no_lock/fail_initial.out diff --git a/tests/specs/lockfile/no_lock/info.nolock.out b/tests/specs/lockfile/no_lock/info.nolock.out new file mode 100644 index 0000000000..b036611937 --- /dev/null +++ b/tests/specs/lockfile/no_lock/info.nolock.out @@ -0,0 +1,7 @@ +local: [WILDLINE]main.ts +type: TypeScript +dependencies: 1 unique +size: [WILDCARD] + +file:///[WILDCARD]/main.ts ([WILDLINE]) +└── http://localhost:4545/lockfile/basic/mod.ts ([WILDLINE]) diff --git a/tests/testdata/lockfile/basic/main.bench.ts b/tests/specs/lockfile/no_lock/main.bench.ts similarity index 100% rename from tests/testdata/lockfile/basic/main.bench.ts rename to tests/specs/lockfile/no_lock/main.bench.ts diff --git a/tests/testdata/lockfile/basic/main.test.ts b/tests/specs/lockfile/no_lock/main.test.ts similarity index 100% rename from tests/testdata/lockfile/basic/main.test.ts rename to tests/specs/lockfile/no_lock/main.test.ts diff --git a/tests/testdata/lockfile/basic/main.ts b/tests/specs/lockfile/no_lock/main.ts similarity index 100% rename from tests/testdata/lockfile/basic/main.ts rename to tests/specs/lockfile/no_lock/main.ts diff --git a/tests/testdata/lockfile/basic/test.nolock.out b/tests/specs/lockfile/no_lock/test.nolock.out similarity index 63% rename from tests/testdata/lockfile/basic/test.nolock.out rename to tests/specs/lockfile/no_lock/test.nolock.out index 1332dfa8f1..b5039c2d6d 100644 --- a/tests/testdata/lockfile/basic/test.nolock.out +++ b/tests/specs/lockfile/no_lock/test.nolock.out @@ -1,4 +1,3 @@ -Download http://localhost:4545/lockfile/basic/mod.ts Check file:///[WILDCARD]/main.test.ts running 1 test from [WILDCARD]/main.test.ts [WILDCARD] diff --git a/tests/specs/mod.rs b/tests/specs/mod.rs index 16a9e6f057..fc61fefac3 100644 --- a/tests/specs/mod.rs +++ b/tests/specs/mod.rs @@ -71,6 +71,9 @@ struct StepMetaData { /// Whether to clean the deno_dir before running the step. #[serde(default)] pub clean_deno_dir: bool, + /// If the test should be retried multiple times on failure. + #[serde(default)] + pub flaky: bool, pub args: VecOrString, pub cwd: Option, #[serde(rename = "if")] @@ -173,33 +176,12 @@ fn run_test(test: &CollectedTest, diagnostic_logger: Rc>>) { } for step in metadata.steps.iter().filter(|s| should_run_step(s)) { - if step.clean_deno_dir { - context.deno_dir().path().remove_dir_all(); - } - - let command = context - .new_command() - .envs(metadata.envs.iter().chain(step.envs.iter())); - let command = match &step.args { - VecOrString::Vec(args) => command.args_vec(args), - VecOrString::String(text) => command.args(text), - }; - let command = match &step.cwd { - Some(cwd) => command.current_dir(cwd), - None => command, - }; - let command = match &step.command_name { - Some(command_name) => command.name(command_name), - None => command, - }; - let output = command.run(); - if step.output.ends_with(".out") { - let test_output_path = cwd.join(&step.output); - output.assert_matches_file(test_output_path); + let run_func = || run_step(step, &metadata, &cwd, &context); + if step.flaky { + run_flaky(run_func); } else { - output.assert_matches_text(&step.output); + run_func(); } - output.assert_exit_code(step.exit_code); } } @@ -217,6 +199,53 @@ fn should_run_step(step: &StepMetaData) -> bool { } } +fn run_flaky(action: impl Fn()) { + for _ in 0..2 { + let result = std::panic::catch_unwind(AssertUnwindSafe(&action)); + if result.is_ok() { + return; + } + } + + // surface error on third try + action(); +} + +fn run_step( + step: &StepMetaData, + metadata: &MultiTestMetaData, + cwd: &PathRef, + context: &test_util::TestContext, +) { + if step.clean_deno_dir { + context.deno_dir().path().remove_dir_all(); + } + + let command = context + .new_command() + .envs(metadata.envs.iter().chain(step.envs.iter())); + let command = match &step.args { + VecOrString::Vec(args) => command.args_vec(args), + VecOrString::String(text) => command.args(text), + }; + let command = match &step.cwd { + Some(cwd) => command.current_dir(cwd), + None => command, + }; + let command = match &step.command_name { + Some(command_name) => command.name(command_name), + None => command, + }; + let output = command.run(); + if step.output.ends_with(".out") { + let test_output_path = cwd.join(&step.output); + output.assert_matches_file(test_output_path); + } else { + output.assert_matches_text(&step.output); + } + output.assert_exit_code(step.exit_code); +} + fn resolve_test_and_assertion_files( dir: &PathRef, metadata: &MultiTestMetaData, diff --git a/tests/specs/publish/allow_slow_types/__test__.jsonc b/tests/specs/publish/allow_slow_types/__test__.jsonc new file mode 100644 index 0000000000..e9f1cd0115 --- /dev/null +++ b/tests/specs/publish/allow_slow_types/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --allow-slow-types --token 'sadfasdf'", + "output": "allow_slow_types.out", + "exitCode": 0 +} diff --git a/tests/testdata/publish/allow_slow_types.out b/tests/specs/publish/allow_slow_types/allow_slow_types.out similarity index 100% rename from tests/testdata/publish/allow_slow_types.out rename to tests/specs/publish/allow_slow_types/allow_slow_types.out diff --git a/tests/testdata/publish/has_slow_types/deno.json b/tests/specs/publish/allow_slow_types/deno.json similarity index 100% rename from tests/testdata/publish/has_slow_types/deno.json rename to tests/specs/publish/allow_slow_types/deno.json diff --git a/tests/testdata/publish/has_slow_types/mod.ts b/tests/specs/publish/allow_slow_types/mod.ts similarity index 100% rename from tests/testdata/publish/has_slow_types/mod.ts rename to tests/specs/publish/allow_slow_types/mod.ts diff --git a/tests/specs/publish/bare_node_builtins/__test__.jsonc b/tests/specs/publish/bare_node_builtins/__test__.jsonc new file mode 100644 index 0000000000..f9e38fbe58 --- /dev/null +++ b/tests/specs/publish/bare_node_builtins/__test__.jsonc @@ -0,0 +1,17 @@ +{ + "tempDir": true, + "envs": { + "DISABLE_JSR_PROVENANCE": "true", + "DENO_TESTING_DISABLE_GIT_CHECK": "1" + }, + "steps": [{ + "args": "publish --token 'sadfasdf' --dry-run --unstable-bare-node-builtins", + "output": "bare_node_builtins.out" + }, { + "envs": { + "DENO_DISABLE_PEDANTIC_NODE_WARNINGS": "1" + }, + "args": "publish --token 'sadfasdf' --dry-run --unstable-bare-node-builtins", + "output": "no_warnings.out" + }] +} diff --git a/tests/specs/publish/bare_node_builtins/bare_node_builtins.out b/tests/specs/publish/bare_node_builtins/bare_node_builtins.out new file mode 100644 index 0000000000..09acc639fa --- /dev/null +++ b/tests/specs/publish/bare_node_builtins/bare_node_builtins.out @@ -0,0 +1,11 @@ +Warning: Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix. +Warning: Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix. +Download http://localhost:4545/npm/registry/@types/node +Download http://localhost:4545/npm/registry/@types/node/node-18.16.19.tgz +Check file:///[WILDLINE]/mod.ts +Checking for slow types in the public API... +Check file:///[WILDLINE]/mod.ts +Simulating publish of @foo/bar@1.0.0 with files: + file:///[WILDLINE]/deno.json (87B) + file:///[WILDLINE]/mod.ts (121B) +Warning Aborting due to --dry-run diff --git a/tests/testdata/publish/bare_node_builtins/deno.json b/tests/specs/publish/bare_node_builtins/deno.json similarity index 100% rename from tests/testdata/publish/bare_node_builtins/deno.json rename to tests/specs/publish/bare_node_builtins/deno.json diff --git a/tests/testdata/publish/bare_node_builtins/mod.ts b/tests/specs/publish/bare_node_builtins/mod.ts similarity index 100% rename from tests/testdata/publish/bare_node_builtins/mod.ts rename to tests/specs/publish/bare_node_builtins/mod.ts diff --git a/tests/specs/publish/bare_node_builtins/no_warnings.out b/tests/specs/publish/bare_node_builtins/no_warnings.out new file mode 100644 index 0000000000..f9a11f37c4 --- /dev/null +++ b/tests/specs/publish/bare_node_builtins/no_warnings.out @@ -0,0 +1,5 @@ +Checking for slow types in the public API... +Simulating publish of @foo/bar@1.0.0 with files: + file:///[WILDLINE]/deno.json (87B) + file:///[WILDLINE]/mod.ts (121B) +Warning Aborting due to --dry-run diff --git a/tests/specs/publish/config_file_jsonc/__test__.jsonc b/tests/specs/publish/config_file_jsonc/__test__.jsonc new file mode 100644 index 0000000000..bef8ce4ca1 --- /dev/null +++ b/tests/specs/publish/config_file_jsonc/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "deno_jsonc.out" +} diff --git a/tests/testdata/publish/deno_jsonc/deno.jsonc b/tests/specs/publish/config_file_jsonc/deno.jsonc similarity index 100% rename from tests/testdata/publish/deno_jsonc/deno.jsonc rename to tests/specs/publish/config_file_jsonc/deno.jsonc diff --git a/tests/testdata/publish/deno_jsonc.out b/tests/specs/publish/config_file_jsonc/deno_jsonc.out similarity index 62% rename from tests/testdata/publish/deno_jsonc.out rename to tests/specs/publish/config_file_jsonc/deno_jsonc.out index 820554943a..af45ed598b 100644 --- a/tests/testdata/publish/deno_jsonc.out +++ b/tests/specs/publish/config_file_jsonc/deno_jsonc.out @@ -1,6 +1,6 @@ -Check file:///[WILDCARD]/publish/deno_jsonc/mod.ts +Check file:///[WILDCARD]/mod.ts Checking for slow types in the public API... -Check file:///[WILDCARD]/publish/deno_jsonc/mod.ts +Check file:///[WILDCARD]/mod.ts Publishing @foo/bar@1.0.0 ... Successfully published @foo/bar@1.0.0 Visit http://127.0.0.1:4250/@foo/bar@1.0.0 for details diff --git a/tests/testdata/publish/deno_jsonc/mod.ts b/tests/specs/publish/config_file_jsonc/mod.ts similarity index 100% rename from tests/testdata/publish/deno_jsonc/mod.ts rename to tests/specs/publish/config_file_jsonc/mod.ts diff --git a/tests/testdata/publish/deno_jsonc/std_http.ts b/tests/specs/publish/config_file_jsonc/std_http.ts similarity index 100% rename from tests/testdata/publish/deno_jsonc/std_http.ts rename to tests/specs/publish/config_file_jsonc/std_http.ts diff --git a/tests/specs/publish/config_flag/__test__.jsonc b/tests/specs/publish/config_flag/__test__.jsonc new file mode 100644 index 0000000000..289f9abc91 --- /dev/null +++ b/tests/specs/publish/config_flag/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf' --config=successful/deno.json", + "output": "successful.out" +} diff --git a/tests/specs/publish/config_flag/successful.out b/tests/specs/publish/config_flag/successful.out new file mode 100644 index 0000000000..78265361a3 --- /dev/null +++ b/tests/specs/publish/config_flag/successful.out @@ -0,0 +1,6 @@ +Check file:///[WILDCARD]/successful/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/successful/mod.ts +Publishing @foo/bar@1.0.0 ... +Successfully published @foo/bar@1.0.0 +Visit http://127.0.0.1:4250/@foo/bar@1.0.0 for details diff --git a/tests/specs/publish/config_flag/successful/deno.json b/tests/specs/publish/config_flag/successful/deno.json new file mode 100644 index 0000000000..fefab899bd --- /dev/null +++ b/tests/specs/publish/config_flag/successful/deno.json @@ -0,0 +1,10 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "imports": { + "@std/http": "./std_http.ts" + } +} diff --git a/tests/testdata/publish/jsr_jsonc/mod.ts b/tests/specs/publish/config_flag/successful/mod.ts similarity index 100% rename from tests/testdata/publish/jsr_jsonc/mod.ts rename to tests/specs/publish/config_flag/successful/mod.ts diff --git a/tests/testdata/publish/jsr_jsonc/std_http.ts b/tests/specs/publish/config_flag/successful/std_http.ts similarity index 100% rename from tests/testdata/publish/jsr_jsonc/std_http.ts rename to tests/specs/publish/config_flag/successful/std_http.ts diff --git a/tests/specs/publish/dry_run/__test__.jsonc b/tests/specs/publish/dry_run/__test__.jsonc new file mode 100644 index 0000000000..3ca6ff4d3c --- /dev/null +++ b/tests/specs/publish/dry_run/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf' --dry-run", + "output": "dry_run.out" +} diff --git a/tests/specs/publish/dry_run/deno.json b/tests/specs/publish/dry_run/deno.json new file mode 100644 index 0000000000..fefab899bd --- /dev/null +++ b/tests/specs/publish/dry_run/deno.json @@ -0,0 +1,10 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "imports": { + "@std/http": "./std_http.ts" + } +} diff --git a/tests/testdata/publish/dry_run.out b/tests/specs/publish/dry_run/dry_run.out similarity index 100% rename from tests/testdata/publish/dry_run.out rename to tests/specs/publish/dry_run/dry_run.out diff --git a/tests/specs/publish/dry_run/mod.ts b/tests/specs/publish/dry_run/mod.ts new file mode 100644 index 0000000000..6e8a61bae9 --- /dev/null +++ b/tests/specs/publish/dry_run/mod.ts @@ -0,0 +1,7 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return { + fileServer: http.fileServer, + }; +} diff --git a/tests/specs/publish/dry_run/std_http.ts b/tests/specs/publish/dry_run/std_http.ts new file mode 100644 index 0000000000..9d57b36f34 --- /dev/null +++ b/tests/specs/publish/dry_run/std_http.ts @@ -0,0 +1,6 @@ +// temp until we get jsr:@std/http in the test server +export default { + fileServer() { + console.log("Hi"); + }, +}; diff --git a/tests/specs/publish/has_slow_types/__test__.jsonc b/tests/specs/publish/has_slow_types/__test__.jsonc new file mode 100644 index 0000000000..470bae81bd --- /dev/null +++ b/tests/specs/publish/has_slow_types/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "has_slow_types.out", + "exitCode": 1 +} diff --git a/tests/specs/publish/has_slow_types/deno.json b/tests/specs/publish/has_slow_types/deno.json new file mode 100644 index 0000000000..5826e55292 --- /dev/null +++ b/tests/specs/publish/has_slow_types/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.1.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/testdata/publish/has_slow_types.out b/tests/specs/publish/has_slow_types/has_slow_types.out similarity index 100% rename from tests/testdata/publish/has_slow_types.out rename to tests/specs/publish/has_slow_types/has_slow_types.out diff --git a/tests/specs/publish/has_slow_types/mod.ts b/tests/specs/publish/has_slow_types/mod.ts new file mode 100644 index 0000000000..0253110493 --- /dev/null +++ b/tests/specs/publish/has_slow_types/mod.ts @@ -0,0 +1,4 @@ +// requires an explicit type annotation of `number` +export function getRandom() { + return Math.random(); +} diff --git a/tests/specs/publish/invalid_import/__test__.jsonc b/tests/specs/publish/invalid_import/__test__.jsonc new file mode 100644 index 0000000000..5436a04f83 --- /dev/null +++ b/tests/specs/publish/invalid_import/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf' --dry-run", + "output": "invalid_import.out", + "exitCode": 1 +} diff --git a/tests/testdata/publish/invalid_import/deno.json b/tests/specs/publish/invalid_import/deno.json similarity index 100% rename from tests/testdata/publish/invalid_import/deno.json rename to tests/specs/publish/invalid_import/deno.json diff --git a/tests/testdata/publish/invalid_import.out b/tests/specs/publish/invalid_import/invalid_import.out similarity index 100% rename from tests/testdata/publish/invalid_import.out rename to tests/specs/publish/invalid_import/invalid_import.out diff --git a/tests/testdata/publish/invalid_import/mod.ts b/tests/specs/publish/invalid_import/mod.ts similarity index 100% rename from tests/testdata/publish/invalid_import/mod.ts rename to tests/specs/publish/invalid_import/mod.ts diff --git a/tests/specs/publish/invalid_import_esm_sh_suggestion/__test__.jsonc b/tests/specs/publish/invalid_import_esm_sh_suggestion/__test__.jsonc new file mode 100644 index 0000000000..6a6c3bdec5 --- /dev/null +++ b/tests/specs/publish/invalid_import_esm_sh_suggestion/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf' --dry-run", + "output": "invalid_import_esm_sh_suggestion.out", + "exitCode": 1 +} diff --git a/tests/testdata/publish/invalid_import_esm_sh_suggestion/deno.json b/tests/specs/publish/invalid_import_esm_sh_suggestion/deno.json similarity index 100% rename from tests/testdata/publish/invalid_import_esm_sh_suggestion/deno.json rename to tests/specs/publish/invalid_import_esm_sh_suggestion/deno.json diff --git a/tests/testdata/publish/invalid_import_esm_sh_suggestion.out b/tests/specs/publish/invalid_import_esm_sh_suggestion/invalid_import_esm_sh_suggestion.out similarity index 100% rename from tests/testdata/publish/invalid_import_esm_sh_suggestion.out rename to tests/specs/publish/invalid_import_esm_sh_suggestion/invalid_import_esm_sh_suggestion.out diff --git a/tests/testdata/publish/invalid_import_esm_sh_suggestion/mod.ts b/tests/specs/publish/invalid_import_esm_sh_suggestion/mod.ts similarity index 100% rename from tests/testdata/publish/invalid_import_esm_sh_suggestion/mod.ts rename to tests/specs/publish/invalid_import_esm_sh_suggestion/mod.ts diff --git a/tests/specs/publish/invalid_path/__test__.jsonc b/tests/specs/publish/invalid_path/__test__.jsonc new file mode 100644 index 0000000000..24f9c0dfac --- /dev/null +++ b/tests/specs/publish/invalid_path/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "invalid_path.out", + "exitCode": 1 +} diff --git a/tests/testdata/publish/invalid_path/deno.json b/tests/specs/publish/invalid_path/deno.json similarity index 100% rename from tests/testdata/publish/invalid_path/deno.json rename to tests/specs/publish/invalid_path/deno.json diff --git a/tests/testdata/publish/invalid_path.out b/tests/specs/publish/invalid_path/invalid_path.out similarity index 100% rename from tests/testdata/publish/invalid_path.out rename to tests/specs/publish/invalid_path/invalid_path.out diff --git a/tests/testdata/publish/invalid_path/mod.ts b/tests/specs/publish/invalid_path/mod.ts similarity index 100% rename from tests/testdata/publish/invalid_path/mod.ts rename to tests/specs/publish/invalid_path/mod.ts diff --git a/tests/specs/publish/invalid_path/path with spaces.txt b/tests/specs/publish/invalid_path/path with spaces.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/specs/publish/javascript_decl_file/__test__.jsonc b/tests/specs/publish/javascript_decl_file/__test__.jsonc new file mode 100644 index 0000000000..0b6b0888ee --- /dev/null +++ b/tests/specs/publish/javascript_decl_file/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "javascript_decl_file.out", + "exitCode": 0 +} diff --git a/tests/testdata/publish/javascript_decl_file/deno.json b/tests/specs/publish/javascript_decl_file/deno.json similarity index 100% rename from tests/testdata/publish/javascript_decl_file/deno.json rename to tests/specs/publish/javascript_decl_file/deno.json diff --git a/tests/testdata/publish/javascript_decl_file.out b/tests/specs/publish/javascript_decl_file/javascript_decl_file.out similarity index 100% rename from tests/testdata/publish/javascript_decl_file.out rename to tests/specs/publish/javascript_decl_file/javascript_decl_file.out diff --git a/tests/testdata/publish/javascript_decl_file/mod.d.ts b/tests/specs/publish/javascript_decl_file/mod.d.ts similarity index 100% rename from tests/testdata/publish/javascript_decl_file/mod.d.ts rename to tests/specs/publish/javascript_decl_file/mod.d.ts diff --git a/tests/testdata/publish/javascript_decl_file/mod.js b/tests/specs/publish/javascript_decl_file/mod.js similarity index 100% rename from tests/testdata/publish/javascript_decl_file/mod.js rename to tests/specs/publish/javascript_decl_file/mod.js diff --git a/tests/specs/publish/javascript_missing_decl_file/__test__.jsonc b/tests/specs/publish/javascript_missing_decl_file/__test__.jsonc new file mode 100644 index 0000000000..1e760cf223 --- /dev/null +++ b/tests/specs/publish/javascript_missing_decl_file/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "javascript_missing_decl_file.out", + "exitCode": 0 +} diff --git a/tests/testdata/publish/javascript_missing_decl_file/deno.json b/tests/specs/publish/javascript_missing_decl_file/deno.json similarity index 100% rename from tests/testdata/publish/javascript_missing_decl_file/deno.json rename to tests/specs/publish/javascript_missing_decl_file/deno.json diff --git a/tests/testdata/publish/javascript_missing_decl_file.out b/tests/specs/publish/javascript_missing_decl_file/javascript_missing_decl_file.out similarity index 100% rename from tests/testdata/publish/javascript_missing_decl_file.out rename to tests/specs/publish/javascript_missing_decl_file/javascript_missing_decl_file.out diff --git a/tests/testdata/publish/javascript_missing_decl_file/mod.js b/tests/specs/publish/javascript_missing_decl_file/mod.js similarity index 100% rename from tests/testdata/publish/javascript_missing_decl_file/mod.js rename to tests/specs/publish/javascript_missing_decl_file/mod.js diff --git a/tests/testdata/publish/javascript_missing_decl_file/other.js b/tests/specs/publish/javascript_missing_decl_file/other.js similarity index 100% rename from tests/testdata/publish/javascript_missing_decl_file/other.js rename to tests/specs/publish/javascript_missing_decl_file/other.js diff --git a/tests/specs/publish/jsr_jsonc/__test__.jsonc b/tests/specs/publish/jsr_jsonc/__test__.jsonc new file mode 100644 index 0000000000..774d5a534e --- /dev/null +++ b/tests/specs/publish/jsr_jsonc/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "mod.out" +} diff --git a/tests/testdata/publish/jsr_jsonc/jsr.jsonc b/tests/specs/publish/jsr_jsonc/jsr.jsonc similarity index 100% rename from tests/testdata/publish/jsr_jsonc/jsr.jsonc rename to tests/specs/publish/jsr_jsonc/jsr.jsonc diff --git a/tests/testdata/publish/jsr_jsonc/mod.out b/tests/specs/publish/jsr_jsonc/mod.out similarity index 100% rename from tests/testdata/publish/jsr_jsonc/mod.out rename to tests/specs/publish/jsr_jsonc/mod.out diff --git a/tests/specs/publish/jsr_jsonc/mod.ts b/tests/specs/publish/jsr_jsonc/mod.ts new file mode 100644 index 0000000000..6e8a61bae9 --- /dev/null +++ b/tests/specs/publish/jsr_jsonc/mod.ts @@ -0,0 +1,7 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return { + fileServer: http.fileServer, + }; +} diff --git a/tests/specs/publish/jsr_jsonc/std_http.ts b/tests/specs/publish/jsr_jsonc/std_http.ts new file mode 100644 index 0000000000..9d57b36f34 --- /dev/null +++ b/tests/specs/publish/jsr_jsonc/std_http.ts @@ -0,0 +1,6 @@ +// temp until we get jsr:@std/http in the test server +export default { + fileServer() { + console.log("Hi"); + }, +}; diff --git a/tests/specs/publish/missing_deno_json/__test__.jsonc b/tests/specs/publish/missing_deno_json/__test__.jsonc new file mode 100644 index 0000000000..614caecd6b --- /dev/null +++ b/tests/specs/publish/missing_deno_json/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "missing_deno_json.out", + "exitCode": 1 +} diff --git a/tests/testdata/publish/missing_deno_json/main.ts b/tests/specs/publish/missing_deno_json/main.ts similarity index 100% rename from tests/testdata/publish/missing_deno_json/main.ts rename to tests/specs/publish/missing_deno_json/main.ts diff --git a/tests/testdata/publish/missing_deno_json.out b/tests/specs/publish/missing_deno_json/missing_deno_json.out similarity index 100% rename from tests/testdata/publish/missing_deno_json.out rename to tests/specs/publish/missing_deno_json/missing_deno_json.out diff --git a/tests/specs/publish/no_check/__test__.jsonc b/tests/specs/publish/no_check/__test__.jsonc new file mode 100644 index 0000000000..e89cd7a574 --- /dev/null +++ b/tests/specs/publish/no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf' --no-check", + "output": "successful_no_check.out" +} diff --git a/tests/specs/publish/no_check/deno.json b/tests/specs/publish/no_check/deno.json new file mode 100644 index 0000000000..fefab899bd --- /dev/null +++ b/tests/specs/publish/no_check/deno.json @@ -0,0 +1,10 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "imports": { + "@std/http": "./std_http.ts" + } +} diff --git a/tests/specs/publish/no_check/mod.ts b/tests/specs/publish/no_check/mod.ts new file mode 100644 index 0000000000..6e8a61bae9 --- /dev/null +++ b/tests/specs/publish/no_check/mod.ts @@ -0,0 +1,7 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return { + fileServer: http.fileServer, + }; +} diff --git a/tests/specs/publish/no_check/std_http.ts b/tests/specs/publish/no_check/std_http.ts new file mode 100644 index 0000000000..9d57b36f34 --- /dev/null +++ b/tests/specs/publish/no_check/std_http.ts @@ -0,0 +1,6 @@ +// temp until we get jsr:@std/http in the test server +export default { + fileServer() { + console.log("Hi"); + }, +}; diff --git a/tests/testdata/publish/successful_no_check.out b/tests/specs/publish/no_check/successful_no_check.out similarity index 100% rename from tests/testdata/publish/successful_no_check.out rename to tests/specs/publish/no_check/successful_no_check.out diff --git a/tests/specs/publish/no_token/__test__.jsonc b/tests/specs/publish/no_token/__test__.jsonc new file mode 100644 index 0000000000..f8a7fa942b --- /dev/null +++ b/tests/specs/publish/no_token/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish", + "output": "no_token.out", + "exitCode": 1 +} diff --git a/tests/testdata/publish/workspace/bar/mod.ts b/tests/specs/publish/no_token/main.ts similarity index 100% rename from tests/testdata/publish/workspace/bar/mod.ts rename to tests/specs/publish/no_token/main.ts diff --git a/tests/testdata/publish/no_token.out b/tests/specs/publish/no_token/no_token.out similarity index 100% rename from tests/testdata/publish/no_token.out rename to tests/specs/publish/no_token/no_token.out diff --git a/tests/specs/publish/node_specifier/__test__.jsonc b/tests/specs/publish/node_specifier/__test__.jsonc new file mode 100644 index 0000000000..f845f24794 --- /dev/null +++ b/tests/specs/publish/node_specifier/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "node_specifier.out" +} diff --git a/tests/testdata/publish/node_specifier/deno.json b/tests/specs/publish/node_specifier/deno.json similarity index 100% rename from tests/testdata/publish/node_specifier/deno.json rename to tests/specs/publish/node_specifier/deno.json diff --git a/tests/testdata/publish/node_specifier/mod.ts b/tests/specs/publish/node_specifier/mod.ts similarity index 100% rename from tests/testdata/publish/node_specifier/mod.ts rename to tests/specs/publish/node_specifier/mod.ts diff --git a/tests/testdata/publish/node_specifier.out b/tests/specs/publish/node_specifier/node_specifier.out similarity index 100% rename from tests/testdata/publish/node_specifier.out rename to tests/specs/publish/node_specifier/node_specifier.out diff --git a/tests/specs/publish/package_json/__test__.jsonc b/tests/specs/publish/package_json/__test__.jsonc new file mode 100644 index 0000000000..c4e954a6ef --- /dev/null +++ b/tests/specs/publish/package_json/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "package_json.out" +} diff --git a/tests/testdata/publish/package_json/deno.json b/tests/specs/publish/package_json/deno.json similarity index 100% rename from tests/testdata/publish/package_json/deno.json rename to tests/specs/publish/package_json/deno.json diff --git a/tests/testdata/publish/package_json/mod.ts b/tests/specs/publish/package_json/mod.ts similarity index 100% rename from tests/testdata/publish/package_json/mod.ts rename to tests/specs/publish/package_json/mod.ts diff --git a/tests/testdata/publish/package_json/package.json b/tests/specs/publish/package_json/package.json similarity index 100% rename from tests/testdata/publish/package_json/package.json rename to tests/specs/publish/package_json/package.json diff --git a/tests/testdata/publish/package_json.out b/tests/specs/publish/package_json/package_json.out similarity index 100% rename from tests/testdata/publish/package_json.out rename to tests/specs/publish/package_json/package_json.out diff --git a/tests/specs/publish/sloppy_imports/__test__.jsonc b/tests/specs/publish/sloppy_imports/__test__.jsonc new file mode 100644 index 0000000000..bfb3d38dd4 --- /dev/null +++ b/tests/specs/publish/sloppy_imports/__test__.jsonc @@ -0,0 +1,21 @@ +{ + "envs": { + "DISABLE_JSR_PROVENANCE": "true", + "DENO_TESTING_DISABLE_GIT_CHECK": "1" + }, + "tempDir": true, + "steps": [{ + "args": "publish --token 'sadfasdf' --dry-run --unstable-sloppy-imports", + "output": "sloppy_imports.out" + }, { + "args": "publish --token 'sadfasdf' --dry-run", + "output": "sloppy_imports_not_enabled.out", + "exitCode": 1 + }, { + "args": "publish --token 'sadfasdf' --dry-run --unstable-sloppy-imports", + "output": "sloppy_imports_no_warnings.out", + "envs": { + "DENO_DISABLE_PEDANTIC_NODE_WARNINGS": "1" + } + }] +} diff --git a/tests/testdata/publish/sloppy_imports/b/index.ts b/tests/specs/publish/sloppy_imports/b/index.ts similarity index 100% rename from tests/testdata/publish/sloppy_imports/b/index.ts rename to tests/specs/publish/sloppy_imports/b/index.ts diff --git a/tests/testdata/publish/sloppy_imports/deno.json b/tests/specs/publish/sloppy_imports/deno.json similarity index 100% rename from tests/testdata/publish/sloppy_imports/deno.json rename to tests/specs/publish/sloppy_imports/deno.json diff --git a/tests/testdata/publish/sloppy_imports/mod.ts b/tests/specs/publish/sloppy_imports/mod.ts similarity index 100% rename from tests/testdata/publish/sloppy_imports/mod.ts rename to tests/specs/publish/sloppy_imports/mod.ts diff --git a/tests/specs/publish/sloppy_imports/sloppy_imports.out b/tests/specs/publish/sloppy_imports/sloppy_imports.out new file mode 100644 index 0000000000..bfa258b939 --- /dev/null +++ b/tests/specs/publish/sloppy_imports/sloppy_imports.out @@ -0,0 +1,10 @@ +Warning Sloppy module resolution (hint: specify path to index.ts file in directory instead) + at file:///[WILDCARD]/mod.ts:1:20 +Check file:///[WILDCARD]/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/mod.ts +Simulating publish of @foo/bar@1.0.0 with files: + file:///[WILDCARD]/b/index.ts (27B) + file:///[WILDCARD]/deno.json (87B) + file:///[WILDCARD]/mod.ts (35B) +Warning Aborting due to --dry-run diff --git a/tests/specs/publish/sloppy_imports/sloppy_imports_no_warnings.out b/tests/specs/publish/sloppy_imports/sloppy_imports_no_warnings.out new file mode 100644 index 0000000000..72ff281a36 --- /dev/null +++ b/tests/specs/publish/sloppy_imports/sloppy_imports_no_warnings.out @@ -0,0 +1,6 @@ +Checking for slow types in the public API... +Simulating publish of @foo/bar@1.0.0 with files: + file:///[WILDCARD]/b/index.ts (27B) + file:///[WILDCARD]/deno.json (87B) + file:///[WILDCARD]/mod.ts (35B) +Warning Aborting due to --dry-run diff --git a/tests/testdata/publish/sloppy_imports_not_enabled.out b/tests/specs/publish/sloppy_imports/sloppy_imports_not_enabled.out similarity index 68% rename from tests/testdata/publish/sloppy_imports_not_enabled.out rename to tests/specs/publish/sloppy_imports/sloppy_imports_not_enabled.out index c2f74ad2c8..4eacbea655 100644 --- a/tests/testdata/publish/sloppy_imports_not_enabled.out +++ b/tests/specs/publish/sloppy_imports/sloppy_imports_not_enabled.out @@ -1,2 +1,2 @@ error: [WILDCARD] Maybe specify path to 'index.ts' file in directory instead or run with --unstable-sloppy-imports - at file:///[WILDCARD]/sloppy_imports/mod.ts:1:20 + at file:///[WILDCARD]/mod.ts:1:20 diff --git a/tests/specs/publish/successful/__test__.jsonc b/tests/specs/publish/successful/__test__.jsonc new file mode 100644 index 0000000000..fe5287e717 --- /dev/null +++ b/tests/specs/publish/successful/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "successful.out" +} diff --git a/tests/specs/publish/successful/deno.json b/tests/specs/publish/successful/deno.json new file mode 100644 index 0000000000..fefab899bd --- /dev/null +++ b/tests/specs/publish/successful/deno.json @@ -0,0 +1,10 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "imports": { + "@std/http": "./std_http.ts" + } +} diff --git a/tests/specs/publish/successful/mod.ts b/tests/specs/publish/successful/mod.ts new file mode 100644 index 0000000000..6e8a61bae9 --- /dev/null +++ b/tests/specs/publish/successful/mod.ts @@ -0,0 +1,7 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return { + fileServer: http.fileServer, + }; +} diff --git a/tests/specs/publish/successful/std_http.ts b/tests/specs/publish/successful/std_http.ts new file mode 100644 index 0000000000..9d57b36f34 --- /dev/null +++ b/tests/specs/publish/successful/std_http.ts @@ -0,0 +1,6 @@ +// temp until we get jsr:@std/http in the test server +export default { + fileServer() { + console.log("Hi"); + }, +}; diff --git a/tests/testdata/publish/successful.out b/tests/specs/publish/successful/successful.out similarity index 100% rename from tests/testdata/publish/successful.out rename to tests/specs/publish/successful/successful.out diff --git a/tests/specs/publish/symlink/__test__.jsonc b/tests/specs/publish/symlink/__test__.jsonc new file mode 100644 index 0000000000..32da3baff5 --- /dev/null +++ b/tests/specs/publish/symlink/__test__.jsonc @@ -0,0 +1,15 @@ +{ + "tempDir": true, + "envs": { + "DISABLE_JSR_PROVENANCE": "true", + "DENO_TESTING_DISABLE_GIT_CHECK": "1" + }, + "steps": [{ + "args": ["eval", "Deno.symlinkSync('./mod.ts', './symlink');"], + "output": "[WILDCARD]" + }, { + "args": "publish --token 'sadfasdf' --dry-run", + "output": "symlink.out", + "exitCode": 0 + }] +} diff --git a/tests/testdata/publish/symlink/deno.json b/tests/specs/publish/symlink/deno.json similarity index 100% rename from tests/testdata/publish/symlink/deno.json rename to tests/specs/publish/symlink/deno.json diff --git a/tests/testdata/publish/symlink/mod.ts b/tests/specs/publish/symlink/mod.ts similarity index 100% rename from tests/testdata/publish/symlink/mod.ts rename to tests/specs/publish/symlink/mod.ts diff --git a/tests/testdata/publish/symlink.out b/tests/specs/publish/symlink/symlink.out similarity index 100% rename from tests/testdata/publish/symlink.out rename to tests/specs/publish/symlink/symlink.out diff --git a/tests/specs/publish/unanalyzable_dynamic_import/__test__.jsonc b/tests/specs/publish/unanalyzable_dynamic_import/__test__.jsonc new file mode 100644 index 0000000000..45073b099d --- /dev/null +++ b/tests/specs/publish/unanalyzable_dynamic_import/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "unanalyzable_dynamic_import.out", + "exitCode": 0 +} diff --git a/tests/testdata/publish/unanalyzable_dynamic_import/deno.json b/tests/specs/publish/unanalyzable_dynamic_import/deno.json similarity index 100% rename from tests/testdata/publish/unanalyzable_dynamic_import/deno.json rename to tests/specs/publish/unanalyzable_dynamic_import/deno.json diff --git a/tests/testdata/publish/unanalyzable_dynamic_import/mod.ts b/tests/specs/publish/unanalyzable_dynamic_import/mod.ts similarity index 100% rename from tests/testdata/publish/unanalyzable_dynamic_import/mod.ts rename to tests/specs/publish/unanalyzable_dynamic_import/mod.ts diff --git a/tests/testdata/publish/unanalyzable_dynamic_import.out b/tests/specs/publish/unanalyzable_dynamic_import/unanalyzable_dynamic_import.out similarity index 100% rename from tests/testdata/publish/unanalyzable_dynamic_import.out rename to tests/specs/publish/unanalyzable_dynamic_import/unanalyzable_dynamic_import.out diff --git a/tests/specs/publish/unsupported_jsx_tsx/__test__.jsonc b/tests/specs/publish/unsupported_jsx_tsx/__test__.jsonc new file mode 100644 index 0000000000..774d5a534e --- /dev/null +++ b/tests/specs/publish/unsupported_jsx_tsx/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "mod.out" +} diff --git a/tests/testdata/publish/unsupported_jsx_tsx/foo.jsx b/tests/specs/publish/unsupported_jsx_tsx/foo.jsx similarity index 100% rename from tests/testdata/publish/unsupported_jsx_tsx/foo.jsx rename to tests/specs/publish/unsupported_jsx_tsx/foo.jsx diff --git a/tests/testdata/publish/unsupported_jsx_tsx/foo.tsx b/tests/specs/publish/unsupported_jsx_tsx/foo.tsx similarity index 100% rename from tests/testdata/publish/unsupported_jsx_tsx/foo.tsx rename to tests/specs/publish/unsupported_jsx_tsx/foo.tsx diff --git a/tests/testdata/publish/unsupported_jsx_tsx/jsr.jsonc b/tests/specs/publish/unsupported_jsx_tsx/jsr.jsonc similarity index 100% rename from tests/testdata/publish/unsupported_jsx_tsx/jsr.jsonc rename to tests/specs/publish/unsupported_jsx_tsx/jsr.jsonc diff --git a/tests/testdata/publish/unsupported_jsx_tsx/mod.out b/tests/specs/publish/unsupported_jsx_tsx/mod.out similarity index 100% rename from tests/testdata/publish/unsupported_jsx_tsx/mod.out rename to tests/specs/publish/unsupported_jsx_tsx/mod.out diff --git a/tests/testdata/publish/unsupported_jsx_tsx/mod.ts b/tests/specs/publish/unsupported_jsx_tsx/mod.ts similarity index 100% rename from tests/testdata/publish/unsupported_jsx_tsx/mod.ts rename to tests/specs/publish/unsupported_jsx_tsx/mod.ts diff --git a/tests/specs/publish/workspace/__test__.jsonc b/tests/specs/publish/workspace/__test__.jsonc new file mode 100644 index 0000000000..7b1c04d568 --- /dev/null +++ b/tests/specs/publish/workspace/__test__.jsonc @@ -0,0 +1,10 @@ +{ + "steps": [{ + "args": "publish --token 'sadfasdf'", + "output": "workspace.out" + }, { + "cwd": "./bar", + "args": "publish --token 'sadfasdf'", + "output": "workspace_individual.out" + }] +} diff --git a/tests/testdata/publish/workspace/bar/deno.json b/tests/specs/publish/workspace/bar/deno.json similarity index 100% rename from tests/testdata/publish/workspace/bar/deno.json rename to tests/specs/publish/workspace/bar/deno.json diff --git a/tests/specs/publish/workspace/bar/mod.ts b/tests/specs/publish/workspace/bar/mod.ts new file mode 100644 index 0000000000..8d9b8a22a1 --- /dev/null +++ b/tests/specs/publish/workspace/bar/mod.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number): number { + return a + b; +} diff --git a/tests/testdata/publish/workspace/deno.json b/tests/specs/publish/workspace/deno.json similarity index 100% rename from tests/testdata/publish/workspace/deno.json rename to tests/specs/publish/workspace/deno.json diff --git a/tests/testdata/publish/workspace/foo/deno.json b/tests/specs/publish/workspace/foo/deno.json similarity index 100% rename from tests/testdata/publish/workspace/foo/deno.json rename to tests/specs/publish/workspace/foo/deno.json diff --git a/tests/testdata/publish/workspace/foo/mod.ts b/tests/specs/publish/workspace/foo/mod.ts similarity index 100% rename from tests/testdata/publish/workspace/foo/mod.ts rename to tests/specs/publish/workspace/foo/mod.ts diff --git a/tests/testdata/publish/workspace.out b/tests/specs/publish/workspace/workspace.out similarity index 63% rename from tests/testdata/publish/workspace.out rename to tests/specs/publish/workspace/workspace.out index 17f2dab3b6..8c57bc2dd8 100644 --- a/tests/testdata/publish/workspace.out +++ b/tests/specs/publish/workspace/workspace.out @@ -1,9 +1,9 @@ Publishing a workspace... -Check file:///[WILDCARD]/workspace/foo/mod.ts -Check file:///[WILDCARD]/workspace/bar/mod.ts +Check file:///[WILDCARD]/foo/mod.ts +Check file:///[WILDCARD]/bar/mod.ts Checking for slow types in the public API... -Check file:///[WILDCARD]/workspace/foo/mod.ts -Check file:///[WILDCARD]/workspace/bar/mod.ts +Check file:///[WILDCARD]/foo/mod.ts +Check file:///[WILDCARD]/bar/mod.ts Publishing @foo/bar@1.0.0 ... Successfully published @foo/bar@1.0.0 Visit http://127.0.0.1:4250/@foo/bar@1.0.0 for details diff --git a/tests/testdata/publish/workspace_individual.out b/tests/specs/publish/workspace/workspace_individual.out similarity index 64% rename from tests/testdata/publish/workspace_individual.out rename to tests/specs/publish/workspace/workspace_individual.out index e734ae06ed..edb6b53aa3 100644 --- a/tests/testdata/publish/workspace_individual.out +++ b/tests/specs/publish/workspace/workspace_individual.out @@ -1,6 +1,6 @@ -Check file:///[WILDCARD]/workspace/bar/mod.ts +Check file:///[WILDCARD]/bar/mod.ts Checking for slow types in the public API... -Check file:///[WILDCARD]/workspace/bar/mod.ts +Check file:///[WILDCARD]/bar/mod.ts Publishing @foo/bar@1.0.0 ... Successfully published @foo/bar@1.0.0 Visit http://127.0.0.1:4250/@foo/bar@1.0.0 for details diff --git a/tests/specs/run/no_deno_json/__test__.jsonc b/tests/specs/run/no_deno_json/__test__.jsonc new file mode 100644 index 0000000000..67867f0233 --- /dev/null +++ b/tests/specs/run/no_deno_json/__test__.jsonc @@ -0,0 +1,36 @@ +{ + "tempDir": true, + "steps": [{ + // --no-config + "args": "run -L debug -A --no-config noconfig.ts", + "output": "noconfig.out", + "cwd": "code" + }, { + // --no-npm + "args": "run -L debug -A --no-npm noconfig.ts", + "output": "noconfig.out", + "cwd": "code" + }, { + // not auto-discovered with env var + "args": "run -L debug -A noconfig.ts", + "output": "noconfig.out", + "cwd": "code", + "envs": { + "DENO_NO_PACKAGE_JSON": "1" + } + }, { + // this should not use --quiet because we should ensure no package.json install occurs + "args": "run -A no_package_json_imports.ts", + "output": "no_package_json_imports.out", + "cwd": "code" + }, { + // auto-discovered node_modules relative package.json + "args": "run -A main.js", + "output": "code/sub_dir/main.out", + "cwd": "code/sub_dir" + }, { + // auto-discovered for local script arg + "args": "run -L debug -A code/main.ts", // notice this is not in the sub dir + "output": "main.out" + }] +} diff --git a/tests/testdata/run/with_package_json/no_deno_json/main.ts b/tests/specs/run/no_deno_json/code/main.ts similarity index 100% rename from tests/testdata/run/with_package_json/no_deno_json/main.ts rename to tests/specs/run/no_deno_json/code/main.ts diff --git a/tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.ts b/tests/specs/run/no_deno_json/code/no_package_json_imports.ts similarity index 100% rename from tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.ts rename to tests/specs/run/no_deno_json/code/no_package_json_imports.ts diff --git a/tests/testdata/run/with_package_json/no_deno_json/noconfig.ts b/tests/specs/run/no_deno_json/code/noconfig.ts similarity index 78% rename from tests/testdata/run/with_package_json/no_deno_json/noconfig.ts rename to tests/specs/run/no_deno_json/code/noconfig.ts index 73b348fbc2..e6f77f92b7 100644 --- a/tests/testdata/run/with_package_json/no_deno_json/noconfig.ts +++ b/tests/specs/run/no_deno_json/code/noconfig.ts @@ -1,6 +1,6 @@ // ensure the cwd is this directory const cwd = Deno.cwd(); -if (!cwd.endsWith("no_deno_json")) { +if (!cwd.endsWith("code")) { console.log(cwd); throw "FAIL"; } else { diff --git a/tests/testdata/run/with_package_json/no_deno_json/package.json b/tests/specs/run/no_deno_json/code/package.json similarity index 100% rename from tests/testdata/run/with_package_json/no_deno_json/package.json rename to tests/specs/run/no_deno_json/code/package.json diff --git a/tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.js b/tests/specs/run/no_deno_json/code/sub_dir/main.js similarity index 100% rename from tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.js rename to tests/specs/run/no_deno_json/code/sub_dir/main.js diff --git a/tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.out b/tests/specs/run/no_deno_json/code/sub_dir/main.out similarity index 100% rename from tests/testdata/run/with_package_json/no_deno_json/sub_dir/main.out rename to tests/specs/run/no_deno_json/code/sub_dir/main.out diff --git a/tests/specs/run/no_deno_json/main.out b/tests/specs/run/no_deno_json/main.out new file mode 100644 index 0000000000..92f5de748b --- /dev/null +++ b/tests/specs/run/no_deno_json/main.out @@ -0,0 +1,4 @@ +[WILDCARD]package.json file found at '[WILDCARD]code[WILDCHAR]package.json' +[WILDCARD] +ok +[Function (anonymous)] Chalk [WILDCARD] diff --git a/tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.out b/tests/specs/run/no_deno_json/no_package_json_imports.out similarity index 100% rename from tests/testdata/run/with_package_json/no_deno_json/no_package_json_imports.out rename to tests/specs/run/no_deno_json/no_package_json_imports.out diff --git a/tests/testdata/run/with_package_json/no_deno_json/noconfig.out b/tests/specs/run/no_deno_json/noconfig.out similarity index 100% rename from tests/testdata/run/with_package_json/no_deno_json/noconfig.out rename to tests/specs/run/no_deno_json/noconfig.out diff --git a/tests/specs/schema.json b/tests/specs/schema.json index b3a30f9363..94e069400b 100644 --- a/tests/specs/schema.json +++ b/tests/specs/schema.json @@ -36,6 +36,9 @@ "type": "string" } }, + "flaky": { + "type": "boolean" + }, "if": { "type": "string", "examples": [ diff --git a/tests/specs/test/include_relative_pattern_dot_slash/__test__.jsonc b/tests/specs/test/include_relative_pattern_dot_slash/__test__.jsonc new file mode 100644 index 0000000000..335c9ccd68 --- /dev/null +++ b/tests/specs/test/include_relative_pattern_dot_slash/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "test", + "output": "output.out" +} diff --git a/tests/testdata/test/relative_pattern_dot_slash/deno.json b/tests/specs/test/include_relative_pattern_dot_slash/deno.json similarity index 100% rename from tests/testdata/test/relative_pattern_dot_slash/deno.json rename to tests/specs/test/include_relative_pattern_dot_slash/deno.json diff --git a/tests/testdata/test/relative_pattern_dot_slash/output.out b/tests/specs/test/include_relative_pattern_dot_slash/output.out similarity index 100% rename from tests/testdata/test/relative_pattern_dot_slash/output.out rename to tests/specs/test/include_relative_pattern_dot_slash/output.out diff --git a/tests/testdata/test/relative_pattern_dot_slash/test/add.mjs b/tests/specs/test/include_relative_pattern_dot_slash/test/add.mjs similarity index 100% rename from tests/testdata/test/relative_pattern_dot_slash/test/add.mjs rename to tests/specs/test/include_relative_pattern_dot_slash/test/add.mjs diff --git a/tests/testdata/test/relative_pattern_dot_slash/test/add.test.mjs b/tests/specs/test/include_relative_pattern_dot_slash/test/add.test.mjs similarity index 100% rename from tests/testdata/test/relative_pattern_dot_slash/test/add.test.mjs rename to tests/specs/test/include_relative_pattern_dot_slash/test/add.test.mjs diff --git a/tests/testdata/check/types_dts/main.out b/tests/testdata/check/types_dts/main.out deleted file mode 100644 index c769989e3c..0000000000 --- a/tests/testdata/check/types_dts/main.out +++ /dev/null @@ -1 +0,0 @@ -Check file:///[WILDCARD]/check/types_dts/main.ts diff --git a/tests/testdata/lockfile/basic/doc.nolock.out b/tests/testdata/lockfile/basic/doc.nolock.out deleted file mode 100644 index e2d66c027b..0000000000 --- a/tests/testdata/lockfile/basic/doc.nolock.out +++ /dev/null @@ -1 +0,0 @@ -Download http://localhost:4545/lockfile/basic/mod.ts diff --git a/tests/testdata/lockfile/basic/info.nolock.out b/tests/testdata/lockfile/basic/info.nolock.out deleted file mode 100644 index d1ef82e49f..0000000000 --- a/tests/testdata/lockfile/basic/info.nolock.out +++ /dev/null @@ -1,8 +0,0 @@ -Download http://localhost:4545/lockfile/basic/mod.ts -local: [WILDCARD]main.ts -type: TypeScript -dependencies: 1 unique -size: [WILDCARD] - -file:///[WILDCARD]/main.ts ([WILDCARD]) -└── http://localhost:4545/lockfile/basic/mod.ts ([WILDCARD]) diff --git a/tests/testdata/publish/bare_node_builtins.out b/tests/testdata/publish/bare_node_builtins.out deleted file mode 100644 index c2cf2e2af4..0000000000 --- a/tests/testdata/publish/bare_node_builtins.out +++ /dev/null @@ -1,11 +0,0 @@ -Warning: Resolving "url" as "node:url" at file:///[WILDCARD]/publish/bare_node_builtins/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix. -Warning: Resolving "url" as "node:url" at file:///[WILDCARD]/publish/bare_node_builtins/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix. -Download http://localhost:4545/npm/registry/@types/node -Download http://localhost:4545/npm/registry/@types/node/node-18.16.19.tgz -Check file:///[WILDCARD]/publish/bare_node_builtins/mod.ts -Checking for slow types in the public API... -Check file:///[WILDCARD]/publish/bare_node_builtins/mod.ts -Simulating publish of @foo/bar@1.0.0 with files: - file:///[WILDCARD]/publish/bare_node_builtins/deno.json (87B) - file:///[WILDCARD]/publish/bare_node_builtins/mod.ts (121B) -Warning Aborting due to --dry-run diff --git a/tests/testdata/publish/bare_node_builtins_no_warnings.out b/tests/testdata/publish/bare_node_builtins_no_warnings.out deleted file mode 100644 index d8d43eff68..0000000000 --- a/tests/testdata/publish/bare_node_builtins_no_warnings.out +++ /dev/null @@ -1,9 +0,0 @@ -Download http://localhost:4545/npm/registry/@types/node -Download http://localhost:4545/npm/registry/@types/node/node-18.16.19.tgz -Check file:///[WILDCARD]/publish/bare_node_builtins/mod.ts -Checking for slow types in the public API... -Check file:///[WILDCARD]/publish/bare_node_builtins/mod.ts -Simulating publish of @foo/bar@1.0.0 with files: - file:///[WILDCARD]/publish/bare_node_builtins/deno.json (87B) - file:///[WILDCARD]/publish/bare_node_builtins/mod.ts (121B) -Warning Aborting due to --dry-run diff --git a/tests/testdata/publish/sloppy_imports.out b/tests/testdata/publish/sloppy_imports.out deleted file mode 100644 index 342eccdc3e..0000000000 --- a/tests/testdata/publish/sloppy_imports.out +++ /dev/null @@ -1,10 +0,0 @@ -Warning Sloppy module resolution (hint: specify path to index.ts file in directory instead) - at file:///[WILDCARD]/publish/sloppy_imports/mod.ts:1:20 -Check file:///[WILDCARD]/publish/sloppy_imports/mod.ts -Checking for slow types in the public API... -Check file:///[WILDCARD]/publish/sloppy_imports/mod.ts -Simulating publish of @foo/bar@1.0.0 with files: - file:///[WILDCARD]/publish/sloppy_imports/b/index.ts (27B) - file:///[WILDCARD]/publish/sloppy_imports/deno.json (87B) - file:///[WILDCARD]/publish/sloppy_imports/mod.ts (35B) -Warning Aborting due to --dry-run diff --git a/tests/testdata/publish/sloppy_imports_no_warnings.out b/tests/testdata/publish/sloppy_imports_no_warnings.out deleted file mode 100644 index 8659010b7c..0000000000 --- a/tests/testdata/publish/sloppy_imports_no_warnings.out +++ /dev/null @@ -1,8 +0,0 @@ -Check file:///[WILDCARD]/publish/sloppy_imports/mod.ts -Checking for slow types in the public API... -Check file:///[WILDCARD]/publish/sloppy_imports/mod.ts -Simulating publish of @foo/bar@1.0.0 with files: - file:///[WILDCARD]/publish/sloppy_imports/b/index.ts (27B) - file:///[WILDCARD]/publish/sloppy_imports/deno.json (87B) - file:///[WILDCARD]/publish/sloppy_imports/mod.ts (35B) -Warning Aborting due to --dry-run diff --git a/tests/testdata/publish/symlink/symlink b/tests/testdata/publish/symlink/symlink deleted file mode 120000 index 0df9bcd04e..0000000000 --- a/tests/testdata/publish/symlink/symlink +++ /dev/null @@ -1 +0,0 @@ -./mod.ts \ No newline at end of file diff --git a/tests/testdata/run/with_package_json/no_deno_json/main.out b/tests/testdata/run/with_package_json/no_deno_json/main.out deleted file mode 100644 index 402b30ed4e..0000000000 --- a/tests/testdata/run/with_package_json/no_deno_json/main.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD]package.json file found at '[WILDCARD]with_package_json[WILDCARD]no_deno_json[WILDCARD]package.json' -[WILDCARD] -ok -[Function (anonymous)] Chalk [WILDCARD] diff --git a/tools/lint.js b/tools/lint.js index 9a001967e4..760aa9f928 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -187,36 +187,37 @@ async function ensureNoNewITests() { // This is to help ensure we slowly deprecate these tests and // replace them with spec tests. const iTestCounts = { - "bench_tests.rs": 37, + "bench_tests.rs": 0, "bundle_tests.rs": 12, - "cache_tests.rs": 11, + "cache_tests.rs": 0, "cert_tests.rs": 3, - "check_tests.rs": 28, + "check_tests.rs": 23, "compile_tests.rs": 0, "coverage_tests.rs": 0, - "doc_tests.rs": 17, + "doc_tests.rs": 15, "eval_tests.rs": 9, "flags_tests.rs": 0, "fmt_tests.rs": 17, - "info_tests.rs": 20, + "info_tests.rs": 18, "init_tests.rs": 0, "inspector_tests.rs": 0, "install_tests.rs": 0, "jsr_tests.rs": 0, "js_unit_tests.rs": 0, "jupyter_tests.rs": 0, - "lint_tests.rs": 24, + "lint_tests.rs": 18, + // Read the comment above. Please don't increase these numbers! "lsp_tests.rs": 0, "node_compat_tests.rs": 4, "node_unit_tests.rs": 3, "npm_tests.rs": 98, "pm_tests.rs": 0, - "publish_tests.rs": 28, + "publish_tests.rs": 0, "repl_tests.rs": 0, - "run_tests.rs": 379, + "run_tests.rs": 373, "shared_library_tests.rs": 0, "task_tests.rs": 30, - "test_tests.rs": 80, + "test_tests.rs": 77, "upgrade_tests.rs": 0, "vendor_tests.rs": 1, "watcher_tests.rs": 0, @@ -233,7 +234,7 @@ async function ensureNoNewITests() { // console.log(`"${entry.name}": ${actualCount},`); if (actualCount > expectedCount) { throw new Error( - `New itest added to ${entry.name}! The itest macro is deprecated. Please move this test to ~/tests/specs.`, + `New itest added to ${entry.name}! The itest macro is deprecated. Please move your new test to ~/tests/specs.`, ); } else if (actualCount < expectedCount) { throw new Error(