diff --git a/lib/internal/test_runner/snapshot.js b/lib/internal/test_runner/snapshot.js index ff3e3c8d0e6ee6..158ec1d44216cd 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;