MagicMirror² DocsMagicMirror² Docs
Donate
Discord
Forum
GitHub
Donate
Discord
Forum
GitHub
  • Getting Started

    • Introduction
    • Requirements
    • Installation & Usage
    • Upgrade Guide
  • Configuration

    • Introduction
    • Autostart your MagicMirror²
    • Raspberry Specific
  • Modules

    • Introduction
    • Module Configuration
    • Default Modules

      • Alert
      • Calendar
      • Clock
      • Compliments
      • Hello World
      • News Feed
      • Update Notification
      • Weather Module
    • Animation Guide
  • Module Development

    • Introduction
    • The Core module file
    • The Node Helper
    • MagicMirror Helper Methods
    • Logger
    • Notifications
    • Weather Module Weather Provider Development
    • How to write good documentation
  • Core Development

    • Introduction
    • Testing
    • Debugging
  • About

    • MagicMirror² Manifesto
    • Contributing Guidelines
    • Donate
    • Support
    • License

Core Development Documentation: Testing

Unit tests are important to ensure the quality of the project as changes occur.

All tests are located in the tests top-level directory.

Hierarchy of Tests

Below the tests directory are other directories that organize the tests:

  • configs - Configuration files for tests.
  • e2e - End-to-end tests that start and run MagicMirror² in various configurations.
  • electron - Electron application tests.
  • mocks - Mock-up data for tests.
  • unit - Unit tests for utilities and smaller portions of MagicMirror².
  • utils - Testing utilities.

Writing a Test

Almost all pull requests must have test coverage of changes. Usually, it is easier to find an existing test and extend it to test your new functionality.

For example, if you were writing a test for a fix in the Calendar module, you might locate tests/e2e/modules/calendar_spec.js and add an additional test there.

If you have questions about how to write a test, you can also ask in the MagicMirror forums.

Help us improve this page!
Last Updated:: 9/30/25, 6:10 PM
Prev
Introduction
Next
Debugging