-
Notifications
You must be signed in to change notification settings - Fork 265
/
Copy pathkarma.conf.js
78 lines (60 loc) · 1.51 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
const istanbul = require('browserify-istanbul');
const isparta = require('isparta');
const karmaBaseConfig = {
basePath: '../',
singleRun: true,
frameworks: ['jasmine', 'browserify'],
preprocessors: {
'app/js/**/*.js': ['browserify', 'coverage'],
'test/**/*.js': ['browserify']
},
browsers: ['Chrome'],
reporters: ['progress', 'coverage'],
autoWatch: true,
browserify: {
debug: true,
extensions: ['.js'],
transform: [
'babelify',
'browserify-ngannotate',
'bulkify',
istanbul({
instrumenter: isparta,
ignore: ['**/node_modules/**', '**/test/**']
})
]
},
proxies: {
'/': 'http://localhost:9876/'
},
urlRoot: '/__karma__/',
files: [
// app-specific code
'app/js/main.js',
// 3rd-party resources
'node_modules/angular-mocks/angular-mocks.js',
// test files
'test/unit/**/*.js'
]
};
const customLaunchers = {
chrome: {
base: 'SauceLabs',
browserName: 'chrome'
}
};
const ciAdditions = {
sauceLabs: {
testName: 'Karma Unit Tests',
startConnect: false,
build: process.env.TRAVIS_BUILD_NUMBER,
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
},
browsers: Object.keys(customLaunchers),
customLaunchers: customLaunchers,
reporters: ['progress', 'coverage', 'saucelabs']
};
module.exports = function(config) {
const isCI = process.env.CI && Boolean(process.env.TRAVIS_PULL_REQUEST);
config.set(isCI ? Object.assign(karmaBaseConfig, ciAdditions) : karmaBaseConfig);
};