【发布时间】:2017-05-08 13:30:11
【问题描述】:
我正在使用guard-minitest 自动运行我的测试。
test/fixtures 目录中还有一个骨架 gem。
问题是,现在 Guard 也在骨架 gem 中运行测试。
我如何告诉 Guard 只为我的实际项目运行我的测试,而不是 test/fixtures 目录中的任何项目?
我尝试了以下方法,但它不起作用:
guard :minitest, :exclude => "test/fixtures/*" do
# with Minitest::Unit
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r{^test/test_helper\.rb$}) { 'test' }
end
编辑:
docs 看起来好像我可以添加一个忽略路径,这也不起作用:
ignore %r{^test/fixtures/}
guard :minitest do
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r{^test/test_helper\.rb$}) { 'test' }
end
编辑:
按照下面的建议,我尝试删除星号,也不起作用:
ignore %r{^test/fixtures/}
guard :minitest do
watch(%r{^test/test_(.*)\.rb$})
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r{^test/test_helper\.rb$}) { 'test' }
end
【问题讨论】: