forked from naver/egjs-view360
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
119 lines (109 loc) · 3.18 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
module.exports = config => {
const karmaConfig = {
frameworks: ["mocha", "chai", "sinon"],
browserNoActivityTimeout: 60000,
// list of files / patterns to load in the browser
files: [
"./node_modules/resemblejs/resemble.js",
"./node_modules/hammer-simulator/index.js",
"./node_modules/webvr-polyfill/build/webvr-polyfill.js",
"./node_modules/webxr-polyfill/build/webxr-polyfill.js",
"./test/hammer-simulator.run.js",
"./test/unit/**/*.spec.js",
{pattern: "./test/manual/img/**/*.*", watched: false, included: false, served: true},
],
proxies: {
"/images/": "/base/test/manual/img/"
},
client: {
mocha: {
opts: "./mocha.opts",
timeout: "20000"
}
},
webpack: {
devtool: "inline-source-map",
resolve: {
extensions: [".ts", ".js"]
},
mode: "none",
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {
"babelrc": false,
"presets": [
[
"@babel/preset-env", {
"targets": {"chrome": "55"},
"debug": true
}
]
],
"plugins": [
"@babel/plugin-transform-modules-commonjs",
["@babel/plugin-proposal-class-properties", {"loose": true}],
]
}
},
{
test: /\.ts$/,
exclude: /node_modules/,
use: {
loader: "ts-loader",
options: {
transpileOnly: true,
compilerOptions: {
module: "es5",
},
}
}
}
]
}
},
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"./test/**/*.spec.js": config.coverage ? ["webpack"] : ["webpack", "sourcemap"]
},
browsers: [],
customLaunchers: {
ChromeHeadlessGL: {
base: "Chrome",
flags: [
"--headless",
"--hide-scrollbars",
"--mute-audio",
"--no-sandbox",
"--disable-setuid-sandbox",
// Without a remote debugging port, Google Chrome exits immediately.
"--remote-debugging-port=9222",
// Although --use-gl=osmesa is not specified. it need to install libosmesa in TRAVIS setting to test sucessfully
]
}
},
reporters: ["mocha"],
webpackMiddleware: {
noInfo: true
}
};
karmaConfig.browsers.push(config.chrome ? "Chrome" : "ChromeHeadlessGL");
if (config.coverage) {
karmaConfig.reporters.push("coverage-istanbul");
karmaConfig.coverageIstanbulReporter = {
reports: ["text-summary", "html", "lcovonly"],
dir: "./coverage"
};
karmaConfig.webpack.module.rules.unshift({
test: /\.ts$/,
exclude: /(node_modules|test)/,
loader: "istanbul-instrumenter-loader"
});
karmaConfig.singleRun = true;
}
config.set(karmaConfig);
};