Comments (2)
I think there's a strong case to make suppressing messages the default, and if not by default, then with an option. In particular, messages should be captured and shown on failure, or discarded on success. Hadley argues in the release notes for the third edition that:
For reasons that I can no longer remember, testthat silently ignores all messages. This is inconsistent with other types of output, so as of the 3rd edition, they now bubble up to your test results. (source)
I'm not convinced that messages should be handled similarly to other output, since they are the interface by which testthat communicates results clearly to the user. By way of example, I think good unit testing libraries provide a feature to suppress printing or do it by default. For instance (from the python world):
- Nose will capture (suppress) printed messages and only show them on failure. (source)
- Unittest provides the
-b
flag which will capture output (stdout and stderr) and only display it on error.
I'll note here that this issue also re-raises #189 too.
from testthat.
And sometimes messages come from other packages functions called from our functions that I have no interest in seeing in my testing output.
@hydrox24 suggestion to have all output captured and displayed only if tests fail is a great option.
What is the reasoning that messages should be handled on a case by case basis? They are information for users, not relevant for testing unless we are specifically testing if a message appears.
from testthat.
Related Issues (20)
- line end with snapshots? HOT 4
- Should there be the reject button in `snapshot_review()`?
- expect_setequal error message is reversed HOT 1
- `skip_if_offline()` complaining about missing curl package on ghactions but curl is installed HOT 1
- Tests fail unless I add source('setup.R') data to test file
- Could the stack trace of `expect_no_*()` be reduced? HOT 1
- expect_visible() does not print a correct error message
- Proposal: add a custom signal class for skip(), then sort skip notes by class HOT 2
- Exported functions missing from "Expectation Internals" section of website's reference index HOT 2
- Installation on R < 4.0 fails on `evaluate` now requiring R >= 4.0 HOT 4
- Easy way to globally and permanently set testthat edition
- Ability to filter tests globally based on the test description
- Feature Proposal: Additional test roxygen headers for more granular metadata
- vdiffr vs testthat::expect_snapshot() for plots HOT 1
- Parallel testing in Azure DevOps Pipelines
- POSIXct objects that differ by fractional seconds are considered equal when run manually but not within `reprex()`
- `test_path()` returns incorrect value in context of `test_coverage_active_file()`
- disallow empty strings for test names HOT 3
- `test_active_file()` unloads helpers HOT 2
- Provide more information when `expect_condition()` and friends fail
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testthat.