1 | // Karma configuration
|
2 | // npm i karma karma-cli karma-firefox-launcher karma-mocha karma-webpack mocha --save-dev
|
3 | // node_modules/.bin/karma start --single-run
|
4 | module.exports = function(config) {
|
5 | config.set({
|
6 |
|
7 | // base path that will be used to resolve all patterns (eg. files, exclude)
|
8 | basePath: '',
|
9 |
|
10 |
|
11 | // frameworks to use
|
12 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
13 | frameworks: ['mocha'],
|
14 |
|
15 |
|
16 | // list of files / patterns to load in the browser
|
17 | files: [
|
18 | 'test/test.js'
|
19 | ],
|
20 |
|
21 | // list of files to exclude
|
22 | exclude: [
|
23 | ],
|
24 |
|
25 | // preprocess matching files before serving them to the browser
|
26 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
27 | preprocessors: {
|
28 | 'test/test.js': ['webpack']
|
29 | },
|
30 |
|
31 | // test results reporter to use
|
32 | // possible values: 'dots', 'progress'
|
33 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
34 | reporters: ['progress'],
|
35 |
|
36 |
|
37 | // web server port
|
38 | port: 9876,
|
39 |
|
40 |
|
41 | // enable / disable colors in the output (reporters and logs)
|
42 | colors: true,
|
43 |
|
44 |
|
45 | // level of logging
|
46 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
47 | logLevel: config.LOG_INFO,
|
48 |
|
49 |
|
50 | // enable / disable watching file and executing tests whenever any file changes
|
51 | autoWatch: true,
|
52 |
|
53 | webpack: {
|
54 | module: {
|
55 | loaders: [
|
56 | {test: /\.html$/, loader: 'html'}
|
57 | ]
|
58 | }
|
59 | },
|
60 |
|
61 | // start these browsers
|
62 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
63 | browsers: ['Firefox'],
|
64 |
|
65 | webpackMiddleware: {
|
66 | noInfo: true
|
67 | },
|
68 | // Continuous Integration mode
|
69 | // if true, Karma captures browsers, runs the tests and exits
|
70 | singleRun: true
|
71 | });
|
72 | };
|
73 |
|