-- ROBLOX deviation: config does not have StackTraceConfig type annotation

local function formatPaths(config, relativeTestPath, line: string): string
	-- ROBLOX deviation: we don't do any formatting of paths in Lua to align with upstream
	return line
end

function getStackTraceLines(stack: string, options: StackTraceOptions): { string }
	if options == nil then
		options = { noCodeFrame = false, noStackTrace = false }
	end
	return removeInternalStackEntries(string.split(stack, "\n"), options)
end

function formatStackTrace(stack: string, config, options: StackTraceOptions, testPath): string
	local lines = getStackTraceLines(stack, options)

	local relativeTestPath = nil
	if testPath then
		relativeTestPath = "unsupported"
	end

	local stacktrace = table.concat(
		Array.map(Array.filter(lines, Boolean), function(line)
			return STACK_INDENT .. formatPaths(config, relativeTestPath, trimPaths(line))
		end),
		"\n"
	)

	return string.format("\n%s", stacktrace)
end
