-
Notifications
You must be signed in to change notification settings - Fork 3
/
karmaConf.js
104 lines (81 loc) · 2.69 KB
/
karmaConf.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
'use strict';
var path = require('path');
/**
* Resolves an NPM module path.
*
* @param {String} npmModule The module to resolve
* @return {String} The NPM module absolute path
*/
function resolveModulePath(npmModule) {
return path.dirname(require.resolve(path.join(npmModule, 'package.json')));
}
// Karma configuration
module.exports = function(config) {
var resources = require('./build/ng-components-files.json');
var files = [];
// Libraries
files.push(path.join(resolveModulePath('angular'), 'angular.min.js'));
files.push(path.join(resolveModulePath('angular-animate'), 'angular-animate.min.js'));
files.push(path.join(resolveModulePath('angular-cookies'), 'angular-cookies.min.js'));
files.push(path.join(resolveModulePath('angular-route'), 'angular-route.min.js'));
files.push(path.join(resolveModulePath('angular-mocks'), 'angular-mocks.js'));
files.push(path.join(resolveModulePath('video.js'), 'dist/video.min.js'));
files.push(path.join(resolveModulePath('chai-spies'), 'chai-spies.js'));
// Sources
resources.js.forEach(function(file) {
files.push(file);
});
// Templates
files.push('src/**/*.html');
// Tests
files.push('src/**/*.spec.js');
config.set({
// Use mocha and chai for tests
frameworks: ['mocha', 'chai'],
// Web server port
port: 9876,
// Disable colors in the output (reporters and logs)
colors: true,
// Level of logging
// Possible values: OFF || ERROR || WARN || INFO || DEBUG
logLevel: 'INFO',
// Disable watching files and executing tests whenever any file changes
autoWatch: false,
// List of browsers to execute tests on
browsers: ['ChromeHeadlessCI'],
// Configure custom ChromHeadlessCI as an extension of ChromeHeadlessCI without sandbox
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// Base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// Plugins to load
plugins: [
'karma-chai',
'karma-mocha',
'karma-chrome-launcher',
'karma-ng-html2js-preprocessor'
],
// HTML templates mock
ngHtml2JsPreprocessor: {
moduleName: 'templates',
cacheIdFromPath: function(filepath) {
return filepath.replace(/^(.*\/)(.*)$/, function(match, match1, match2) {
return 'opl-' + match2;
});
}
},
// Files to preprocess
preprocessors: {
'src/**/*.html': ['ng-html2js']
},
// List of files / patterns to load in the browser
files: files
});
};