function TestBootstrap.run(Y,D,R,j)R=R or TextReporter j=j or{}local f=j.showTimingInfo or false local A=j.testNamePattern local P=j.extraEnvironment or{}if type(D)~="\116\097\098\108\101"then error(("\066\097\100 \097\114\103\117\109\101\110\116 \035\049 \116\111 \084\101\115\116\066\111\111\116\115\116\114\097\112\058\114\117\110\046 \069\120\112\101\099\116\101\100 \116\097\098\108\101\044 \103\111\116 \037\115"):format(typeof(D)),2)end local T=tick()local e={}for D,R in ipairs(D)do local j=Y:getModules(R)for D,R in ipairs(j)do table.insert(e,R)end end local k=tick()local N=TestPlanner.createPlan(e,A,P)local W=tick()local B=TestRunner.runPlan(N)local Z=tick()R.report(B)local s=tick()if f then local D={("\084\111\111\107 \037\102 \115\101\099\111\110\100\115 \116\111 \108\111\099\097\116\101 \116\101\115\116 \109\111\100\117\108\101\115"):format(k-T);("\084\111\111\107 \037\102 \115\101\099\111\110\100\115 \116\111 \099\114\101\097\116\101 \116\101\115\116 \112\108\097\110"):format(W-k);("\084\111\111\107 \037\102 \115\101\099\111\110\100\115 \116\111 \114\117\110 \116\101\115\116\115"):format(Z-W);("\084\111\111\107 \037\102 \115\101\099\111\110\100\115 \116\111 \114\101\112\111\114\116 \116\101\115\116\115"):format(s-Z)}print(table.concat(D,"\n"))end return B end return TestBootstrap

function TestBootstrap:run(roots, reporter, otherOptions)
	reporter = reporter or TextReporter

	otherOptions = otherOptions or {}
	local showTimingInfo = otherOptions["showTimingInfo"] or false
	local testNamePattern = otherOptions["testNamePattern"]
	local extraEnvironment = otherOptions["extraEnvironment"] or {}

	if type(roots) ~= "table" then
		error(("Bad argument #1 to TestBootstrap:run. Expected table, got %s"):format(typeof(roots)), 2)
	end

	local startTime = tick()

	local modules = {}
	for _, subRoot in ipairs(roots) do
		local newModules = self:getModules(subRoot)

		for _, newModule in ipairs(newModules) do
			table.insert(modules, newModule)
		end
	end

	local afterModules = tick()

	local plan = TestPlanner.createPlan(modules, testNamePattern, extraEnvironment)
	local afterPlan = tick()

	local results = TestRunner.runPlan(plan)
	local afterRun = tick()

	reporter.report(results)
	local afterReport = tick()

	if showTimingInfo then
		local timing = {
			("Took %f seconds to locate test modules"):format(afterModules - startTime),
			("Took %f seconds to create test plan"):format(afterPlan - afterModules),
			("Took %f seconds to run tests"):format(afterRun - afterPlan),
			("Took %f seconds to report tests"):format(afterReport - afterRun),
		}

		print(table.concat(timing, "\n"))
	end

	return results
end

return TestBootstrap
