Merge pull request #24238 from demeritcowboy/boo
[civicrm-core.git] / karma.conf.js
CommitLineData
5438399c
TO
1var cv = require('civicrm-cv')({mode: 'sync'});
2var _CV = cv('vars:show');
3var cmd =
30034e81 4 'define("CIVICRM_KARMA", 1);' +
fc64d0fd 5 'CRM_Core_BAO_ConfigSetting::enableAllComponents();' +
5438399c
TO
6 'global $civicrm_root;' +
7 '$f = CRM_Utils_File::addTrailingSlash($civicrm_root)."tmp/karma.cv.js";' +
8 'mkdir(dirname($f), 0777, TRUE);' +
9 '$a=Civi::service("angular");' +
10 '$data = "var CRM = CRM || {}; CRM.angular =";' +
11 '$data .= json_encode(array(' +
12 ' "modules" => array_keys($a->getModules()),' +
13 ' "requires" => $a->getResources(array_keys($a->getModules()), "requires","requires"),' +
14 '));' +
15 '$data .= ";";' +
16 'file_put_contents($f, $data);' +
17 'return $f;';
18var angularTempFile = cv(['php:eval', '-U', _CV.ADMIN_USER, cmd]);
19
416abe87
PH
20module.exports = function(config) {
21 config.set({
22 autoWatch: true,
5915de41 23 browsers: ['PhantomJS'],
416abe87 24 exclude: [
2c074028 25 'ang/api4Explorer/Explorer.js'
416abe87
PH
26 ],
27 files: [
6a77bdf4 28 'bower_components/phantomjs-polyfill/bind-polyfill.js',
416abe87
PH
29 'bower_components/jquery/dist/jquery.min.js',
30 'bower_components/jquery-ui/jquery-ui.min.js',
b2df037d 31 'bower_components/lodash-compat/lodash.min.js',
e1ef4e11 32 'bower_components/select2/select2.min.js',
416abe87 33 'packages/jquery/plugins/jquery.blockUI.js',
3426f10d 34 'bower_components/jquery-validation/dist/jquery.validate.min.js',
401f6f82 35 'packages/jquery/plugins/jquery.timeentry.js',
416abe87 36 'js/Common.js',
403c52ac 37 'js/crm.datepicker.js',
416abe87 38 'bower_components/angular/angular.js',
5438399c 39 angularTempFile,
da9f6ba5 40 'bower_components/angular-file-upload/dist/angular-file-upload.js',
416abe87
PH
41 'bower_components/angular-jquery-dialog-service/dialog-service.js',
42 'bower_components/angular-route/angular-route.js',
43 'bower_components/angular-mocks/angular-mocks.js',
44 'bower_components/angular-ui-sortable/sortable.js',
416abe87 45 'bower_components/angular-unsavedChanges/dist/unsavedChanges.js',
416abe87 46 'js/crm.ajax.js',
4c78db19
TO
47 'ang/*.js',
48 'ang/**/*.js',
416abe87
PH
49 'tests/karma/lib/*.js',
50 'tests/karma/**/*.js',
4c78db19 51 'ang/**/*.html'
416abe87 52 ],
401f6f82 53 preprocessors : {
4c78db19 54 'ang/**/*.html' : ['ng-html2js']
401f6f82
TO
55 },
56
57 ngHtml2JsPreprocessor: {
4c78db19 58 stripPrefix: 'ang/',
401f6f82
TO
59 prependPrefix: '~/',
60 moduleName: 'crmResource'
61 },
416abe87
PH
62 frameworks: ['jasmine'],
63 logLevel: config.LOG_INFO,
64 port: 9876,
65 reporters: ['progress'],
8ae4e322 66 junitReporter: {
75181cda 67 useBrowserName: false,
8ae4e322
TO
68 outputFile: 'tests/output/karma.xml',
69 suite: ''
70 },
b43a993a 71 singleRun: false
416abe87
PH
72 });
73};