Skip to main content

forgetest

Attribute Macro forgetest 

#[forgetest]
Expand description

Defines a Forge integration test.

The function may take a prj: _ argument for the TestProject and a cmd: _ argument for the forge TestCommand, in any order. Either can be left out. An async function runs on a multi-threaded Tokio runtime.

The attribute optionally takes the project’s PathStyle, which defaults to PathStyle::Dapptools.

ⓘ
#[forgetest]
fn can_build(prj: _, cmd: _) {
    cmd.arg("build").assert_success();
}

#[forgetest(PathStyle::HardHat)]
async fn can_build_hardhat(cmd: _) {
    cmd.arg("build").assert_success();
}