forked from ipfs/ipfs-companion
-
Notifications
You must be signed in to change notification settings - Fork 4
/
karma.conf.js
63 lines (62 loc) · 1.53 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
const reporters = ['mocha', 'coverage']
if (process.env.COVERALLS_REPO_TOKEN) {
reporters.push('coveralls')
}
module.exports = function (config) {
config.set({
singleRun: true,
concurrency: Infinity,
browsers: ['Firefox'],
frameworks: ['mocha', 'chai', 'sinon'],
reporters,
coverageReporter: {
dir: 'build/coverage',
reporters: [
{
type: 'lcov',
subdir: 'lcov'
},
{
type: 'html',
subdir (browser) {
// normalization process to keep a consistent browser name
// across different OS
return browser.toLowerCase().split(/[ /-]/)[0]
}
}, { type: 'text-summary' }
]
},
files: [
'node_modules/sinon-chrome/bundle/sinon-chrome-webextensions.min.js',
'test/unit/*.shim.js',
'add-on/src/lib/*.js',
'add-on/dist/background/*.js',
'test/unit/*.test.js'
],
preprocessors: {
'add-on/dist/**/*.js': ['babel', 'coverage']
},
babelPreprocessor: {
options: {
presets: ['es2017'],
sourceMap: 'inline'
},
filename: function (file) {
return file.originalPath.replace(/\.js$/, '.es2017.js')
},
sourceFileName: function (file) {
return file.originalPath
}
},
plugins: [
'karma-babel-preprocessor',
'karma-coveralls',
'karma-coverage',
'karma-firefox-launcher',
'karma-chai',
'karma-sinon',
'karma-mocha',
'karma-mocha-reporter'
]
})
}