summaryrefslogtreecommitdiff
path: root/test/parallel/test-buffer-constructor-deprecation-error.js
blob: 46535e103b33eef4505e53ec5523a73c35e59eb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';

const common = require('../common');

const bufferWarning = 'Buffer() is deprecated due to security and usability ' +
                      'issues. Please use the Buffer.alloc(), ' +
                      'Buffer.allocUnsafe(), or Buffer.from() methods instead.';

common.expectWarning('DeprecationWarning', bufferWarning, 'DEP0005');

// This is used to make sure that a warning is only emitted once even though
// `new Buffer()` is called twice.
process.on('warning', common.mustCall());

Error.prepareStackTrace = (err, trace) => new Buffer(10);

new Error().stack;