MCPcopy Create free account
hub / github.com/Effect-TS/effect / main

Function main

packages/effect/typeperf/compare.mjs:255–383  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

253}
254
255const main = () => {
256 const baseSha = resolveRef(baseRef)
257 const headSha = resolveRef(headRef)
258 mkdirSync(worktreesRoot, { recursive: true })
259 const runRoot = mkdtempSync(join(worktreesRoot, "run-"))
260 const worktrees = []
261 const rows = []
262 let failed = false
263
264 try {
265 const baseWorktree = createWorktree(runRoot, "base", baseSha)
266 worktrees.push(baseWorktree)
267 const headWorktree = createWorktree(runRoot, "head", headSha)
268 worktrees.push(headWorktree)
269
270 const baseTargetRoot = materializeSuite(baseWorktree, httpapi)
271 const headTargetRoot = materializeSuite(headWorktree, httpapi)
272 const matchedSuites = suites.filter((suite) => selectedSuiteName === undefined || suite.name === selectedSuiteName)
273 if (matchedSuites.length === 0) {
274 throw new Error(`Unknown comparison suite: ${selectedSuiteName}`)
275 }
276
277 for (const suite of matchedSuites) {
278 const baseTarget = suite.name === httpapi.name ? baseTargetRoot : materializeSuite(baseWorktree, suite)
279 const headTarget = suite.name === httpapi.name ? headTargetRoot : materializeSuite(headWorktree, suite)
280 const baselineRelativePath = "baseline.ts"
281 const baseBaseline = measure(
282 baseTarget,
283 suite.name,
284 "baseline",
285 join(baseTarget.suiteDir, baselineRelativePath)
286 )
287 const headBaseline = measure(
288 headTarget,
289 suite.name,
290 "baseline",
291 join(headTarget.suiteDir, baselineRelativePath)
292 )
293 if (!baseBaseline.ok || !headBaseline.ok) {
294 if (!baseBaseline.ok) {
295 process.stderr.write(baseBaseline.output)
296 }
297 if (!headBaseline.ok) {
298 process.stderr.write(headBaseline.output)
299 }
300 throw new Error(`Baseline failed for comparison suite ${suite.name}`)
301 }
302
303 const fixtures = suite.fixtures.filter((fixture) =>
304 selectedFixtureName === undefined || fixture.name === selectedFixtureName
305 )
306 if (selectedFixtureName !== undefined && fixtures.length === 0) {
307 throw new Error(`Unknown comparison fixture: ${suite.name}/${selectedFixtureName}`)
308 }
309
310 for (const fixture of fixtures) {
311 const baseMeasurement = measure(
312 baseTarget,

Callers 1

compare.mjsFile · 0.85

Calls 15

createWorktreeFunction · 0.85
materializeSuiteFunction · 0.85
failureLabelFunction · 0.85
suiteHashFunction · 0.85
relativeFunction · 0.85
removeWorktreeFunction · 0.85
pushMethod · 0.80
filterMethod · 0.80
resolveRefFunction · 0.70
measureFunction · 0.70
subtractDiagnosticsFunction · 0.70
sanitizeFunction · 0.70

Tested by

no test coverage detected