diff --git a/lib/assert.js b/lib/assert.js index 9a684cbe5fd6bf..bbd3c283c5f0e9 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -965,10 +965,10 @@ assert.ifError = function ifError(err) { // This will remove any duplicated frames from the error frames taken // from within `ifError` and add the original error frames to the newly // created ones. - const origStackStart = origStack.indexOf('\n at'); + const origStackStart = StringPrototypeIndexOf(origStack, '\n at'); if (origStackStart !== -1) { const originalFrames = StringPrototypeSplit( - origStack.slice(origStackStart + 1), + StringPrototypeSlice(origStack, origStackStart + 1), '\n' ); // Filter all frames existing in err.stack.