Adds tests to a project.
include_tests(esm = TRUE)add_test_file(name)
run_tests()
Whether to install esm
and require it for tests (recommended).
Name of the test file to add, without extension.
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
. Internally
include_tests()
also runs use_loader_mocha()
.
Requiring esm
(esm = TRUE
) is recommended as it will allow using the latest
ESM, e.g.: import
in tests.