MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / execImageDiffCommand

Function execImageDiffCommand

test/shared/screenshots.ts:260–278  ·  view source on GitHub ↗
(cmd: string)

Source from the content-addressed store, hash-verified

258}
259
260async function execImageDiffCommand(cmd: string) {
261 return await new Promise<string>((resolve, reject) => {
262 let commandOutput = '';
263 try {
264 commandOutput = childProcess.execSync(cmd, {encoding: 'utf8'});
265 resolve(commandOutput);
266 } catch (e) {
267 // image_diff will exit with a status code of 1 if the diff is too big, so
268 // this needs to be caught, but the outcome is the same - we want to send
269 // back the string for processing.
270 if (e.stdout && e.stdout.indexOf('diff') === -1) {
271 reject(new Error(`Comparing diff failed. stdout: "${e.stdout}"`));
272 return;
273 }
274
275 resolve(e.stdout);
276 }
277 });
278}
279
280async function compare(golden: string, generated: string, maximumDiffThreshold: number, isInDiffUpdateMode: boolean) {
281 const isOnBot = process.env.LUCI_CONTEXT !== undefined;

Callers 1

imageDiffFunction · 0.85

Calls 2

execSyncMethod · 0.80
indexOfMethod · 0.80

Tested by

no test coverage detected