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

[scan] fix scan failing to return results when there are test failures #20237

Merged
merged 2 commits into from
May 18, 2022

Conversation

tahirmt
Copy link
Contributor

@tahirmt tahirmt commented Apr 30, 2022

When using test_failure! method it causes scan to skip sending the output even if fail_build is set to false

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

Resolves #20236

Description

  • While the exception is caught when fail_build option is set to false, it still causes the results to not be sent to consumers.
  • To fix this I moved the fail_build definition from run_tests to scan and then used the value of fail_build to determine whether to raise the exception or to just post a ui error.

Testing Steps

Added a unit test to confirm that with fail_build set to false it returns the output from the action and that the output contains the correct values.

When using test_failure! method it causes scan to skip sending the output even if fail_build is set to false
@tahirmt tahirmt changed the title Fix scan failing to return results when there are test failures [scan] Fix scan failing to return results when there are test failures Apr 30, 2022
@joshdholtz joshdholtz changed the title [scan] Fix scan failing to return results when there are test failures [scan] fix scan failing to return results when there are test failures May 18, 2022
Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for catching this! I added one commit to also add a check inside of the exit status code check to not raise an error. I tested this against my sample project and I was able to get the results returned as expected for when fail_build was set to both true and false.

Really appreciate the contribution! ❤️

@joshdholtz joshdholtz merged commit 1015e10 into fastlane:master May 18, 2022
@tahirmt tahirmt deleted the fix-scan-exception branch May 18, 2022 02:48
Copy link

@fastlane-bot fastlane-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations! 🎉 This was released as part of fastlane 2.206.0 🚀

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

Successfully merging this pull request may close these issues.

[scan] Scan does not return output when there are test failures
3 participants