homehub/packages/homehub_icons/karma.conf.js
2021-08-26 12:33:15 +02:00

71 lines
1.6 KiB
JavaScript

var path = require('path');
const CONTEXT = path.resolve(__dirname);
const SCSS_DIR = path.resolve(CONTEXT, 'scss');
const PROJECT_DIR = path.resolve(CONTEXT, 'src');
const TESTS_DIR = path.resolve(CONTEXT, 'tests');
const ENTRY_POINT = path.resolve(TESTS_DIR, '__entry__.js');
module.exports = function (config) {
config.set({
basePath: '.',
browsers: ['jsdom'],
frameworks: ['jasmine'],
files: [ENTRY_POINT],
junitReporter: {
outputDir: '',
outputFile: 'test-results.xml',
suite: 'homehub_frontend',
useBrowserName: false,
},
mochaReporter: {
ignoreSkipped: true,
},
preprocessors: {
[ENTRY_POINT]: ['webpack', 'sourcemap'],
},
reporters: ['mocha'],
singleRun: false,
webpack: {
mode: 'development',
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.js?/,
include: PROJECT_DIR,
use: ['babel-loader'],
},
{
test: /\.js$/,
include: TESTS_DIR,
use: ['babel-loader'],
},
{
test: /\.scss$/,
use: ['null-loader'],
},
{
test: /\.(png|svg)$/,
use: ['null-loader'],
},
],
},
resolve: {
alias: {
'scss': SCSS_DIR,
'src': PROJECT_DIR,
'tests': TESTS_DIR,
},
},
externals: {
'cheerio': 'window',
'react/addons': 'react',
'react/lib/ExecutionEnvironment': 'react',
'react/lib/ReactContext': 'react',
},
},
});
};