Learn R Programming

packer (version 0.1.0)

tests: Add Tests

Description

Adds tests to a project.

Usage

include_tests(esm = TRUE)

add_test_file(name)

run_tests()

Arguments

esm

Whether to install esm and require it for tests (recommended).

name

Name of the test file to add, without extension.

Details

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.