Skip to content

Commit 74c2ac1

Browse files
committed
tests: use safe-buffer to construct buffers
1 parent 9c1aaa9 commit 74c2ac1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"eslint-plugin-promise": "3.6.0",
2020
"eslint-plugin-standard": "3.0.1",
2121
"istanbul": "0.4.5",
22-
"mocha": "2.5.3"
22+
"mocha": "2.5.3",
23+
"safe-buffer": "5.1.1"
2324
},
2425
"files": [
2526
"lib/",

test/support/capture-stderr.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
'use strict'
88

9+
/**
10+
* Module dependencies.
11+
* @private
12+
*/
13+
14+
var Buffer = require('safe-buffer').Buffer
15+
916
/**
1017
* Module exports.
1118
* @public
@@ -25,7 +32,7 @@ function captureStderr (fn, color) {
2532

2633
process.stderr.isTTY = Boolean(color)
2734
process.stderr.write = function write (chunk, encoding) {
28-
chunks.push(new Buffer(chunk, encoding))
35+
chunks.push(Buffer.from(chunk, encoding))
2936
}
3037

3138
try {

0 commit comments

Comments
 (0)