-
Notifications
You must be signed in to change notification settings - Fork 2
/
karma.conf.js
72 lines (64 loc) · 2.7 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
const isProductionBuild = process.env.NODE_ENV === 'production';
const shouldWatch = !isProductionBuild;
const shouldSingleRun = isProductionBuild;
const webpackConfig = require('./webpack.config.common');
process.env.CHROME_BIN = require('puppeteer').executablePath();
// known issues with karma and CommonChunksPlugin
// https://github.com/webpack/karma-webpack/issues/24
// https://github.com/webpack-contrib/karma-webpack/issues/22
webpackConfig.plugins[0] = function() {};
module.exports = function(config) {
const logLevel = isProductionBuild ? config.LOG_DEBUG : config.LOG_INFO;
config.set({
basePath: './',
frameworks: ['jasmine'],
files: [
// karma needs these files and (mostly for phantomjs) polyfills first
{ pattern: 'node_modules/reflect-metadata/Reflect.js', watched: false },
{ pattern: 'node_modules/babel-polyfill/browser.js', watched: false },
{ pattern: 'node_modules/zone.js/dist/zone.js', watched: false },
{ pattern: 'node_modules/zone.js/dist/long-stack-trace-zone.js', watched: false },
{ pattern: 'node_modules/zone.js/dist/proxy.js', watched: false },
{ pattern: 'node_modules/zone.js/dist/sync-test.js', watched: false },
{ pattern: 'node_modules/zone.js/dist/jasmine-patch.js', watched: false },
{ pattern: 'node_modules/zone.js/dist/async-test.js', watched: false },
{ pattern: 'node_modules/zone.js/dist/fake-async-test.js', watched: false },
{ pattern: 'node_modules/intl/dist/Intl.js', watched: false },
{ pattern: 'node_modules/intl/locale-data/jsonp/en.js', watched: false },
{ pattern: 'src/**/**/*.spec.js', watched: true }
],
preprocessors: {
'src/**/*.js': ['webpack', 'babel', 'coverage'],
'src/**/*.ts': ['webpack', 'coverage']
},
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/',
outputFile: 'test-results.xml',
suite: 'seed-webapp',
useBrowserName: false
},
coverageReporter: {
type: 'cobertura',
dir: './reports',
subdir: 'coverage'
}
});
};