This repository was archived by the owner on Sep 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathkarma.conf.js
More file actions
60 lines (55 loc) · 1.56 KB
/
Copy pathkarma.conf.js
File metadata and controls
60 lines (55 loc) · 1.56 KB
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
const path = require('path');
const webpackConfig = require('./webpack.config');
module.exports = config => {
const files = [{ pattern: 'src/index.spec.ts' }];
const webpackOptions = { hmr: false, test: true, coverage: false };
const buildPath = path.join(__dirname, 'dist');
config.set({
preprocessors: {
'**/index.spec.ts': ['webpack', 'sourcemap'],
'**/index.ts': ['coverage'],
},
browsers: ['ChromeCustom'],
customLaunchers: {
ChromeCustom: {
base: 'ChromeHeadless',
// We must disable the Chrome sandbox when running Chrome inside Docker (Chrome's sandbox needs
// more permissions than Docker allows by default)
flags: ['--no-sandbox'],
},
},
frameworks: ['jasmine'],
reporters: ['progress'],
mime: {
'text/x-typescript': ['ts', 'tsx'],
},
port: 9876,
});
if (process.argv.indexOf('--coverage') !== -1) {
const testResultsOutput = `${__dirname}/~testresults`;
webpackOptions.coverage = true;
config.set({
reporters: ['coverage', 'remap-coverage'],
coverageReporter: {
type: 'in-memory',
},
remapCoverageReporter: {
text: null,
// html: `${testResultsOutput}/coverage`
},
});
} else {
files.unshift({
pattern: path.join(buildPath, 'libs.js'),
watched: false,
});
}
const webpackConfiguration = webpackConfig(webpackOptions);
config.set({
files: files,
webpack: webpackConfiguration,
webpackMiddleware: {
stats: webpackConfiguration.stats,
},
});
};