gemspec中test_files配置的目的是什么 [英] What is the purpose of test_files configuration in a gemspec
问题描述
单元测试文件的集合.当用户要求对宝石进行单元测试时,它们将作为单元测试加载.
A collection of unit test files. They will be loaded as unit tests when the user requests a gem to be unit tested.
但是没有gem test
命令,并且与包装中使用的files
配置不同,我看不到有任何明显的使用位置.谷歌似乎也没有提供任何服务.
However there is no gem test
command, and unlike the files
config which is used in the packaging, I don't see any obvious place this is used. Google also seems not to turn up anything.
在gem中指定test_files有什么意义吗?
Is there any point for specifying test_files in a gem?
推荐答案
我也一直在寻找答案,尽管我还没有明确的不要使用test_files",该支持已被弃用.
I've been trying to find an answer to this as well, and while I haven't turned up a definitive "don't use test_files" it seems that support has been somewhat deprecated.
据我所知,您的问题的答案是取决于".指定test_files有一些要点,但可能与您期望的不一样:
From what I can tell, the answer to your question is "it depends". There are some points to specifying test_files, but they might not be what you expect/want:
- 从测试的角度来看,rubygems似乎对运行指定的测试文件没有任何作用.
- 从包装的角度来看,它们将被安装,这对于最终用户可能有用也可能没有用.
一些参考文献:
- 一个打开的第735号问题以不安装test_files,该操作推迟到post-2 .x RubyGems发布是由于向后兼容" RubyGems github存储库中的
- 提交429f88 ... 宝石(包含在v1.5.0中)
- 关闭的错误#27507 从gem install中删除-t(已删除-t在该错误中包含一些讨论之后)
- An open Issue #735 to not install test_files, deferred to a post-2.x RubyGems release due to 'backward compatibility'
- Commit 429f88... in the RubyGems github repo, which removed code that tests gems (included back in v1.5.0)
- A closed Bug #27507 to remove -t from gem install (it was removed after some discussion included in the bug)
这篇关于gemspec中test_files配置的目的是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!