-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkarma.conf.js
77 lines (69 loc) · 2.01 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
var path = require('path');
var hasCoverage = global.process.argv.reduce(function (result, arg) {
return arg.indexOf('coverage') !== -1 || result;
});
var include = [
path.resolve('./src')
];
var preLoaders = hasCoverage ? [
// Process test code with Babel
{test: /_spec\.js$/, loader: 'babel', include: include},
// Process all non-test code with Isparta
{test: /\.js$/, loader: 'isparta', include: include, exclude: /_spec\.js$/}
] : [
{test: /\.js$/, loader: 'babel', include: include}
];
var loaders = [
{test: /\.scss$/,loaders: ["style", "css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]", "autoprefixer-loader", "sass"]},
{test: /\.css$/,loaders: ["style", "css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]"]},
{test: /\.png$/, loader: 'null'},
{test: /\.jpg$/, loader: 'null'},
// Loader for JSON, may be used in some tests
{test: /\.json$/, loader: 'json'},
// Need some real loaders for HTML, because angular directives are coupled with templates
{test: /\.pug/, loader: "pug-html-loader" },
{ test: /\.html$/, loader: "html" },
];
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'spec.js'
],
webpack: {
devtool: 'eval',
module: {
loaders: loaders,
preLoaders: preLoaders
},
cache: true
},
webpackMiddleware: {
stats: {
chunkModules: false,
colors: true
}
},
preprocessors: {
'spec.js': ['webpack']
},
reporters: ['progress', 'coverage'],
coverageReporter: {
dir: 'coverage/',
subdir: '.',
reporters: [
{type: 'cobertura', file: 'cobertura.xml'},
{type: 'text', file: 'text.txt'},
{type: 'text-summary', file: 'text-summary.txt'},
{type: 'html'}
]
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['PhantomJS'],
singleRun: true
});
};