-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathkarma.conf.js
95 lines (73 loc) · 2.26 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
/**
* @author Damien Dell'Amico <damien.dellamico@gmail.com>
* @copyright Copyright (c) 2016
* @license GPL-3.0
*/
// Reference: http://karma-runner.github.io/0.13/config/configuration-file.html
var webpackConfig = require('./webpack.config.js');
module.exports = function karmaConfig(config) {
var configuration = {
// base path that will be used to resolve all patterns (e.g. files, exclude)
basePath: '.',
// Karma’s "context" html file with an <ion-app></ion-app> injected
customContextFile: './test/karma-static/context.html',
// Karma’s "debug" html file with an <ion-app></ion-app> injected
customDebugFile: './test/karma-static/debug.html',
frameworks: [
// Set framework to jasmine
'jasmine'
],
reporters: [
// Reference: https://github.com/mlex/karma-spec-reporter
// Set reporter to print detailed results to console
'spec',
// Reference: https://github.com/karma-runner/karma-coverage
// Output code coverage files
'coverage'
],
/*
* list of files / patterns to load in the browser
*
* we are building the test environment in ./spec-bundle.js
*/
files: [{ pattern: './test/index.js', watched: false }],
// list of files to exclude
exclude: [
'node_modules/angular2/**/*_spec.js',
'node_modules/ionic-angular/**/*spec*'
],
preprocessors: { './test/index.js': ['coverage', 'webpack', 'sourcemap'] },
browsers: [
'Chrome'
],
browserNoActivityTimeout: 30000,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Configure code coverage reporter
coverageReporter: {
dir: 'coverage/',
type: 'html'
},
// Test webpack config
webpack: webpackConfig,
// Hide webpack build information from output
webpackMiddleware: {
noInfo: true
},
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
/*
* Continuous Integration mode
* if true, Karma captures browsers, runs the tests and exits
*/
singleRun: true
};
if(process.env.TRAVIS){
configuration.browsers = ['Chrome_travis_ci'];
}
config.set(configuration);
};