ruby - Why exclude tests from gemspec files? -


bundler's gemspec template provides following default specifying gems files:

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 

a lot of other (seemingly irrelevant) files .gitignore , .travis.yml file included, why exclude tests?

i've seen other high-profile gems ignore test files too.

besides holding arbitrary metadata gem, 1 important thing gemspec tell rubygems files needed build gem.

i think bundler recommends excluding tests because aren't functional code needed gem built or run. including every test suite every gem in ruby universe expensive. there isn't compelling reason need access omniauth's tests within app.

the tests important, , that's why exist part of repository. aren't necessary in production, don't wrapped in package download rubygems.

as .gitignore , .travis.yml can exclude these on own. don't think bundler team trying think of every scenario, ones.


Comments