skip

Signature

function skip(bool skip) external;

Description

Marks a test as skipped, conditionally. It must be called at the top of the test to ensure it is skipped without any execution.

If skip is called with a false boolean, it will not skip the test.

Tests marked as skipped will appear with a [SKIPPED] label on the test runner and on the summary, to easily identify skipped tests.

Examples


function testSkip() public {
    vm.skip(true);
    /// This revert will not be reached as this test will be skipped.
    revert("Should not reach this revert");
}

function testNotSkip() public {
    vm.skip(false);
    /// This revert will be reached as this test will not be skipped, and the test will fail.
    revert("Should reach this revert");
}