1 | // single run:
|
2 | // karma start karma.conf.js
|
3 |
|
4 | // continuous watch and rerun on file changes using PhantomJS
|
5 | // karma start karma.conf.js --single-run=false --browsers=PhantomJS
|
6 |
|
7 | // single run using Chrome (not run by default)
|
8 | // karma start karma.conf.js --browsers=Chrome
|
9 |
|
10 | // continuous run using Chrome
|
11 | // karma start karma.conf.js --single-run=false --browsers=Chrome
|
12 |
|
13 | // if you want to debug source code in the browser and do not need coverage
|
14 | // karma start karma.conf.js --single-run=false --browsers=Chrome --debug
|
15 |
|
16 | var sourcePreprocessors = 'coverage';
|
17 | function isDebug(argument) {
|
18 | return argument === '--debug';
|
19 | }
|
20 | if (process.argv.some(isDebug)) {
|
21 | sourcePreprocessors = [];
|
22 | }
|
23 |
|
24 | module.exports = function (config) {
|
25 | config.set({
|
26 |
|
27 | // base path, that will be used to resolve files and exclude
|
28 | basePath: '',
|
29 |
|
30 |
|
31 | // frameworks to use
|
32 | frameworks: ['mocha'],
|
33 |
|
34 |
|
35 | // list of files / patterns to load in the browser
|
36 | files: [
|
37 | 'node_modules/expect.js/index.js',
|
38 | 'index.js',
|
39 | 'test/*spec.js'
|
40 | ],
|
41 |
|
42 |
|
43 | // list of files to exclude
|
44 | exclude: [
|
45 | ],
|
46 |
|
47 | preprocessors: {
|
48 | 'index.js': sourcePreprocessors,
|
49 | },
|
50 |
|
51 | // test results reporter to use
|
52 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
|
53 | reporters: ['dots', 'coverage'],
|
54 |
|
55 | coverageReporter: {
|
56 | reporters: [{
|
57 | type: 'lcov',
|
58 | dir : 'coverage/'
|
59 | }, {
|
60 | type: 'text-summary'
|
61 | }],
|
62 | },
|
63 |
|
64 | // web server port
|
65 | port: 9876,
|
66 |
|
67 |
|
68 | // enable / disable colors in the output (reporters and logs)
|
69 | colors: true,
|
70 |
|
71 |
|
72 | // level of logging
|
73 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
74 | logLevel: config.LOG_INFO,
|
75 |
|
76 |
|
77 | // enable / disable watching file and executing tests whenever any file changes
|
78 | autoWatch: true,
|
79 |
|
80 |
|
81 | // Start these browsers, currently available:
|
82 | // - Chrome
|
83 | // - ChromeCanary
|
84 | // - Firefox
|
85 | // - Opera (has to be installed with `npm install karma-opera-launcher`)
|
86 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
|
87 | // - PhantomJS
|
88 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
|
89 | browsers: ['PhantomJS'],
|
90 |
|
91 |
|
92 | // If browser does not capture in given timeout [ms], kill it
|
93 | captureTimeout: 10000,
|
94 |
|
95 |
|
96 | // Continuous Integration mode
|
97 | // if true, it capture browsers, run tests and exit
|
98 | singleRun: true
|
99 | });
|
100 | };
|