Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option --json changes return status #407

Closed
mrbobfrog opened this issue Aug 8, 2019 · 2 comments · Fixed by #465
Closed

option --json changes return status #407

mrbobfrog opened this issue Aug 8, 2019 · 2 comments · Fixed by #465

Comments

@mrbobfrog
Copy link

Bug Description

On a code base, when I run depcheck <project> --json it changes the return status (returns zero on unused or missing dependencies). FYI depcheck <project> returns non-zero.

Code snippets

Where the dependency is used:

var http = require('http');

var server = http.createServer(function(req, res) {
  res.writeHead(200);
  res.end('Hi everybody!');
});
server.listen(8080);

Where the dependency is listed in package.json:

{
  "name": "simple",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "typescript": "~3.4.5"
  }
}

Versions

  • node -v: v10.16.0
  • npm -v: 6.10.3
  • depcheck --version: 0.8.3

Extra info

I would like to use depcheck as part of an automated build pipeline. Unfortunately, it does not behave consistently when I use the --json option.

Here's my test:

$ depcheck .
Unused dependencies
* typescript
$ echo $?
255
$ depcheck . --json
{"dependencies":["typescript"],"devDependencies":[],"missing":{},"using":{},"invalidFiles":{},"invalidDirs":{}}
$ echo $?
0

BONUS POINTS: If you wish to help us debug further, the depcheck --json option will show more information. Check here in the README for documentation on json output.

@stale
Copy link

stale bot commented Nov 2, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@rumpl
Copy link
Member

rumpl commented Nov 3, 2019

@mrbobfrog Thanks for reporting this, will be fixed in the next release, see #465

@stale stale bot removed the wontfix label Nov 3, 2019
rumpl added a commit that referenced this issue Nov 3, 2019
@rumpl rumpl closed this as completed in #465 Nov 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants