You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
Something like this works as a proof-of-concept (if you're using iTerm):
/* eslint-disable *//* * To enable this image reporter, add it to your `jest.config.js` "reporters" definition: "reporters": [ "default", "<rootDir>/image-reporter.js" ] */constfs=require('fs');constpath=require('path');constchalk=require('chalk');consttermImg=require('term-img');functionfallback(){// do nothing}classImageReporter{constructor(globalConfig,options){this._globalConfig=globalConfig;this._options=options;}onTestResult(test,testResult,aggregateResults){// reporter is only supported within iTerm.if(process.env.TERM_PROGRAM!=='iTerm.app')return;if(testResult.numFailingTests&&testResult.failureMessage.match(/different from snapshot/)){console.log(chalk.red(`\n (${chalk.underline.bold('Snapshot Diffs')})`));constparsedTestPath=path.parse(test.path);constdiffOutputDir=path.join(parsedTestPath.dir,'__image_snapshots__','__diff_output__');constfiles=fs.readdirSync(diffOutputDir);files.forEach(value=>{constdiffOutputPath=`${diffOutputDir}/${value}`;console.log(`\n - ${diffOutputPath}\n`);termImg(diffOutputPath,{ fallback });});}}}module.exports=ImageReporter;
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The Cypress snapshot tool has a custom reporter that looks like it will output diff images to the terminal.
This would be a neat addition to give feedback faster.
The text was updated successfully, but these errors were encountered: