diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-07 20:16:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-07 20:16:32 -0500 |
commit | 2dfc0aca7c6a04d54fe6f9a73be70fc4c591d552 (patch) | |
tree | 58fb01c46364e4888097e7135b2f829f38ce990c /tests/integration/bench_tests.rs | |
parent | 2ed984ba3aa638c3f088ac1edc5c779c7d9195d1 (diff) |
fix(publish): make include and exclude work (#22720)
1. Stops `deno publish` using some custom include/exclude behaviour from
other sub commands
2. Takes ancestor directories into account when resolving gitignore
3. Backards compatible change that adds ability to unexclude an exclude
by using a negated glob at a more specific level for all sub commands
(see https://github.com/denoland/deno_config/pull/44).
Diffstat (limited to 'tests/integration/bench_tests.rs')
-rw-r--r-- | tests/integration/bench_tests.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/integration/bench_tests.rs b/tests/integration/bench_tests.rs index 8621679dc..e0d3f8724 100644 --- a/tests/integration/bench_tests.rs +++ b/tests/integration/bench_tests.rs @@ -1,5 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +use deno_core::serde_json::json; use deno_core::url::Url; use test_util as util; use test_util::itest; @@ -8,6 +9,7 @@ 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", @@ -285,3 +287,32 @@ fn conditionally_loads_type_graph() { .run(); assert_not_contains!(output.combined_output(), "type_reference.d.ts"); } + +#[test] +fn opt_out_top_level_exclude_via_bench_unexclude() { + let context = TestContextBuilder::new().use_temp_cwd().build(); + let temp_dir = context.temp_dir().path(); + temp_dir.join("deno.json").write_json(&json!({ + "bench": { + "exclude": [ "!excluded.bench.ts" ] + }, + "exclude": [ "excluded.bench.ts", "actually_excluded.bench.ts" ] + })); + + temp_dir + .join("main.bench.ts") + .write("Deno.bench('test1', () => {});"); + temp_dir + .join("excluded.bench.ts") + .write("Deno.bench('test2', () => {});"); + temp_dir + .join("actually_excluded.bench.ts") + .write("Deno.bench('test3', () => {});"); + + let output = context.new_command().arg("bench").run(); + output.assert_exit_code(0); + let output = output.combined_output(); + assert_contains!(output, "main.bench.ts"); + assert_contains!(output, "excluded.bench.ts"); + assert_not_contains!(output, "actually_excluded.bench.ts"); +} |