-- ROBLOX deviation END


local chalk = require(Packages.ChalkLua)

local JestUtil = require(Packages.JestUtil)
local ErrorWithStack = JestUtil.ErrorWithStack
local formatTime = JestUtil.formatTime

local typesModule = require(CurrentModule.types)
type ConsoleBuffer = typesModule.ConsoleBuffer
type LogCounters = typesModule.LogCounters
type LogMessage = typesModule.LogMessage
type LogTimers = typesModule.LogTimers
type LogType = typesModule.LogType
type InspectOptions = typesModule.InspectOptions

local RobloxShared = require(Packages.RobloxShared)
type Writeable = RobloxShared.Writeable

export type BufferedConsole = {
	Console: Console,
	assert: (self: BufferedConsole, value: unknown, message: (string | Error)?) -> (),
	count: (self: BufferedConsole, label: string?) -> (),
	countReset: (self: BufferedConsole, label: string?) -> (),
	debug: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
	dir: (self: BufferedConsole, firstArg: unknown, options: InspectOptions?) -> (),
	dirxml: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
	error: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
	group: (self: BufferedConsole, title: string?, ...any) -> (),
	groupCollapsed: (self: BufferedConsole, title: string?, ...any) -> (),
	groupEnd: (self: BufferedConsole) -> (),
	info: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
	log: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
	time: (self: BufferedConsole, label: string?) -> (),
	timeEnd: (self: BufferedConsole, label: string?) -> (),
	timeLog: (self: BufferedConsole, label: string?, ...any) -> (),
	warn: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
	getBuffer: (self: BufferedConsole) -> ConsoleBuffer?,
	write: (buffer: ConsoleBuffer, type: LogType, message: LogMessage, level: (number | nil)?) -> ConsoleBuffer,
}

type BufferedConsolePrivate = BufferedConsole & {
	_log: (self: BufferedConsolePrivate, type: LogType, message: LogMessage) -> (),
	_buffer: ConsoleBuffer,
	_counters: LogCounters,
	_timers: LogTimers,
	_groupDepth: number,
}
