Repository navigation
Don't ship tests in the gem - #301
Merged
apotonick merged 1 commit intoOct 21, 2026
Merged
Conversation
test/ isn't needed at runtime and is more than half of the packed gem (79 KB -> 34 KB). spec.test_files is ignored by RubyGems, so it goes too.
apotonick
reviewed
Oct 21, 2026
|
|
||
| spec.files = `git ls-files`.split("\n") | ||
| spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
| spec.files = `git ls-files`.split("\n").reject { |f| f.start_with?("test/", "spec/", "features/") } |
Member
There was a problem hiding this comment.
Do you understand why the old version doesn't play anymore? It's generic bundler gem logic.
Author
There was a problem hiding this comment.
rubygems/guides#90 (comment)
test_files still ships the test files. The documentation about it has been removed, and it has been soft deprecated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gem currently packs everything
git ls-fileslists, includingtest/, which isn't needed at runtime and is more than half of the gem (79 KB packed, about 215 KB unpacked → 34 KB packed). It ends up in every installation, e.g. production Docker images.This rejects
test/,spec/andfeatures/fromspec.files(the same pathsspec.test_filesnamed), and removesspec.test_files, which RubyGems ignores.rake testuses its ownFileList, so it is unaffected.