UNPKG

2.27 kBJavaScriptView Raw
1// Karma configuration
2
3module.exports = function (config) {
4 var karmaConfig = {
5
6 // base path that will be used to resolve all patterns (eg. files, exclude)
7 basePath: '',
8
9
10 // frameworks to use
11 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
12 frameworks: ['mocha'],
13
14
15 // list of files / patterns to load in the browser
16 files: [
17 'dist/test.bundle.js'
18 ],
19
20
21 // list of files to exclude
22 exclude: [
23 ],
24
25 client: {
26 mocha: {
27 reporter: 'html', // change Karma's debug.html to the mocha web reporter
28 ui: 'bdd'
29 }
30 },
31
32 // preprocess matching files before serving them to the browser
33 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
34 preprocessors: {
35 },
36
37
38 // test results reporter to use
39 // possible values: 'dots', 'progress'
40 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
41 reporters: ['env'],
42
43
44 // web server port
45 port: 9876,
46
47
48 // enable / disable colors in the output (reporters and logs)
49 colors: true,
50
51
52 // level of logging
53 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
54 logLevel: config.LOG_INFO,
55
56
57 // enable / disable watching file and executing tests whenever any file changes
58 autoWatch: true,
59
60
61 // start these browsers
62 // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
63 browsers: ['Chrome'],
64
65
66 // Continuous Integration mode
67 // if true, Karma captures browsers, runs the tests and exits
68 singleRun: false,
69
70 // Concurrency level
71 // how many browser should be started simultaneous
72 concurrency: Infinity,
73
74 customLaunchers: {
75 chrome_travis_ci: {
76 base: 'Chrome',
77 flags: ['--no-sandbox']
78 }
79 }
80 }
81
82 if (process.env.TRAVIS) {
83 karmaConfig.browsers = ['Firefox']; // ['chrome_travis_ci', 'Firefox'];
84 }
85 config.set(karmaConfig)
86}