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

Commit

Permalink
BREAKING: Run all tests by default
Browse files Browse the repository at this point in the history
Only run partial when explicitly asked specifically to just run "--missing" or "--unused"

This is breaking as the default check is now changing, which may cause failures
  • Loading branch information
voxpelli committed Jul 28, 2019
1 parent da6c139 commit 5e4f11b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
7 changes: 5 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ check({
excludePeer: args.peer === false,
ignore: [].concat(args.i || [])
}
if (args.extra) {

const runAllTests = !args.extra && !args.missing

if (runAllTests || args.extra) {
const extras = check.extra(pkg, deps, options)
failed += extras.length
if (extras.length) {
Expand All @@ -97,7 +100,7 @@ check({
console.log('Success! All dependencies in package.json are used in the code')
}
}
if (args.missing || !args.extra) {
if (runAllTests || args.missing) {
const missing = check.missing(pkg, deps, options)
failed += missing.length
if (missing.length) {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
"dependency-check": "cli.js"
},
"scripts": {
"check:dependencies": "node cli.js . && node cli.js . --missing --extra --no-dev -e js:detective-cjs",
"check:dependencies": "node cli.js . --no-dev",
"check:node-versions": "installed-check --engine-check --no-version-check",
"lint": "standard",
"test-cli:main-as-file": "node cli.js test/index.js",
"test-cli:custom-detective": "node cli.js test/ -e js:detective-cjs",
"test-cli:glob": "node cli.js test/ --entry '**/*.js' --no-default-entries",
"test-cli:main-as-file": "node cli.js test/index.js",
"test-cli:simple": "node cli.js test/",
"test-cli": "npm-run-all --parallel test-cli:*",
"test": "npm-run-all lint test-cli check:*"
Expand Down
11 changes: 8 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,36 @@ $ dependency-check <path to module file(s), package.json or module folder>
$ dependency-check ./package.json
Success! All dependencies used in the code are listed in package.json
Success! All dependencies in package.json are used in the code
$ dependency-check ./package.json --missing
Success! All dependencies used in the code are listed in package.json
$ dependency-check ./package.json --unused
Success! All dependencies in package.json are used in the code
# or with file input instead:
$ dependency-check ./index.js
Success! All dependencies used in the code are listed in package.json
Success! All dependencies in package.json are used in the code
# even with globs and multiple inputs:
$ dependency-check ./test/**/*.js ./lib/*.js
Success! All dependencies used in the code are listed in package.json
Success! All dependencies in package.json are used in the code
```

`dependency-check` exits with code 1 if there are discrepancies, in addition to printing them out

To always exit with code 0 pass `--ignore`

### --missing (default)
### --missing

running `dependency-check ./package.json` will check to make sure that all modules in your code are listed in your package.json
running `dependency-check ./package.json --missing` will only do the check to make sure that all modules in your code are listed in your package.json

### --unused, --extra

running `dependency-check ./package.json --unused` will do the inverse of the default missing check and will tell you which modules in your package.json dependencies **were not used** in your code
running `dependency-check ./package.json --unused` will only do the inverse of the missing check and will tell you which modules in your package.json dependencies **were not used** in your code

### --no-dev

Expand Down

0 comments on commit 5e4f11b

Please sign in to comment.