Skip to content

Conversation

@jonthegeek
Copy link
Contributor

Name snap_dir arg for testthat::local_snapshotter() in test_coverage_active_file()

Fixes #2630

Name `snap_dir` arg for `testthat::local_snapshotter()` in `test_coverage_active_file()`

Fixes r-lib#2630
@jonthegeek
Copy link
Contributor Author

It's a little ironic for this not to have test coverage, but the tests here are pretty light, and it's tricky to add them. I could probably get some things in place to at least throw errors if something like this happens again if you'd like.

@fabiandistlerkb
Copy link

Thank you. This has been annoying me for the past weeks. I got a local quickfix. Is there a chance to get this into the dev version quickly?

@hadley
Copy link
Member

hadley commented Jan 8, 2026

Hmmm, I haven't noticed this because I haven't updated devtools for a long time 😬

@hadley
Copy link
Member

hadley commented Jan 8, 2026

Let me also fix this in testthat, since I'm about to release it. We'll still want this change because it's definitely better practice to use a named argument here.

hadley added a commit to r-lib/testthat that referenced this pull request Jan 8, 2026
hadley added a commit to r-lib/testthat that referenced this pull request Jan 8, 2026
Copy link
Member

@jennybc jennybc left a comment

Choose a reason for hiding this comment

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

This is sort of nitpicky/meta but sort of legit and I know you are resilient enough @jonthegeek to take it 😁 but can you back out the Air-ish formatting changes, so this only has the meaningful change? I think it's just the addition of snap_dir =?

(I need to do a holistic re-formatting of devtools as a whole. And it really does make it easier to see what's in this PR / what the problem is.)

@jonthegeek
Copy link
Contributor Author

This is sort of nitpicky/meta but sort of legit and I know you are resilient enough @jonthegeek to take it 😁 but can you back out the Air-ish formatting changes, so this only has the meaningful change? I think it's just the addition of snap_dir =?

(I need to do a holistic re-formatting of devtools as a whole. And it really does make it easier to see what's in this PR / what the problem is.)

I almost did this earlier today because I didn't intentionally make them (air and/or "Strip trailing horizontal whitespace when saving" did). It's a little tricky to save WITHOUT applying those things but I can work it out!

@jennybc
Copy link
Member

jennybc commented Jan 13, 2026

It's a little tricky to save WITHOUT applying those things but I can work it out!

Hmmm, does that mean you've configured Air formatting on save at the user level? That's kind of anti-recommended, even though it's tempting.

https://posit-dev.github.io/air/editor-vscode.html#user-vs-workspace-settings

User level settings are automatically applied for all projects that you open. While this sounds nice, if you open an older project (or a project you don’t own) that doesn’t use Air, then you’ll have to remember to turn off your user level Air settings before committing to that project, otherwise you may create a large amount of format related diffs that the project may not want.

In any case, thanks for the fixup! (devtools is about to get Air formatted in a separate PR.)

@jennybc jennybc merged commit 8943b48 into r-lib:main Jan 13, 2026
13 of 14 checks passed
@jonthegeek
Copy link
Contributor Author

jonthegeek commented Jan 13, 2026

Hmmm, does that mean you've configured Air formatting on save at the user level? That's kind of anti-recommended, even though it's tempting.

I still use RStudio most of the time, and at least some of that was happening via old-school settings... although now that I look at it it looks like I do always apply air. I'll take a look and see what makes sense to reconfigure!

Edit: Oh ok, Rstudio only supports "always on." I think I'm mostly just waiting for posit-dev/positron#1778 before I can switch without too-frequent frustration.

@jonthegeek jonthegeek deleted the fix-2630-test_coverage_active_file branch January 13, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_coverage_active_file() fails with testthat 3.3

4 participants