1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
| 'use strict';
|
| var webpackCfg = require('./webpack.config.js');
| var webpack = require('webpack');
| var path = require('path');
|
| module.exports = function (config) {
| var indexSpec = path.join(process.cwd(), './test/solarLunar.spec.js');
| var files = [
| indexSpec,
| ];
| var preprocessors = {};
| preprocessors[indexSpec] = ['webpack'];
|
| var reporters = ['mocha'];
|
| if (process.env.TRAVIS_JOB_ID) {
| reporters = ['coverage', 'coveralls'];
| }
|
| var coverageReporter = {
| reporters: [
| {
| type: 'lcov',
| subdir: '.',
| },
| {
| type: 'text',
| },
| ],
| };
|
| webpackCfg.module.rules.push({
| test: /\.jsx?$/,
| loader: 'istanbul-instrumenter-loader',
| include: [path.join(process.cwd(), './src')],
| enforce: 'post'
| });
|
| var conf = {
| reporters: reporters,
| singleRun: true,
| browsers: ['Electron'],
| electronOpts: {},
| client: {
| mocha: {
| reporter: 'html', // change Karma's debug.html to the mocha web reporter
| ui: 'bdd',
| },
| },
| frameworks: ['mocha'],
| files: files,
| preprocessors: preprocessors,
| coverageReporter: coverageReporter,
| webpack: webpackCfg,
| webpackServer: {
| noInfo: true, //please don't spam the console when running in karma!
| },
| };
|
| config.set(conf);
| };
|
|