docs: details to run unit tests on Windows (#21840)

* document how to get unit tests running

* chore: fix styles

* chore: add lang fence

Co-authored-by: Cheng Zhao <zcbenz@github.com>
This commit is contained in:
bitdisaster 2020-01-23 17:51:09 -08:00 committed by Cheng Zhao
parent 74acd17771
commit 467d7457be

View file

@ -11,6 +11,7 @@ as well as unit and integration tests. To learn more about Electron's
coding style, please see the [coding-style](coding-style.md) document. coding style, please see the [coding-style](coding-style.md) document.
## Linting ## Linting
To ensure that your JavaScript is in compliance with the Electron coding To ensure that your JavaScript is in compliance with the Electron coding
style, run `npm run lint-js`, which will run `standard` against both style, run `npm run lint-js`, which will run `standard` against both
Electron itself as well as the unit tests. If you are using an editor Electron itself as well as the unit tests. If you are using an editor
@ -44,11 +45,29 @@ would run `npm run test -- -g ipc`.
[standard-addons]: https://standardjs.com/#are-there-text-editor-plugins [standard-addons]: https://standardjs.com/#are-there-text-editor-plugins
### Testing on Windows 10 devices ### Testing on Windows 10 devices
#### Extra steps to run the unit test:
1. Visual Studio 2019 must be installed.
2. Node headers have to be compiled for your configuration.
```powershell
ninja -C out\Testing third_party\electron_node:headers
```
3. The electron.lib has to be copied as node.lib.
```powershell
cd out\Testing
mkdir gen\node_headers\Release
copy electron.lib gen\node_headers\Release\node.lib
```
#### Missing fonts
[Some Windows 10 devices](https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list) do not ship with the Meiryo font installed, which may cause a font fallback test to fail. To install Meiryo: [Some Windows 10 devices](https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list) 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_. 1. Push the Windows key and search for _Manage optional features_.
1. Click _Add a feature_. 2. Click _Add a feature_.
1. Select _Japanese Supplemental Fonts_ and click _Install_. 3. Select _Japanese Supplemental Fonts_ and click _Install_.
#### Pixel measurements
Some tests which rely on precise pixel measurements may not work correctly on Some tests which rely on precise pixel measurements may not work correctly on
devices with Hi-DPI screen settings due to floating point precision errors. devices with Hi-DPI screen settings due to floating point precision errors.
@ -56,4 +75,4 @@ To run these tests correctly, make sure the device is set to 100% scaling.
To configure display scaling: To configure display scaling:
1. Push the Windows key and search for _Display settings_. 1. Push the Windows key and search for _Display settings_.
1. Under _Scale and layout_, make sure that the device is set to 100%. 2. Under _Scale and layout_, make sure that the device is set to 100%.