forked from userdive/agent.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.ts
102 lines (97 loc) · 2.46 KB
/
karma.conf.ts
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
import * as objectAssign from 'object-assign'
import * as puppeteer from 'puppeteer'
import { customLaunchers } from './browser-providers.conf'
let override = {}
if (
process.env.SAUCE_USERNAME &&
process.env.SAUCE_ACCESS_KEY &&
process.env.CI_MODE === 'sauce'
) {
override = objectAssign(
{},
{
sauceLabs: {
testName: '@userdive/agent',
recordVideo: false,
recordScreenshots: false,
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
commandTimeout: 600,
idleTimeout: 600,
maxDuration: 5400,
},
concurrency: 2,
browserDisconnectTimeout: 300000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 300000,
customLaunchers,
browsers: Object.keys(customLaunchers),
reporters: ['mocha', 'coverage-istanbul', 'saucelabs'],
}
)
} else {
process.env.CHROME_BIN = puppeteer.executablePath()
override = objectAssign(
{},
{
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-web-security', '--enable-gpu'],
},
},
browsers: [
process.env.CI_MODE === 'IE' ? 'IE' : 'ChromeHeadlessNoSandbox',
],
reporters: ['mocha', 'coverage-istanbul'],
}
)
}
export const createSettings = (pattern: string = `test/**/*.test.ts`) =>
objectAssign(
{},
{
mime: {
'text/x-typescript': ['ts'],
},
basePath: '',
frameworks: ['mocha', 'fixture'],
files: [{ pattern }],
preprocessors: {
[pattern]: ['webpack'],
},
webpack: {
module: {
rules: [
{
test: /\.ts$/,
use: ['webpack-espower-loader', 'ts-loader'],
},
{
test: /\.ts$/,
enforce: 'post',
use: { loader: 'istanbul-instrumenter-loader' },
exclude: [/node_modules/, /test/],
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
node: { fs: 'empty' },
mode: 'development',
},
coverageIstanbulReporter: {
reports: ['html', 'lcovonly', 'text-summary'],
},
webpackMiddleware: {
stats: 'errors-only',
},
mochaReporter: {
showDiff: true,
},
singleRun: true,
},
override
)
export default (config: any) =>
config.set(createSettings(`packages/*/test/**/*.ts`))