mirror of https://github.com/lukechilds/node.git
Browse Source
The pending deprecation warning is off by default. Launch the node process with --pending-deprecation or NODE_PENDING_DEPRECATION=1 env var set. PR-URL: https://github.com/nodejs/node/pull/11968 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>v6
James M Snell
8 years ago
3 changed files with 61 additions and 1 deletions
@ -0,0 +1,14 @@ |
|||
// Flags: --no-warnings --pending-deprecation
|
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
const Buffer = require('buffer').Buffer; |
|||
|
|||
process.on('warning', common.mustNotCall('A warning should not be emitted')); |
|||
|
|||
// With the --pending-deprecation flag, the deprecation warning for
|
|||
// new Buffer() should not be emitted when Uint8Array methods are called.
|
|||
|
|||
Buffer.from('abc').map((i) => i); |
|||
Buffer.from('abc').filter((i) => i); |
|||
Buffer.from('abc').slice(1, 2); |
@ -0,0 +1,15 @@ |
|||
// Flags: --pending-deprecation --no-warnings
|
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
const Buffer = require('buffer').Buffer; |
|||
|
|||
const bufferWarning = 'The Buffer() and new Buffer() constructors are not ' + |
|||
'recommended for use due to security and usability ' + |
|||
'concerns. Please use the new Buffer.alloc(), ' + |
|||
'Buffer.allocUnsafe(), or Buffer.from() construction ' + |
|||
'methods instead.'; |
|||
|
|||
common.expectWarning('DeprecationWarning', bufferWarning); |
|||
|
|||
new Buffer(10); |
Loading…
Reference in new issue