-
Notifications
You must be signed in to change notification settings - Fork 321
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
Test error output in expect_message() #395
Conversation
with update of golden files to show the problem
10165e4
to
fe2ea0e
Compare
Why don't I see the problem when running from the console? with_reporter("summary", test_that("abc", expect_message(f(), NA)))
#> 1
#> Warnings ------------------------------------------------------------------------------------------------
#> 1. abc (@expect-output.R#145) - w
#>
#> Failed --------------------------------------------------------------------------------------------------
#> 1. Failure: abc --------------------------------------------------------------------------------------------#> -
#> f() showed 1 message.
#> * m |
This is what I see in current master (06f1a36):
|
|
This is correct behaviour, right? with_reporter("summary", test_that("", expect_message(warning("A"), NA)))
#> .
#> Warnings ------------------------------------------------------------------------------------------------
#> 1. (@expect-output.R#145) - A
#>
#> DONE ====================================================================================================
with_reporter("summary", test_that("", expect_message(stop("A"), NA)))
#> Failed --------------------------------------------------------------------------------------------------
#> 1. Error: (@expect-output.R#145) #> ---------------------------------------------------------------------------
#> A
#> 1: expect_message(stop("A"), NA)
#> 2: evaluate_promise(object, capture_warnings = FALSE) at #> /Users/hadley/Documents/devtools/testthat/R/expect-output.R:145
#> 3: with_sink(temp, withCallingHandlers(withVisible(code), warning = handle_warning, message = #> handle_message)) at /Users/hadley/Documents/devtools/testthat/R/evaluate-promise.R:56
#> 4: withCallingHandlers(withVisible(code), warning = handle_warning, message = handle_message) at #> /Users/hadley/Documents/devtools/testthat/R/evaluate-promise.R:87
#> 5: withVisible(code)
#> 6: stop("A")
#>
#> DONE ==================================================================================================== i.e. the error message and warning are captured and printed even within So is the problem only seen in the reporters test, where we have another sink in play? (Because of the |
Capturing and printing at end is not the problem here; showing the progress indicators is. The progress output misses a
|
Ok, got it. Now I can reliably reproduce the problem, I'll think about some other approaches. |
with update of golden files to show the problem. Demo of the problem #380 tries to solve.