jest-diff
Advanced tools
Comparing version 21.3.0-alpha.1e3ee68e to 21.3.0-alpha.eff7a1cf
@@ -244,2 +244,7 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.default = | ||
diffStrings;var _chalk = require('chalk');var _chalk2 = _interopRequireDefault(_chalk);var _diff = require('diff');var _constants = require('./constants.js');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}const DIFF_CONTEXT_DEFAULT = 5; // removed | added | equal | ||
@@ -265,3 +270,5 @@ // Given diff digit, return array which consists of: | ||
const highlightTrailingSpaces = (line, bgColor) => line.replace(/\s+$/, bgColor('$&')); // BOTH leading AND trailing if expected value is data structure. | ||
const highlightLeadingTrailingSpaces = (line, bgColor) => highlightTrailingSpaces(line.replace(/^\s+/, bgColor('$&')), bgColor);const getAnnotation = options => _chalk2.default.green('- ' + (options && options.aAnnotation || 'Expected')) + '\n' + _chalk2.default.red('+ ' + (options && options.bAnnotation || 'Received')) + '\n\n'; // Given string, return array of its lines. | ||
const highlightLeadingTrailingSpaces = (line, bgColor // If line consists of ALL spaces: highlight all of them. | ||
) => highlightTrailingSpaces(line, bgColor).replace( // If line has an ODD length of leading spaces: highlight only the LAST. | ||
/^(\s\s)*(\s)(?=[^\s])/, '$1' + bgColor('$2'));const getAnnotation = options => _chalk2.default.green('- ' + (options && options.aAnnotation || 'Expected')) + '\n' + _chalk2.default.red('+ ' + (options && options.bAnnotation || 'Received')) + '\n\n'; // Given string, return array of its lines. | ||
const splitIntoLines = string => {const lines = string.split('\n');if (lines.length !== 0 && lines[lines.length - 1] === '') {lines.pop();}return lines;}; // Given diff character and compared line, return original line with colors. | ||
@@ -268,0 +275,0 @@ const formatLine = (char, lineCompared, getOriginal) => {const digit = getDiffDigit(char);if (getOriginal) {// Compared without indentation if expected value is data structure. |
{ | ||
"name": "jest-diff", | ||
"version": "21.3.0-alpha.1e3ee68e", | ||
"version": "21.3.0-alpha.eff7a1cf", | ||
"repository": { | ||
@@ -13,5 +13,5 @@ "type": "git", | ||
"diff": "^3.2.0", | ||
"jest-get-type": "21.3.0-alpha.1e3ee68e", | ||
"pretty-format": "21.3.0-alpha.1e3ee68e" | ||
"jest-get-type": "21.3.0-alpha.eff7a1cf", | ||
"pretty-format": "21.3.0-alpha.eff7a1cf" | ||
} | ||
} |
14448
184
+ Addedjest-get-type@21.3.0-alpha.eff7a1cf(transitive)
+ Addedpretty-format@21.3.0-alpha.eff7a1cf(transitive)
- Removedjest-get-type@21.3.0-alpha.1e3ee68e(transitive)
- Removedpretty-format@21.3.0-alpha.1e3ee68e(transitive)