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

Function start

test/runTest/server.js:272–607  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

270
271
272async function start() {
273 // Clean PR directories before starting
274 const {cleanPRDirectories} = require('./util');
275 cleanPRDirectories();
276
277 if (!checkPuppeteer()) {
278 console.error(`Can't find puppeteer >= 9.0.0, run 'npm install' to update in the 'test/runTest' folder`);
279 return;
280 }
281
282 let stableVersions;
283 let nightlyVersions;
284 try {
285 stableVersions = await fetchVersions(false, useCNMirror);
286 nightlyVersions = (await fetchVersions(true, useCNMirror)).slice(0, 100);
287 } catch (e) {
288 console.error('Failed to fetch version list:', e);
289 console.log(`Try again later or try the CN mirror with: ${chalk.yellow('npm run test:visual -- -- --useCNMirror')}`)
290 return;
291 }
292
293 let _currentTestHash;
294 let _currentRunConfig;
295
296 // let runtimeCode = await buildRuntimeCode();
297 // fse.outputFileSync(path.join(__dirname, 'tmp/testRuntime.js'), runtimeCode, 'utf-8');
298
299 // Start a static server for puppeteer open the html test cases.
300 let {io} = serve();
301
302 io.of('/client').on('connect', async socket => {
303
304 let isAborted = false;
305 function abortTests() {
306 if (!isRunning()) {
307 return;
308 }
309 isAborted = true;
310 stopRunningTests();
311 io.of('/client').emit('abort');
312 }
313
314 socket.on('syncRunConfig', async ({
315 runConfig,
316 forceSet
317 }) => {
318 // First time open.
319 if ((!_currentRunConfig || forceSet) && runConfig) {
320 _currentRunConfig = runConfig;
321 }
322
323 if (!_currentRunConfig) {
324 return;
325 }
326
327 socket.emit('syncRunConfig_return', {
328 runConfig: _currentRunConfig,
329 versions: stableVersions,

Callers 1

server.jsFile · 0.70

Calls 13

requireFunction · 0.85
checkPuppeteerFunction · 0.85
serveFunction · 0.85
getRunHashFunction · 0.85
abortTestsFunction · 0.85
updateTestsListFunction · 0.85
isRunningFunction · 0.85
delTestsRunFunction · 0.85
stopRunningTestsFunction · 0.85
startTestsFunction · 0.85
openFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…