-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.ts
73 lines (68 loc) · 2.14 KB
/
karma.conf.ts
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
/// <reference path="node_modules/@types/node/index.d.ts" />
/// <reference path="node_modules/typescript/lib/lib.es2017.d.ts" />
import * as _ from 'lodash';
import { Config } from 'karma';
import { Configuration } from 'webpack';
import webpackConfig = require('./webpack.config');
export = (config: any) => {
const karma: Config = config;
karma.set({
files: [
{ pattern: 'src/i18n/*.json', included: false },
{ pattern: 'build/libs.js', watched: false },
{ pattern: 'src/spec.module.js' },
],
preprocessors: {
'**/spec.module.js': ['webpack', 'sourcemap']
},
browsers: ['Nightmare'],
frameworks: [
'jasmine',
],
reporters: ['progress'],
});
config.set({
proxies: {
'/i18n': '/base/src/i18n',
},
mime: {
'text/x-typescript': ['ts', 'tsx'],
},
nightmareOptions: {
width: 800,
height: 600,
show: false,
devTools: false
},
webpack: webpackConfig({ hmr: false, test: true }),
webpackMiddleware: {
stats: 'minimal'
}
});
if (process.argv.indexOf('--coverage') !== -1) {
const testResultsOutput = __dirname + '/.testresults';
config.set({
reporters: ['mocha', 'html', 'junit', 'coverage', 'remap-coverage'],
coverageReporter: {
type: 'in-memory'
},
remapCoverageReporter: {
'text-summary': null,
json: `${testResultsOutput}/coverage.json`,
html: `${testResultsOutput}/coverage`
},
htmlReporter: {
outputDir: testResultsOutput,
namedFiles: true,
reportName: 'index',
pageTitle: 'jstest',
},
junitReporter: {
outputDir: testResultsOutput,
outputFile: 'junit.xml',
useBrowserName: false
},
webpack: webpackConfig({ hmr: false, test: true, coverage: true }),
});
}
};