forked from walterra/d3-milestones
/
karma.config.js
82 lines (76 loc) · 1.88 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
const buble = require('rollup-plugin-buble');
const tapSpec = require('tap-spec');
const { eslint } = require('rollup-plugin-eslint');
const nodeResolve = require('rollup-plugin-node-resolve');
module.exports = (config) => {
const configuration = {
autoWatch: false,
// client: { captureConsole: false },
browsers: [ 'Chrome' ],
browserConsoleLogOptions: {
level: 'error',
format: '%b %T: %m',
terminal: false
},
colors: true,
files: [
'build/d3-milestones.css',
'build/tape.js',
{ pattern: 'test/*-test.js', watched: false }
],
frameworks: ['tap'],
// logLevel: config.LOG_DEBUG,
logLevel: config.LOG_ERROR,
plugins: [
'karma-rollup-preprocessor',
'karma-tap',
'karma-tap-pretty-reporter',
'karma-chrome-launcher'
],
preprocessors: {
'test/*-test.js': [ 'rollup' ]
},
reporters: ['tap-pretty'],
rollupPreprocessor: {
// context: 'this',
external: ['tape'],
output: {
format: 'iife',
globals: {
'tape': 'tape'
},
sourcemap: 'inline'
},
plugins: [
eslint({
exclude: [
'src/styles/**',
]
}),
nodeResolve(),
buble()
]
},
singleRun: true,
tapReporter: {
prettify: tapSpec
}
};
if (process.env.TRAVIS) {
configuration.autoWatch = false;
configuration.browsers = ['Chrome_travis_ci'];
configuration.customLaunchers = {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
};
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
configuration.singleRun = true;
// Concurrency level
// how many browser should be started simultaneous
configuration.concurrency = Infinity;
}
config.set(configuration);
};