This repository has been archived by the owner on Apr 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathkarma.conf.js
105 lines (98 loc) · 2.47 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
const webpackMerge = require('webpack-merge');
const commonConfig = require('./build/webpack/webpack.common.config.js');
const componentsToTest = [
'browser',
'components/n-ui/ads',
'components/n-ui/tracking',
'components/n-ui/speedcurve-lux'
];
module.exports = function (karma) {
const config = {
basePath: '',
frameworks: ['mocha', 'chai', 'sinon', 'sinon-chai'],
files: [require('./server/lib/asset-manager/polyfill-io').enhanced].concat(
componentsToTest.map(name => name + '/**/*.spec.js')
),
preprocessors: componentsToTest.reduce((obj, name) => {
obj[name + '/**/*.spec.js'] = ['webpack', 'sourcemap'];
return obj;
}, {}),
webpack: webpackMerge(commonConfig(['commonOptions', ['es5', { karmaTest: true }]]), {
devtool: 'inline-source-map'
}),
webpackMiddleware: {
stats: 'errors-only',
noInfo: true
},
reporters: ['progress'],
port: 9876,
colors: true,
// possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG
logLevel: karma.LOG_INFO,
browsers: ['ChromeHeadless'],
plugins: [
require('karma-mocha'),
require('karma-chai'),
require('karma-sinon'),
require('karma-sinon-chai'),
require('karma-sourcemap-loader'),
require('karma-webpack'),
require('karma-chrome-launcher'),
require('karma-browserstack-launcher'),
require('karma-html-reporter')
],
client: {
mocha: {
reporter: 'html',
ui: 'bdd',
timeout: 0
}
},
captureTimeout: 1000 * 60,
singleRun: true,
browserNoActivityTimeout: 50000,
browserDisconnectTolerance: 3,
autoWatch: false
};
if (process.env.CI) {
config.browserStack = {
username: process.env.BROWSERSTACK_USER,
accessKey: process.env.BROWSERSTACK_KEY,
project: 'n-ui',
name: 'Unit Tests'
};
config.customLaunchers = {
chromeLatest: {
base: 'BrowserStack',
browser: 'chrome',
browser_version: 'latest',
os: 'Windows',
os_version: '10'
},
firefoxLatest: {
base: 'BrowserStack',
browser: 'firefox',
browser_version: 'latest',
os: 'Windows',
os_version: '10'
},
ie11: {
base: 'BrowserStack',
browser: 'IE',
browser_version: '11',
os: 'Windows',
os_version: '7'
},
safari: {
base: 'BrowserStack',
os: 'OS X',
os_version: 'High Sierra',
browser: 'Safari',
browser_version: 'latest'
}
};
config.browsers = Object.keys(config.customLaunchers);
config.reporters.push('BrowserStack');
}
karma.set(config);
};