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

Function diagnose

perf/runner.mjs:238–275  ·  view source on GitHub ↗
(browser, server, result, dir, isInterrupted)

Source from the content-addressed store, hash-verified

236}
237
238async function diagnose(browser, server, result, dir, isInterrupted) {
239 for (let scenario of result.scenarios) {
240 for (let arm of Object.keys(result.builds)) {
241 if (isInterrupted()) {
242 return;
243 }
244 let file = `${scenario.id}-${arm}.trace.json`;
245 let current;
246 try {
247 current = await openPage(
248 browser,
249 server,
250 scenario,
251 arm,
252 result.options,
253 result.builds[arm],
254 true
255 );
256 // Match the measured trials' warm state before the traced trial.
257 for (let warmup = 0; warmup < result.options.warmup; warmup++) {
258 await prepare(current.page, scenario, current.size);
259 await perform(current, scenario);
260 }
261 await prepare(current.page, scenario, current.size);
262 await saveTrace(current.session, path.join(dir, file), () => perform(current, scenario));
263 if (current.errors.length) {
264 throw new Error(current.errors.join('\n'));
265 }
266 let summary = summarizeTrace(JSON.parse(await fs.readFile(path.join(dir, file), 'utf8')));
267 result.diagnostics.push({scenario: scenario.id, arm, file, summary});
268 } catch (error) {
269 result.diagnostics.push({scenario: scenario.id, arm, error: error.message});
270 } finally {
271 await current?.context.close();
272 }
273 }
274 }
275}
276
277export async function run(options) {
278 let selected = scenarios.filter(

Callers 1

runFunction · 0.85

Calls 8

summarizeTraceFunction · 0.90
openPageFunction · 0.85
prepareFunction · 0.85
saveTraceFunction · 0.85
pushMethod · 0.80
performFunction · 0.70
closeMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected