测试
这个仓库为 JavaScript 和 C ++ 提供了linting 规则 - 以及单元和集成测试。 通过 coding-style文档来学习更多的Electron’s编码风格
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.
若要通过匹配模式运行单个测试,可以执行 npm run test -- -g=PATTERN
,把PATTERN
替换为匹配某个测试的正则表达式。 例:如果想运行IPC测试,你可以执行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:
Visual Studio 2019 must be installed.
Node headers have to be compiled for your configuration.
Missing fonts
一些 Windows 10 设备上没有默认安装Meriryo字体,这会导致字体回退测试的失败。 要安装Meiryo字体:
- 按下Windows key并搜索 管理可选功能。
- 单击添加功能
- 选择Japanese Supplemental Fonts并单击 安装
Pixel measurements
要配置缩放比:
- 按下Windows key并搜索显示设置.