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:
66
node_modules/jest-snapshot/build/index.js
generated
vendored
66
node_modules/jest-snapshot/build/index.js
generated
vendored
@@ -2,8 +2,6 @@
|
||||
|
||||
var _fs = _interopRequireDefault(require('fs'));
|
||||
|
||||
var _jestDiff = _interopRequireDefault(require('jest-diff'));
|
||||
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
|
||||
var _snapshot_resolver = require('./snapshot_resolver');
|
||||
@@ -12,6 +10,8 @@ var _State = _interopRequireDefault(require('./State'));
|
||||
|
||||
var _plugins = require('./plugins');
|
||||
|
||||
var _print = require('./print');
|
||||
|
||||
var utils = _interopRequireWildcard(require('./utils'));
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
@@ -54,7 +54,8 @@ const DID_NOT_THROW = 'Received function did not throw'; // same as toThrow
|
||||
const NOT_SNAPSHOT_MATCHERS = `.${(0, _jestMatcherUtils.BOLD_WEIGHT)(
|
||||
'not'
|
||||
)} cannot be used with snapshot matchers`;
|
||||
const HINT_ARG = (0, _jestMatcherUtils.BOLD_WEIGHT)('hint');
|
||||
const HINT_ARG = 'hint';
|
||||
const HINT_COLOR = _jestMatcherUtils.BOLD_WEIGHT;
|
||||
const INLINE_SNAPSHOT_ARG = 'snapshot';
|
||||
const PROPERTY_MATCHERS_ARG = 'properties';
|
||||
const INDENTATION_REGEX = /^([^\S\n]*)\S/m; // Display name in report when matcher fails same as in snapshot file,
|
||||
@@ -121,22 +122,35 @@ function stripAddedIndentation(inlineSnapshot) {
|
||||
const fileExists = (filePath, hasteFS) =>
|
||||
hasteFS.exists(filePath) || jestExistsFile(filePath);
|
||||
|
||||
const cleanup = (hasteFS, update, snapshotResolver) => {
|
||||
const cleanup = (hasteFS, update, snapshotResolver, testPathIgnorePatterns) => {
|
||||
const pattern = '\\.' + _snapshot_resolver.EXTENSION + '$';
|
||||
const files = hasteFS.matchFiles(pattern);
|
||||
const filesRemoved = files.reduce((acc, snapshotFile) => {
|
||||
if (!fileExists(snapshotResolver.resolveTestPath(snapshotFile), hasteFS)) {
|
||||
let testIgnorePatternsRegex = null;
|
||||
|
||||
if (testPathIgnorePatterns && testPathIgnorePatterns.length > 0) {
|
||||
testIgnorePatternsRegex = new RegExp(testPathIgnorePatterns.join('|'));
|
||||
}
|
||||
|
||||
const list = files.filter(snapshotFile => {
|
||||
const testPath = snapshotResolver.resolveTestPath(snapshotFile); // ignore snapshots of ignored tests
|
||||
|
||||
if (testIgnorePatternsRegex && testIgnorePatternsRegex.test(testPath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!fileExists(testPath, hasteFS)) {
|
||||
if (update === 'all') {
|
||||
_fs.default.unlinkSync(snapshotFile);
|
||||
}
|
||||
|
||||
return acc + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, 0);
|
||||
return false;
|
||||
});
|
||||
return {
|
||||
filesRemoved
|
||||
filesRemoved: list.length,
|
||||
filesRemovedList: list
|
||||
};
|
||||
};
|
||||
|
||||
@@ -168,6 +182,14 @@ const toMatchSnapshot = function toMatchSnapshot(
|
||||
secondArgument
|
||||
};
|
||||
|
||||
if (expectedArgument === HINT_ARG) {
|
||||
options.expectedColor = HINT_COLOR;
|
||||
}
|
||||
|
||||
if (secondArgument === HINT_ARG) {
|
||||
options.secondArgumentColor = HINT_COLOR;
|
||||
}
|
||||
|
||||
if (arguments.length === 3 && !propertyMatchers) {
|
||||
throw new Error(
|
||||
'Property matchers must be an object.\n\nTo provide a snapshot test name without property matchers, use: toMatchSnapshot("name")'
|
||||
@@ -347,19 +369,20 @@ const _toMatchSnapshot = ({
|
||||
`${actual}`;
|
||||
} else {
|
||||
expected = (expected || '').trim();
|
||||
actual = (actual || '').trim();
|
||||
const diffMessage = (0, _jestDiff.default)(expected, actual, {
|
||||
aAnnotation: 'Snapshot',
|
||||
bAnnotation: 'Received',
|
||||
expand: snapshotState.expand
|
||||
});
|
||||
actual = (actual || '').trim(); // Assign to local variable because of declaration let expected:
|
||||
// TypeScript thinks it could change before report function is called.
|
||||
|
||||
const printed = (0, _print.printDiffOrStringified)(
|
||||
expected,
|
||||
actual,
|
||||
received,
|
||||
'Snapshot',
|
||||
'Received',
|
||||
snapshotState.expand
|
||||
);
|
||||
|
||||
report = () =>
|
||||
`Snapshot name: ${printName(currentTestName, hint, count)}\n\n` +
|
||||
(diffMessage ||
|
||||
(0, _jestMatcherUtils.EXPECTED_COLOR)('- ' + (expected || '')) +
|
||||
'\n' +
|
||||
(0, _jestMatcherUtils.RECEIVED_COLOR)('+ ' + actual));
|
||||
`Snapshot name: ${printName(currentTestName, hint, count)}\n\n` + printed;
|
||||
} // Passing the actual and expected objects so that a custom reporter
|
||||
// could access them, for example in order to display a custom visual diff,
|
||||
// or create a different error message
|
||||
@@ -391,6 +414,7 @@ const toThrowErrorMatchingSnapshot = function toThrowErrorMatchingSnapshot(
|
||||
const expectedArgument =
|
||||
typeof hint === 'string' && hint.length !== 0 ? HINT_ARG : '';
|
||||
const options = {
|
||||
expectedColor: HINT_COLOR,
|
||||
isNot: this.isNot,
|
||||
promise: this.promise,
|
||||
secondArgument: ''
|
||||
|
||||
Reference in New Issue
Block a user