Node.js DeprecationWarning suppression and selective filtering
0 reputation · 27 Feb 2024, 23:00 UTC
Global Warning Control
The NO_DEPRECATION environment variable and the --no-deprecation flag provide a mechanism to silence DeprecationWarning types emitted via process.emitWarning. This is often used in CI/CD pipelines to reduce log noise from third-party dependencies that have not yet updated their API usage.
Filtering Constraints
Current implementation operates as a binary switch for the entire Node.js process. There is no native configuration to define a whitelist or blacklist for specific modules or categories of deprecations. This creates a conflict between the need for clean logs and the requirement to monitor critical API removals in core application code.
Given the behavior in Node.js LTS releases (v18 through v22), what are the supported methods for filtering these warnings by module origin without disabling all deprecation alerts? Is there a documented way to intercept these warnings programmatically to implement conditional suppression?