-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma.conf.js
66 lines (61 loc) · 1.57 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
/* eslint-disable no-console */
/* eslint-env node */
const { createDefaultConfig } = require('@open-wc/testing-karma'),
merge = require('webpack-merge'),
baseCustomLaunchers = {
FirefoxHeadless: {
base: 'Firefox',
flags: ['-headless']
}
},
sauceCustomLaunchers = {
slChrome: {
base: 'SauceLabs',
browserName: 'chrome',
browserVersion: 'beta',
platformName: 'Windows 10'
}
},
allCustomLaunchers = {
...baseCustomLaunchers,
...sauceCustomLaunchers
};
module.exports = config => {
const useSauce = process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY,
customLaunchers = useSauce ? allCustomLaunchers : baseCustomLaunchers;
if (!useSauce) {
console.warn('Missing SAUCE_USERNAME/SAUCE_ACCESS_KEY, skipping sauce.');
}
config.set(
merge(createDefaultConfig(config), {
browsers: Object.keys(customLaunchers),
customLaunchers,
files: [
// runs all files ending with .test in the test folder,
// can be overwritten by passing a --grep flag. examples:
//
// npm run test -- --grep test/foo/bar.test.js
// npm run test -- --grep test/bar/*
{
pattern: config.grep ? config.grep : 'test/**/*.test.js',
type: 'module'
}
],
coverageIstanbulReporter: {
thresholds: {
emitWarning: true // set to `true` to not fail the test command when thresholds are not met
}
},
esm: {
nodeResolve: true
},
sauceLabs: {
testName: 'Web App Unit Tests'
},
reporters: ['dots', 'saucelabs'],
singleRun: true
// you can overwrite/extend the config further
})
);
return config;
};