Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #26 from InfoSec812/Kill_more_mutants
Browse files Browse the repository at this point in the history
Kill more mutants
  • Loading branch information
InfoSec812 authored Feb 21, 2019
2 parents d054fec + 83c5a63 commit a4d1e41
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
20 changes: 14 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ language: node_js
node_js:
- node
deploy:
provider: npm
email: "[email protected]"
api_key: "$API_TOKEN"
on:
branch: master
tag: latest
- provider: npm
email: "[email protected]"
api_key: "$API_TOKEN"
on:
branch: master
tag: latest
- provider: releases
api_key: "${GITHUB_TOKEN}"
file:
- "reports/mutation/html/*"
- "coverage/*"
- "unit-test-reports/*"
on:
branch: master
addons:
sonarcloud:
organization: "infosec812-github" # the key of the org you chose at step #3
Expand Down
6 changes: 6 additions & 0 deletions lib/parse_args.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ test('Test undefined threshold', () => {
expect(threshold).toBe(validThresholds.indexOf('critical'));
});

test('Test with MODERATE threshold', () => {
const argv = ['-t', 'moderate'];
const { threshold, ignoreDev, json_output, registry, whitelist } = parse_args(argv);
expect(threshold).toBe(1);
});

test('Test whitelist with HIGH threshold', () => {
const argv = ['-w', 'https-proxy-agent:1.0.0'];
const { threshold, ignoreDev, json_output, registry, whitelist } = parse_args(argv);
Expand Down
4 changes: 2 additions & 2 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function filter_advisories(advisories, ignoreDev, threshold, whitelist = []) {
for (let i = 0; i < whitelist.length; i++) {
if (whitelist[i].startsWith(module_name+':') || (whitelist[i] == module_name)) {
const version = whitelist[i].split(':')[1]; // Module name matches, check the version
if (version === undefined || version === null || version == '*' || version == '') {
if (version === undefined || version == '*') {
return false; // Version was not specified or is a wildcard, so filter out this item
} else if (version == module_version) {
return false; // Version matches specified version, so filter out this item
Expand All @@ -96,4 +96,4 @@ function filter_advisories(advisories, ignoreDev, threshold, whitelist = []) {
module.exports = {
parse_audit_results,
filter_advisories: filter_advisories
};
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "npm-audit-ci-wrapper",
"version": "2.1.5",
"version": "2.1.6",
"description": "A wrapper for 'npm audit' which can be configurable for use in a CI/CD tool like Jenkins",
"keywords": ["npm", "audit", "ci", "security", "dependencies", "jenkins", "travis"],
"main": "index.js",
Expand Down

0 comments on commit a4d1e41

Please sign in to comment.