-
Notifications
You must be signed in to change notification settings - Fork 281
/
karma.conf.js
89 lines (82 loc) · 2.85 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
const path = require("path");
module.exports = function(config) {
var customLaunchers = {
ChromeHeadlessTravis: {
base: "ChromeHeadless",
flags: ['--no-sandbox']
}
};
var configuration = {
frameworks: ["jasmine"],
files: [
{pattern: './ci/spec-bundle.js', watched: false}
],
preprocessors: {
'./ci/spec-bundle.js': ['webpack'],
},
webpackMiddleware: {
scripts: 'errors-only'
},
webpack: {
devtool: "inline-source-map",
mode: "development",
resolve: {
extensions: ['.ts', '.js', '.mjs'],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
"@jsdevtools/coverage-istanbul-loader",
{loader: 'ts-loader', options: {transpileOnly: true}}
]
},
{
test: /\.m?js$/,
exclude: /node_modules/,
use: [{loader: 'babel-loader', options: {presets: ['@babel/preset-env']}}]
}
]
},
},
mime: {
'text/x-typescript': ['ts', 'tsx']
},
reporters: ["progress", "coverage-istanbul"],
coverageIstanbulReporter: {
reports: ['text', 'text-summary', "lcovonly"],
dir: path.join(__dirname, "coverage"),
combineBrowserReports: true,
fixWebpackSourcePaths: true,
},
browsers: ["ChromeHeadless", "FirefoxHeadless"],
customLaunchers: customLaunchers,
singleRun: true,
concurrency: 2,
plugins: [
'karma-jasmine',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-webpack',
'karma-coverage-istanbul-reporter'
]
};
if (process.env.TRAVIS) {
configuration.browsers = ['ChromeHeadlessTravis', 'FirefoxHeadless'];
}
if (process.env.SAUCE && process.env.SAUCE_USERNAME) {
var currentBrowsers = configuration.browsers;
var sauceBrowsers = Object.keys(customLaunchers).filter((s) => s.startsWith('sl_'));
configuration.browsers = currentBrowsers.concat(sauceBrowsers);
if (process.env.TRAVIS) {
var buildNumber = process.env.TRAVIS_BUILD_NUMBER;
var travisBuildId = process.env.TRAVIS_BUILD_ID;
var buildId = `TRAVIS ${buildNumber} (${travisBuildId})`;
configuration.sauceLabs.build = buildId;
configuration.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
}
}
config.set(configuration);
}