-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathkarma.conf.js
76 lines (67 loc) · 2.25 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
const isProductionBuild = process.env.NODE_ENV === 'production';
const shouldWatch = !isProductionBuild;
const shouldSingleRun = isProductionBuild;
const srcGlob = './src/**/**/*.js';
const vendorGlob = './src/vendor.js';
const webpackConfig = require('./webpack.config.common');
// known issues with karma and CommonChunksPlugin
// https://github.com/webpack/karma-webpack/issues/24
webpackConfig.plugins[0] = function() {};
process.env.CHROME_BIN = require('puppeteer').executablePath();
// don't fail on eslint errors while developing
webpackConfig.module.rules[0].use[1].options.failOnError = isProductionBuild;
module.exports = function(config) {
const logLevel = isProductionBuild ? config.LOG_DEBUG : config.LOG_INFO;
config.set({
basePath: './',
frameworks: ['jasmine'],
files: [
{ pattern: vendorGlob, watched: false },
{ pattern: './node_modules/angular-mocks/angular-mocks.js', watched: false },
{ pattern: srcGlob, watched: false }
],
preprocessors: {
[srcGlob]: ['webpack'],
[vendorGlob]: ['webpack']
},
webpack: webpackConfig,
reporters: ['progress', 'dots', 'junit', 'coverage'],
port: 9876,
logLevel: logLevel,
autoWatch: shouldWatch,
browsers: ['CustomChromeHeadless'],
customLaunchers: {
CustomChromeHeadless: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-setuid-sandbox'] // https://github.com/Googlechrome/puppeteer/issues/290#issuecomment-322852784
}
},
captureTimeout: 210000, // https://github.com/jasmine/jasmine/issues/1413#issuecomment-334247097
browserDisconnectTolerance: 3,
browserDisconnectTimeout: 210000,
browserNoActivityTimeout: 210000,
singleRun: shouldSingleRun,
concurrency: Infinity,
junitReporter: {
outputDir: './reports/test-results',
outputFile: 'test-results.xml',
suite: 'seed-webapp',
useBrowserName: false
},
coverageReporter: {
reporters: [{
type: 'cobertura',
dir: './reports',
subdir: 'test-coverage/',
file: 'coverage.xml'
}, {
type: 'html',
dir: './reports',
subdir: 'test-coverage/',
file: 'coverage.html'
}, {
type: 'text-summary'
}]
}
});
};