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

Commit 5e4f11b

Browse files
committedJul 28, 2019
BREAKING: Run all tests by default
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
1 parent da6c139 commit 5e4f11b

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed
 

‎cli.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ check({
8888
excludePeer: args.peer === false,
8989
ignore: [].concat(args.i || [])
9090
}
91-
if (args.extra) {
91+
92+
const runAllTests = !args.extra && !args.missing
93+
94+
if (runAllTests || args.extra) {
9295
const extras = check.extra(pkg, deps, options)
9396
failed += extras.length
9497
if (extras.length) {
@@ -97,7 +100,7 @@ check({
97100
console.log('Success! All dependencies in package.json are used in the code')
98101
}
99102
}
100-
if (args.missing || !args.extra) {
103+
if (runAllTests || args.missing) {
101104
const missing = check.missing(pkg, deps, options)
102105
failed += missing.length
103106
if (missing.length) {

‎package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
"dependency-check": "cli.js"
88
},
99
"scripts": {
10-
"check:dependencies": "node cli.js . && node cli.js . --missing --extra --no-dev -e js:detective-cjs",
10+
"check:dependencies": "node cli.js . --no-dev",
1111
"check:node-versions": "installed-check --engine-check --no-version-check",
1212
"lint": "standard",
13-
"test-cli:main-as-file": "node cli.js test/index.js",
13+
"test-cli:custom-detective": "node cli.js test/ -e js:detective-cjs",
1414
"test-cli:glob": "node cli.js test/ --entry '**/*.js' --no-default-entries",
15+
"test-cli:main-as-file": "node cli.js test/index.js",
1516
"test-cli:simple": "node cli.js test/",
1617
"test-cli": "npm-run-all --parallel test-cli:*",
1718
"test": "npm-run-all lint test-cli check:*"

‎readme.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,36 @@ $ dependency-check <path to module file(s), package.json or module folder>
3434
3535
$ dependency-check ./package.json
3636
Success! All dependencies used in the code are listed in package.json
37+
Success! All dependencies in package.json are used in the code
38+
$ dependency-check ./package.json --missing
39+
Success! All dependencies used in the code are listed in package.json
3740
$ dependency-check ./package.json --unused
3841
Success! All dependencies in package.json are used in the code
3942
4043
# or with file input instead:
4144
4245
$ dependency-check ./index.js
4346
Success! All dependencies used in the code are listed in package.json
47+
Success! All dependencies in package.json are used in the code
4448
4549
# even with globs and multiple inputs:
4650
4751
$ dependency-check ./test/**/*.js ./lib/*.js
4852
Success! All dependencies used in the code are listed in package.json
53+
Success! All dependencies in package.json are used in the code
4954
```
5055

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

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

55-
### --missing (default)
60+
### --missing
5661

57-
running `dependency-check ./package.json` will check to make sure that all modules in your code are listed in your package.json
62+
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
5863

5964
### --unused, --extra
6065

61-
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
66+
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
6267

6368
### --no-dev
6469

0 commit comments

Comments
 (0)