A Danger plugin that shows all build errors, warnings and unit tests results generated from xcodebuild.
| 1 Error | |
|---|---|
| 🚫 |
MyWeightTests.MyWeightTests: testError, failed - :w: MyWeightTests/MyWeightTests.swift#L26 |
| 2 Warnings | |
|---|---|
MyWeight/ViewController.swift#L35: initialization of immutable value ‘bla’ was never used; consider replacing with assignment to ‘_’ or removing it
let bla = "unused variable"
|
|
Bla.m#L32: Value stored to ‘theme’ is never read
theme = *ptr++;
|
| 1 Message | |
|---|---|
| 📖 | TestTarget: Executed 5 tests, with 1 failure (0 unexpected) in 0.032 (0.065) seconds |
Add this line to your Gemfile:
gem 'danger-xcode_summary'Just add this line to your Dangerfile:
xcode_summary.report 'MyApp.xcresult'You need to pass the path of the xcresult generated after compiling your app.
By default, this is inside the DerivedData for your project, but you can use the -resultBundlePath
flag when calling xcodebuild to customize its path. You can read more about it in this blog post from the folks at PSPDFKit.
You can also ignore warnings from certain files by setting ignored_files:
Warning: ignored_files patterns applied on relative paths.
# Ignoring warnings from Pods
xcode_summary.ignored_files = 'Pods/**'
# Ignoring specific warnings
xcode_summary.ignored_results { |result|
result.message.include? 'ld' # Ignore ld_warnings
}
xcode_summary.report 'MyApp.xcresult'
# When `true`, collapses parallelized test runs of the same target into one line.
# Defaults to `false`.
xcode_summary.collapse_parallelized_tests = trueYou can use ignores_warnings to supress warnings and shows only errors.
xcode_summary.ignores_warnings = trueYou can use inline_mode.
When this value is enabled, each warnings and errors are commented on each lines.
# Comment on each lines
xcode_summary.inline_mode = true
xcode_summary.report 'MyApp.xcresult'You can use ignore_retried_tests to intelligently handle retried unit tests.
When enabled, if a test fails but succeeds on retry, the failure will be ignored and not reported as an error.
# Ignore test failures that succeeded on retry
xcode_summary.ignore_retried_tests = true
xcode_summary.report 'MyApp.xcresult'You can use strict to reporting errors as warnings thereby don't block merge PR.
# If value is `false`, then errors will be reporting as warnings
xcode_summary.strict = falseYou can get warning and error number by calling warning_error_count. The return will be a JSON string contains warning and error count, e.g {"warnings":1,"errors":3}:
result = xcode_summary.warning_error_count 'MyApp.xcresult'danger-xcode_summary is released under the MIT license. See LICENSE.txt for details.
- Clone this repo
- Run
bundle installto setup dependencies. - Run
bundle exec rake specto run the tests. - Use
bundle exec guardto automatically have tests run as you make changes. - Make your changes.