Skip to content

Commit

Permalink
ALL - default config to null
Browse files Browse the repository at this point in the history
Better config handling. If a non existing
path is passed as config throw error
  • Loading branch information
Christoffer Åström committed Nov 13, 2017
1 parent 9274eae commit 04f3bd4
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/cdp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const cdp = {
return yargs
.options(options)
.config('config', (configPath) => {
if (configPath === null) {
return {};
}
if (!fs.existsSync(configPath)) {
throw new Error(`Config ${configPath} not found`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cdp/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
config: {
description: 'Path to config file',
type: 'string',
default: 'aw.config.js',
default: null,
alias: 'c',
},
url: {
Expand Down
3 changes: 3 additions & 0 deletions src/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ const node = {
return yargs
.options(options)
.config('config', (configPath) => {
if (configPath === null) {
return {};
}
if (!fs.existsSync(configPath)) {
throw new Error(`Config ${configPath} not found`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/node/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
config: {
description: 'Path to config file',
type: 'string',
default: 'aw.config.js',
default: null,
alias: 'c',
},
glob: {
Expand Down
2 changes: 1 addition & 1 deletion src/protractor/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
config: {
description: 'Path to config file',
type: 'string',
default: 'aw.config.js',
default: null,
alias: 'c',
},
glob: {
Expand Down
1 change: 0 additions & 1 deletion src/protractor/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
const dns = require('dns');
const os = require('os');
const http = require('http');
const path = require('path');

module.exports = {
getFullQualifiedDNSName() {
Expand Down
3 changes: 3 additions & 0 deletions src/puppeteer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const puppet = {
return yargs
.options(options)
.config('config', (configPath) => {
if (configPath === null) {
return {};
}
if (!fs.existsSync(configPath)) {
throw new Error(`Config ${configPath} not found`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/puppeteer/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
config: {
description: 'Path to config file',
type: 'string',
default: 'aw.config.js',
default: null,
alias: 'c',
},
glob: {
Expand Down
5 changes: 4 additions & 1 deletion src/serve/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const server = {
config: {
description: 'Path to config file',
type: 'string',
default: 'aw.config.js',
default: null,
alias: 'c',
},
port: {
Expand All @@ -31,6 +31,9 @@ const server = {
},
})
.config('config', (configPath) => {
if (configPath === null) {
return {};
}
if (!fs.existsSync(configPath)) {
throw new Error(`Config ${configPath} not found`);
}
Expand Down

0 comments on commit 04f3bd4

Please sign in to comment.