-- ROBLOX DEVIATION: These are assigned in the constructor for testing

local npm_config_user_agent, npm_lifecycle_event, npm_lifecycle_script

export type SummaryReporter = {
	onRunStart: (self: SummaryReporter, aggregatedResults: AggregatedResult, options: ReporterOnStartOptions) -> (),
	onRunComplete: (self: SummaryReporter, contexts: Set<Context>, aggregatedResults: AggregatedResult) -> (),
}

type SummaryReporterPrivate = SummaryReporter & {
	_globalConfig: Config_GlobalConfig,
	_estimatedTime: number,
}

local SummaryReporter = setmetatable({}, { __index = BaseReporter }) :: any

SummaryReporter.__index = SummaryReporter
SummaryReporter.filename = "SummaryReporter"

function SummaryReporter.new(globalConfig: Config_GlobalConfig, _process: any?): SummaryReporter
	local self = setmetatable((BaseReporter.new(_process) :: any) :: SummaryReporterPrivate, SummaryReporter)

	-- ROBLOX deviation START: _process can be nil
	if _process then
		npm_lifecycle_script = _process.env.npm_lifecycle_script
		npm_lifecycle_event = _process.env.npm_lifecycle_event
		npm_config_user_agent = _process.env.npm_config_user_agent
	end
	-- ROBLOX deviation END
	self._globalConfig = globalConfig
	self._estimatedTime = 0

	return (self :: any) :: SummaryReporter
end
