File tree 3 files changed +27
-9
lines changed
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
902
902
deprecated. Please use the versions of the API that accept an `async_context`
903
903
parameter.
904
904
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
+
905
914
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
906
915
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
907
916
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
908
917
[`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer
909
918
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
919
+ [`assert`]: assert.html
910
920
[`clearInterval()`]: timers.html#timers_clearinterval_timeout
911
921
[`clearTimeout()`]: timers.html#timers_cleartimeout_timeout
912
922
[`EventEmitter.listenerCount(emitter, eventName)`]: events.html#events_eventemitter_listenercount_emitter_eventname
Original file line number Diff line number Diff line change 3
3
const errors = require ( 'internal/errors' ) ;
4
4
const util = require ( 'util' ) ;
5
5
const 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' ) ;
11
15
12
16
function setup_performance ( ) {
13
17
require ( 'perf_hooks' ) ;
Original file line number Diff line number Diff line change 2
2
const common = require ( '../common' ) ;
3
3
const assert = require ( 'assert' ) ;
4
4
5
+ common . expectWarning (
6
+ 'DeprecationWarning' ,
7
+ 'process.assert() is deprecated. Please use the `assert` module instead.' ,
8
+ 'DEP0100'
9
+ ) ;
10
+
5
11
assert . strictEqual ( process . assert ( 1 , 'error' ) , undefined ) ;
6
12
common . expectsError ( ( ) => {
7
13
process . assert ( undefined , 'errorMessage' ) ;
8
14
} , {
9
15
code : 'ERR_ASSERTION' ,
10
16
type : Error ,
11
17
message : 'errorMessage'
12
- }
13
- ) ;
18
+ } ) ;
14
19
common . expectsError ( ( ) => {
15
20
process . assert ( false ) ;
16
21
} , {
17
22
code : 'ERR_ASSERTION' ,
18
23
type : Error ,
19
24
message : 'assertion error'
20
- }
21
- ) ;
25
+ } ) ;
You can’t perform that action at this time.
0 commit comments