diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 1e7ff6f682347b..fb830914ceb99a 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3313,6 +3313,9 @@ Values other than `undefined`, `null`, integer numbers, and integer strings -Type: Documentation-only +Type: Runtime -The [`--trace-atomics-wait`][] flag is deprecated. +The [`--trace-atomics-wait`][] flag is deprecated because +it uses the V8 hook `SetAtomicsWaitCallback`, +that will be removed in a future V8 release. ### DEP0166: Double slashes in imports and exports targets diff --git a/src/node.cc b/src/node.cc index deaed9ec3d74a9..cec88c4f4ecd84 100644 --- a/src/node.cc +++ b/src/node.cc @@ -258,6 +258,10 @@ void Environment::InitializeDiagnostics() { if (options_->trace_uncaught) isolate_->SetCaptureStackTraceForUncaughtExceptions(true); if (options_->trace_atomics_wait) { + ProcessEmitDeprecationWarning( + Environment::GetCurrent(isolate_), + "The flag --trace-atomics-wait is deprecated.", + "DEP0165"); isolate_->SetAtomicsWaitCallback(AtomicsWaitCallback, this); AddCleanupHook([](void* data) { Environment* env = static_cast(data); diff --git a/test/parallel/test-trace-atomic-deprecation.js b/test/parallel/test-trace-atomic-deprecation.js new file mode 100644 index 00000000000000..10434c417518fd --- /dev/null +++ b/test/parallel/test-trace-atomic-deprecation.js @@ -0,0 +1,14 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const { test } = require('node:test'); + +test('should emit deprecation warning DEP0165', async () => { + await common.spawnPromisified(process.execPath, ['--trace-atomics-wait', '-e', '{}']) + .then(common.mustCall(({ code, stdout, stderr }) => { + assert.strictEqual(code, 0); + assert.strictEqual(stdout, ''); + assert.match(stderr, /\[DEP0165\] DeprecationWarning:/); + })); +});