如何使用 VSCode 中的 -OutPut 详细信息快速运行 Pester? [英] how to run Pester quickly with -OutPut Detailed in VSCode?

查看:25
本文介绍了如何使用 VSCode 中的 -OutPut 详细信息快速运行 Pester?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆