This repository has been archived by the owner on Nov 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
55 lines (47 loc) · 1.58 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
const isProductionBuild = process.env.NODE_ENV === 'production';
const shouldWatch = !isProductionBuild;
const shouldSingleRun = isProductionBuild;
const browser = isProductionBuild ? 'PhantomJS' : 'Chrome';
const webpackConfig = require('./webpack.config.common');
// use this to allow spec.ts to be processed by Karma.
// better way to do this?
webpackConfig.module.loaders[0].exclude = [];
// known issue with karma and CommonChunksPlugin
// https://github.com/webpack/karma-webpack/issues/24
webpackConfig.plugins[0] = function() {};
module.exports = function(config) {
const logLevel = isProductionBuild ? config.LOG_DEBUG : config.LOG_INFO;
config.set({
basePath: './',
frameworks: ['jasmine'],
files: [
// pull in PhantomJS polyfills
// https://github.com/wallabyjs/public/issues/542
{ pattern: 'node_modules/reflect-metadata/Reflect.js', watched: false },
{ pattern: 'node_modules/babel-polyfill/browser.js', watched: false },
{ pattern: 'src/**/*.spec.ts', watched: false }
],
preprocessors: {
'**/*.spec.ts': ['webpack', 'coverage']
},
webpack: webpackConfig,
reporters: ['progress', 'dots', 'junit', 'coverage'],
port: 9876,
logLevel: logLevel,
autoWatch: shouldWatch,
browsers: [browser],
singleRun: shouldSingleRun,
concurrency: Infinity,
junitReporter: {
outputDir: './reports/',
outputFile: 'test-results.xml',
suite: 'as-webapp',
useBrowserName: false
},
coverageReporter: {
type: 'cobertura',
dir: './reports',
subdir: 'coverage'
}
});
};