How to use the jest-matcher-utils.INVERTED_COLOR function in jest-matcher-utils

To help you get started, we’ve selected a few jest-matcher-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / jest / packages / expect / src / print.ts View on Github external
export const printReceivedStringContainExpectedSubstring = (
  received: string,
  start: number,
  length: number, // not end
): string =>
  RECEIVED_COLOR(
    '"' +
      printSubstring(received.slice(0, start)) +
      INVERTED_COLOR(printSubstring(received.slice(start, start + length))) +
      printSubstring(received.slice(start + length)) +
      '"',
  );
github Shopify / quilt / packages / react-testing / src / matchers / strings.ts View on Github external
function printReceivedWithHighlight(
  text: string,
  start: number,
  length: number,
) {
  return receivedColor(
    `"${text.slice(0, start)}${invertedColor(
      text.slice(start, start + length),
    )}${text.slice(start + length)}"`,
  );
}
github facebook / jest / packages / expect / src / print.ts View on Github external
.map((item, i) => {
          const stringified = stringify(item);
          return i === index ? INVERTED_COLOR(stringified) : stringified;
        })
        .join(', ') +