forc-test

Run the Sway unit tests for the current project.

NOTE: This feature is not yet implemented. Track progress at the following link: https://github.com/FuelLabs/sway/issues/1832

NOTE: Previously this command was used to support Rust integration testing, however the provided behaviour served no benefit over running cargo test directly. The proposal to change the behaviour to support unit testing can be found at the following link: https://github.com/FuelLabs/sway/issues/1833

Sway unit tests are functions decorated with the #[test_script] attribute. Each test is compiled as an independent script program and has access to the namespace of the module in which it is declared. Unit tests declared within contract projects may also call directly into their associated contract's ABI.

Upon successful compilation, test scripts are executed to their completion. A test is considered a failure in the case that a revert (rvrt) instruction is encountered during execution. Otherwise, it is considered a success.

USAGE:

forc test [OPTIONS] [FILTER]

ARGS:

<FILTER> When specified, only tests containing the given string will be executed

OPTIONS:

-h, --help

Print help information

-L, --log-level <LOG_LEVEL>

Set the log level

-s, --silent

Silence all output

-v, --verbose

Use verbose output