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

Set-TestInconclusive does not fail the test when running in -Strict mode #885

Closed
nohwnd opened this issue Sep 16, 2017 · 7 comments
Closed

Comments

@nohwnd
Copy link
Member

nohwnd commented Sep 16, 2017

Setting test to inconclusive marks the test as inconclusive even when running in Strict mode, we are probably making the check first, and then running the test.

Related #529

@nohwnd nohwnd added the Bug label Sep 16, 2017
@nohwnd nohwnd added this to the v4.1 milestone Sep 16, 2017
@nohwnd nohwnd modified the milestones: v4.1, 4.2 Nov 12, 2017
@nohwnd
Copy link
Member Author

nohwnd commented May 6, 2018

Repro:

$path = "$env:TEMP\Strict.tests.ps1"
'describe "a" { it "b" { Set-TestInconclusive } }' | Set-Content $path

Invoke-Pester -Strict "$env:TEMP\Strict.tests.ps1"

# output: 
# Tests completed in 36ms
# Tests Passed: 0, Failed: 0, Skipped: 0, Pending: 0, Inconclusive: 1 

@bergmeister
Copy link
Contributor

bergmeister commented May 6, 2018

This one is going to be opinionated but the user should make a choice whether to mark inconclusive as failed or not. Therefore only making it fail when using -Strict looks ok to me as per your proposal but without the switch I would leave it as it is.
VSTS has this 'great' behaviour that it marks the build as red in this case but the UI hides inconclusive tests by default...

@nohwnd nohwnd removed this from the 4.3 milestone May 6, 2018
@nohwnd nohwnd added this to the New runtime milestone Dec 16, 2018
@nohwnd
Copy link
Member Author

nohwnd commented Dec 16, 2018

This one is still happening. The Set-TestInconclusive was recently changed to use this implementation #1026 That PR should serve as a good guide in which places and in which files the process of detecting test inconclusive is happening. And when we are running in strict mode we should fail the test after we receive the known exceptions, instead of marking it as inconculsive (or pending or skipped). Also don't confuse this with PowerShell's Strict-Mode, this strict mode refers to -Strict parameter on Invoke-Pester described here.

@renehernandez
Copy link
Contributor

@nohwnd I am checking this as possible first issue to contribute to, but is this still relevant since in the docs Set-TestInconclusive is already deprecated in favor of Set-ItResult.

Or should the resolution for this should cover both Set-TestInconclusive and Set-ItResult? (in case that Set-ItResult has the same issue)

@nohwnd
Copy link
Member Author

nohwnd commented Jan 18, 2019

@renehernandez Yes this is still valid. The underlying mechanism of setting the test result is (I hope :)) the same for both Set-ItResult and Set-TestInconclusive. The former was deprecated because it does just a single thing and uses Test instead of It in the name. When this issue is solved the test in which we set a result, should be marked as failed in the result when running with the -Strict switch on Invoke-Pester, and not as inconclusive (or pending or skipped).

@renehernandez
Copy link
Contributor

@nohwnd Sounds good, I am go to start working on it this weekend

@nohwnd
Copy link
Member Author

nohwnd commented Jan 18, 2019

Good, ping me if you need help:) twitter will get you faster response :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants