From 5539682923b7db3310b809a8d46afbf8bace7768 Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Sat, 28 Oct 2017 18:16:20 +0200 Subject: [PATCH 1/3] code style fixed --- lib/cli.js | 6 +-- lib/utils.js | 6 +-- spec/cli_spec.js | 98 ++++++++++++++++++++++++------------------------ 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index a359689..a1286b2 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -61,7 +61,7 @@ module.exports = function(proc) { .then(function(){return verifyVarietyLib(proc);}) .then(function(libPath){return executeVariety(proc, args, libPath);}); }) - .catch(function(ex) { - return printHelp(proc, ex); - }); + .catch(function(ex) { + return printHelp(proc, ex); + }); }; diff --git a/lib/utils.js b/lib/utils.js index ef2e201..f6bb038 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -14,9 +14,9 @@ var jsVarDefinition = function(value, name) { var buildParams = function(collection, opts) { return _.map( - _.assign({}, {'collection':collection}, opts), - jsVarDefinition - ).join(''); + _.assign({}, {'collection':collection}, opts), + jsVarDefinition + ).join(''); }; module.exports = { diff --git a/spec/cli_spec.js b/spec/cli_spec.js index 25fe088..1802263 100644 --- a/spec/cli_spec.js +++ b/spec/cli_spec.js @@ -41,10 +41,10 @@ describe(__filename, function () { argv: ['node', 'variety-cli.js', '--help'], process: null }) - .then(function(){ - expect(ws.content).toContain('Usage: variety db_name/collection_name [options]'); - done(); - }); + .then(function(){ + expect(ws.content).toContain('Usage: variety db_name/collection_name [options]'); + done(); + }); }); it('CLI should correctly execute Variety', function (done) { @@ -61,16 +61,16 @@ describe(__filename, function () { argv: ['node', 'variety-cli.js', 'foo/bar', '--limit=5', '--host', 'localhost'], process: null }) - .then(function(res) { - expect(res.bin).toEqual('mongo'); - expect(res.args[0]).toEqual('foo'); //db name - expect(res.args[1]).toEqual('--eval=var collection="bar";var limit=5;'); //variety args - expect(res.args[2]).toEndWith('variety.js'); //library path - expect(res.args[3]).toEqual('--host'); //library path - expect(res.args[4]).toEqual('localhost'); //library path - done(); - }) - .catch(done); + .then(function(res) { + expect(res.bin).toEqual('mongo'); + expect(res.args[0]).toEqual('foo'); //db name + expect(res.args[1]).toEqual('--eval=var collection="bar";var limit=5;'); //variety args + expect(res.args[2]).toEndWith('variety.js'); //library path + expect(res.args[3]).toEqual('--host'); //library path + expect(res.args[4]).toEqual('localhost'); //library path + done(); + }) + .catch(done); }); it('CLI should forward auth arguments directly to mongo shell', function (done) { @@ -87,20 +87,20 @@ describe(__filename, function () { argv: ['node', 'variety-cli.js', 'foo/bar', '--username', 'lorem', '--password', 'ipsum', '--authenticationDatabase', 'my-auth-db'], process: null }) - .then(function(res) { - expect(res.bin).toEqual('mongo'); - expect(res.args[0]).toEqual('foo'); //db name - expect(res.args[1]).toEqual('--eval=var collection="bar";'); //variety args - expect(res.args[2]).toEndWith('variety.js'); //library path - expect(res.args[3]).toEqual('--username'); - expect(res.args[4]).toEqual('lorem'); - expect(res.args[5]).toEqual('--password'); - expect(res.args[6]).toEqual('ipsum'); - expect(res.args[7]).toEqual('--authenticationDatabase'); - expect(res.args[8]).toEqual('my-auth-db'); - done(); - }) - .catch(done); + .then(function(res) { + expect(res.bin).toEqual('mongo'); + expect(res.args[0]).toEqual('foo'); //db name + expect(res.args[1]).toEqual('--eval=var collection="bar";'); //variety args + expect(res.args[2]).toEndWith('variety.js'); //library path + expect(res.args[3]).toEqual('--username'); + expect(res.args[4]).toEqual('lorem'); + expect(res.args[5]).toEqual('--password'); + expect(res.args[6]).toEqual('ipsum'); + expect(res.args[7]).toEqual('--authenticationDatabase'); + expect(res.args[8]).toEqual('my-auth-db'); + done(); + }) + .catch(done); }); it('CLI should handle short versions of mongo arguments (for example -u, -p)', function (done) { @@ -117,20 +117,20 @@ describe(__filename, function () { argv: ['node', 'variety-cli.js', 'foo/bar', '-u', 'lorem', '-p', 'ipsum', '--authenticationDatabase', 'my-auth-db'], process: null }) - .then(function(res) { - expect(res.bin).toEqual('mongo'); - expect(res.args[0]).toEqual('foo'); //db name - expect(res.args[1]).toEqual('--eval=var collection="bar";'); //variety args - expect(res.args[2]).toEndWith('variety.js'); //library path - expect(res.args[3]).toEqual('-u'); - expect(res.args[4]).toEqual('lorem'); - expect(res.args[5]).toEqual('-p'); - expect(res.args[6]).toEqual('ipsum'); - expect(res.args[7]).toEqual('--authenticationDatabase'); - expect(res.args[8]).toEqual('my-auth-db'); - done(); - }) - .catch(done); + .then(function(res) { + expect(res.bin).toEqual('mongo'); + expect(res.args[0]).toEqual('foo'); //db name + expect(res.args[1]).toEqual('--eval=var collection="bar";'); //variety args + expect(res.args[2]).toEndWith('variety.js'); //library path + expect(res.args[3]).toEqual('-u'); + expect(res.args[4]).toEqual('lorem'); + expect(res.args[5]).toEqual('-p'); + expect(res.args[6]).toEqual('ipsum'); + expect(res.args[7]).toEqual('--authenticationDatabase'); + expect(res.args[8]).toEqual('my-auth-db'); + done(); + }) + .catch(done); }); it('CLI should handle incorrect args and print error + help', function (done) { @@ -146,13 +146,13 @@ describe(__filename, function () { argv: ['node', 'variety-cli.js', 'foo/bar', '--sort', '{foo:bar)'], // incorrect brackets pair process: null }) - .then(function() { - done(new Error('Should throw exception and continue in catch branch')); - }) - .catch(function(err) { - expect(err.message).toContain('Failed to parse option'); - done(); - }); + .then(function() { + done(new Error('Should throw exception and continue in catch branch')); + }) + .catch(function(err) { + expect(err.message).toContain('Failed to parse option'); + done(); + }); }); }); From 7a66f480fb086517ec6d32cccb4774962b3b519a Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Sat, 28 Oct 2017 18:16:35 +0200 Subject: [PATCH 2/3] dependencies updated --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 623620e..83466a0 100644 --- a/package.json +++ b/package.json @@ -24,14 +24,14 @@ "dependencies": { "child-process-promise": "^2.0.1", "colors": "^1.1.2", - "hjson": "^1.6.3", + "hjson": "^3.1.0", "lodash": "^4.6.1", "minimist": "^1.1.1", "variety": "variety/variety" }, "devDependencies": { "coveralls": ">=2.11.2", - "eslint": "^2.4.0", + "eslint": "^4.10.0", "istanbul": ">=0.3.13", "jasmine-node": ">=1.14.5" }, From f8f816ae05a6fa63b2f13b96268bcec4a64a804a Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Sat, 28 Oct 2017 18:17:12 +0200 Subject: [PATCH 3/3] travis and appveyor config updated --- .travis.yml | 4 ++-- appveyor.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 14ee0c5..67d7778 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js sudo: false node_js: - - "4" - - "5" + - "node" + - "lts/*" after_script: "npm run coverage" diff --git a/appveyor.yml b/appveyor.yml index 34f2398..fa5442b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ environment: matrix: - - nodejs_version: "4" - - nodejs_version: "5" + - nodejs_version: "LTS" + - nodejs_version: "Stable" install: - ps: Install-Product node $env:nodejs_version - npm install -g jasmine-node