]> git.proxmox.com Git - pve-eslint.git/blob - eslint/karma.conf.js
buildsys: change upload product to devel
[pve-eslint.git] / eslint / karma.conf.js
1 "use strict";
2 const os = require("os");
3 const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
4
5 if (os.platform === "linux" && os.arch() === "arm64") {
6
7 // For arm64 architecture, install chromium-browser using "apt-get install chromium-browser"
8 process.env.CHROME_BIN = "/usr/bin/chromium-browser";
9 } else {
10 process.env.CHROME_BIN = require("puppeteer").executablePath();
11 }
12
13 module.exports = function(config) {
14 config.set({
15
16 // base path that will be used to resolve all patterns (eg. files, exclude)
17 basePath: "",
18
19 // next three sections allow console.log to work
20 client: {
21 captureConsole: true
22 },
23
24 browserConsoleLogOptions: {
25 terminal: true,
26 level: "log"
27 },
28
29 /*
30 * frameworks to use
31 * available frameworks: https://npmjs.org/browse/keyword/karma-adapter
32 */
33 frameworks: ["mocha", "webpack"],
34
35
36 // list of files / patterns to load in the browser
37 files: [
38 "tests/lib/linter/linter.js"
39 ],
40
41
42 // list of files to exclude
43 exclude: [
44 ],
45
46
47 /*
48 * preprocess matching files before serving them to the browser
49 * available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
50 */
51 preprocessors: {
52 "tests/lib/linter/linter.js": ["webpack"]
53 },
54 webpack: {
55 mode: "none",
56 plugins: [
57 new NodePolyfillPlugin()
58 ],
59 resolve: {
60 alias: {
61 "../../../lib/linter$": "../../../build/eslint.js"
62 }
63 },
64 stats: "errors-only"
65 },
66 webpackMiddleware: {
67 logLevel: "error"
68 },
69
70
71 /*
72 * test results reporter to use
73 * possible values: "dots", "progress"
74 * available reporters: https://npmjs.org/browse/keyword/karma-reporter
75 */
76 reporters: ["mocha"],
77
78 mochaReporter: {
79 output: "minimal"
80 },
81
82 // web server port
83 port: 9876,
84
85
86 // enable / disable colors in the output (reporters and logs)
87 colors: true,
88
89
90 /*
91 * level of logging
92 * possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
93 */
94 logLevel: config.LOG_INFO,
95
96
97 // enable / disable watching file and executing tests whenever any file changes
98 autoWatch: false,
99
100
101 /*
102 * start these browsers
103 * available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
104 */
105 browsers: ["HeadlessChrome"],
106 customLaunchers: {
107 HeadlessChrome: {
108 base: "ChromeHeadless",
109 flags: ["--no-sandbox"]
110 }
111 },
112
113 /*
114 * Continuous Integration mode
115 * if true, Karma captures browsers, runs the tests and exits
116 */
117 singleRun: true,
118
119 /*
120 * Concurrency level
121 * how many browser should be started simultaneous
122 */
123 concurrency: Infinity
124 });
125 };