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/fmt_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/fmt_tests.rs')
-rw-r--r-- | tests/integration/fmt_tests.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/integration/fmt_tests.rs b/tests/integration/fmt_tests.rs index 6588ae10a..417454888 100644 --- a/tests/integration/fmt_tests.rs +++ b/tests/integration/fmt_tests.rs @@ -1,8 +1,10 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +use deno_core::serde_json::json; use test_util as util; use test_util::itest; use util::assert_contains; +use util::assert_not_contains; use util::PathRef; use util::TestContext; use util::TestContextBuilder; @@ -351,3 +353,28 @@ fn fmt_with_glob_config_and_flags() { assert_contains!(output, "Found 2 not formatted files in 2 files"); } + +#[test] +fn opt_out_top_level_exclude_via_fmt_unexclude() { + let context = TestContextBuilder::new().use_temp_cwd().build(); + let temp_dir = context.temp_dir().path(); + temp_dir.join("deno.json").write_json(&json!({ + "fmt": { + "exclude": [ "!excluded.ts" ] + }, + "exclude": [ "excluded.ts", "actually_excluded.ts" ] + })); + + temp_dir.join("main.ts").write("const a = 1;"); + temp_dir.join("excluded.ts").write("const a = 2;"); + temp_dir + .join("actually_excluded.ts") + .write("const a = 2;"); + + let output = context.new_command().arg("fmt").run(); + output.assert_exit_code(0); + let output = output.combined_output(); + assert_contains!(output, "main.ts"); + assert_contains!(output, "excluded.ts"); + assert_not_contains!(output, "actually_excluded.ts"); +} |