【问题标题】:How to invoke PowerShell Pester tests in an Azure Function Timer Trigger?如何在 Azure Function Timer Trigger 中调用 PowerShell Pester 测试?
【发布时间】:2017-06-27 20:12:53
【问题描述】:

执行包含Describe 块和检查布尔值的It 块的Invoke-Pester x.tests.ps1。该函数失败并显示以下内容。

/ServiceStatus/modules/Pester_3.4.6/Pester.psm1
2017-06-27T20:19:39.503 Function completed (Failure, Id=ffacbf52-7871-4c88-a831-8664d9b57bf8, Duration=1992ms)
2017-06-27T20:19:39.550 Exception while executing function: Functions.ServiceStatus. System.Management.Automation: A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell workflows.
View files
Test
Request body
1


Find
No results

Output
 Status: 202 Accepted

【问题讨论】:

  • 您需要完整发布实际的错误消息。错误中有价值的部分完全从您的图像中截断。
  • 该错误似乎表明您的代码正在提示用户输入,但主机不支持。这很奇怪,因为我认为 Pester 从来没有提示输入。尝试使用-Show None 来抑制输出(这相当于-Quiet,显然已被弃用)。

标签: powershell azure azure-functions pester


【解决方案1】:

您可以使用 --no-interactive 使用 Azure Functions 核心工具运行函数。见https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local#run-functions-locally

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-01-21
    • 2021-08-24
    • 1970-01-01
    • 2021-07-26
    • 2017-09-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多