-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
78 lines (66 loc) · 1.85 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
const path = require('path');
const fs = require('fs');
const browsers = require('./karma.browsers.js');
const webpackConfiguration = require('./webpack.config.js');
const args = process.argv.slice(2);
const isCI = args.length >= 2 && args[1] === '--ci';
if (isCI && !process.env.SAUCE_USERNAME) {
if (!fs.existsSync('sauce.json')) {
console.log('Create a sauce.json with your credentials based on the sauce-sample.json file.');
process.exit(1);
} else {
process.env.SAUCE_USERNAME = require('./sauce').username;
process.env.SAUCE_ACCESS_KEY = require('./sauce').accessKey;
}
}
// Remove default entry point since we're using test-main.js instead
delete webpackConfiguration.entry;
module.exports = function (config) {
// Karma configuration
let configuration = {
files: [
// only specify one entry point
// and require all tests in there
'test/test-main.js',
],
preprocessors: {
// add webpack as preprocessor
'test/test-main.js': ['webpack'],
},
frameworks: ['mocha'],
reporters: ['mocha', 'coverage'],
coverageReporter: {
reporters: [
{ type: 'text' },
{ type: 'html', subdir: 'report-html' },
{ type: 'lcov', subdir: 'report-lcov' },
],
},
istanbulReporter: {
},
webpack: webpackConfiguration,
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox'],
},
},
logLevel: config.LOG_WARN,
autoWatch: true,
singleRun: false,
colors: true,
webpackMiddleware: {
stats: 'errors-only',
},
};
if (process.env.TRAVIS) {
configuration = Object.assign({}, configuration, {
customLaunchers: browsers,
browsers: Object.keys(browsers),
retryLimit: 3,
autoWatch: false,
concurrency: 4,
});
}
config.set(configuration);
};