-
Notifications
You must be signed in to change notification settings - Fork 2
/
karma.config.js
93 lines (79 loc) · 2.07 KB
/
karma.config.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
const assign = require('lodash.assign')
const pkg = require('./package.json')
const webpackConfig = require('./webpack.config.dev')
webpackConfig.devtool = 'inline-source-map'
const options = {
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai-as-promised', 'sinon-chai'],
files: [
'./node_modules/babel-polyfill/dist/polyfill.js',
'test/**/*.js',
],
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'./test/**/*.js': ['webpack', 'sourcemap'],
},
webpack: webpackConfig,
webpackMiddleware: {
// webpack-dev-middleware configuration
noInfo: true,
colors: true,
timings: true,
chunks: false,
chunkModules: false,
modules: false,
},
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec', 'coverage'],
coverageReporter: {
dir: 'coverage',
reporters: [
{ type: 'lcovonly', subdir: '.', file: 'lcov.info' },
{ type: 'json', subdir: '.', file: 'coverage.json' },
{ type: 'text' },
{ type: 'text-summary' },
{ type: 'html' },
],
},
singleRun: true,
colors: true,
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-chai',
'karma-mocha',
'karma-sinon-chai',
'karma-chai-as-promised',
'karma-sauce-launcher',
'karma-sourcemap-loader',
'karma-coverage',
'karma-spec-reporter',
'karma-webpack',
],
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome', 'Firefox'],
}
const customLaunchers = {
sl_ie: {
base: 'SauceLabs',
browserName: 'internet explorer',
},
}
if (process.env.TRAVIS) {
assign(options, {
sauceLabs: {
testName: pkg.name,
},
customLaunchers,
browsers: Object.keys(customLaunchers),
reporters: ['spec', 'coverage', 'saucelabs'],
})
}
if (process.env.CI_NAME === 'codeship') {
assign(options, {
reporters: ['spec', 'coverage'],
})
}
module.exports = function (config) {
config.set(options)
}