CLI
mud test

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:

  1. Starts an anvil (opens in a new tab) instance.
  2. Deploys the World and all related Systems using mud deploy.
  3. Runs tests using forge test (opens in a new tab) and passes the deployed world address to the tests via the WORLD_ADDRESS environment variable.

Command line options

OptionMeaningTypeDefault value
--versionShow version numberbooleanfalse
--configPathPath to the config filestringmud.config.ts
--printConfigPrint the resolved configbooleanfalse
--saveDeploymentSave the deployment info to a filebooleantrue
--profileThe foundry profile to usestringlocal
--srcDirSource directorystringFoundry src directory
--skipBuildSkip rebuilding the contracts before deployingbooleanfalse
--alwaysRunPostDeployRun PostDeploy.s.sol after each deploybooleanfalse (run the script only when deploying a new World)
--portPort for the testing anvil instancenumber4242
--helpShow helpbooleanfalse

Examples

pnpm mud test