You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updating to Windows > 10.0.17666 (Windows 10 1809 or Windows Server 2019), then running GitHub Desktop tests (yarn test), leads to failed tests related to Electron's NativeTheme API:
FAIL app/test/unit/git-store-test.ts
● Test suite failed to run
TypeError: Cannot read property 'addListener' of undefined
20 | }
21 |
> 22 | remote.nativeTheme.addListener('updated', this.onThemeNotificationFromOS)
| ^
23 | }
24 |
25 | private onThemeNotificationFromOS = (event: string, userInfo: any) => {
at ThemeChangeMonitor.subscribe (src/ui/lib/theme-change-monitor.ts:22:24)
at new ThemeChangeMonitor (src/ui/lib/theme-change-monitor.ts:10:10)
at Object.<anonymous> (src/ui/lib/theme-change-monitor.ts:44:35)
at Object.<anonymous> (src/lib/stores/app-store.ts:65:1)
at Object.<anonymous> (src/lib/stores/index.ts:2:1)
at Object.<anonymous> (test/unit/git-store-test.ts:10:1)
The reason this problem only starts to appear now, is that the AppVeyor pipeline has been running on Visual Studio 2015 (Windows Server 2012 R2) until now, and when upgrading to Visual Studio 2019 (Windows Server 2019), the function isWindows10And1809Preview17666OrLater()returns true because build 17763 (Server 2019) > 17666.
A solution I can think of is to check whether remote.nativeTheme exists, as it's undefined in test environments apparently (it does work as expected when manually running the GitHub Desktop app on Windows 10 >1809, just not in yarn test). Not sure if it's the best solution, but it does make the tests pass. I'm attaching a PR for consideration by the GitHub Desktop team, feel free to decline if you think there's a better solution to resolve this issue.
Version & OS
Open 'About GitHub Desktop' menu to see the Desktop version. Also include what operating system you are using.
Steps to reproduce the behavior
Run Windows 1809 (or later) or Windows Server 2019 (or later), since these builds have numbers 17763 (higher than 17666)
Run yarn test, then the error above will show up
Expected behavior
Tests should pass without errors
Actual behavior
Multiple tests that are related to Electron's NativeTheme API fail both on client devices and the build pipeline (AppVeyor)
thanks for documenting this so well @dennisameling ! i made a fix in #9709 after doing a little research. would you take a look and see if that works for you?
Describe the bug
Updating to Windows > 10.0.17666 (Windows 10 1809 or Windows Server 2019), then running GitHub Desktop tests (
yarn test
), leads to failed tests related to Electron's NativeTheme API:Commit: dennisameling@9771d64
AppVeyor pipeline: https://ci.appveyor.com/project/dennisameling/desktop/builds/32639417/job/fqktr9tpr2fnjqid#L477
The reason this problem only starts to appear now, is that the AppVeyor pipeline has been running on Visual Studio 2015 (Windows Server 2012 R2) until now, and when upgrading to Visual Studio 2019 (Windows Server 2019), the function
isWindows10And1809Preview17666OrLater()
returns true because build 17763 (Server 2019) > 17666.A solution I can think of is to check whether
remote.nativeTheme
exists, as it's undefined in test environments apparently (it does work as expected when manually running the GitHub Desktop app on Windows 10 >1809, just not inyarn test
). Not sure if it's the best solution, but it does make the tests pass. I'm attaching a PR for consideration by the GitHub Desktop team, feel free to decline if you think there's a better solution to resolve this issue.Version & OS
Open 'About GitHub Desktop' menu to see the Desktop version. Also include what operating system you are using.
Steps to reproduce the behavior
yarn test
, then the error above will show upExpected behavior
Tests should pass without errors
Actual behavior
Multiple tests that are related to Electron's NativeTheme API fail both on client devices and the build pipeline (AppVeyor)
Screenshots
N/A
Logs
AppVeyor pipeline logs: https://ci.appveyor.com/project/dennisameling/desktop/builds/32639417/job/fqktr9tpr2fnjqid#L477
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: