comforter-cli
Advanced tools
+4
-3
| before_script: | ||
| - . /opt/.nvm/nvm.sh | ||
| - nvm use stable | ||
| - npm install | ||
| - source /usr/local/nvm/nvm.sh | ||
| - nvm install v6.12.0 | ||
| - nvm use v6.12.0 | ||
| - npm i | ||
| cache: | ||
@@ -6,0 +7,0 @@ untracked: true |
+11
-2
@@ -47,2 +47,10 @@ #! /usr/bin/env node | ||
| if (argv['merge-base']) { | ||
| data.mergeBase = argv['merge-base']; | ||
| } | ||
| if (argv['target-branch']) { | ||
| data.targetBranch = argv['target-branch']; | ||
| } | ||
| var deferred = q.defer(); | ||
@@ -114,3 +122,4 @@ | ||
| .on('fail', fail.bind(null, errors.badRequest)); | ||
| }); | ||
| }) | ||
| .catch(fail.bind(null, errors.badRequest)); | ||
@@ -133,3 +142,3 @@ } | ||
| } | ||
| if (!params.project || !params.branch || !params.commit || !params.host || !params.apiKey) { | ||
| if (!params.project || !params.branch || !params.commit || !params.host || !params.apiKey || !params.name) { | ||
| fail(errors.missingRequiredParams); | ||
@@ -136,0 +145,0 @@ } |
+2
-2
| { | ||
| "name": "comforter-cli", | ||
| "version": "0.4.3", | ||
| "version": "0.4.4", | ||
| "description": "cli tool for communicating with comforter instance", | ||
| "scripts": { | ||
| "test": "jshint --reporter=node_modules/jshint-stylish lib/*.js test/ && jscs lib/ test/ && lab -v" | ||
| "test": "jshint --reporter=node_modules/jshint-stylish lib/*.js test/ && jscs lib/ test/ && lab -v --leaks" | ||
| }, | ||
@@ -8,0 +8,0 @@ "bin": { |
+1
-1
@@ -7,5 +7,5 @@ ## Comforter CLI tool | ||
| `npm install -g comforter-cli` | ||
| `comforter-cli (--path <path-to-lcov-info-file> OR --totalLines <lines> --totalCovered <lines>) --name <project-name> --branch <branch-name> --project <project-id> --commit <sha> --apiKey <key> [--zip <path-to-html-coverage>]` | ||
| `comforter-cli (--path <path-to-lcov-info-file> OR --totalLines <lines> --totalCovered <lines>) --name <project-name> --branch <branch-name> --project <project-id> --commit <sha> [--merge-base <sha>] [--target-branch <branch name>] --apiKey <key> [--zip <path-to-html-coverage>]` | ||
| * [x] Accept path to generated coverage html and zip and send to Comforter | ||
| * [ ] Use `npm cli` to avoid running tests in exec, allowing coverage and better testing (see [jshint](https://github.com/jshint/jshint) repo for examples) |
| 'use strict'; | ||
| var lab = exports.lab = require('lab').script(); | ||
| var code = require('code'); | ||
| var child = require('child_process'); | ||
| var path = require('path'); | ||
| var fs = require('fs-extra'); | ||
| var Combinatorics = require('js-combinatorics'); | ||
| var outfile = path.resolve(__dirname, '.output/setup.out'); | ||
| lab.experiment('setup: params', function () { | ||
| lab.before(function (done) { | ||
| fs.mkdirpSync(path.resolve(__dirname, '.output')); | ||
| done(); | ||
| }); | ||
| lab.after(function (done) { | ||
| fs.unlink(outfile); | ||
| done(); | ||
| }); | ||
| var params = { | ||
| host: 'http://localhost/', | ||
| branch: 'my-branch', | ||
| commit: 'sha', | ||
| project: 1, | ||
| apiKey: 'key', | ||
| name: 'stuff' | ||
| }; | ||
| var keys = Object.keys(params); | ||
| var permutations = Combinatorics.permutation(keys).toArray(); | ||
| permutations.forEach(function (permutation, index) { | ||
| var string = ''; | ||
| permutation.forEach(function (param, index) { | ||
| if (index === permutation.length - 1) { | ||
| return; // only use 3 | ||
| } | ||
| string += '--' + param + ' ' + params[param] + ' '; | ||
| }); | ||
| lab.test('fails when missing required params combo ' + index, function (done) { | ||
| child.exec('node ' + __dirname + '/../lib/index.js --coverage 98.8 ' + string + ' > ' + outfile, function (err) { | ||
| code.expect(err).to.exist(); | ||
| code.expect(err.toString()).to.contain('Missing one or many of required params (commit, branch, project, host, apiKey, name)'); | ||
| done(); | ||
| }); | ||
| }); | ||
| }); | ||
| }); |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
3
-25%1
-50%10107
-9.83%8
-11.11%157
-19.07%