Skip to content

Commit

Permalink
Replace deprecated new Buffer()
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDancingCode authored and demurgos committed Apr 8, 2018
1 parent 841228b commit 428393b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ module.exports = function (opt) {

if (data && data.v3SourceMap && file.sourceMap) {
applySourceMap(file, data.v3SourceMap);
file.contents = new Buffer(data.js);
file.contents = Buffer.from(data.js);
} else {
file.contents = new Buffer(data);
file.contents = Buffer.from(data);
}

file.path = dest;
Expand Down
30 changes: 15 additions & 15 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('gulp-coffee', function() {

it('should concat two files', function(done) {
var filepath = '/home/contra/test/file.coffee';
var contents = new Buffer('a = 2');
var contents = Buffer.from('a = 2');
var opts = {bare: true};
var expected = coffeescript.compile(String(contents), opts);

Expand All @@ -72,7 +72,7 @@ describe('gulp-coffee', function() {

it('should emit errors correctly', function(done) {
var filepath = '/home/contra/test/file.coffee';
var contents = new Buffer('if a()\r\n then huh');
var contents = Buffer.from('if a()\r\n then huh');

coffee({bare: true})
.on('error', function(err) {
Expand All @@ -87,7 +87,7 @@ describe('gulp-coffee', function() {

it('should compile a file (no bare)', function(done) {
var filepath = 'test/fixtures/grammar.coffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var expected = coffeescript.compile(String(contents));

coffee()
Expand All @@ -98,7 +98,7 @@ describe('gulp-coffee', function() {

it('should compile a file (with bare)', function(done) {
var filepath = 'test/fixtures/grammar.coffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var opts = {bare: true};
var expected = coffeescript.compile(String(contents), opts);

Expand All @@ -110,7 +110,7 @@ describe('gulp-coffee', function() {

it('should compile a file with source map', function(done) {
var filepath = 'test/fixtures/grammar.coffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var expected = coffeescript.compile(String(contents), {
sourceMap: true,
sourceFiles: ['grammar.coffee'],
Expand All @@ -128,7 +128,7 @@ describe('gulp-coffee', function() {

it('should compile a file with bare and with source map', function(done) {
var filepath = 'test/fixtures/grammar.coffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var expected = coffeescript.compile(String(contents), {
bare: true,
sourceMap: true,
Expand All @@ -146,7 +146,7 @@ describe('gulp-coffee', function() {

it('should compile a file (no header)', function(done) {
var filepath = 'test/fixtures/grammar.coffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var expected = coffeescript.compile(String(contents), {header: false});

coffee()
Expand All @@ -157,7 +157,7 @@ describe('gulp-coffee', function() {

it('should compile a file (with header)', function(done) {
var filepath = 'test/fixtures/grammar.coffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var expected = coffeescript.compile(String(contents), {header: true});

coffee({header: true})
Expand All @@ -168,7 +168,7 @@ describe('gulp-coffee', function() {

it('should compile a literate file', function(done) {
var filepath = 'test/fixtures/journo.litcoffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var opts = {literate: true};
var expected = coffeescript.compile(String(contents), opts);

Expand All @@ -180,7 +180,7 @@ describe('gulp-coffee', function() {

it('should compile a literate file (implicit)', function(done) {
var filepath = 'test/fixtures/journo.litcoffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var expected = coffeescript.compile(String(contents), {literate: true});

coffee()
Expand All @@ -191,7 +191,7 @@ describe('gulp-coffee', function() {

it('should compile a literate file (with bare)', function(done) {
var filepath = 'test/fixtures/journo.litcoffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var opts = {literate: true, bare: true};
var expected = coffeescript.compile(String(contents), opts);

Expand All @@ -203,7 +203,7 @@ describe('gulp-coffee', function() {

it('should compile a literate file with source map', function(done) {
var filepath = 'test/fixtures/journo.litcoffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var expected = coffeescript.compile(String(contents), {
literate: true,
sourceMap: true,
Expand All @@ -221,7 +221,7 @@ describe('gulp-coffee', function() {

it('should compile a literate file with bare and with source map', function(done) {
var filepath = 'test/fixtures/journo.litcoffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var expected = coffeescript.compile(String(contents), {
literate: true,
bare: true,
Expand All @@ -240,7 +240,7 @@ describe('gulp-coffee', function() {

it('should rename a literate markdown file', function(done) {
var filepath = 'test/fixtures/journo.coffee.md';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var opts = {literate: true};
var expected = coffeescript.compile(String(contents), opts);

Expand All @@ -252,7 +252,7 @@ describe('gulp-coffee', function() {

it('should accept a custom coffeescript version', function(done) {
var filepath = 'test/fixtures/grammar.coffee';
var contents = new Buffer(fs.readFileSync(filepath));
var contents = Buffer.from(fs.readFileSync(filepath));
var wasSpyCalled = false;
var opts = {
coffee: {
Expand Down

0 comments on commit 428393b

Please sign in to comment.