Skip to content

Function auto_test fails on subsequent file changes #1385

Open
@mihaiconstantin

Description

@mihaiconstantin

Summary

This is not the intended use, but the function auto_test seems to fail on subsequent test file changes, with an error thrown in test_files. Perhaps the error message could be made more informative.

Steps to reproduce

  1. open R session in terminal
  2. run devtools::create("./foo")
  3. run cd foo
  4. run usethis::use_testthat()
  5. run usethis::use_test("foo")
  6. run testthat::auto_test("./R", "./tests/testthat")

At this point, I get a confirmation that the test foo passed:

== Results ==========================
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]

When I add, i.e., expect_equal(TRUE, TRUE) to test-foo.R and save, the tests are rerun, and test_files throws an error:

== Results =============================================================
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
Rerunning tests:  test-foo.R
Error in test_files(test_dir = test_dir, test_package = test_package,  :
  argument "test_package" is missing, with no default

I am not very familiar with testthat, but it seems that the error occurs on line 173:

testthat/R/test-files.R

Lines 171 to 182 in b0b3319

test_files(
test_dir = test_dir,
test_package = test_package,
test_paths = test_paths,
load_helpers = load_helpers,
reporter = reporter,
env = env,
stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning,
wrap = wrap,
load_package = load_package
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviortests 📘

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions