-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
98 lines (97 loc) · 2.51 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
import webpack_config from './webpack.config.js';
import path from 'path';
module.exports = (config) =>
config.set({
basePath: '',
frameworks: ['detectBrowsers', 'mocha'],
plugins: [
'karma-mocha',
'karma-webpack',
'karma-mocha-own-reporter',
'karma-ie-launcher',
'karma-firefox-launcher',
'karma-chrome-launcher',
'karma-safari-launcher',
'karma-opera-launcher',
'karma-phantomjs-launcher',
'karma-detect-browsers',
'karma-coverage',
],
files: [
// 'mock/browser-global-vars.js',
require.resolve('mocha-lazy-bdd/dist/mocha-lazy-bdd'),
'mock/mocha-lazy-bdd.js',
// 'node_modules/power-assert/build/power-assert.js',
// 'src/**/*.js',
'test/**/*.js',
],
exclude: ['**/*.swp'],
preprocessors: {
// 'src/**/*.js': ['webpack', 'coverage'],
'test/**/*.js': ['webpack'],
},
webpack: {
devtool: 'inline-source-map',
module: {
loaders: webpack_config.module.loaders,
postLoaders: [
{
test: /\.js$/,
include: path.resolve('./src/'),
loader: 'istanbul-instrumenter',
},
],
},
},
babelPreprocessor: {
options: {
presets: ['es2015'],
plugins: ['babel-plugin-espower'],
sourceMap: true,
},
filename: (file) => file.originalPath.replace(/\.js$/, '.es5.js'),
sourceFileName: (file) => file.originalPath,
},
coverageReporter: {
reporters: [{type: 'lcov'}],
instrumenters: {isparta: require('isparta')},
instrumenter: {
'**/*.js': 'isparta',
},
instrumenterOptions: {
isparta: {
babel: {
presets: ['power-assert'],
sourceMap: true,
},
},
},
},
reporters: ['mocha-own', 'coverage'],
detectBrowsers: {
postDetection: function(availableBrowsers) {
const result = availableBrowsers;
if (process.env.TRAVIS) {
const chrome_index = availableBrowsers.indexOf('Chrome');
if (chrome_index >= 0) {
result.splice(chrome_index, 1);
result.push('Chrome_travis_ci');
}
}
return result;
},
},
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox'],
},
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: [],
singleRun: false,
concurrency: Infinity,
});