---
url: /test-inventory/api/functions/pickTestFields.md
---
# Function: pickTestFields()

> **pickTestFields**<`K`>(`inventory`, `fields`): [`PickedInventory`](../type-aliases/PickedInventory.md)<`K`>

Leaves only `id` and the given keys on each test record, in that order, to make the output smaller. Suites,
diagnostics and the summary are unchanged. The result no longer matches the JSON Schema, which requires every key.

Throws a `TypeError` for a key that test records don't have.

## Type Parameters

### K

`K` *extends* keyof [`TestRecord`](../interfaces/TestRecord.md)

## Parameters

### inventory

[`Inventory`](../interfaces/Inventory.md)

### fields

readonly `K`\[]

## Returns

[`PickedInventory`](../type-aliases/PickedInventory.md)<`K`>
