Skip to content

Exclude some unnecessary files from the crate#424

Open
musicinmybrain wants to merge 2 commits into
nextest-rs:mainfrom
musicinmybrain:crate-exclude
Open

Exclude some unnecessary files from the crate#424
musicinmybrain wants to merge 2 commits into
nextest-rs:mainfrom
musicinmybrain:crate-exclude

Conversation

@musicinmybrain
Copy link
Copy Markdown

Suggested in the review for a rust-datatest-stable package for Fedora. These files are only useful for upstream development, and aren’t useful for crate users.

@sunshowers
Copy link
Copy Markdown
Member

Thanks! Thoughts on making it an allowlist using include?

@musicinmybrain
Copy link
Copy Markdown
Author

Thanks! Thoughts on making it an allowlist using include?

No objections to that. It could look something like this:

diff --git a/Cargo.toml b/Cargo.toml
index 6cf6696..a9ab3fd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,13 +10,12 @@ edition = "2021"
 categories = ["development-tools::testing"]
 keywords = ["datatest", "data-driven-tests", "test-harness"]
 rust-version = "1.72"
-exclude = [
-    ".cargo/**",
-    ".github/**",
-    ".gitignore",
-    "Justfile",
-    "release.toml",
-    "scripts/**",
+include = [
+    "CHANGELOG.md",
+    "LICENSE*",
+    "README.md",
+    "src/**",
+    "tests/**",
 ]
 
 [badges]

which is equivalent, except that I hadn’t excluded CONTRIBUTING.md, but I’m not bothering to include it, because it seems like it, too, is really only useful for interacting with upstream.

I’ve left the tests in for now because they’re useful to me: I maintain a rust-datatest-stable package in Fedora, and we package Rust libraries using published crates from crates.io, so this means I can run the tests with our compilers on all of our primary architectures, which we’ve found really does catch bugs in practice across the Rust stack. However, there is a valid argument that most crate users don’t need the tests, and some people prefer to omit them, so if you ask me to omit the tests, I will. It would reduce the size of the crate archive to 26136 bytes, from 30435 with the tests included and 34478 bytes before this PR.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.47%. Comparing base (a00be6e) to head (3954496).
⚠️ Report is 26 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #424      +/-   ##
==========================================
+ Coverage   87.59%   88.47%   +0.87%     
==========================================
  Files           4        4              
  Lines         403      399       -4     
==========================================
  Hits          353      353              
+ Misses         50       46       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sunshowers
Copy link
Copy Markdown
Member

Thanks -- let's include the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants