> For the complete documentation index, see [llms.txt](https://docs-v2.hypertest.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-v2.hypertest.co/user-guides/ignoring-differences.md).

# Ignoring Differences

In some scenarios, you might want to ignore certain differences between expected mocks/responses and actual ones.

These differences may be due to env variables, timestamps, or other non-critical factors that don't represent true regressions.

HyperTest allows to provide custom filtering logic to ignore such differences through two filter functions:

#### **filterFunctionToIgnoreMockDiffs**:

* This function allows users to specify conditions under which a particular mock difference should be ignored.
* **Input parameters**:

  * [mockDiff](/user-guides/ignoring-differences/type-references-for-filter-functions.md#mockdifference): An object describing the difference between the recorded mock and the replayed one.
  * [currentMock](/user-guides/ignoring-differences/type-references-for-filter-functions.md#currentmock-type): The original mock object recorded during testing.
  * [requestObj](/user-guides/ignoring-differences/type-references-for-filter-functions.md#requestobj-types): The request for which this mock difference was captured.

  Check out detailed Type Reference for Input Parameters [here](/user-guides/ignoring-differences/type-references-for-filter-functions.md).
* **Return value**:&#x20;

  The function should return a boolean, **false for ignoring** and **true for keeping** the difference.

Consider a case where you're making an outbound call to a 3rd party service and some metadata is being sent along with it, getting this error for random metadata is undesirable.

<figure><img src="/files/oC2BA3Q24eEnAiWeXaP1" alt=""><figcaption></figcaption></figure>

You can ignore any differences originating from metadata field like shown in the given example:

{% code fullWidth="false" %}

```javascript
function filterFunctionToIgnoreMockDiffs({ mockDiff, currentMock, requestObj }) { 
  // Ignore differences in the metadata field
  if (mockDiff?.evaluatedPath?.at(-2) === "metadata") return false;

  // Return true to consider this mock difference as critical
  return true;
}
```

{% endcode %}

#### **filterFunctionToIgnoreResponseDiffs**:

* This function allows users to specify conditions under which a particular response difference should be ignored.
* **Input parameters**:

  * [responseDiff](/user-guides/ignoring-differences/type-references-for-filter-functions.md#responsedifference): An object describing the difference between the expected response and the actual one.
  * [requestObj](/user-guides/ignoring-differences/type-references-for-filter-functions.md#requestobj-types): The request for which this response difference was captured.

  Check out detailed Type Reference for Input Parameters [here](/user-guides/ignoring-differences/type-references-for-filter-functions.md).
* **Return value**:&#x20;

  The function should return a boolean, **false for ignoring** and **true for keeping** the difference.

Consider a case where you're sending out some metrics about the order processing to the client, the processing time would definitely vary from an actual env vs a mocked environment, as this is not a real regression it should not be considered.

<figure><img src="/files/RmYTXJGPze7Id5FwDXcr" alt=""><figcaption></figcaption></figure>

```javascript
function filterFunctionToIgnoreResponseDiffs({ responseDiff, requestObj }) { 
  // Ignore differences in the metadata field
  if (responseDiff?.evaluatedPath?.at(-2) === "metadata") return false;

  // Return true to consider this mock difference as critical
  return true;
}
```

By customizing these functions, you can tailor the test results to focus on actual regressions while ignoring known, non-critical changes.
