]> git.proxmox.com Git - pve-eslint.git/blame - eslint/karma.conf.js
import 8.4.0 source
[pve-eslint.git] / eslint / karma.conf.js
CommitLineData
eb39fafa 1"use strict";
6f036462 2const os = require("os");
5422a9cc 3const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
eb39fafa 4
34eeec05 5if (os.platform === "linux" && os.arch() === "arm64") {
6f036462
TL
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}
eb39fafa
DC
12
13module.exports = function(config) {
14 config.set({
15
16 // base path that will be used to resolve all patterns (eg. files, exclude)
17 basePath: "",
18
34eeec05
TL
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 },
eb39fafa
DC
28
29 /*
30 * frameworks to use
31 * available frameworks: https://npmjs.org/browse/keyword/karma-adapter
32 */
5422a9cc 33 frameworks: ["mocha", "webpack"],
eb39fafa
DC
34
35
36 // list of files / patterns to load in the browser
37 files: [
eb39fafa
DC
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",
5422a9cc
TL
56 plugins: [
57 new NodePolyfillPlugin()
58 ],
59 resolve: {
60 alias: {
61 "../../../lib/linter$": "../../../build/eslint.js"
62 }
63 },
eb39fafa
DC
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};