Comments (4)
It's possible that testthat uses the unix line endings for all the text it generates but it's possible that pkgdown is producing OS-varying line endings. Regardless, testthat should automatically process snapshots to remove \r
.
from testthat.
Snapshot files should already be written with consistent line ending, so if you're seeing problems that's definitely a bug.
from testthat.
Oh, okay! Cool.
But I am surprised to see it hasn't come up before...
The simple way to get this is simply to work with snapshots on mac and Windows and you start seeing some ghost diffs appear.
I thought this was a pure git problem:
Here is what I tried:
- Using specific line ending in .Rproj
- Try to configure it git wise (I don't really understand this)
- Try to set gitattributes line ending for snapshots, but I couldn't resolve it.
I still think it can be solved with using the correct git setting. If it is, it may be worth documenting it?
I always end up with this in the git pane.
It is especially annoying when working with usethis::pr_*()
functions as I need to do a manual step before proceeding.
It makes it hard to distinguish between snapshots that changed vs remained the same.
from testthat.
I think I finally found a way to mitigate that. Using the Posix line ending option in .Rproj seems to work pretty well!
This is not the default option, but for some collaborative projects, it may be worth using. Also, using core.autocrlf = true git config is not a good idea (unless all collaborators have this setting, but there is no good way to do this)
use_git_config(scope = "project", "core.autocrlf" = "false")
Seems to work well now. But I am stuck with a .Rproj always in diff. rstudio/rstudio#1929
from testthat.
Related Issues (20)
- 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.