Files
git.stella-ops.org/src/Web/StellaOps.Web/karma.conf.cjs
2025-10-28 15:10:40 +02:00

64 lines
1.7 KiB
JavaScript

const { join } = require('path');
const { resolveChromeBinary } = require('./scripts/chrome-path');
const { env } = process;
const chromeBin = resolveChromeBinary(__dirname);
if (chromeBin) {
env.CHROME_BIN = chromeBin;
} else if (!env.CHROME_BIN) {
console.warn(
'[karma] Unable to locate a Chromium binary automatically. ' +
'Set CHROME_BIN or STELLAOPS_CHROMIUM_BIN, or place an offline build under .cache/chromium/. ' +
'See docs/DeterministicInstall.md for bootstrap instructions.'
);
}
const isCI = env.CI === 'true' || env.CI === '1';
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false
},
jasmineHtmlReporter: {
suppressAll: true
},
coverageReporter: {
dir: join(__dirname, './coverage/stellaops-web'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
browsers: ['ChromeHeadlessOffline'],
customLaunchers: {
ChromeHeadlessOffline: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox'
]
}
},
restartOnFileChange: false
});
};