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