-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
90 lines (79 loc) · 2.13 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
79
80
81
82
83
84
85
86
87
88
89
90
'use strict';
/* eslint-disable */
const path = require('path');
const fs = require('fs');
const os = require('os');
const glob = require('glob');
const webpackTestConfig = require('./test/webpack.test.config.js');
const bundlePath = path.join(os.tmpdir(), `webpack.test.bundle.${(new Date()).getTime()}.js`);
module.exports = (config) => {
const requires = [];
const testFiles = glob.sync('test/**/*.test.ts');
requires.push(...testFiles.map((file) => `require('${path.resolve(file)
.replace(/\\/g, '\\\\')
.replace(/.ts$/, '')}');`));
fs.writeFileSync(bundlePath, requires.join('\n'));
const reporters = ['coverage-istanbul', 'brief'];
if (config.coverage === false) {
reporters.shift();
}
config.set({
basePath: '',
colors: true,
concurrency: 1,
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-setuid-sandbox'],
},
},
frameworks: ['jasmine'],
reporters,
files: [
path.resolve('node_modules', 'regenerator-runtime', 'runtime.js'),
path.resolve('node_modules', '@webcomponents', 'webcomponentsjs', 'custom-elements-es5-adapter.js'),
bundlePath,
],
preprocessors: {
[bundlePath]: ['webpack'],
},
mime: {
'text/x-typescript': ['ts', 'tsx'],
},
webpack: webpackTestConfig,
webpackMiddleware: {
stats: 'errors-only',
},
briefReporter: {
earlyErrorReport: true,
omitExternalStackFrames: true,
renderOnRunCompleteOnly: true,
},
coverageIstanbulReporter: {
reports: ['html', 'text-summary'],
dir: path.resolve('.', 'coverage'),
combineBrowserReports: true,
fixWebpackSourcePaths: true,
'report-config': {
html: {
subdir: 'html',
},
},
thresholds: {
emitWarning: false,
global: {
statements: 90,
lines: 90,
branches: 75,
functions: 90,
},
each: {
branches: 75,
functions: 75,
lines: 75
},
},
},
});
};