Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate bench, publish, and more itests to spec tests #23584

Merged
merged 22 commits into from Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/Cargo.toml
Expand Up @@ -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
Expand Down
237 changes: 0 additions & 237 deletions tests/integration/bench_tests.rs
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
72 changes: 0 additions & 72 deletions 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")]
Expand All @@ -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();
Expand Down