photoprism/frontend/karma.conf.js

72 lines
1.8 KiB
JavaScript

const path = require("path");
const findChrome = require("chrome-finder");
process.env.CHROME_BIN = findChrome();
module.exports = (config) => {
config.set({
logLevel: config.LOG_INFO,
webpackMiddleware: {
stats: "errors-only"
},
frameworks: ["mocha"],
browsers: ["LocalChrome"],
customLaunchers: {
LocalChrome: {
base: "ChromeHeadless",
flags: ["--disable-translate", "--disable-extensions", "--no-sandbox", "--disable-web-security", "--disable-dev-shm-usage"],
},
},
files: [
{pattern: "tests/unit/**/*_test.js", watched: false},
],
// Preprocess through webpack
preprocessors: {
"tests/unit/**/*_test.js": ["webpack"],
},
reporters: ["progress", "html"],
htmlReporter: {
outputFile: "tests/unit.html",
},
webpack: {
mode: "development",
resolve: {
modules: [
path.join(__dirname, "src"),
path.join(__dirname, "node_modules"),
path.join(__dirname, "tests/unit"),
],
alias: {
vue: "vue/dist/vue.min.js",
},
},
module: {
rules: [
{
test: /\.js$/,
loader: "babel-loader",
exclude: file => (
/node_modules/.test(file)
),
query: {
presets: ["@babel/preset-env"],
compact: false,
},
},
],
},
},
singleRun: true,
});
};