Skip to content
Permalink
Browse files

Skeletal repo and made sure tests pass

  • Loading branch information
Umesh Pathak Umesh Pathak
Umesh Pathak authored and Umesh Pathak committed Apr 15, 2019
1 parent 792d4da commit 2857827bd73be8210c2efbf93291e0a08d4bb638
Showing with 38 additions and 178 deletions.
  1. +1 −1 .gitignore
  2. +34 −0 .jsdoc-config.json
  3. 0 codegens/.gitkeep
  4. +1 −1 index.js
  5. 0 lib/.gitkeep
  6. +1 −54 npm/test-system.js
  7. +0 −55 npm/test-unit.js
  8. +1 −2 npm/test.js
  9. +0 −9 package.json
  10. +0 −41 test/system/nsp.test.js
  11. +0 −15 test/system/repository.test.js
@@ -4,7 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.coverage/*
# Runtime data
pids
*.pid
@@ -0,0 +1,34 @@
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
},
"source": {
"include": [ ],
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
},

"plugins": [
"plugins/markdown"
],

"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"highlightTutorialCode" : true
},

"opts": {
"template": "./node_modules/postman-jsdoc-theme",
"encoding": "utf8",
"destination": "./out/docs",
"recurse": true,
"readme": "README.md"
},

"markdown": {
"parser": "gfm",
"hardwrap": false
}
}
No changes.
@@ -1 +1 @@
module.exports = require('./lib');

No changes.
@@ -3,8 +3,6 @@ require('shelljs/global');

var chalk = require('chalk'),
async = require('async'),
_ = require('lodash'),
path = require('path'),
Mocha = require('mocha'),
recursive = require('recursive-readdir'),

@@ -13,18 +11,7 @@ var chalk = require('chalk'),
*
* @type {String}
*/
SPEC_SOURCE_DIR = './test/system',

/**
* Load a JSON from file synchronously, used as an alternative to dynamic requires.
*
* @param {String} file - The path to the JSON file to load from.
* @returns {Object} - The parsed JSON object contained in the file at the provided path.
* @throws {SyntaxError} - Throws an error if the provided JSON file is invalid.
*/
loadJSON = function (file) {
return JSON.parse(require('fs').readFileSync(path.join(__dirname, file)).toString());
};
SPEC_SOURCE_DIR = './test/system';

module.exports = function (exit) {
// banner line
@@ -71,46 +58,6 @@ module.exports = function (exit) {
mocha.run(next);
mocha = null; // cleanup
});
},

/**
* Execute nsp checks on project dependencies. In-program usage of nsp is a bit tricky as we have to emulate the
* cli script's usage of internal nsp functions.
*
* @param {Function} next - The callback function invoked upon completion of the NSP check.
* @returns {*}
*/
function (next) {
var nsp = require('nsp'),
pkg = loadJSON('../package.json'),
nsprc = loadJSON('../.nsprc');

console.info('processing nsp for security vulnerabilities...\n');

// we do not pass full package for privacy concerns and also to add the ability to ignore exclude packages,
// hence we customise the package before we send it
nsp.check({
offline: false,
package: _.merge({
dependencies: _.omit(pkg.dependencies, nsprc.exclusions || [])
}, _.pick(pkg, ['name', 'version', 'homepage', 'repository']))
}, function (err, result) {
// if processing nsp had an error, simply print that and exit
if (err) {
console.error(chalk.red('There was an error processing NSP!\n') + chalk.gray(err.message || err) +
'\n\nSince NSP server failure is not a blocker for tests, tests are not marked as failure!');
return next();
}

// in case an nsp violation is found, we raise an error
if (result.length) {
console.error(nsp.formatters.default(err, result));
return next(1);
}

console.info(chalk.green('nsp ok!\n'));
return next();
});
}
], exit);
};

This file was deleted.

@@ -7,8 +7,7 @@ var chalk = require('chalk'),

require('async').series([
require('./test-lint'),
require('./test-system'),
require('./test-unit')
require('./test-system')
// require('./test-browser')
// require('./test-integration')
], function (code) {
@@ -3,11 +3,7 @@
"version": "0.0.0",
"description": "Generates code snippets for a postman collection",
"main": "index.js",
"bin": {
"code-gen": "./bin/code-gen.js"
},
"directories": {
"lib": "lib",
"test": "test"
},
"scripts": {
@@ -25,11 +21,6 @@
"license": "Apache-2.0",
"homepage": "https://bitbucket.org/postmanlabs/code-gen#readme",
"dependencies": {
"async": "2.6.0",
"commander": "2.15.1",
"lodash": "4.17.4",
"postman-collection": "3.0.7",
"postman-runtime": "7.1.3"
},
"devDependencies": {
"async": "2.5.0",

This file was deleted.

@@ -118,8 +118,6 @@ describe('project repository', function () {

describe('.ignore files', function () {
var gitignorePath = '.gitignore',
npmignorePath = '.npmignore',
npmignore = parseIgnore(npmignorePath),
gitignore = parseIgnore(gitignorePath);

describe(gitignorePath, function () {
@@ -132,19 +130,6 @@ describe('project repository', function () {
});
});

describe(npmignorePath, function () {
it('must exist', function (done) {
fs.stat(npmignorePath, done);
});

it('must have valid content', function () {
expect(_.isEmpty(npmignore)).to.not.be.ok;
});
});

it('.gitignore coverage must be a subset of .npmignore coverage', function () {
expect(_.intersection(gitignore, npmignore)).to.eql(gitignore);
});
});

describe('.eslintrc', function () {

0 comments on commit 2857827

Please sign in to comment.
You can’t perform that action at this time.