Test: Add Linux GTK version switch for electron to fix test-node

This commit is contained in:
ayumi-signal 2025-06-18 12:15:30 -07:00 committed by GitHub
parent fb0c414702
commit e69c036c4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -46,7 +46,7 @@
"test": "run-s test-node test-electron test-lint-intl test-eslint",
"test-electron": "node ts/scripts/test-electron.js",
"test-release": "node ts/scripts/test-release.js",
"test-node": "cross-env LANG=en-us electron-mocha --timeout 10000 --file test/setup-test-node.js --recursive ts/test-node ts/test-both",
"test-node": "cross-env LANG=en-us electron-mocha --timeout 10000 --main test/fix-linux-gtk.js --file test/setup-test-node.js --recursive ts/test-node ts/test-both",
"test-mock": "mocha --require ts/test-mock/setup-ci.js ts/test-mock/**/*_test.js",
"test-eslint": "mocha .eslint/rules/**/*.test.js --ignore-leaks",
"test-lint-intl": "ts-node ./build/intl-linter/linter.ts --test",

11
test/fix-linux-gtk.js Normal file
View file

@ -0,0 +1,11 @@
// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
const { app } = require('electron');
if (process.platform === 'linux') {
// eslint-disable-next-line no-console
console.log('Applying electron switch for Linux GTK version --gtk-version=3');
// https://github.com/electron/electron/issues/46538#issuecomment-2808806722
app.commandLine.appendSwitch('gtk-version', '3');
}