Node.js has three types of deprecations: documentation-only, runtime, and end-of-life.
End-of-life deprecations are easy to "find" because they are basically things that have been removed and will cause errors when you try to use them.
Runtime deprecations are pretty easy to find because they emit warnings so if you have logging available, you will see them.
Documentation-only deprecations won't show up, but a good number of them become runtime deprecations if you run Node.js with the --pending-deprecation flag or the NODE_PENDING_DEPRECATION environment variable set.
It's also a good idea (in my opinion) to run with the --trace-warnings flag or the --trace-deprecation flag so that you get a stack trace for your deprecation warnings to find them easily in your dependencies, etc.
Two important limitations of --pending-deprecation:
- It won't find deprecated APIs until you try to use them. Parsing is not enough. (Having 100% test coverage is useful.)
- Not all (or even most) documentation-only APIs emit warnings with
--pending-deprecation. However, this will cause warnings for many of the most important ones, so it's totally worth doing in my opinion.
If you want to always get notified of pending deprecations and have stack traces for all warnings, you can set two environment variables in your .profile or .bashrc or equivalent:
NODE_PENDING_DEPRECATION=1
NODE_OPTIONS=--trace-warnings
Be aware that this will make pretty much everything you run noisy. Even npm will start printing warnings on nearly every invocation.