diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-08 14:25:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-08 14:25:22 -0500 |
commit | 5d85efd595e13863a443fb53a8b2954e5c6c77cc (patch) | |
tree | 8ac548a6ac5df550f865387fb56b80a2f12896a6 /tests | |
parent | fee4943f760fae2c9386ceeda86c3f8fbfd8e6a0 (diff) |
fix(publish): ability to un-exclude when .gitignore ignores everything (#22805)
This is an unrealistic scenario, but it's still a good thing to fix and
have a test for because it probably fixes some other underlying issues
with how the gitignore was being resolved for the root directory.
From https://github.com/denoland/deno/pull/22720#issuecomment-1986134425
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/publish_tests.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/integration/publish_tests.rs b/tests/integration/publish_tests.rs index 28046d047..49c531e7d 100644 --- a/tests/integration/publish_tests.rs +++ b/tests/integration/publish_tests.rs @@ -459,6 +459,34 @@ fn not_include_gitignored_file_unless_exact_match_in_include() { } #[test] +fn gitignore_everything_exlcuded_override() { + let context = publish_context_builder().build(); + let temp_dir = context.temp_dir().path(); + + temp_dir.join(".gitignore").write("*\n"); + temp_dir.join("deno.json").write_json(&json!({ + "name": "@foo/bar", + "version": "1.0.0", + "exports": "./root_main.ts", + "publish": { + // should opt out of .gitignore even though everything + // is .gitignored + "exclude": ["!**"] + } + })); + + temp_dir.join("root_main.ts").write(""); + let sub_dir = temp_dir.join("sub"); + sub_dir.create_dir_all(); + sub_dir.join("sub_main.ts").write(""); + let output = context.new_command().arg("publish").arg("--dry-run").run(); + output.assert_exit_code(0); + let output = output.combined_output(); + assert_contains!(output, "root_main.ts"); + assert_contains!(output, "sub_main.ts"); +} + +#[test] fn includes_directories_with_gitignore_when_unexcluded() { let context = publish_context_builder().build(); let temp_dir = context.temp_dir().path(); |