PowerShell / PowerShell/PSScriptAnalyzer

Locally running ./build.ps1 -Tests does not function as docs specify

Abierto
#1,652 1 comentario 0 reacciones 1 asignado Ver en GitHub

@JamesWTruher ya está trabajando en esto.

Desde el 28/9/2021.

Issue - Bug
Lenguaje dominante
C#
Estrellas
2.2k
Forks
414
Merge medio
13 h 1 min
PR fusionados (30 d)
2

Descripción

Steps to reproduce

git clone https://github.com/PowerShell/PSScriptAnalyzer.git
cd PSScriptAnalyzer
./Build.ps1. -Test
Import-module ./build.psm1
Get-TestResults # Or Get-TestFailures

Expected behavior

This should, as per the documentation, load the results file and output it to the console.

Actual behavior

Throws these errors:

Resolve-Path : Cannot find path 'C:\Users\Coby\source\repos\PSScriptAnalyzer\TestResults.xml' because it does not
exist.
At C:\Users\Coby\source\repos\PSScriptAnalyzer\build.psm1:410 char:17
+     $logPath = (Resolve-Path $logfile).Path
+                 ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Coby\s...TestResults.xml:String) [Resolve-Path], ItemNotFoundE
   xception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.ResolvePathCommand

Get-Content : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\Coby\source\repos\PSScriptAnalyzer\build.psm1:411 char:34
+     $results = [xml](Get-Content $logPath)
+                                  ~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-Content], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.GetContentC
   ommand

You cannot call a method on a null-valued expression.
At C:\Users\Coby\source\repos\PSScriptAnalyzer\build.psm1:412 char:5
+     $results.SelectNodes(".//test-case")
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Environment data

Fails in all environments.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.