Skip to main content

mops test

Mops can run Motoko unit tests

mops test

Put your tests in test/* files.

All tests run as quickly as possible thanks to parallel execution.

See test package to help you write tests.


--reporter, -r

Test reporter.

--reporter <reporter>

Available reporters:

  • verbose - print each test name (default)
  • files - print only test files
  • compact - pretty progress bar
  • silent - print only errors

--watch, -w

Re-run tests every time you change *.mo files.



Test run mode

--mode <mode>

Available modes:

  • interpreter - run tests via moc -r (default)
  • wasi - compile test file to wasm and execute it with wasmtime. Useful, when you use to_candid/from_candid, or if you get stackoverflow errors.

You can also specify wasi mode for a specific test file by adding the line below as the first line in the test file

// @testmode wasi