question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exit code from `depcheck` executable

See original GitHub issue

Using the depcheck executable should exit with an error code if there are unused dependencies. Running it on my project this doesnt appear to be the case.

$ depcheck
Unused devDependencies
* gulp-eslint
* should-http
Missing dependencies
* mongoose-text-search

Results in an exit code:

$ echo $?
0

Versions: Node: v5.7.0 depcheck: 0.6.3.

I’ve had a look around in the code and the issue appears to stem from this block of code: https://github.com/depcheck/depcheck/blob/6cb92533adf3ed2ed3f6054d6cb3c51e56731615/bin/depcheck#L11-L13 If you move the process.exit to outside of the on('finish') callback then it works as expected. Have you seen this issue before? What was the reasoning behind adding that callback?

Edit: This was introduced here: https://github.com/depcheck/depcheck/commit/44124dd908efb5b638b1d417ece5e2aa7a2daa50

Checking out the version before the 0.6.0 release (0.5.11) has fixed the issue.

Edit 2: I’ve added a regression test for this issue in my fork: https://github.com/domharrington/depcheck/commit/99e6ce1816e9e457a7366b969551472f355991b0 Any help would be appreciated!

Edit 3: According to the node docs, process.stdout never emits a finish event: https://nodejs.org/api/process.html#process_process_stdout. Can confirm this is the case as when i put a log statement into that callback, it never gets called.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
PatrickEickmeiercommented, Sep 21, 2017

I made some tests and it seems that there is only an exit code >0 when there are unused dependencies.

$ depcheck --ignores=winston
Missing dependencies
* handlebars
$ echo $?
0
$ depcheck --ignores=handlebars
Unused dependencies
* winston
$ echo $?
255
1reaction
pdehaancommented, Jun 29, 2016

Any chance we get get a new release published to npm with this fix?

Read more comments on GitHub >

github_iconTop Results From Across the Web

depcheck | Yarn - Package Manager
Depcheck is a tool for analyzing the dependencies in a project to see: how each dependency is used, which dependencies are useless, and...
Read more >
Setup Failed on component WIC Installer - Microsoft Community
NET FRAMEWORK FROM THE FOLLOWING LINK BUT AN ERROR OCCURRED WHILE ... WIC Installer DepCheck indicates WIC Installer is not installed. Error ......
Read more >
dependency-check-cli – Command Line Arguments
If the score set between 0 and 10 the exit code from dependency-check will indicate if a vulnerability with a CVSS score equal...
Read more >
depcheck - UNPKG
The CDN for depcheck. ... 90, - Option to exit without error code \(when running via "npm run depcheck"\) ... 607, - Exit...
Read more >
depcheck - npm
The dependency lodash is used somewhere in the code, but not declared in the package.json file. Please note that, if a subfolder has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found