我正在尝试在Gitlab Runner计算机上运行单元测试,我的单元测试命令为npm run test:unit
。这将为我拥有的Angular 10应用程序运行Karma单元测试。
但是运行该命令后,出现以下错误:
27 10 2020 00:00:31.695:ERROR [launcher]: Cannot start Chrome
/builds/platform-one/products/cybertron/cyberlynx-jhi-fe/node_modules/puppeteer/.local-chromium/linux-686378/chrome-linux/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory
我当前无法编辑运行代码的Gitlab运行程序/服务器。有什么办法可以暂时禁止我的业力测试运行Chrome吗?
这是我的karma.conf.js文件:
process.env.CHROME_BIN = require('puppeteer').executablePath()
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-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/angular-testing'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
customLaunchers: {
'ChromeHeadless': {
base: 'Chrome',
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--remote-debugging-port=9222'
]
}
},
singleRun: false,
restartOnFileChange: true
});
};