| 17 | } |
| 18 | |
| 19 | async function startServer() { |
| 20 | return new Promise((resolve, reject) => { |
| 21 | console.log('Starting documentation server...'); |
| 22 | const child = exec('yarn start:docs', { |
| 23 | env: {...process.env, DOCS_ENV: 'dev'} |
| 24 | }); |
| 25 | child.stdout.on('data', data => { |
| 26 | console.log(`Server output: ${data}`); |
| 27 | if (data.includes('Server running at')) { |
| 28 | console.log('Documentation server is running'); |
| 29 | resolve({process: child, baseUrl: data.split(' ')[3].trim()}); |
| 30 | } |
| 31 | }); |
| 32 | child.stderr.on('data', data => { |
| 33 | console.error(`Server error: ${data}`); |
| 34 | }); |
| 35 | }); |
| 36 | } |
| 37 | |
| 38 | function waitForServer(url, timeout = 30000, interval = 1000) { |
| 39 | return new Promise((resolve, reject) => { |