Skip to content

Commit 0d2e62c

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 (cherry picked from commit 934956a)
1 parent 8805842 commit 0d2e62c

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
@@ -1508,7 +1508,7 @@ test("getSourceMapFromUrl: Unexpected data: format", async (t) => {
15081508

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

15141514
const res = await getSourceMapFromUrl({
@@ -1540,7 +1540,7 @@ test("getSourceMapFromUrl: File reference not found", async (t) => {
15401540

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

15461546
const res = await getSourceMapFromUrl({
@@ -1555,7 +1555,7 @@ test("getSourceMapFromUrl: HTTPS URL reference", async (t) => {
15551555

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

15611561
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)