Skip to content

Commit 328a63c

Browse files
committed
[INTERNAL] Replace deprecated new Buffer() calls
Replacing deprecated 'new Buffer(string)' with 'Buffer.from(string)'. Resolves a TypeError being thrown in our tests when executed with Node 20.15.0 or 22.3.0. Root cause: nodejs/node#53075
1 parent f119ccd commit 328a63c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/lib/processors/minifier.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@ test("getSourceMapFromUrl: Unexpected data: format", async (t) => {
15121512

15131513
test("getSourceMapFromUrl: File reference", async (t) => {
15141514
const {getSourceMapFromUrl} = __localFunctions__;
1515-
const readFileStub = sinon.stub().resolves(new Buffer("Source Map Content"));
1515+
const readFileStub = sinon.stub().resolves(Buffer.from("Source Map Content"));
15161516
const sourceMappingUrl = `./other/file.map`;
15171517

15181518
const res = await getSourceMapFromUrl({
@@ -1544,7 +1544,7 @@ test("getSourceMapFromUrl: File reference not found", async (t) => {
15441544

15451545
test("getSourceMapFromUrl: HTTPS URL reference", async (t) => {
15461546
const {getSourceMapFromUrl} = __localFunctions__;
1547-
const readFileStub = sinon.stub().resolves(new Buffer("Source Map Content"));
1547+
const readFileStub = sinon.stub().resolves(Buffer.from("Source Map Content"));
15481548
const sourceMappingUrl = `https://ui5.sap.com/resources/my/test/module.js.map`;
15491549

15501550
const res = await getSourceMapFromUrl({
@@ -1559,7 +1559,7 @@ test("getSourceMapFromUrl: HTTPS URL reference", async (t) => {
15591559

15601560
test("getSourceMapFromUrl: Absolute path reference", async (t) => {
15611561
const {getSourceMapFromUrl} = __localFunctions__;
1562-
const readFileStub = sinon.stub().resolves(new Buffer("Source Map Content"));
1562+
const readFileStub = sinon.stub().resolves(Buffer.from("Source Map Content"));
15631563
const sourceMappingUrl = `/some/file.map`;
15641564

15651565
const res = await getSourceMapFromUrl({

test/lib/tasks/buildThemes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ test.serial("buildThemes (useWorkers = true)", async (t) => {
493493
};
494494
const lessResource = {
495495
getPath: () => "/resources/test/library.source.less",
496-
getBuffer: () => new Buffer("/** test comment */")
496+
getBuffer: () => Buffer.from("/** test comment */")
497497
};
498498

499499
const workspace = {

0 commit comments

Comments
 (0)