How to use the jest-matcher-utils.SUGGEST_TO_EQUAL 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 DefinitelyTyped / DefinitelyTyped / types / jest-matcher-utils / jest-matcher-utils-tests.ts View on Github external
import chalk from 'chalk';
import * as utils from 'jest-matcher-utils';

utils.EXPECTED_COLOR; // $ExpectType Chalk
utils.RECEIVED_COLOR; // $ExpectType Chalk
utils.SUGGEST_TO_EQUAL; // $ExpectType string

utils.stringify({}); // $ExpectType string
utils.stringify({}, 44);
utils.stringify({}, '44'); // $ExpectError
utils.stringify({}, false); // $ExpectError

utils.highlightTrailingWhitespace('', chalk.red); // $ExpectType string
utils.highlightTrailingWhitespace(44, chalk.blue); // $ExpectError
utils.highlightTrailingWhitespace(false, chalk.green); // $ExpectError

utils.printReceived({}); // $ExpectType string
utils.printExpected({}); // $ExpectType string
utils.printWithType('obj', {}, () => ''); // $ExpectType string

utils.ensureNoExpected(null, ''); // $ExpectType void
utils.ensureNoExpected('', '');
github flaviuse / mern-authentication / client / node_modules / expect / build / matchers.js View on Github external
const oneline = (0, _utils.isOneline)(expected, received);
          const diffString = (0, _jestMatcherUtils.diff)(expected, received, {
            expand: this.expand
          });
          return (
            (0, _jestMatcherUtils.matcherHint)(
              matcherName,
              undefined,
              undefined,
              options
            ) +
            '\n\n' +
            `Expected: ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
            `Received: ${(0, _jestMatcherUtils.printReceived)(received)}` +
            (diffString && !oneline ? `\n\nDifference:\n\n${diffString}` : '') +
            (suggestToEqual ? ` ${_jestMatcherUtils.SUGGEST_TO_EQUAL}` : '')
          );
        }; // Passing the actual and expected objects so that a custom reporter
    // could access them, for example in order to display a custom visual diff,