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

Demonstrate inconsistent WithExpectedExitCode behavior #4080

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Jericho
Copy link
Contributor

@Jericho Jericho commented Dec 7, 2022

I'm submitting this PR to demonstrate the problem I tried to explain in #4013

I have written a unit test that fails due to the problem I described. In short:

  • Cake script executes a command
  • The command's exit code is zero
  • The script is configured to expect a non-zero exit code

Given these facts, I expect Cake to throw an exception but my unit test highlights the fact that this is not happening.

@Jericho
Copy link
Contributor Author

Jericho commented Dec 7, 2022

As I have mentioned, my unit test fails (here):

[xUnit.net 00:00:06.59]     Cake.Common.Tests.Unit.Tools.Command.CommandRunnerTests.Exception_Thrown_when_command_exit_code_is_zero_and_expected_value_is_non_zero [FAIL]
  Failed Cake.Common.Tests.Unit.Tools.Command.CommandRunnerTests.Exception_Thrown_when_command_exit_code_is_zero_and_expected_value_is_non_zero [157 ms]
  Error Message:
   Assert.IsType() Failure
Expected: Cake.Core.CakeException
Actual:   (null)
  Stack Trace:
     at Cake.Common.Tests.Unit.Tools.Command.CommandRunnerTests.Exception_Thrown_when_command_exit_code_is_zero_and_expected_value_is_non_zero() in D:\a\cake\cake\src\Cake.Common.Tests\Unit\Tools\Command\CommandRunnerTests.cs:line 230

@Jericho Jericho linked an issue Mar 30, 2023 that may be closed by this pull request
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WithExpectedExitCode ignored when the tool exit code is zero
1 participant