Adds tests to a project, currently supports mocha and peeky, see details for more.
include_tests_mocha(esm = TRUE)include_tests_peeky()
add_test_file(name)
run_tests(open = FALSE)
Whether to install esm
and require it for tests (recommended).
Name of the test file to add, without extension.
Only valid for "peeky," this will open a development
UI if TRUE
.
include_tests_mocha
uses mocha and
mocha-webpack and
creates a directory called testjs
where tests should be placed.
The function run_tests()
will then uses mocha on all the files in
the testjs
directory. All tests should end with .test.js
.
include_tests_peeky
uses peeky
it's very similar to mocha but also comes with a development UI
that can be accessed when running tests by setting open
to
TRUE
.
Requiring esm
(esm = TRUE
) is recommended as it will allow using the latest
ESM, e.g.: import
in tests.