Environment Configuration
Environment Overview
In Moonwall, an environment refers to a specific configuration and setup for running blockchain networks that you intend to run your tests against. In other words, what network are you going to run, how is it configured, and what parameters do you need to provide for it to be started successfully?
You'll specify the foundation that you're using within your environment. Within the context of the foundation you'll also specify the path to the binary you're running.
You can also specify configuration details like the directory of test files, and additional parameters such as the default test timeout and the specific foundation configuration.
You'll need to set up your environment configuration while getting your Moonwall Config file sorted. Let's dive into each of the parameters you can use when setting up your environment.
Environment Params
- reporters string[]: an optional array of reporter names from the list of Vitest Built ins. In most cases, you'll want to use the Basic Reporter. Other reporters are possible, but come with the following strings attached:
TIP
In most cases, you'll want to use the Basic Reporter. Other reporters are possible, but come with the following strings attached: verbose has a bug in the upstream library where the values are crossed out when you have too many tests. default - this has custom animations which break when you have too many tests. html - this is great but requires a bit more explanation as you not only have to import another library to support this feature, but then you need to serve that html page (which is a simple one line command, but requires a separate terminal window). json - output file needs to be specified otherwise it just prints it to console uselessly.
- reportFile string or { [reporterName: string]: string }: Writes test results to a file when using the HTLM or JSON reporter. You can provide an object instead of a string to define individual outputs when using multiple reporters.
- name string: string name of your environment
- description string: description of the environment to display in menus
- timeout number: The default timeout for tests and hooks
- testFileDir string[]: Array of directories where your test files are held
- envVars string[]: An optional array of environment variable names.
- foundation: The foundation configuration for the environment.
- include? string[]: An optional array included files or directories.
- connections? * ProviderConfig[]*: An optional array of ProviderConfig objects.
- multiThreads? boolean or number An optional boolean to indicate if multi-threading is enabled.
TIP
Optionally, rather than providing a boolean or a number for multiThreads you can specify your own threadPool spec using a PoolOptions config object. See poolOptions for more info.
- contracts? string: Path to directory containing smart contracts for testing against.
- defaultSigner? {Substrate keyring type, privateKey} Allows you to specify the kind of signer and the private key with which to sign and send transactions during the createBlock() function. The default signer can be of type ethereum, sr25519, or ed25519 For more info about each, see Polkadot Keyring docs
- defaultAllowFailures? boolean: Toggle whether createBlock() will throw when extrinsic errors inside.
- defaultFinalization? boolean:Toggle whether createBlock() will finalize blocks by default or not.