英文:
How can I turn off (disable, negate) an rspec command line option?
问题
在我的团队的Rails应用中,我们的.rspec
文件包含--profile
。
我不希望在我本地运行rspec时99%的时间都显示性能分析信息。更改整个团队的.rspec
不是一个选项。
在我的.rspec-local
文件(它被git忽略了),我想要抑制或覆盖.rspec
中的设置。
这是否可行?
如何以抑制已声明的rspec参数的语法?
英文:
In my team's Rails app, our file .rspec
includes --profile
.
I don't want profile information showing up 99% of the times I run rspec locally. Changing .rspec
for the whole team is not an option.
In my file .rspec-local
(which is gitignored), I would like to suppress or override the setting in .rspec
Is this possible?
What is the syntax to do suppress an rspec parameter already declared?
答案1
得分: 1
前缀标志选项使用 no-
来覆盖先前的声明。例如,.rspec
首先被加载,然后 .rspec-local
被第二次加载:
.rspec:
--profile
--no-color
.rspec-local:
--no-profile
--color
结果是 rspec 将不带 profile,并且带有颜色。
EDIT: TIL(今天我学到了)您可以在您的主目录中创建 ~/.rspec
,它将为所有您的项目加载! 😄 不幸的是,当您的测试在 Docker 容器内运行时,这不起作用。 😞
英文:
Prefix flag options with no-
to override previous declarations. For example, .rspec
gets loaded first, then .rspec-local
gets loaded second:
.rspec:
--profile
--no-color
.rspec-local:
--no-profile
--color
The result is that rspec will run without the profile, and with color.
EDIT: TIL that you can create ~/.rspec in your home directory and it will be loaded for all your projects! 😃 Unfortunately, that doesn't work when your tests run inside a docker container. 😞
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论