File tree Expand file tree Collapse file tree 3 files changed +27
-9
lines changed
Expand file tree Collapse file tree 3 files changed +27
-9
lines changed Original file line number Diff line number Diff line change @@ -902,11 +902,21 @@ Certain versions of `node::MakeCallback` APIs available to native modules are
902902deprecated. Please use the versions of the API that accept an `async_context`
903903parameter.
904904
905+ <a id="DEP0100"></a>
906+ ### DEP0100: process.assert()
907+
908+ Type: Runtime
909+
910+ `process.assert()` is deprecated. Please use the [`assert`][] module instead.
911+
912+ This was never a documented feature.
913+
905914[`--pending-deprecation`]: cli.html#cli_pending_deprecation
906915[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
907916[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
908917[`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer
909918[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
919+ [`assert`]: assert.html
910920[`clearInterval()`]: timers.html#timers_clearinterval_timeout
911921[`clearTimeout()`]: timers.html#timers_cleartimeout_timeout
912922[`EventEmitter.listenerCount(emitter, eventName)`]: events.html#events_eventemitter_listenercount_emitter_eventname
Original file line number Diff line number Diff line change 33const errors = require ( 'internal/errors' ) ;
44const util = require ( 'util' ) ;
55const constants = process . binding ( 'constants' ) . os . signals ;
6-
7- const assert = process . assert = function ( x , msg ) {
8- if ( ! x ) throw new errors . Error ( 'ERR_ASSERTION' , msg || 'assertion error' ) ;
9- } ;
10-
6+ const assert = require ( 'assert' ) . strict ;
7+ const { deprecate } = require ( 'internal/util' ) ;
8+
9+ process . assert = deprecate (
10+ function ( x , msg ) {
11+ if ( ! x ) throw new errors . Error ( 'ERR_ASSERTION' , msg || 'assertion error' ) ;
12+ } ,
13+ 'process.assert() is deprecated. Please use the `assert` module instead.' ,
14+ 'DEP0100' ) ;
1115
1216function setup_performance ( ) {
1317 require ( 'perf_hooks' ) ;
Original file line number Diff line number Diff line change 22const common = require ( '../common' ) ;
33const assert = require ( 'assert' ) ;
44
5+ common . expectWarning (
6+ 'DeprecationWarning' ,
7+ 'process.assert() is deprecated. Please use the `assert` module instead.' ,
8+ 'DEP0100'
9+ ) ;
10+
511assert . strictEqual ( process . assert ( 1 , 'error' ) , undefined ) ;
612common . expectsError ( ( ) => {
713 process . assert ( undefined , 'errorMessage' ) ;
814} , {
915 code : 'ERR_ASSERTION' ,
1016 type : Error ,
1117 message : 'errorMessage'
12- }
13- ) ;
18+ } ) ;
1419common . expectsError ( ( ) => {
1520 process . assert ( false ) ;
1621} , {
1722 code : 'ERR_ASSERTION' ,
1823 type : Error ,
1924 message : 'assertion error'
20- }
21- ) ;
25+ } ) ;
You can’t perform that action at this time.
0 commit comments