Testing

    This repository comes with linting rules for both JavaScript and C++ – as well as unit and integration tests. To learn more about Electron’s coding style, please see the coding-style document.

    To ensure that your changes are in compliance with the Electron coding style, run , which will run a variety of linting checks against your changes depending on which areas of the code they touch.

    Many of these checks are included as precommit hooks, so it’s likely you error would be caught at commit time.

    If you are not using , ensure that the name you have configured for your local build of Electron is one of Testing, Release, Default, or you have set . Without these set, Electron will fail to perform some pre-testing steps.

    To run only specific tests matching a pattern, run npm run test -- -g=PATTERN, replacing the PATTERN with a regex that matches the tests you would like to run. As an example: If you want to run only IPC tests, you would run npm run test -- -g ipc.

    If you’ve made changes that might affect the way Node.js is embedded into Electron, we have a test runner that runs all of the tests from Node.js, using Electron’s custom fork of Node.js.

    To run all of the Node.js tests:

    To run a single Node.js test:

    Extra steps to run the unit test:

    1. Visual Studio 2019 must be installed.

    2. Node headers have to be compiled for your configuration.

    Missing fonts

    Some Windows 10 devices do not ship with the Meiryo font installed, which may cause a font fallback test to fail. To install Meiryo:

    1. Push the Windows key and search for Manage optional features.
    2. Click Add a feature.
    3. Select Japanese Supplemental Fonts and click Install.

    Pixel measurements

    To configure display scaling:

    1. Push the Windows key and search for Display settings.