-
Notifications
You must be signed in to change notification settings - Fork 106
/
config.js
52 lines (45 loc) · 1.3 KB
/
config.js
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
/**
* @typedef {Object} Configuration
* @property {String} coverageEnvVar - name of environment variable for coverage
* @property {String} coverageFolder - directory in which to write coverage to
* @property {Array<String>} excludes - list of glob paths to exclude
* @property {Array<String>} reporters - list of reporters
*/
'use strict';
var extend = require('extend');
var fs = require('fs');
var path = require('path');
/**
* Get configuration for a project, falling back to default configuration if
* project does not provide a configuration of its own
* @param {String} root - root path of project
* @returns {Configuration} configuration to use for project
*/
function config(root) {
var configFile = path.join(root, 'config', 'coverage.js');
var defaultConfig = getDefaultConfig();
if (fs.existsSync(configFile)) {
var projectConfig = require(configFile);
return extend({}, defaultConfig, projectConfig);
}
return defaultConfig;
}
/**
* Get default configuration
* @returns {Configuration} default configuration
*/
function getDefaultConfig() {
return {
coverageEnvVar: 'COVERAGE',
coverageFolder: 'coverage',
excludes: [
'*/mirage/**/*'
],
useBabelInstrumenter: false,
reporters: [
'html',
'lcov'
]
};
}
module.exports = config;