KentonWhite / ProjectTemplate

A template utility for R projects that provides a skeletal project.
http://projecttemplate.net
GNU General Public License v3.0
622 stars 159 forks source link

Mastering guide should show 'load.project' step prior to stub.tests() #300

Closed mkrasmus closed 2 years ago

mkrasmus commented 4 years ago

Report an Issue / Request a Feature

I'm submitting a (Check one with "x") :


Issue Severity Classification -

(Check one with "x") :

Expected Behavior

When following the guide on unit testing the flow of script should include load.project() prior to stub.tests() or will return an error:

> library('ProjectTemplate')
> create.project()
> setwd('new-project')
> stub.tests()
Generating stub tests in tests/autogenerated.R:
Error in get("config", envir = .TargetEnv) : object 'config' not found
Current Behavior

Returns error if steps are followed in order.

Steps to Reproduce Behavior

As above

Possible Solution

include load.project() in the example code/output to the guide

KentonWhite commented 4 years ago

Might be a change to how TestThat runs. I can update the guide and also look at the internals if anything has changed.

KentonWhite commented 2 years ago

ARGH! The error is an image. Added a footnote that some versions of TestThat may require load.project is run before stub.tests