forked from civicrm/civicrm-core
-
Notifications
You must be signed in to change notification settings - Fork 2
/
karma.conf.js
80 lines (78 loc) · 2.64 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
var cv = require('civicrm-cv')({mode: 'sync'});
var _CV = cv('vars:show');
var cmd =
'define("CIVICRM_KARMA", 1);' +
'CRM_Core_BAO_ConfigSetting::enableAllComponents();' +
'global $civicrm_root;' +
'$f = CRM_Utils_File::addTrailingSlash($civicrm_root)."tmp/karma.cv.js";' +
'mkdir(dirname($f), 0777, TRUE);' +
'$a=Civi::service("angular");' +
'$data = "var CRM = CRM || {}; CRM.angular =";' +
'$data .= json_encode(array(' +
' "modules" => array_keys($a->getModules()),' +
' "requires" => $a->getResources(array_keys($a->getModules()), "requires","requires"),' +
'));' +
'$data .= ";";' +
'file_put_contents($f, $data);' +
'return $f;';
var angularTempFile = cv(['php:eval', '-U', _CV.ADMIN_USER, cmd]);
module.exports = function(config) {
config.set({
autoWatch: true,
browsers: ['ChromeHeadless'],
exclude: [
'ang/api4Explorer/Explorer.js'
],
files: [
'bower_components/jquery/dist/jquery.min.js',
'bower_components/jquery-ui/jquery-ui.min.js',
'bower_components/lodash-compat/lodash.min.js',
'bower_components/select2/select2.min.js',
'packages/jquery/plugins/jquery.blockUI.js',
'bower_components/jquery-validation/dist/jquery.validate.min.js',
'packages/jquery/plugins/jquery.timeentry.js',
'js/Common.js',
'js/crm.datepicker.js',
'bower_components/angular/angular.js',
angularTempFile,
'bower_components/angular-file-upload/dist/angular-file-upload.js',
'bower_components/angular-jquery-dialog-service/dialog-service.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/angular-ui-sortable/sortable.js',
'bower_components/angular-unsavedChanges/dist/unsavedChanges.js',
'js/crm.ajax.js',
'ang/*.js',
'ang/**/*.js',
'tests/karma/lib/*.js',
'tests/karma/**/*.js',
'ang/**/*.html',
'ext/civi_mail/ang/*.js',
'ext/civi_mail/ang/**/*.js',
'ext/civi_mail/ang/**/*.html',
'ext/civi_case/ang/*.js',
'ext/civi_case/ang/**/*.js',
'ext/civi_case/ang/**/*.html'
],
preprocessors : {
'ang/**/*.html': ['ng-html2js'],
'ext/*/ang/**/*.html': ['ng-html2js'],
},
ngHtml2JsPreprocessor: {
cacheIdFromPath: function(filepath) {
return filepath.replace(/.*ang\//, '~/');
},
moduleName: 'crmResource'
},
frameworks: ['jasmine'],
logLevel: config.LOG_INFO,
port: 9876,
reporters: ['progress'],
junitReporter: {
useBrowserName: false,
outputFile: 'tests/output/karma.xml',
suite: ''
},
singleRun: false
});
};