1 | // Karma configuration
|
2 | // Generated on Sun Aug 28 2016 19:03:27 GMT-0400 (Eastern Daylight Time)
|
3 |
|
4 | var TemplateServerMiddlewareFactory = function (config) {
|
5 | var TEMPLATE_REQUEST_REGEXP = /^\/base\/dist\/test\/.+\.html$/i;
|
6 | return function (req, res, next) {
|
7 | if(TEMPLATE_REQUEST_REGEXP.test(req.url)) {
|
8 | req.url = req.url.replace(/^\/base\/dist\/test\//, '/base/');
|
9 | }
|
10 |
|
11 | next();
|
12 | };
|
13 | }
|
14 |
|
15 | module.exports = function (config) {
|
16 | config.set({
|
17 |
|
18 | // base path that will be used to resolve all patterns (eg. files, exclude)
|
19 | basePath: '',
|
20 |
|
21 |
|
22 | // frameworks to use
|
23 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
24 | frameworks: ['jasmine', 'requirejs'],
|
25 |
|
26 | beforeMiddleware: ['template-server'],
|
27 | plugins: config.plugins.concat([
|
28 | {'middleware:template-server': ['factory', TemplateServerMiddlewareFactory]}
|
29 | ]),
|
30 |
|
31 | // list of files / patterns to load in the browser
|
32 | files: [
|
33 | 'dist/test/test/setup.js',
|
34 | { pattern: 'dist/test/**/*.js', included: false, watched: true },
|
35 | { pattern: '**/*.html', included: false, watched: true },
|
36 | { pattern: 'node_modules/**/*.js', included: false, watched: false },
|
37 | ],
|
38 |
|
39 |
|
40 | // list of files to exclude
|
41 | exclude: [],
|
42 |
|
43 |
|
44 | // preprocess matching files before serving them to the browser
|
45 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
46 | preprocessors: {
|
47 | },
|
48 |
|
49 |
|
50 | // test results reporter to use
|
51 | // possible values: 'dots', 'progress'
|
52 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
53 | reporters: ['progress'],
|
54 |
|
55 |
|
56 | // web server port
|
57 | port: 9876,
|
58 |
|
59 |
|
60 | // enable / disable colors in the output (reporters and logs)
|
61 | colors: true,
|
62 |
|
63 |
|
64 | // level of logging
|
65 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
66 | logLevel: config.LOG_INFO,
|
67 |
|
68 |
|
69 | // enable / disable watching file and executing tests whenever any file changes
|
70 | autoWatch: true,
|
71 |
|
72 |
|
73 | // start these browsers
|
74 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
75 | browsers: ['Chrome'],
|
76 |
|
77 |
|
78 | // Continuous Integration mode
|
79 | // if true, Karma captures browsers, runs the tests and exits
|
80 | singleRun: false,
|
81 |
|
82 | // Concurrency level
|
83 | // how many browser should be started simultaneous
|
84 | concurrency: Infinity
|
85 | })
|
86 | }
|