forked from cBioPortal/cbioportal-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
executable file
·117 lines (98 loc) · 3.05 KB
/
karma.conf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* eslint-disable */
var argv = require('yargs').argv;
process.env.NODE_ENV = 'test';
var webpackConfig = require('./webpack.config');
const webpack = require('webpack');
var path = require('path');
// code which should not impact coverage reports should be listed
// in exclude
// webpackConfig.module.rules.push({
// test: /.tsx?$/,
// include: path.resolve(__dirname, 'src/'),
// exclude: [
// /.spec./,
// /\/shared\/api\//
// ],
// enforce:'post',
// loader: 'istanbul-instrumenter-loader'
// });
//this will be used by in test context to load corresponding spec files if there is a grep passed (or all if not)
webpackConfig.plugins.push(new webpack.DefinePlugin({
'SPEC_REGEXP': ('grep' in argv) ? `/(global|(${argv.grep}[a-z]*))\.spec\./i` : '/\.spec\.(jsx?|tsx?)$/'
}));
webpackConfig.entry = "";
webpackConfig.mode = "development";
if (argv.debug) {
console.log("argv: ",argv);
webpackConfig.devtool = "inline-source-map";
}
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai'],
files: [
{
pattern: './common-dist/common.bundle.js',
watched: false,
served: true
},
{ pattern: "src/**/*.json",
included: false,
watched:false,
served:true
},
'tests.webpack.js'
],
preprocessors: {
// add webpack as preprocessor
'tests.webpack.js': ['webpack', 'sourcemap'],
},
pattern:".spec.",
webpack: webpackConfig,
webpackServer: {
noInfo: true
},
webpackMiddleware: {
// webpack-dev-middleware configuration
// i. e.
stats: 'errors-only'
},
plugins: [
'karma-mocha',
'karma-mocha-reporter',
'karma-chai',
'karma-webpack',
//'karma-phantomjs-launcher',
'karma-chrome-launcher',
'karma-sourcemap-loader',
//'karma-coverage',
'karma-junit-reporter'
],
customLaunchers: {
Chrome_with_debugging: {
base: 'Chrome',
chromeDataDir: path.resolve(__dirname, '.chrome'),
flags: [ '--remote-debugging-port=9333' ]
}
},
// coverageIstanbulReporter: {
// reports: ['text-summary','json-summary','html', 'lcov'],
// dir: './test/fixtures/outputs'
// },
junitReporter: {
outputDir: process.env.JUNIT_REPORT_PATH,
outputFile: process.env.JUNIT_REPORT_NAME,
useBrowserName: false
},
mochaReporter: {
showDiff: true
},
reporters: ['mocha','junit'],
port: 9876,
colors: true,
logLevel: config.LOG_DISABLE,
browsers: ['Chrome'],
//browsers: ['PhantomJS'],
singleRun: !argv.watch,
});
};