Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerShell tests fail with no feedback #290

Open
hobovsky opened this issue Jan 10, 2024 · 3 comments
Open

PowerShell tests fail with no feedback #290

hobovsky opened this issue Jan 10, 2024 · 3 comments
Labels
bug Something isn't working language/powershell

Comments

@hobovsky
Copy link

Some kinds of errors cause PowerShell tests fail with completely no feedback other than "Time: 2277ms
Response received but no data was written to STDOUT or STDERR."
.

Example: this kumite.

I think this happens mostly on syntax errors, but I am not sure if it's the only kind of errors causing this, is it limited only to some snippets, etc.

@hobovsky hobovsky added bug Something isn't working language/powershell labels Jan 10, 2024
@kaz-yoshihara
Copy link

We're converting the NUnitXML, so that's probably why we get nothing if the test doesn't start. We can change how we run the tests if there's a way to capture the errors.


Here's how we run the tests.

The files:

  • Solution.ps1
  • Solution.Tests.ps1
  • Preloaded.ps1 (optional)

The command:

pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass Run-Tests.ps1

Run-Tests.ps1:

Import-Module -Name Pester
Import-Module -Name Pester-Codewars

$config = New-PesterConfiguration
$config.Should.ErrorAction = 'Continue'
$config.Output.Verbosity = 'None'
$config.Run.PassThru = $true

Invoke-Pester -Configuration $config | ConvertTo-NUnitReport | ConvertTo-Codewars

Pester-Codewars is https://github.com/codewars/Pester-Codewars and stored in ~/.local/share/powershell/Modules/Pester-Codewars/Pester-Codewars.psm1.

@hobovsky
Copy link
Author

hobovsky commented Jan 10, 2024

After the Invoke-Pester finishes, something takes care of processing the NUnit XML, right? Is it possible to check out the stdout/stderr if the report is not found, and present it as output of a test run?

I can check if/how such error is reported, I just do not know if it's possible to use stdout if there's no XML report.

EDIT: Okay I think I got it.

@kazk
Copy link
Member

kazk commented Jan 10, 2024

The last line in Run-Tests.ps1:

Invoke-Pester -Configuration $config | ConvertTo-NUnitReport | ConvertTo-Codewars

I forgot the details, but ConvertTo-NUnitReport should be generating the NUnit XML. Then that's piped to ConvertTo-Codewars .
I don't think we do anything to the stderr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working language/powershell
Projects
None yet
Development

No branches or pull requests

3 participants