Skip to content

isIsolateMode

function isIsolateMode() external view returns (bool result);

Returns whether the running Solidity test is executed in isolation mode, which you enable by setting isolate to true in the Solidity tests configuration.

In isolation mode, every top-level call runs as a separate transaction, which changes gas accounting and when state is committed. Use this cheatcode to adapt a test, or to skip it, depending on the mode it runs in.

function testGasOfTransfer() public {
if (!vm.isIsolateMode()) {
vm.skip(true, "gas is only exact in isolation mode");
}
// ...
}