Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function diffPropsForNode(
node: Node,
props: object,
{expand = false},
) {
return diff(props, getObjectSubset(node.props, props), {
expand,
});
}
export function diffVariablesForOperation(
operation: Operation,
variables: object,
{expand = false},
) {
return diff(variables, getObjectSubset(operation.variables, variables), {
expand,
});
}
function assertionErrorMessage(
error: AssertionErrorWithStack,
options: DiffOptions,
) {
const {expected, actual, generatedMessage, message, operator, stack} = error;
const diffString = diff(expected, actual, options);
const hasCustomMessage = !generatedMessage;
const operatorName = getOperatorName(operator, stack);
const trimmedStack = stack
.replace(message, '')
.replace(/AssertionError(.*)/g, '');
if (operatorName === 'doesNotThrow') {
return (
buildHintString(assertThrowingMatcherHint(operatorName)) +
chalk.reset(`Expected the function not to throw an error.\n`) +
chalk.reset(`Instead, it threw:\n`) +
` ${printReceived(actual)}` +
chalk.reset(hasCustomMessage ? '\n\nMessage:\n ' + message : '') +
trimmedStack
);
}