Skip to content

Commit 2f48ca6

Browse files
authored
Long live helper.R! (#1626)
1 parent 56d0ad0 commit 2f48ca6

File tree

4 files changed

+40
-26
lines changed

4 files changed

+40
-26
lines changed

β€ŽR/test-files.Rβ€Ž

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' are available in the test `env` (e.g. via `load_package`).
77
#'
88
#' @section Special files:
9-
#' There are two types of `.R` file that have special behaviour:
9+
#' Certain `.R` files have special significance in testthat:
1010
#'
1111
#' * Test files start with `test` and are executed in alphabetical order.
1212
#'
@@ -15,14 +15,17 @@
1515
#' `withr::defer(clean_up(), teardown_env())`. See `vignette("test-fixtures")`
1616
#' for more details.
1717
#'
18-
#' There are two other types of special file that we no longer recommend using:
19-
#'
2018
#' * Helper files start with `helper` and are executed before tests are
21-
#' run. They're also loaded by `devtools::load_all()`, so there's no
22-
#' real point to them and you should just put your helper code in `R/`.
19+
#' run and, unlike setup files, are also loaded by `devtools::load_all()`.
20+
#' Helper files can be necessary for side-effect-y code that you need to run
21+
#' when developing the package interactively. It's certainly possible to
22+
#' define custom test utilities in a helper file, but they can usually be
23+
#' defined below `R/`, just like any other internal function.
24+
#'
25+
#' There is another type of special file that we no longer recommend using:
2326
#'
2427
#' * Teardown files start with `teardown` and are executed after the tests
25-
#' are run. Now we recommend interleave setup and cleanup code in `setup-`
28+
#' are run. Now we recommend interleaving setup and cleanup code in `setup-`
2629
#' files, making it easier to check that you automatically clean up every
2730
#' mess that you make.
2831
#'

β€Žman/test_dir.Rdβ€Ž

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žman/test_file.Rdβ€Ž

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žman/test_package.Rdβ€Ž

Lines changed: 13 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)