问题描述
在VSCode中按快捷键'Ctrl+F5'运行后缀为'.tests.ps1'的Pester测试文件.
Press the shortcut key 'Ctrl+F5' in VSCode to run the Pester test file with the suffix '.tests.ps1'.
在'about_Parsing.Tests.ps1'中按Ctrl+F5"后,控制台会直接出现:d:\GitRepository\PowerShell\example\pester\about_Parsing\about_Parsing.Tests.ps1
In 'about_Parsing.Tests.ps1' After you press "Ctrl+F5", the console will directly appear:d:\GitRepository\PowerShell\example\pester\about_Parsing\about_Parsing.Tests.ps1
然后直接运行测试.
如何以如此方便的方式运行测试并使用各种invoke-pester
参数,例如-output details
?
How to run tests in such a convenient way and use various invoke-pester
parameters, such as -output detailed
?
推荐答案
如果你去 VSCode 的设置并搜索 Pester,你应该找到一个名为:
If you go to the Settings of VSCode and search for Pester, you should find a setting called:
PowerShell >Pester:输出冗长
PowerShell > Pester: Output Verbosity
您可以将其设置为详细".
You can set this to "detailed".
该设置还表明,如果您使用的是 Pester v5 或更新版本,您还可以通过它默认使用的 $PesterPreference
变量进行设置.您可以在脚本或 PowerShell 配置文件中设置此变量.
The setting also indicates that if you're using Pester v5 or newer you can also set this via the $PesterPreference
variable which it uses by default. You could set this variable in your script or PowerShell profile.
$PesterPreference = [PesterConfiguration]::Default
$PesterPreference.Output.Verbosity = 'Detailed'
这篇关于如何使用 VSCode 中的 -OutPut 详细信息快速运行 Pester?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!