From b1199c7bb4b6e430e75ab2dcc3dfe2d87d39c982 Mon Sep 17 00:00:00 2001 From: Ayoub Mabrouk <77799760+Ayoub-Mabrouk@users.noreply.github.com> Date: Tue, 24 Feb 2026 22:02:18 +0000 Subject: [PATCH] test_runner: replace native methods with primordials Replace native methods with primordials. PR-URL: https://github.com/nodejs/node/pull/61219 Reviewed-By: Colin Ihrig Reviewed-By: Chemi Atlow Reviewed-By: Jordan Harband Reviewed-By: Pietro Marchini Reviewed-By: Moshe Atlow --- lib/internal/test_runner/snapshot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/test_runner/snapshot.js b/lib/internal/test_runner/snapshot.js index ff3e3c8d0e6..158ec1d4421 100644 --- a/lib/internal/test_runner/snapshot.js +++ b/lib/internal/test_runner/snapshot.js @@ -9,6 +9,7 @@ const { SafeMap, String, StringPrototypeReplaceAll, + StringPrototypeSlice, } = primordials; const { codes: { @@ -291,7 +292,7 @@ function validateFunctionArray(fns, name) { } function escapeSnapshotKey(str) { - let result = JSONStringify(str, null, 2).slice(1, -1); + let result = StringPrototypeSlice(JSONStringify(str, null, 2), 1, -1); result = StringPrototypeReplaceAll(result, '`', '\\`'); result = StringPrototypeReplaceAll(result, '${', '\\${'); return result;