forked from vue-gl/vue-gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
74 lines (71 loc) · 2.42 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
const rollupPluginIstanbul = require('rollup-plugin-istanbul'); // eslint-disable-line import/no-extraneous-dependencies
const rollupPluginBabel = require('rollup-plugin-babel'); // eslint-disable-line import/no-extraneous-dependencies
const { execSync } = require('child_process');
const { browserStack, saucelabs } = require('./karma.browsers');
module.exports = (config) => {
const options = {
reporters: ['progress', 'coverage'],
frameworks: ['mocha', 'chai', 'js-polyfills'],
files: [
{ pattern: require.resolve('vue/dist/vue'), watched: false },
{ pattern: require.resolve('three'), watched: false },
{ pattern: 'src/index.js', watched: false },
{ pattern: 'test/**/*.spec.js' },
],
jsPolyfills: ['typedarray'],
preprocessors: {
'src/index.js': ['rollup'],
'test/**/*.spec.js': ['babel'],
},
rollupPreprocessor: {
output: {
format: 'iife',
name: 'VueGL',
globals: {
three: 'THREE',
},
sourcemap: 'inline',
intro: execSync('babel-external-helpers -t var'),
},
external: 'three',
plugins: [
rollupPluginIstanbul({ include: 'src/**' }),
rollupPluginBabel(),
],
},
coverageReporter: {
type: 'text-summary',
},
};
if (process.env.CI) {
options.junitReporter = { outputDir: 'junit' };
options.coverageReporter = { type: 'lcovonly', dir: 'coverage' };
options.reporters = ['coverage', 'junit', 'dots'];
options.browserNoActivityTimeout = 60000;
options.client = { mocha: { timeout: 10000 } };
options.browsers = [];
if (process.env.CIRCLE_BRANCH === 'master') {
options.concurrency = 4;
options.reporters.push('saucelabs');
options.sauceLabs = {
testName: 'VueGL unit test',
recordScreenshots: false,
public: 'public restricted',
};
options.customLaunchers = saucelabs;
} else if (process.env.BROWSER_STACK_USERNAME && process.env.BROWSER_STACK_ACCESS_KEY) {
options.concurrency = 2;
options.reporters.push('BrowserStack');
options.browserStack = {
startTunnel: true,
video: false,
};
options.customLaunchers = browserStack;
} else {
options.browsers.push('Chrome', 'Firefox');
}
if (options.customLaunchers) options.browsers.push(...Object.keys(options.customLaunchers));
options.singleRun = true;
}
config.set(options);
};