mud test
ⓘ
This page is about running tests. There is a separate guide about writing them.
This command runs the tests in a MUD project. Internally, it runs the following steps:
- Starts an
anvil(opens in a new tab) instance. - Deploys the
Worldand all relatedSystems usingmud deploy. - Runs tests using
forge test(opens in a new tab) and passes the deployed world address to the tests via theWORLD_ADDRESSenvironment variable.
Command line options
| Option | Meaning | Type | Default value |
|---|---|---|---|
--version | Show version number | boolean | false |
--configPath | Path to the config file | string | mud.config.ts |
--printConfig | Print the resolved config | boolean | false |
--saveDeployment | Save the deployment info to a file | boolean | true |
--profile | The foundry profile to use | string | local |
--srcDir | Source directory | string | Foundry src directory |
--skipBuild | Skip rebuilding the contracts before deploying | boolean | false |
--alwaysRunPostDeploy | Run PostDeploy.s.sol after each deploy | boolean | false (run the script only when deploying a new World) |
--port | Port for the testing anvil instance | number | 4242 |
--help | Show help | boolean | false |
Examples
pnpm mud test