-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma.conf.js
70 lines (65 loc) · 1.78 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
const ENV = process.env.npm_lifecycle_event;
const WATCH = ENV === 'test:watch';
module.exports = function (config) {
const CONFIGURATION = {
frameworks: ['jasmine', 'karma-typescript'],
files: [{
pattern: 'base.spec.ts'
},
{
pattern: 'src/**/*.+(ts|html)'
}
],
preprocessors: {
'**/*.ts': ['karma-typescript']
},
karmaTypescriptConfig: {
bundlerOptions: {
entrypoints: /\.spec\.ts$/,
transforms: [
require('karma-typescript-angular2-transform')
]
},
compilerOptions: {
lib: ['ES2015', 'DOM']
},
exclude: [
"demo"
]
},
reporters: ['progress', 'karma-typescript'],
browsers: ['Chrome'],
colors: true,
logLevel: config.LOG_INFO,
singleRun: !WATCH,
autoWatch: WATCH,
client: {
captureConsole: true
},
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}
};
if (!WATCH) {
CONFIGURATION.karmaTypescriptConfig.coverageOptions = {
instrumentation: true,
exclude: [
/\.(d|spec|test|module)\.ts/,
/\index.ts/,
]
};
CONFIGURATION.karmaTypescriptConfig.reports = {
'text': '',
'text-summary': '',
'html': 'coverage/html',
'lcovonly': 'coverage'
};
}
if (process.env.TRAVIS) {
CONFIGURATION.browsers = ['Chrome_travis_ci'];
}
config.set(CONFIGURATION);
};