Lazily launches or returns existing Chromium browser instance.
()
| 136 | |
| 137 | /** Lazily launches or returns existing Chromium browser instance. */ |
| 138 | private async launchBrowser(): Promise<Browser> { |
| 139 | if (this.browser) { |
| 140 | return this.browser; |
| 141 | } |
| 142 | |
| 143 | await this.installBrowser(); |
| 144 | |
| 145 | this.browser = await logger.task( |
| 146 | 'Launching Chromium browser', |
| 147 | async () => ({ |
| 148 | message: 'Launched Chromium browser', |
| 149 | result: await chromium.launch({ headless: true }), |
| 150 | }), |
| 151 | ); |
| 152 | |
| 153 | return this.browser; |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | async function analyzePage( |
no test coverage detected