Matteo Scandolo | a5d03d5 | 2016-07-21 11:35:46 -0700 | [diff] [blame] | 1 | /*eslint-env node */ |
| 2 | (function () { |
| 3 | |
| 4 | 'use strict'; |
| 5 | |
| 6 | // Karma configuration |
| 7 | // Generated on Tue Oct 06 2015 09:27:10 GMT+0000 (UTC) |
| 8 | |
| 9 | const babelPreset = require('babel-preset-es2015'); |
| 10 | |
| 11 | /*eslint-disable*/ |
| 12 | |
| 13 | var files = [ |
| 14 | 'node_modules/babel-polyfill/dist/polyfill.js', |
| 15 | |
| 16 | |
| 17 | // loading jquery (it's used in tests) |
| 18 | `./bower_components/jquery/dist/jquery.js`, |
| 19 | `./bower_components/jasmine-jquery/lib/jasmine-jquery.js`, |
| 20 | |
| 21 | // loading helpers and vendors |
| 22 | `./dist/ngXosVendor.min.js`, |
| 23 | `./dist/xosUiComponents.js`, |
| 24 | |
| 25 | // loading ngMock |
| 26 | `./bower_components/angular-mocks/angular-mocks.js`, |
| 27 | ] |
| 28 | .concat([ |
| 29 | // loading tests |
| 30 | `spec/test_helpers.js`, |
| 31 | `spec/ui/xos.helpers.mock.js`, |
| 32 | 'spec/ui/**/*.test.js' |
| 33 | ]); |
| 34 | |
| 35 | module.exports = function(config) { |
| 36 | /*eslint-enable*/ |
| 37 | config.set({ |
| 38 | |
| 39 | // base path that will be used to resolve all patterns (eg. files, exclude) |
| 40 | basePath: '', |
| 41 | |
| 42 | |
| 43 | // frameworks to use |
| 44 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter |
| 45 | frameworks: ['jasmine'], |
| 46 | |
| 47 | |
| 48 | // list of files / patterns to load in the browser |
| 49 | files: files, |
| 50 | |
| 51 | |
| 52 | // list of files to exclude |
| 53 | exclude: [ |
| 54 | ], |
| 55 | |
| 56 | |
| 57 | // preprocess matching files before serving them to the browser |
| 58 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor |
| 59 | preprocessors: { |
| 60 | './spec/ui/**/*.test.js': ['babel'], |
| 61 | './spec/test_helpers.js': ['babel'], |
| 62 | './spec/ui/xos.helpers.mock.js': ['babel'] |
| 63 | }, |
| 64 | |
| 65 | babelPreprocessor: { |
| 66 | options: { |
| 67 | presets: [babelPreset], |
| 68 | sourceMap: 'inline' |
| 69 | } |
| 70 | }, |
| 71 | |
| 72 | //ngHtml2JsPreprocessor: { |
| 73 | // stripPrefix: 'src/', //strip the src path from template url (http://stackoverflow.com/questions/22869668/karma-unexpected-request-when-testing-angular-directive-even-with-ng-html2js) |
| 74 | // moduleName: 'templates' // define the template module name |
| 75 | //}, |
| 76 | |
| 77 | // test results reporter to use |
| 78 | // possible values: 'dots', 'progress' |
| 79 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter |
| 80 | reporters: ['dots', 'junit', 'coverage'], |
| 81 | |
| 82 | junitReporter: { |
| 83 | outputDir: 'test-result', |
| 84 | useBrowserName: false, |
| 85 | outputFile: 'test-results.xml' |
| 86 | }, |
| 87 | |
| 88 | coverageReporter: { |
| 89 | type: 'cobertura', |
| 90 | subdir: '.', |
| 91 | dir: 'test-result/' |
| 92 | }, |
| 93 | |
| 94 | // web server port |
| 95 | port: 9876, |
| 96 | |
| 97 | |
| 98 | // enable / disable colors in the output (reporters and logs) |
| 99 | colors: true, |
| 100 | |
| 101 | |
| 102 | // level of logging |
| 103 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG |
| 104 | logLevel: config.LOG_INFO, |
| 105 | |
| 106 | |
| 107 | // enable / disable watching file and executing tests whenever any file changes |
| 108 | autoWatch: false, |
| 109 | |
| 110 | |
| 111 | // start these browsers |
| 112 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher |
| 113 | browsers: [ |
| 114 | 'PhantomJS', |
| 115 | // 'Chrome' |
| 116 | ], |
| 117 | |
| 118 | |
| 119 | // Continuous Integration mode |
| 120 | // if true, Karma captures browsers, runs the tests and exits |
| 121 | singleRun: true |
| 122 | }); |
| 123 | }; |
| 124 | |
| 125 | })(); |