MCPcopy
hub / github.com/apache/echarts / runTests

Function runTests

test/runTest/cli.js:453–500  ·  view source on GitHub ↗
(pendingTests)

Source from the content-addressed store, hash-verified

451}
452
453async function runTests(pendingTests) {
454 const browser = await puppeteer.launch({
455 headless: program.headless,
456 args: [`--window-size=830,750`] // new option
457 });
458 // TODO Not hardcoded.
459 // let runtimeCode = fs.readFileSync(path.join(__dirname, 'tmp/testRuntime.js'), 'utf-8');
460 let runtimeCode = await buildRuntimeCode();
461 runtimeCode = `window.__VRT_PLAYBACK_SPEED__ = ${program.speed || 1};\n${runtimeCode}`;
462
463 process.on('exit', () => {
464 browser.close();
465 });
466
467 async function eachTask(testOpt) {
468 console.log(`Running test: ${testOpt.name}, renderer: ${program.renderer}, useCoarsePointer: ${program.useCoarsePointer}`);
469 try {
470 await runTest(browser, testOpt, runtimeCode, program.expectedSource, program.expected, program.actualSource, program.actual);
471 }
472 catch (e) {
473 // Restore status
474 testOpt.status = 'unsettled';
475 console.error(e);
476 }
477
478 if (program.save) {
479 process.send(testOpt);
480 }
481 }
482
483 // console.log('Running threads: ', program.threads);
484 // await runTasks(pendingTests, async (testOpt) => {
485 // await eachTask(testOpt);
486 // }, program.threads);
487
488
489 try {
490 for (let testOpt of pendingTests) {
491 await eachTask(testOpt);
492 }
493 }
494 catch(e) {
495 console.error(e);
496 }
497
498
499 await browser.close();
500}
501
502runTests(program.tests.split(',').map(testName => {
503 return {

Callers 1

cli.jsFile · 0.70

Calls 2

eachTaskFunction · 0.85
closeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…