-
Notifications
You must be signed in to change notification settings - Fork 8
/
karma.conf.js
63 lines (62 loc) · 1.72 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
const webpackConfig = require("./webpack.config");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
const webpack = require("webpack");
const path = require("path");
module.exports = function(config) {
config.set({
frameworks: ["detectBrowsers", "mocha"],
files: ["test/*.spec.ts"],
preprocessors: {
// don't use browserify, because it don't support dynamic require.
// and some file is dynamic required in the `stm-lib` package.
"test/*.spec.ts": ["webpack"]
},
singleRun: true,
browserDisconnectTimeout: 60000,
browserDisconnectTolerance: 3,
client: {
mocha: {
timeout: 30000 // 6 seconds - upped from 2 seconds
}
},
plugins: [
"karma-webpack",
"karma-chrome-launcher",
"karma-env-preprocessor",
"karma-firefox-launcher",
"karma-detect-browsers",
"karma-mocha"
],
webpack: {
node: webpackConfig.node,
resolve: webpackConfig.resolve,
module: webpackConfig.module,
output: {
path: path.join(__dirname, "temp")
},
mode: "development",
plugins: [
new NodePolyfillPlugin({
excludeAliases: ["console", "crypto"]
}),
new webpack.IgnorePlugin({
resourceRegExp: /canvas/,
contextRegExp: /jsdom$/
})
]
},
detectBrowsers: {
enabled: true,
usePhantomJS: false,
postDetection(availableBrowser) {
if (availableBrowser.includes("Chrome")) {
return ["ChromeHeadless"];
}
var browsers = ["Chrome", "Firefox"];
return browsers.filter(function(browser) {
return availableBrowser.indexOf(browser) !== -1;
});
}
}
});
};