Fixed #1 - Fixed the whatsnew-** script for loading release notes into builds

Added test to ensure that release notes are parsed properly
Updated to latest dependencies to fix security vulnerability
Updated GH Actions Workflow to run test before updating tag
Updated README.md to reflect proper whatsnew documentation.
This commit is contained in:
Drew Heavner
2020-01-30 11:14:51 -05:00
parent b6496ac4e3
commit bdde081050
2660 changed files with 251487 additions and 213182 deletions

View File

@@ -1,8 +1,6 @@
MIT License
For Jest software
Copyright (c) 2014-present, Facebook, Inc.
Copyright (c) Facebook, Inc. and its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -4,13 +4,17 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import jestDiff, { DiffOptions } from 'jest-diff';
import { DiffOptions } from 'jest-diff';
declare type MatcherHintColor = (arg: string) => string;
export declare type MatcherHintOptions = {
comment?: string;
expectedColor?: MatcherHintColor;
isDirectExpectCall?: boolean;
isNot?: boolean;
promise?: string;
receivedColor?: MatcherHintColor;
secondArgument?: string;
secondArgumentColor?: MatcherHintColor;
};
export { DiffOptions };
export declare const EXPECTED_COLOR: import("chalk").Chalk & {
@@ -39,7 +43,8 @@ export declare const ensureActualIsNumber: (actual: unknown, matcherName: string
export declare const ensureExpectedIsNumber: (expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
export declare const ensureNumbers: (actual: unknown, expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
export declare const ensureExpectedIsNonNegativeInteger: (expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
export declare const diff: typeof jestDiff;
export declare const printDiffOrStringify: (expected: unknown, received: unknown, expectedLabel: string, receivedLabel: string, expand: boolean) => string;
export declare const diff: (a: any, b: any, options?: import("jest-diff/build/types").DiffOptions | undefined) => string | null;
export declare const pluralize: (word: string, count: number) => string;
declare type PrintLabel = (string: string) => string;
export declare const getLabelPrinter: (...strings: string[]) => PrintLabel;

View File

@@ -1 +1 @@
{"version":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Aa,6GAQzB,CAAC;AAEF,eAAO,MAAM,kCAAkC,4FAoB9C,CAAC;AAoDF,eAAO,MAAM,oBAAoB,iHAoDhC,CAAC;AAeF,eAAO,MAAM,IAAI,sGACuC,CAAC;AAEzD,eAAO,MAAM,SAAS,yCAC6C,CAAC;AAOpE,aAAK,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;AAE7C,eAAO,MAAM,eAAe,sCAM3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,6DAI2C,CAAC;AAK5E,eAAO,MAAM,WAAW,qGA+DvB,CAAC"}

View File

@@ -9,13 +9,13 @@ Object.defineProperty(exports, 'DiffOptions', {
return _jestDiff.DiffOptions;
}
});
exports.matcherHint = exports.matcherErrorMessage = exports.getLabelPrinter = exports.pluralize = exports.diff = exports.ensureExpectedIsNonNegativeInteger = exports.ensureNumbers = exports.ensureExpectedIsNumber = exports.ensureActualIsNumber = exports.ensureNoExpected = exports.printWithType = exports.printExpected = exports.printReceived = exports.highlightTrailingWhitespace = exports.stringify = exports.SUGGEST_TO_CONTAIN_EQUAL = exports.DIM_COLOR = exports.BOLD_WEIGHT = exports.INVERTED_COLOR = exports.RECEIVED_COLOR = exports.EXPECTED_COLOR = void 0;
exports.matcherHint = exports.matcherErrorMessage = exports.getLabelPrinter = exports.pluralize = exports.diff = exports.printDiffOrStringify = exports.ensureExpectedIsNonNegativeInteger = exports.ensureNumbers = exports.ensureExpectedIsNumber = exports.ensureActualIsNumber = exports.ensureNoExpected = exports.printWithType = exports.printExpected = exports.printReceived = exports.highlightTrailingWhitespace = exports.stringify = exports.SUGGEST_TO_CONTAIN_EQUAL = exports.DIM_COLOR = exports.BOLD_WEIGHT = exports.INVERTED_COLOR = exports.RECEIVED_COLOR = exports.EXPECTED_COLOR = void 0;
var _chalk = _interopRequireDefault(require('chalk'));
var _jestDiff = _interopRequireWildcard(require('jest-diff'));
var _jestGetType = _interopRequireDefault(require('jest-get-type'));
var _jestGetType = _interopRequireWildcard(require('jest-get-type'));
var _prettyFormat = _interopRequireDefault(require('pretty-format'));
@@ -79,6 +79,9 @@ const BOLD_WEIGHT = _chalk.default.bold;
exports.BOLD_WEIGHT = BOLD_WEIGHT;
const DIM_COLOR = _chalk.default.dim;
exports.DIM_COLOR = DIM_COLOR;
const MULTILINE_REGEXP = /\n/;
const SPACE_SYMBOL = '\u{00B7}'; // middle dot
const NUMBERS = [
'zero',
'one',
@@ -129,17 +132,21 @@ const stringify = (object, maxDepth = 10) => {
exports.stringify = stringify;
const highlightTrailingWhitespace = text =>
text.replace(/\s+$/gm, _chalk.default.inverse('$&'));
text.replace(/\s+$/gm, _chalk.default.inverse('$&')); // Instead of inverse highlight which now implies a change,
// replace common spaces with middle dot at the end of any line.
exports.highlightTrailingWhitespace = highlightTrailingWhitespace;
const replaceTrailingSpaces = text =>
text.replace(/\s+$/gm, spaces => SPACE_SYMBOL.repeat(spaces.length));
const printReceived = object =>
RECEIVED_COLOR(highlightTrailingWhitespace(stringify(object)));
RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
exports.printReceived = printReceived;
const printExpected = value =>
EXPECTED_COLOR(highlightTrailingWhitespace(stringify(value)));
EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
exports.printExpected = printExpected;
@@ -230,11 +237,114 @@ const ensureExpectedIsNonNegativeInteger = (expected, matcherName, options) => {
)
);
}
};
exports.ensureExpectedIsNonNegativeInteger = ensureExpectedIsNonNegativeInteger;
const isLineDiffable = (expected, received) => {
const expectedType = (0, _jestGetType.default)(expected);
const receivedType = (0, _jestGetType.default)(received);
if (expectedType !== receivedType) {
return false;
}
if ((0, _jestGetType.isPrimitive)(expected)) {
// Print generic line diff for strings only:
// * if neither string is empty
return (
typeof expected === 'string' &&
typeof received === 'string' &&
expected.length !== 0 &&
received.length !== 0 &&
(MULTILINE_REGEXP.test(expected) || MULTILINE_REGEXP.test(received))
);
}
if (
expectedType === 'date' ||
expectedType === 'function' ||
expectedType === 'regexp'
) {
return false;
}
if (expected instanceof Error && received instanceof Error) {
return false;
}
if (
expectedType === 'object' &&
typeof expected.asymmetricMatch === 'function'
) {
return false;
}
if (
receivedType === 'object' &&
typeof received.asymmetricMatch === 'function'
) {
return false;
}
return true;
};
const printDiffOrStringify = (
expected,
received,
expectedLabel,
receivedLabel,
expand
) => {
if (typeof expected === 'string' && typeof received === 'string') {
const result = (0, _jestDiff.getStringDiff)(expected, received, {
aAnnotation: expectedLabel,
bAnnotation: receivedLabel,
expand
});
if (result !== null) {
if (result.isMultiline) {
return result.annotatedDiff;
}
const printLabel = getLabelPrinter(expectedLabel, receivedLabel);
const expectedLine = printLabel(expectedLabel) + printExpected(result.a);
const receivedLine = printLabel(receivedLabel) + printReceived(result.b);
return expectedLine + '\n' + receivedLine;
}
}
if (isLineDiffable(expected, received)) {
const difference = (0, _jestDiff.default)(expected, received, {
aAnnotation: expectedLabel,
bAnnotation: receivedLabel,
expand
});
if (
typeof difference === 'string' &&
difference.includes('- ' + expectedLabel) &&
difference.includes('+ ' + receivedLabel)
) {
return difference;
}
}
const printLabel = getLabelPrinter(expectedLabel, receivedLabel);
const expectedLine = printLabel(expectedLabel) + printExpected(expected);
const receivedLine =
printLabel(receivedLabel) +
(stringify(expected) === stringify(received)
? 'serializes to the same string'
: printReceived(received));
return expectedLine + '\n' + receivedLine;
}; // Sometimes, e.g. when comparing two numbers, the output from jest-diff
// does not contain more information than the `Expected:` / `Received:` already gives.
// In those cases, we do not print a diff to make the output shorter and not redundant.
exports.ensureExpectedIsNonNegativeInteger = ensureExpectedIsNonNegativeInteger;
exports.printDiffOrStringify = printDiffOrStringify;
const shouldPrintDiff = (actual, expected) => {
if (typeof actual === 'number' && typeof expected === 'number') {
@@ -292,6 +402,9 @@ const matcherHint = (
) => {
const _options$comment = options.comment,
comment = _options$comment === void 0 ? '' : _options$comment,
_options$expectedColo = options.expectedColor,
expectedColor =
_options$expectedColo === void 0 ? EXPECTED_COLOR : _options$expectedColo,
_options$isDirectExpe = options.isDirectExpectCall,
isDirectExpectCall =
_options$isDirectExpe === void 0 ? false : _options$isDirectExpe,
@@ -299,14 +412,22 @@ const matcherHint = (
isNot = _options$isNot === void 0 ? false : _options$isNot,
_options$promise = options.promise,
promise = _options$promise === void 0 ? '' : _options$promise,
_options$receivedColo = options.receivedColor,
receivedColor =
_options$receivedColo === void 0 ? RECEIVED_COLOR : _options$receivedColo,
_options$secondArgume = options.secondArgument,
secondArgument =
_options$secondArgume === void 0 ? '' : _options$secondArgume;
_options$secondArgume === void 0 ? '' : _options$secondArgume,
_options$secondArgume2 = options.secondArgumentColor,
secondArgumentColor =
_options$secondArgume2 === void 0
? EXPECTED_COLOR
: _options$secondArgume2;
let hint = '';
let dimString = 'expect'; // concatenate adjacent dim substrings
if (!isDirectExpectCall && received !== '') {
hint += DIM_COLOR(dimString + '(') + RECEIVED_COLOR(received);
hint += DIM_COLOR(dimString + '(') + receivedColor(received);
dimString = ')';
}
@@ -333,10 +454,10 @@ const matcherHint = (
if (expected === '') {
dimString += '()';
} else {
hint += DIM_COLOR(dimString + '(') + EXPECTED_COLOR(expected);
hint += DIM_COLOR(dimString + '(') + expectedColor(expected);
if (secondArgument) {
hint += DIM_COLOR(', ') + EXPECTED_COLOR(secondArgument);
hint += DIM_COLOR(', ') + secondArgumentColor(secondArgument);
}
dimString = ')';

View File

@@ -1,26 +1,19 @@
{
"_args": [
[
"jest-matcher-utils@24.8.0",
"/Users/drew.heavner/Documents/Github/upload-google-play"
]
],
"_development": true,
"_from": "jest-matcher-utils@24.8.0",
"_id": "jest-matcher-utils@24.8.0",
"_from": "jest-matcher-utils@^24.9.0",
"_id": "jest-matcher-utils@24.9.0",
"_inBundle": false,
"_integrity": "sha512-lex1yASY51FvUuHgm0GOVj7DCYEouWSlIYmCW7APSqB9v8mXmKSn5+sWVF0MhuASG0bnYY106/49JU1FZNl5hw==",
"_integrity": "sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA==",
"_location": "/jest-matcher-utils",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "jest-matcher-utils@24.8.0",
"raw": "jest-matcher-utils@^24.9.0",
"name": "jest-matcher-utils",
"escapedName": "jest-matcher-utils",
"rawSpec": "24.8.0",
"rawSpec": "^24.9.0",
"saveSpec": null,
"fetchSpec": "24.8.0"
"fetchSpec": "^24.9.0"
},
"_requiredBy": [
"/expect",
@@ -28,23 +21,26 @@
"/jest-jasmine2",
"/jest-snapshot"
],
"_resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.8.0.tgz",
"_spec": "24.8.0",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play",
"_resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz",
"_shasum": "f5b3661d5e628dffe6dd65251dfdae0e87c3a073",
"_spec": "jest-matcher-utils@^24.9.0",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/jest-jasmine2",
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"bundleDependencies": false,
"dependencies": {
"chalk": "^2.0.1",
"jest-diff": "^24.8.0",
"jest-get-type": "^24.8.0",
"pretty-format": "^24.8.0"
"jest-diff": "^24.9.0",
"jest-get-type": "^24.9.0",
"pretty-format": "^24.9.0"
},
"deprecated": false,
"description": "A set of utility functions for expect and related packages",
"engines": {
"node": ">= 6"
},
"gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4",
"gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1",
"homepage": "https://github.com/facebook/jest#readme",
"license": "MIT",
"main": "build/index.js",
@@ -57,5 +53,5 @@
"url": "git+https://github.com/facebook/jest.git",
"directory": "packages/jest-matcher-utils"
},
"version": "24.8.0"
"version": "24.9.0"
}

View File

@@ -1,12 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build"
},
"references": [
{"path": "../jest-diff"},
{"path": "../jest-get-type"},
{"path": "../pretty-format"}
]
}