Skip to content

Commit

Permalink
Disable running Firefox from Karma on M1 Macs
Browse files Browse the repository at this point in the history
The old admin UI is on its way out anyway,
so it should be fine to close opencast#3894 with this.
Karma is deprecated anyway, so if we want to fix it properly,
we would need to get a new (frontend) test runner in there,
which I don't see happening.
  • Loading branch information
JulianKniephoff committed Jan 24, 2024
1 parent 0208d6a commit 41c441e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions modules/admin-ui-frontend/test/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const os = require('os');

module.exports = function (config) {
config.set({
basePath : './',
Expand Down Expand Up @@ -71,13 +73,20 @@ module.exports = function (config) {
preferHeadless: true,
// limit the list of browsers used by karma
postDetection: (browsers) => {
const allowed = new Set(['ChromeHeadless', 'FirefoxHeadless']);
const allowed = ['Chrome'];
// Karma can't start FirefoxHeadless on M1 Macs
// See https://github.com/opencast/opencast/issues/3894
const isM1Mac = os.platform() === 'darwin' && os.arch() === 'arm64';
if (!isM1Mac) {
allowed.push('Firefox');
}
const allowedSet = new Set(allowed.map(browser => browser + 'Headless'));
console.info('Detected browsers: ' + browsers);
browsers = browsers.filter(browser => allowed.has(browser));
browsers = browsers.filter(browser => allowedSet.has(browser));
console.info('Usable browsers: ' + browsers);
if (browsers.length < 1) {
console.error('No browsers detected');
console.error('Suggest installing Firefox or other FOSS browser');
console.error('Install one of ' + allowed.join(', '));
throw 'No browsers detected';
}
return browsers;
Expand Down

0 comments on commit 41c441e

Please sign in to comment.