MCPcopy Create free account
hub / github.com/adobe/react-spectrum / run

Function run

perf/runner.mjs:277–446  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

275}
276
277export async function run(options) {
278 let selected = scenarios.filter(
279 scenario =>
280 !options.scenario ||
281 options.scenario
282 .split(',')
283 .some(filter => scenario.id === filter || scenario.fixture === filter)
284 );
285 if (
286 !selected.length ||
287 options.scenario
288 ?.split(',')
289 .some(filter => !scenarios.some(s => s.id === filter || s.fixture === filter))
290 ) {
291 throw new Error('Unknown scenario filter. Use `yarn perf list`.');
292 }
293 let builds = {base: await loadBuild(options.base)};
294 if (options.candidate) {
295 builds.candidate = await loadBuild(options.candidate);
296 if (
297 builds.base.lockHash !== builds.candidate.lockHash ||
298 JSON.stringify(builds.base.versions) !== JSON.stringify(builds.candidate.versions)
299 ) {
300 throw new Error(
301 'Builds use different dependency locks or tool versions. Compare like-for-like builds.'
302 );
303 }
304 }
305 let id =
306 new Date().toISOString().replaceAll(/[:.]/g, '-') +
307 '-' +
308 Math.random().toString(16).slice(2, 8);
309 let dir = path.join(local, 'results', id);
310 await fs.mkdir(dir, {recursive: true});
311 let server = await serve(builds);
312 let result = {
313 schema: 2,
314 started: new Date().toISOString(),
315 status: 'running',
316 options,
317 builds,
318 scenarios: selected,
319 environment: {
320 node: process.version,
321 platform: os.platform(),
322 release: os.release(),
323 arch: os.arch(),
324 cpu: os.cpus()[0]?.model,
325 logicalCpus: os.cpus().length,
326 memory: os.totalmem(),
327 browser: '',
328 viewport: {width: 1280, height: 900},
329 mode: options.headed ? 'headed' : 'full Chromium headless'
330 },
331 samples: [],
332 order: [],
333 diagnostics: []
334 };

Callers 4

confirmFunction · 0.90
cli.mjsFile · 0.90
validateFunction · 0.70
smokeFunction · 0.70

Calls 15

loadBuildFunction · 0.90
randomFunction · 0.90
shuffledFunction · 0.90
pauseFunction · 0.90
serveFunction · 0.85
checkInterruptedFunction · 0.85
launchFunction · 0.85
openPageFunction · 0.85
measureTrialsFunction · 0.85
persistFunction · 0.85
diagnoseFunction · 0.85
StringFunction · 0.85

Tested by

no test coverage detected