(contextOrFileName: string | Mocha.Context)
| 183 | * If there's a failure, it will be logged (errors are swallowed). |
| 184 | */ |
| 185 | export async function captureScreenShot(contextOrFileName: string | Mocha.Context) { |
| 186 | if (!isCI) { |
| 187 | return; |
| 188 | } |
| 189 | fs.ensureDirSync(path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'logs')); |
| 190 | const filename = path.join( |
| 191 | EXTENSION_ROOT_DIR_FOR_TESTS, |
| 192 | 'logs', |
| 193 | await generateScreenShotFileName(contextOrFileName) |
| 194 | ); |
| 195 | try { |
| 196 | // @ts-expect-error - screenshot-desktop doesn't have type definitions |
| 197 | const screenshot = await import('screenshot-desktop'); |
| 198 | await screenshot.default({ filename }); |
| 199 | } catch (ex) { |
| 200 | console.error(`Failed to capture screenshot into ${filename}`, ex); |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | let remoteUrisCleared = false; |
| 205 | export function initializeCommonNodeApi() { |
no test coverage detected