Skip to content

Commit

Permalink
Add config for cdp
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoffer Åström committed Nov 1, 2017
1 parent 2da897d commit e3985d0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/cdp/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* eslint no-console: 0, max-len: 0 */
/* eslint no-console: 0, max-len: 0, global-require: 0, import/no-dynamic-require: 0 */
const path = require('path');
const fs = require('fs');
const globby = require('globby');
const options = require('./options');
const Runner = require('./runner');
const createHttpServer = require('./http-server');
const NYC = require('nyc');
const findUp = require('find-up');

process.on('unhandledRejection', (err) => {
console.error(`Promise Rejection:${err}`);
Expand All @@ -31,11 +32,21 @@ const cdp = {
return yargs
.usage('cdp [options]')
.options(options)
.config('config', (configPath) => {
let foundConfigPath = configPath;
if (!fs.existsSync(configPath)) {
foundConfigPath = findUp.sync(options.config.default);
}
let config = {};
try {
config = require(foundConfigPath);
} catch (_) {} //eslint-disable-line
return config;
})
.coerce('nyc', (opt) => {
opt.exclude = [...new Set(opt.defaultExclude.concat(opt.exclude))];
opt.sourceMap = false;
opt.instrumenter = './lib/instrumenters/noop';
// console.log(opt);
return opt;
});
},
Expand Down

0 comments on commit e3985d0

Please sign in to comment.