(options)
| 409 | |
| 410 | |
| 411 | function runDiffImageToSnapshot(options) { |
| 412 | options.receivedImageBuffer = options.receivedImageBuffer.toString('base64'); |
| 413 | |
| 414 | const serializedInput = JSON.stringify(options); |
| 415 | |
| 416 | let result = {}; |
| 417 | |
| 418 | const writeDiffProcess = childProcess.spawnSync( |
| 419 | process.execPath, [`${__dirname}/diff-process.js`], |
| 420 | { |
| 421 | input: Buffer.from(serializedInput), |
| 422 | stdio: ['pipe', 'inherit', 'inherit', 'pipe'], |
| 423 | maxBuffer: options.maxChildProcessBufferSizeInBytes, |
| 424 | } |
| 425 | ); |
| 426 | |
| 427 | if (writeDiffProcess.status === 0) { |
| 428 | const output = writeDiffProcess.output[3].toString(); |
| 429 | result = JSON.parse(output); |
| 430 | } else { |
| 431 | throw new Error(`Error running image diff: ${(writeDiffProcess.error && writeDiffProcess.error.message) || 'Unknown Error'}`); |
| 432 | } |
| 433 | |
| 434 | return result; |
| 435 | } |
| 436 | |
| 437 | module.exports = { |
| 438 | diffImageToSnapshot, |
no outgoing calls
no test coverage detected
searching dependent graphs…