Skip to content

Commit

Permalink
Fix up Buffer usage
Browse files Browse the repository at this point in the history
  • Loading branch information
vladikoff committed Mar 17, 2020
1 parent 4bfa98e commit 0a66968
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -7,7 +7,7 @@
"repository": "https://github.com/gruntjs/grunt.git",
"license": "MIT",
"engines": {
"node": ">=10"
"node": ">=8"
},
"scripts": {
"test": "node bin/grunt test",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/spawn-multibyte.js
Expand Up @@ -4,7 +4,7 @@
// A multibyte buffer containing all our output. We will slice it later.
// In this case we are using a Japanese word for hello / good day, where each
// character takes three bytes.
var fullOutput = new Buffer('こんにちは');
var fullOutput = Buffer.from('こんにちは');

// Output one full character and one third of a character
process.stdout.write(fullOutput.slice(0, 4));
Expand Down
6 changes: 3 additions & 3 deletions test/grunt/config_test.js
Expand Up @@ -18,7 +18,7 @@ exports.config = {
bar: 'bar',
arr: ['foo', '<%= obj.foo2 %>'],
arr2: ['<%= arr %>', '<%= obj.Arr %>'],
buffer: new Buffer('test'),
buffer: Buffer.from('test'),
});
done();
},
Expand Down Expand Up @@ -57,7 +57,7 @@ exports.config = {
test.deepEqual(grunt.config.process(['<%= arr %>', '<%= obj.Arr %>']), [['foo', 'bar'], ['foo', 'bar']], 'Should expand <%= arr %> and <%= obj.Arr %> values as objects if possible.');
var buf = grunt.config.process('<%= buffer %>');
test.ok(Buffer.isBuffer(buf), 'Should retrieve Buffer instances as Buffer.');
test.deepEqual(buf, new Buffer('test'), 'Should return buffers as-is.');
test.deepEqual(buf, Buffer.from('test'), 'Should return buffers as-is.');
test.done();
},
'config.get': function(test) {
Expand All @@ -72,7 +72,7 @@ exports.config = {
test.deepEqual(grunt.config.get(['obj', 'arr2']), [['foo', 'bar'], ['foo', 'bar']], 'Should expand <%= arr %> and <%= obj.Arr %> values as objects if possible.');
var buf = grunt.config.get('buffer');
test.ok(Buffer.isBuffer(buf), 'Should retrieve Buffer instances as Buffer.');
test.deepEqual(buf, new Buffer('test'), 'Should return buffers as-is.');
test.deepEqual(buf, Buffer.from('test'), 'Should return buffers as-is.');
test.done();
},
'config.set': function(test) {
Expand Down
2 changes: 1 addition & 1 deletion test/grunt/file_test.js
Expand Up @@ -567,7 +567,7 @@ exports.file = {
encoding: null,
process: function(src) {
test.ok(Buffer.isBuffer(src), 'when encoding is specified as null, process src as a buffer');
return new Buffer('føø' + src.toString() + 'bår');
return Buffer.from('føø' + src.toString() + 'bår');
}
});
test.equal(grunt.file.read(tmpfile.path), 'føø' + this.string + 'bår', 'file should be saved as the buffer returned by process.');
Expand Down

0 comments on commit 0a66968

Please sign in to comment.