Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
🔧 fix 🐅 s and process lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandresobolevski committed Jul 15, 2016
1 parent cf365ff commit 2ed9b1f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"no-new-wrappers": [2],
"no-new": [2],
"no-param-reassign": [1],
"no-process-env": [1],
"no-process-env": [0],
"no-proto": [2],
"no-redeclare": [1],
"no-return-assign": [2],
Expand Down
23 changes: 16 additions & 7 deletions args.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const defaultOptions = () => {
}));
};

// args are expected to be in ['key=value', 'key1=value2' ...] format
function mergeArgs (args) {
const userOptions = {};

Expand Down Expand Up @@ -84,9 +85,8 @@ function mergeArgs (args) {
`Valid values for this key are: ${optionsBook[arg[0]].acceptedValues}`;
};

// args are expected to be in ['key=value', 'key1=value2' ...] format
try {
if (!isEmpty(args)) {
if (!isEmpty(args) && !contains('--test-type=webdriver', args)) {
args.forEach( expression => {
const arg = split('=', expression);
const parsedArg = parseArgValue(arg);
Expand All @@ -101,18 +101,27 @@ function mergeArgs (args) {
}
});
}

} catch (error) {
// keep this console log for the user running it from the CL
console.error(error);
process.exit(-1);

} finally {
return merge(defaultOptions(), userOptions);
}
return merge(defaultOptions(), userOptions);
}

// if in development mode, just pass in an empty args object => defaults all
const acceptedArgs = () => {
return process.env.NODE_ENV === 'development' ? {} : process.argv.slice(2);

let argsToMerge = [];

if (process.env.NODE_ENV === 'development') {
argsToMerge = ['logdetail=2'];
} else if (!contains('./test/e2e.js', process.argv.slice(2))) {
argsToMerge = process.argv.slice(2);
}

return argsToMerge;

};

export const ARGS = mergeArgs(acceptedArgs());
3 changes: 0 additions & 3 deletions main.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ app.on('ready', () => {
function log(logEntry, code = 2) {

// default log detail set to 1 (warn level) in ./args.js

console.log(code, logEntry);

if (code <= OPTIONS.logdetail) {
switch (code) {
case 0:
Expand Down
11 changes: 6 additions & 5 deletions test/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ describe('plotly database connector', function Spec() {
before(openApp);

describe('upon starting', () => {

it('should have the correct app title Name and Version',
async () => {
const title = await this.driver.getTitle();
Expand Down Expand Up @@ -358,7 +359,7 @@ describe('plotly database connector', function Spec() {

it('should show a log with a new logged item',
async () => {
const expectedClass = 'test-1-entries';
const expectedClass = 'test-4-entries';
const logs = await this.getLogs();

const testClass = await this.getClassOf(logs);
Expand Down Expand Up @@ -386,7 +387,7 @@ describe('plotly database connector', function Spec() {

it('should show a log with a new logged item',
async () => {
const expectedClass = 'test-2-entries';
const expectedClass = 'test-20-entries';
const logs = await this.getLogs();

const testClass = await this.getClassOf(logs);
Expand Down Expand Up @@ -437,7 +438,7 @@ describe('plotly database connector', function Spec() {

it('should show a log with a new logged item',
async () => {
const expectedClass = 'test-3-entries';
const expectedClass = 'test-22-entries';
const logs = await this.getLogs();

const testClass = await this.getClassOf(logs);
Expand Down Expand Up @@ -471,7 +472,7 @@ describe('plotly database connector', function Spec() {
const btn = await this.getConnectBtn();

await this.waitFor(expectedClass, btn);

const testClass = await this.getClassOf(btn);
expect(testClass).to.contain(expectedClass);
});
Expand Down Expand Up @@ -511,7 +512,7 @@ describe('plotly database connector', function Spec() {

it('should show a log with a new logged item',
async () => {
const expectedClass = 'test-1-entries';
const expectedClass = 'test-5-entries';
const logs = await this.getLogs();

const testClass = await this.getClassOf(logs);
Expand Down

0 comments on commit 2ed9b1f

Please sign in to comment.