/* @flow */
const jsdiff = require('diff');
require('colors');

export default function logDiff(label: string, a: string, b: string) {
  const { write } = process.stdout;
  const diff = jsdiff.diffChars(a, b);
  // $FlowFixMe
  write(`${label['yellow']}\n`);
  diff.forEach(({ added, removed, value }) => {
    const color = added ? 'green' : removed ? 'red' : 'grey';
    write(value[color]);
  });
  write('\n\n');
}

/* @flow */
const jsdiff = require('diff');
require('colors');

export default function logDiff(label: any, a: string, b: string) {
  const diff = jsdiff.diffChars(a, b);
  process.stdout.write(`${label['yellow']}\n`);
  diff.forEach(({ added, removed, value }) => {
    const color = added ? 'green' : removed ? 'red' : 'grey';
    process.stdout.write(value[color]);
  });
  process.stdout.write('\n\n');
}

Fix console warning when running tests
chore(utils): Fix console warning when running tests

* Don’t use ‘write’ alias as it changes ‘this’ to ‘undefined’
