---
url: https://huldoser.github.io/test-inventory/reference/output.md
description: >-
  Every key of the JSON output for tests, suites, the summary and diagnostics,
  and how it is versioned.
---

# Output

A scan returns one JSON object. Its [JSON Schema](https://huldoser.github.io/test-inventory/schema/v1.json) is
published with each release. This abbreviated example shows the overall shape, with most fields and records omitted:

```json
{
  "schemaVersion": 1,
  "tool": { "name": "test-inventory", "version": "0.12.2" },
  "framework": "playwright",
  "frameworkVersion": "1.63.0",
  "summary": { "fileCount": 11, "testCount": 31 },
  "suites": [],
  "tests": [],
  "diagnostics": []
}
```

## Rules for every key

* Every key is always present, in every record, for every framework. Nothing is `undefined` or left out. The one
  exception is asked for: `--fields` keeps only the named keys of each test.
* A boolean that cannot be true in a framework is `false`: `isFixme` in Vitest, `isShuffled` in Playwright.
* A list with nothing in it is `[]`.
* A value that does not exist or could not be worked out is `null`.
* Two scans of the same code give the same output, byte for byte. There is no timestamp.
* Paths are relative to the project root and use `/` on every system.
* Lines and columns start at 1. A line ends at `\n`, `\r\n` or `\r`, and columns count UTF-16 code units, as editors do.

In the TypeScript declarations on this page, ids and hashes are a `Hash`, lines and columns a `Position`, and counts a
`Count`:

::: details Hash, Position and Count

```ts
/** @pattern ^[0-9a-f]{16}$ */
type Hash = string;

/**
 * @asType integer
 * @minimum 1
 */
type Position = number;

/**
 * @asType integer
 * @minimum 0
 */
type Count = number;
```

:::

## Top level

| Key                | Type           | Meaning                                                                                                                                                |
| ------------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `schemaVersion`    | `1`            | The version of this format. See [versioning](#versioning).                                                                                             |
| `tool`             | object         | `name` is `test-inventory`; `version` is the version that produced the output.                                                                         |
| `framework`        | string         | `playwright`, `vitest`, `jest`, `mocha`, `jasmine`, `cypress`, `webdriverio`, `node` or `bun`: the one given to the scan, or the one the project uses. |
| `frameworkVersion` | string or null | Read from the project, or given with `--framework-version`. See [framework version](/guide/cli#framework-version).                                     |
| `summary`          | object         | Counts over the whole scan.                                                                                                                            |
| `configs`          | array          | The configs the scanned files use; for Jest, a `package.json` too.                                                                                     |
| `files`            | array          | One record per scanned file.                                                                                                                           |
| `suites`           | array          | One record per describe.                                                                                                                               |
| `tests`            | array          | One record per test declaration.                                                                                                                       |
| `diagnostics`      | array          | What the scan could not read, or read only in part.                                                                                                    |

::: details TypeScript

```ts
/** The output of one scan. */
export interface Inventory {
  /** Version of this format. It changes only when a key is removed, renamed or changes meaning. */
  schemaVersion: 1;
  tool: Tool;
  /** The framework the scan was run for. */
  framework: Framework;
  /** Read from the project, or given with `--framework-version`; null when unknown. */
  frameworkVersion: string | null;
  summary: Summary;
  /** The configs the scanned files use, sorted by path. */
  configs: ConfigRecord[];
  /** One per scanned file, in the order the files were scanned. */
  files: FileRecord[];
  suites: SuiteRecord[];
  tests: TestRecord[];
  diagnostics: Diagnostic[];
}

export interface Tool {
  name: 'test-inventory';
  /** Version of test-inventory that produced the output. */
  version: string;
}

export type Framework =
  'playwright' | 'vitest' | 'jest' | 'mocha' | 'jasmine' | 'cypress' | 'webdriverio' | 'node' | 'bun';
```

:::

## Tests

A test record holds the values the runner applies to the test, including those it inherits from the describes and
the file around it.

| Key                                                                             | Type                           | Meaning                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                                                                            | string                         | 16 hex characters from the file path, the describe titles and title without tags, and the position among tests with the same title. It stays the same when the test moves to another line.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `bodyHash`                                                                      | string or null                 | 16 hex characters from the test function's syntax tree, so formatting, comments, quote style, semicolons, trailing commas and line endings don't change it. For a function passed by name, the hash of that function when it is declared in the file; for a wrapper call that receives one function, as in `test(title, withBroker(async () => {}))`, the hash of that function. `null` without a function. Trivial bodies such as `async () => {}` share a hash. Compare hashes only between scans with the same exact `tool.version`; see [inventory diffs](/guide/diff#hash-compatibility-and-incomplete-scans). |
| `dependencyHash`                                                                | string                         | 16 hex characters from the test declaration and its supported project dependencies. See [dependency hash](#dependency-hash) for coverage and limits.                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `dependencies`                                                                  | string\[]                       | The files that went into `dependencyHash`, the test's own file included, sorted, from the project root.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `dependencyGlobs`                                                               | string\[]\[]                     | Root-relative Vite module patterns grouped by call. A path can match any group. Within each group, negative entries exclude paths, including the importing file. Empty for tests that reach no supported glob.                                                                                                                                                                                                                                                                                                                                                                                                      |
| `hasUnfollowedDependencies`                                                     | boolean                        | Something the test reaches couldn't be followed, such as an import of a file that is missing or doesn't parse, or `import()` with a path worked out at run time, so a change there doesn't change `dependencyHash`. `unfollowedDependencies` says where.                                                                                                                                                                                                                                                                                                                                                            |
| `unfollowedDependencies`                                                        | string\[]                       | The file and line of each place the test reaches that couldn't be followed, as `support/venues.ts:2`, sorted; `[]` when `hasUnfollowedDependencies` is `false`. A [`dependency-not-followed`](/reference/diagnostics) warning at the place says what it is, unless a config warning or `scanSource()`, which reads no other file, explains it already, or a snapshot file can't be read or lies outside the project. A change to one of these files may affect the test even though `dependencies` doesn't list it.                                                                                                 |
| `suiteId`                                                                       | string or null                 | The nearest describe. `null` outside any describe.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `parentTestId`                                                                  | string or null                 | For a `node:test` subtest, declared in another test's body with `t.test()` or `test()`, the id of that test, which runs it while it runs. `null` for every other test.                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `suitePath`                                                                     | string\[]                       | Titles of the describes around the test, outermost first, and for a subtest the titles of the tests it is declared in.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `relativeFilePath`                                                              | string                         | The file, from the project root.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `fileName`                                                                      | string                         | The file name without folders.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `lineStart`, `lineEnd`                                                          | number                         | First and last line of the test call.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `columnStart`, `columnEnd`                                                      | number                         | Where the test call starts, and the column just after its last character.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `declaredAt`                                                                    | object or null                 | `{ relativeFilePath, lineStart, columnStart }` of the test in a helper imported from another file, when that helper declares it. The record's own location is then the call in this file that registers the test. `null` for tests written in the file.                                                                                                                                                                                                                                                                                                                                                             |
| `title`                                                                         | string                         | The title as the runner shows it, tags included.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `titleWithoutTags`                                                              | string                         | Playwright: the title without its `@tag` words. Vitest: the title.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `hasDynamicTitle`                                                               | boolean                        | The title could not be worked out; `title` holds its source text.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `fullName`                                                                      | string                         | `suitePath` and `title` joined with `>`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `isTypeTest`                                                                    | boolean                        | Declared in a Vitest type test file, `*.test-d.ts` or `*.spec-d.ts`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `state`                                                                         | string                         | `active`, `skip`, `fixme`, `todo`, `expectedToFail` or `notLoaded`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `isActive`, `isSkipped`, `isFixme`, `isTodo`, `isExpectedToFail`, `isNotLoaded` | boolean                        | Exactly one is true, matching `state`. `isActive: false` does not mean the test never executes: expected-to-fail tests run, and a conditional state may not apply. See [key concepts](/guide/concepts#state-describes-the-code).                                                                                                                                                                                                                                                                                                                                                                                    |
| `isOnly`                                                                        | boolean                        | The test is selected by `.only` under the runner's focus rules, or a Vitest tag sets `only`. In Mocha, Cypress and WebdriverIO on Mocha, a suite's focused tests exclude its child suites; otherwise inner focus replaces outer focus.                                                                                                                                                                                                                                                                                                                                                                              |
| `isConditional`                                                                 | boolean                        | The state applies only when a condition holds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `condition`                                                                     | string or null                 | The condition's source text, on one line and cut at 200 characters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `reason`                                                                        | string or null                 | The reason given with the state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `hasDynamicReason`                                                              | boolean                        | The reason could not be worked out to a string; `reason` holds its source text.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `stateSource`                                                                   | string or null                 | Where the state is set: `test`, `suite` or `file`, or `config` for a Vitest tag the config defines. `null` for active tests.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `stateLine`                                                                     | number or null                 | The line that sets the state. `null` for active tests and a state from the config.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `isParallel`, `isSerial`                                                        | boolean                        | The file or a Vitest tag can set the mode. Playwright defaults to parallel when every selected project enables `fullyParallel`. Vitest reads `sequence.concurrent` from the root through version 4 and from each selected project in version 5. Bun checks `concurrentTestGlob`. See [Vitest scheduling](/frameworks/vitest) for how test and suite options interact with the default.                                                                                                                                                                                                                              |
| `tags`                                                                          | string\[]                       | Tags of the test and every describe around it, outermost first, without duplicates; for Playwright 1.57 and later, the config's `tag` first.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `annotations`                                                                   | object\[]                       | `{ type, description, lineStart }` from Playwright's `annotation` option and `test.info().annotations.push()`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `comments`                                                                      | string\[]                       | The comment lines directly above the test, without lint, compiler, formatter and coverage directives. By default only for tests that are not active.                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `locks`                                                                         | string\[]                       | Playwright `lock` names on the test and its describes (1.63), and from `test.describe.configure()` in the file and those describes (1.64).                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `meta`                                                                          | object or null                 | Vitest `meta`, merged from the test's tags, the describes and the test, in that order, literal values only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `hooks`                                                                         | object                         | Every hook that runs around the test: those at the top of the file and in each describe around it, by kind. See [files](#files).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `timeout`                                                                       | number or null                 | In milliseconds. See [run settings](#run-settings). The effective setting from the test, suite, file or config; `null` when absent or unknown. Check `timeoutSource` and `timeoutConfigText`.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `isSlow`, `slowCondition`                                                       | boolean, string or null        | Playwright `test.slow()` applies, and its condition's source text; `null` when it always applies.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `retries`                                                                       | number or null                 | How many times the runner retries the test when it fails. The effective setting from the test, suite, file or config; `null` when absent or unknown. Check `retriesSource` and `retriesConfigText`.                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `retryDelay`, `retryCondition`                                                  | number or null, string or null | Vitest's `retry` object (4.1): the milliseconds between retries, and the source text of its `condition`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `repeats`                                                                       | number or null                 | Vitest's or Bun's `repeats`: how many times the runner runs the test again after the first run.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `fixtures`                                                                      | string\[]                       | The names the test function takes from its context, then those of the `beforeEach`, `afterEach` and `aroundEach` hooks around it, once each. Vitest's own context keys, such as `expect`, `task` and `annotate`, are left out. See [what the body does](#what-the-body-does).                                                                                                                                                                                                                                                                                                                                       |
| `expectCount`                                                                   | number                         | The `expect()`, `expect.soft()`, `expect.poll()` and `expect.element()` (Vitest browser mode) calls written in the body, also through Playwright's `expect.configure(...)`, in place or kept in a variable.                                                                                                                                                                                                                                                                                                                                                                                                         |
| `expectedAssertions`, `expectsAssertions`                                       | number or null, boolean        | Vitest's `expect.assertions(n)` and `expect.hasAssertions()` in the body.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `hasEmptyBody`                                                                  | boolean                        | The test function has no statements, comments aside.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `steps`                                                                         | object\[]                       | `{ title, hasDynamicTitle, lineStart, depth, isSkipped }` for each Playwright `test.step()` and `test.step.skip()` in the body, in source order; `depth` is 0 for a step directly in the test.                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `isBenchmark`                                                                   | boolean                        | A Vitest 5 benchmark: in a file such as `*.bench.ts`, or using the `bench` fixture. Plain `vitest` doesn't run it; `vitest bench` does.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `isParameterized`                                                               | boolean                        | Declared with `.each` or `.for`, or inside a `describe.each` or `describe.for`, so the runner repeats it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `caseCount`                                                                     | number or null                 | How many times the runner repeats the test: its own cases times those of each describe table and the passes of each loop around it. `null` when the scan can't work out a table or a loop's values, or the test is neither parameterized nor in a loop.                                                                                                                                                                                                                                                                                                                                                             |
| `caseIndex`                                                                     | number or null                 | With `--expand-cases`, which case of its own table, or pass of the innermost loop around it inside its describe, the test is, from 0, as Vitest's `%#` counts. `null` without `--expand-cases`, or when the test isn't one of several; the case of a describe around it is that describe's `caseIndex`.                                                                                                                                                                                                                                                                                                             |
| `isInLoop`                                                                      | boolean                        | Declared inside a loop, `forEach` or `map`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `isInCondition`                                                                 | boolean                        | Declared inside `if`, `?:`, `&&`, `\|\|`, `??`, `switch` or a `catch` block.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `isInFunction`                                                                  | boolean                        | Declared inside a plain function. A function called from the file or a describe has its tests recorded at each call; one the scan can't place gets a `test-in-function` warning.                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `projects`                                                                      | string\[] or null               | The names of the projects that run the test, of the config its file uses: those whose files include it, less those whose Playwright `grep` or `grepInvert` leaves its title out, and from Playwright 1.64 those with `default: false` that no running project lists in `dependencies` or `teardown`. `[]` when no project runs it; `null` without a config, or when the scan can't tell, as for a dynamic title under a `grep`. See [configs](#configs).                                                                                                                                                            |

::: details TypeScript

```ts
/** A test, with the effective values the runner applies, including those inherited from its describes. */
export interface TestRecord {
  /** Derived from the file path, the describe titles, the title and its position among tests with the same title. */
  id: Hash;
  /**
   * Hash of the test body, ignoring whitespace and comments: the test function, one passed by name, or the one a wrapper
   * call receives; null when the test has none of these.
   */
  bodyHash: Hash | null;
  /**
   * Hash of everything the test runs in the project: its call, the hooks, options and code of the file and of every
   * describe around it, and the functions, classes, constants and modules these use, followed through imports. Ignores
   * whitespace and comments. Installed packages are not in it.
   */
  dependencyHash: Hash;
  /** The files that went into `dependencyHash`, the test's own included, sorted, with `/` separators. */
  dependencies: string[];
  /** Something the test reaches couldn't be followed, so a change there doesn't change `dependencyHash`. */
  hasUnfollowedDependencies: boolean;
  /** Root-relative Vite module patterns, grouped by call. Within each group a leading ! excludes matching paths. */
  dependencyGlobs: string[][];
  /**
   * Where the test reaches what couldn't be followed: the file and line of each place, as `support/venues.ts:2`, sorted;
   * empty when `hasUnfollowedDependencies` is false. A `dependency-not-followed` warning at the place says what it is.
   */
  unfollowedDependencies: string[];
  /** The nearest describe; null outside any describe. */
  suiteId: Hash | null;
  /**
   * The test whose body declares this one as a subtest, which `node:test` runs while it runs that test; null for every
   * other test.
   */
  parentTestId: Hash | null;
  /** Titles of the describes around the test, and of the tests a subtest is declared in, outermost first. */
  suitePath: string[];
  /** Path from the project root, with `/` separators. */
  relativeFilePath: string;
  fileName: string;
  lineStart: Position;
  lineEnd: Position;
  /** In UTF-16 code units. */
  columnStart: Position;
  /** In UTF-16 code units. */
  columnEnd: Position;
  /**
   * Where a helper imported from another file writes the test; the record's location is then the
   * call that registers it. Null for code written in the scanned file.
   */
  declaredAt: DeclaredAt | null;
  /** As the runner shows it, tags included. */
  title: string;
  /** `title` with `@tag` words removed and spaces tidied. */
  titleWithoutTags: string;
  /** The title could not be resolved to a fixed string, so `title` holds its source text. */
  hasDynamicTitle: boolean;
  /** `suitePath` and `title` joined with " > ". */
  fullName: string;
  /** Declared in a Vitest type test file (`*.test-d.ts`, `*.spec-d.ts`). */
  isTypeTest: boolean;
  state: TestState;
  /** True only for state active; false does not establish that the test never executes. */
  isActive: boolean;
  isSkipped: boolean;
  isFixme: boolean;
  isTodo: boolean;
  isExpectedToFail: boolean;
  /** The runner did not load this test, possibly because its describe failed; a diagnostic at `stateLine` says why. */
  isNotLoaded: boolean;
  /** The test is selected by a `.only`, following the runner's focus rules. */
  isOnly: boolean;
  /** The state applies only when a condition holds, as with `test.skip(condition)` or `skipIf`. */
  isConditional: boolean;
  /** Source text of the condition, shortened when long; null when unconditional. */
  condition: string | null;
  reason: string | null;
  /** The reason could not be worked out to a string, so `reason` holds its source text. */
  hasDynamicReason: boolean;
  /** null for active tests. */
  stateSource: StateSource | null;
  /** The line that sets the state; null for active tests. */
  stateLine: Position | null;
  /** Both `isParallel` and `isSerial` false means the framework's default mode. */
  isParallel: boolean;
  isSerial: boolean;
  /** From the test and every describe around it, outermost first, without duplicates. */
  tags: string[];
  annotations: Annotation[];
  /** Comment lines directly above the test. By default only filled for tests that are not active. */
  comments: string[];
  /** From the test, its describes and the `test.describe.configure()` calls around it. Playwright only. */
  locks: string[];
  /** Merged from the describes and the test. Vitest only; literal values only. */
  meta: Record<string, MetaValue> | null;
  /** Every hook that runs around the test: those of the file and of each describe around it. */
  hooks: HookCounts;
  /**
   * In milliseconds: the last `test.setTimeout()` in the body or a `beforeEach`, otherwise the nearest describe or file
   * that sets one, otherwise the config. Null when none sets it, so the runner's default applies.
   */
  timeout: Count | null;
  /** Playwright `test.slow()` applies: the runner triples the timeout. */
  isSlow: boolean;
  /** Source text of the condition of the `test.slow()` that applies; null when unconditional or not slow. */
  slowCondition: string | null;
  /** Effective retry count from the test, suite, file or config; null when absent or unknown. See retriesSource. */
  retries: Count | null;
  /**
   * Milliseconds between retries: Vitest's from the `retry` object (4.1), Jest's from `waitBeforeRetry` of
   * `jest.retryTimes()` (30.0); null otherwise.
   */
  retryDelay: Count | null;
  /** Vitest only: source text of the `retry` object's `condition`, a RegExp or a function. */
  retryCondition: string | null;
  /**
   * How many times the runner runs the test again after the first run: Vitest's or Bun's `repeats`, or Playwright's
   * `repeatEach` from the config less one.
   */
  repeats: Count | null;
  /**
   * Where `timeout` comes from; null when nothing sets it. A null `timeout` from the config means the config sets it, but
   * its projects set different values or the value depends on a condition, as in `process.env.CI ? 2 : 0`.
   */
  timeoutSource: SettingSource | null;
  /** Where `retries`, `retryDelay` and `retryCondition` come from, read as `timeoutSource` is. */
  retriesSource: SettingSource | null;
  /** Where `repeats` comes from, read as `timeoutSource` is. */
  repeatsSource: SettingSource | null;
  /**
   * The config's source text for `timeout` when the config sets it under a condition, as in
   * `process.env.CI ? 60_000 : 30_000`, shortened when long; null otherwise.
   */
  timeoutConfigText: string | null;
  /** The config's source text for `retries`, read as `timeoutConfigText` is. */
  retriesConfigText: string | null;
  /** The config's source text for `repeats`, Playwright's `repeatEach`, read as `timeoutConfigText` is. */
  repeatsConfigText: string | null;
  /**
   * Names the test function takes from its context, then those of the `beforeEach`, `afterEach` and `aroundEach` hooks
   * around it, once each. Vitest's own context keys, such as `expect` and `task`, are left out.
   */
  fixtures: string[];
  /** Calls of `expect()`, `expect.soft()` and `expect.poll()` written in the body, each counted once. */
  expectCount: Count;
  /** Vitest `expect.assertions(n)` in the body. */
  expectedAssertions: Count | null;
  /** Vitest `expect.hasAssertions()` in the body. */
  expectsAssertions: boolean;
  /** The test function has no statements, comments aside. */
  hasEmptyBody: boolean;
  /** Playwright `test.step()` and `test.step.skip()` calls in the body, in source order. */
  steps: Step[];
  /** Vitest 5 benchmark: in a benchmark file, or using the `bench` fixture. Plain `vitest` doesn't run it. */
  isBenchmark: boolean;
  /** Declared with `.each` or `.for`, or inside a describe declared with them, so the runner repeats it. */
  isParameterized: boolean;
  /**
   * How many times the runner repeats the test: the cases of its own table times those of each describe table and the
   * passes of each loop around it. Null when the scan can't work out a table or a loop's values, or the test is neither
   * parameterized nor in a loop.
   */
  caseCount: Count | null;
  /**
   * With `expandCases`, which case of its own table, or pass of the innermost loop around it inside its describe, the
   * test is, from 0, as Vitest's `%#` counts; null without `expandCases`, or when the test isn't one of several. The
   * case of a describe table or loop around the describe is the describe's `caseIndex`.
   */
  caseIndex: Count | null;
  /** Declared inside a loop, `forEach` or `map`. */
  isInLoop: boolean;
  /** Declared inside `if`, `?:`, `&&`, `switch` or a `catch` block. */
  isInCondition: boolean;
  /** Declared inside a plain function. */
  isInFunction: boolean;
  /**
   * Names of the projects that run the test, of the config its file uses, after each project's files and Playwright's
   * `grep` and `grepInvert`. `[]` when no project runs it; null when there is no config, or the scan can't tell.
   */
  projects: string[] | null;
}

/**
 * The state the runner applies to a test, after describes and file-level calls are taken into account. `notLoaded`:
 * the runner refuses to load the file, so none of its tests run.
 */
export type TestState = 'active' | 'skip' | 'fixme' | 'todo' | 'expectedToFail' | 'notLoaded';

/**
 * Where a test's state is set: on the test, on a describe around it, at file level, or by a Vitest tag the config
 * defines.
 */
export type StateSource = 'test' | 'suite' | 'file' | 'config';

export interface Annotation {
  type: string;
  description: string | null;
  lineStart: Position;
}

export interface Step {
  /** The title, or its source text when it can't be worked out. */
  title: string;
  hasDynamicTitle: boolean;
  lineStart: Position;
  /** 0 for a step directly in the test, 1 for a step inside it, and so on. */
  depth: Count;
  /** Declared with `test.step.skip()`. */
  isSkipped: boolean;
}

export type MetaValue = string | number | boolean | null | MetaValue[] | { [key: string]: MetaValue };
```

:::

### Dependency hash

`dependencyHash` covers the supported project code and inputs a test reaches:

* Its declaration, options and body; surrounding hooks, `test.use()` values and suite settings.
* Fixtures requested by the test, hooks, conditions and options, including transitive fixtures, automatic fixtures
  and overrides of Playwright's built-in fixtures.
* Other top-level code in the file; the config and its base configs; setup, global setup and teardown files; and
  Playwright setup projects listed in the running projects' dependencies.
* Jasmine helpers, Cypress support files, Bun preload files and Node script preloads.
* Snapshot files and screenshots found at the runners' supported default locations.
* Functions, classes, constants and modules reached through those inputs, followed through imports and re-exports,
  with the code each module executes when it loads.

It uses syntax-tree hashing like `bodyHash`: formatting, comments and moving a test to another line do not change
it. The declaration includes its title, so renaming a test can change `dependencyHash` without changing `bodyHash`.
Installed packages are excluded. [Known limits](/guide/limits#what-dependencyhash-leaves-out) explains both missing
inputs and shared inputs that can make the hash change more broadly than the test's behavior.

### How the state is chosen

The state is the one the runner applies. The test's own skip, fixme or todo comes first: `test.fixme()` in a skipped
describe stays `fixme`. Then the describes around it from the innermost out, then the file. A state that always
applies wins over one that only applies under a condition, and an unconditional skip, fixme or todo around a test wins
over the test's own expected failure, as neither runner runs that test. For the same reason it wins over an
unconditional skip in a test or hook body: in a fixme or todo describe, the test keeps that state. `stateSource` says
where the chosen state was set.

node:test and Bun put some describes first. node:test creates nothing inside a skipped describe, so its tests are
skipped whatever their own state. In Bun, the outermost skipped or todo describe decides, over the describes inside it
and the test's own state: `test.skip()` in `describe.todo()` is todo.

In Vitest, `.only` wins over `.skip`, which wins over `.todo`, within one declaration: `test.only.skip` is active. A
test's options win over its chain, so `test.skip('title', { skip: false }, fn)` runs, while a describe's chain wins
over its options, and so does a test's for its mode. A describe passes its `skip` option down to the tests and
describes inside, where it wins over todo: `test.todo()` in `describe('title', { skip: true }, fn)` is skipped. It does
so also when the describe's own `.only` keeps the describe from being skipped.

From Vitest 5.0.5 a test's `.skip`, `skipIf()` and `runIf()` each set its `skip`, so the last of them decides:
`test.skip.skipIf(false)` runs, and a `skipIf()` or `runIf()` replaces the skip of a tag or of a describe's options. An
option set to `undefined` changes nothing there, so `test.skip('title', { skip: undefined }, fn)` stays skipped. The
scan applies both to all of Vitest 5.

A Vitest tag the config defines in `test.tags` sets its options on every test that carries it, also through a
describe or a `@module-tag` comment. When two tags set the same option, the one with the lowest `priority` wins, and
one without a priority loses to every one with one. Vitest merges the tags' options with the test's own and those a
describe passes down, such as `describe('title', { skip: true }, fn)`, and then takes `only` over `skip` over `todo`:
a tag's `only` runs a `test.skip()`, and a tag's `skip` skips a test with `todo: true`. A state that comes from a tag
has `stateSource: "config"`. A describe's own mode, as in `describe.skip()`, applies to its tests only when they get
no state of their own, so a tag's `todo` in it stays `todo`. A test's own `skip`, `only`, `todo` or `fails` option
replaces its tag's, also when set to `false`: `test('title', { tags: ['flaky'], skip: false }, fn)` runs.

For `concurrent`, `timeout`, `retry`, `repeats` and `meta`, the test's own options win over its tags. From Vitest 5
the tags win over the options a describe passes down; in Vitest 4.1 the describe's win, and so does the config's
`sequence.concurrent` when it sets one.

A `test.skip()`, `test.fixme()`, `test.fail()` or `test.describe.configure()` call inside a plain function in the file
applies where the function is called: to a test that calls it in its body, to the tests a hook covers when a hook calls
it, or to a describe when it is called directly in the describe's body. The conditions around the call and inside the
function are joined, and `stateLine` is the line of the call inside the function. Calls through other functions in the
file are followed too. A function that is exported, or that nothing in the file calls, changes no record and gets a
`state-in-helper` warning.

When a file has a problem that makes the runner refuse to load it, such as a Playwright test without a body, a
Vitest call to an API that the version removed or an async Jest describe, the affected tests are `notLoaded`. The scope depends on the runner: it can be the whole file, a describe or only
tests at or after the refused call. `stateSource` is `file` or `suite`, and `stateLine` identifies the problem;
`condition` and `reason` are `null`. The [diagnostic](/reference/diagnostics#files-the-runner-refuses-to-load) says
why. Everything else about the tests stays as written, so fixing the file brings their states back. A refused call
that declares a test or describe is listed without the part that fails, so its tests are `notLoaded` too. A refused
call reached only under a condition is reported but leaves the states as they are, since the file loads unless the
condition holds.

### Run settings

Each run setting comes from the nearest place that sets it, and `timeoutSource`, `retriesSource` and `repeatsSource`
say which: `test`, `suite`, `file` or `config`, or `null` when nothing sets it, so the runner's default applies.

1. Calls in the test body, the last one winning: Playwright's `test.setTimeout()` and `test.slow()`.
2. The same calls in a `beforeEach` around the test, which runs before the body. In `beforeAll` and `afterAll` they
   set the hook's own timeout, and an `afterEach` runs after the body, so those are left out.
3. The test's own options, such as Vitest's and Bun's `timeout`, `retry` and `repeats`, node:test's `timeout`,
   Cypress's `retries`, Mocha's `this.timeout()` and `this.retries()` in the test, or a timeout after the body, as in
   `test(title, fn, 30_000)`.
4. Each describe around the test, from the innermost out, and then the file: Playwright's
   `test.describe.configure({ timeout, retries })`, `test.setTimeout()` and `test.slow()` written in the describe, and
   the options Vitest passes down from `describe()`, and Mocha's `this.timeout()` and `this.retries()` in a describe.
   From Vitest 5, the test's tags come before the describes, with
   source `config`; in Vitest 4.1, after them.
5. The config the file uses: Playwright's `timeout`, `retries` and `repeatEach` of the projects that run the test,
   with `repeatEach` as `repeats`, the runs after the first; Vitest's `testTimeout`, `retry` and, from Vitest 5,
   `repeats`; the other runners' settings are under [configs](#configs). When the projects set different values, or the value depends on a condition, the key is `null` with its
   source `config`; so are all three when the scan can't work out the projects.

The scan doesn't guess whether a run is in CI, so a value under a condition stays `null`, and `timeoutConfigText`,
`retriesConfigText` and `repeatsConfigText` hold the config's text for it, such as `"process.env.CI ? 2 : 0"`, shortened
when long. They are `null` for any other value, and when the projects that run the test write different texts.

A Vitest `retry` replaces the whole `retry` around it, so a test with `retry: 1` in a describe with a `delay` has no
`retryDelay`. Vitest reads the `retry` object from 4.1; before, it never runs a test whose `retry` is an object. The
scan then gives `null`, with an `unresolved-option` warning for an object in the test file, and with source `config`
and a `config-value-unknown` warning for one in the config.

Playwright triples the timeout of a slow test once, when `test.slow()` runs; a `test.setTimeout()` after it replaces
the tripled value. The record keeps `timeout` as written and `isSlow` beside it. `test.slow()` under a condition, or
inside `if`, gives `slowCondition`. A timeout set only under a condition, or one the scan can't work out, such as a
constant imported from another file, is left out with an `unresolved-option` warning, and the value around it applies.

In the web app, the live price stream retries its tests, since the demo feed drops connections now and then:

```ts excerpt
test.describe('live price stream', () => {
  // The demo feed drops connections now and then.
  test.describe.configure({ retries: 2 });
  // ...
});
```

```json
{
  "fullName": "live price stream > updates prices without a reload",
  "timeout": null,
  "isSlow": false,
  "retries": 2,
  "retryDelay": null,
  "repeats": null,
  "retriesSource": "suite"
}
```

### What the body does

These keys come from the test function itself, not from the functions it calls: an `expect()` or a `test.step()` in a
page object or a helper isn't counted. Each call is counted once as written, also inside a loop. Vitest's
`annotate(message, type?)` from the test context (3.2) adds an annotation, of type `notice` when no type is given.

In the web app, the order lifecycle enters and confirms the order in two steps:

```ts excerpt
test('places a limit order for 100 NVDA', async ({ orderTicket, blotter }) => {
  await test.step('enter the order', async () => {
    await orderTicket.open('NVDA');
    await orderTicket.buy({ quantity: 100, limitPrice: 118 });
  });
  await test.step('confirm it', async () => {
    await orderTicket.confirm();
  });
  await expect(blotter.status('NVDA')).toHaveText('Working');
});
```

```json
{
  "fullName": "order lifecycle > places a limit order for 100 NVDA",
  "fixtures": ["orderTicket", "blotter"],
  "expectCount": 1,
  "hasEmptyBody": false,
  "steps": [
    { "title": "enter the order", "hasDynamicTitle": false, "lineStart": 8, "depth": 0, "isSkipped": false },
    { "title": "confirm it", "hasDynamicTitle": false, "lineStart": 12, "depth": 0, "isSkipped": false }
  ]
}
```

## Suites

A suite record describes what is written on the describe itself. Values a test inherits from it are in the test
record.

| Key                                                                                              | Type                   | Meaning                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`, `parentId`                                                                                 | string, string or null | The describe and the one around it.                                                                                                                                            |
| `bodyHash`                                                                                       | string or null         | The describe's own code: hooks, `test.use()`, `describe.configure()` and helpers, without the tests and describes inside it, hashed as for tests. `null` when nothing is left. |
| `relativeFilePath`, `fileName`, `lineStart`, `lineEnd`, `columnStart`, `columnEnd`, `declaredAt` |                        | As for tests.                                                                                                                                                                  |
| `title`, `titleWithoutTags`, `hasDynamicTitle`                                                   |                        | As for tests. An anonymous Playwright describe has an empty title and is left out of paths.                                                                                    |
| `path`                                                                                           | string\[]               | The titles of this describe and those around it.                                                                                                                               |
| `isSkipped`, `isFixme`, `isTodo`, `isExpectedToFail`, `isOnly`                                   | boolean                | Set on this describe. `isExpectedToFail` is a Playwright `test.fail()` in the describe's body.                                                                                 |
| `isConditional`, `condition`, `reason`, `hasDynamicReason`                                       |                        | As for tests.                                                                                                                                                                  |
| `isParallel`, `isSerial`, `isShuffled`                                                           | boolean                | The mode set on this describe.                                                                                                                                                 |
| `isParameterized`                                                                                | boolean                | `describe.each` or `describe.for`.                                                                                                                                             |
| `caseIndex`                                                                                      | number or null         | With `--expand-cases`, which case of its table or pass of its loop the describe is, from 0. `null` otherwise.                                                                  |
| `tags`, `annotations`, `locks`, `meta`                                                           |                        | Written on this describe.                                                                                                                                                      |
| `hooks`                                                                                          | object                 | The hooks registered directly in this describe, by kind.                                                                                                                       |
| `timeout`, `isSlow`, `slowCondition`, `retries`, `retryDelay`, `retryCondition`, `repeats`       |                        | Set on this describe: by its options, or by `describe.configure()`, `test.setTimeout()` and `test.slow()` in its body.                                                         |

::: details TypeScript

```ts
/** A describe block, with what is written on the describe itself. Inherited values are on the tests. */
export interface SuiteRecord {
  id: Hash;
  /** The describe around this one; null at the top level. */
  parentId: Hash | null;
  /**
   * Hash of the describe's own code (hooks, `test.use()`, `describe.configure()`, helpers), ignoring whitespace,
   * comments, and nested tests and describes; null when nothing is left.
   */
  bodyHash: Hash | null;
  /** Path from the project root, with `/` separators. */
  relativeFilePath: string;
  fileName: string;
  lineStart: Position;
  lineEnd: Position;
  /** In UTF-16 code units. */
  columnStart: Position;
  /** In UTF-16 code units. */
  columnEnd: Position;
  /**
   * Where a helper imported from another file writes the describe; the record's location is then the
   * call that registers it. Null for code written in the scanned file.
   */
  declaredAt: DeclaredAt | null;
  /** As the runner shows it, tags included. */
  title: string;
  /** `title` with `@tag` words removed and spaces tidied. */
  titleWithoutTags: string;
  /** The title could not be resolved to a fixed string, so `title` holds its source text. */
  hasDynamicTitle: boolean;
  /** Titles of the describes around this one and of this one, outermost first. */
  path: string[];
  isSkipped: boolean;
  /** Playwright only. */
  isFixme: boolean;
  /** Vitest only. */
  isTodo: boolean;
  /** Tests in the describe are expected to fail, as with `test.fail()` in its body. Playwright only. */
  isExpectedToFail: boolean;
  isOnly: boolean;
  /** The state applies only when a condition holds. */
  isConditional: boolean;
  /** Source text of the condition, shortened when long; null when unconditional. */
  condition: string | null;
  reason: string | null;
  /** The reason could not be worked out to a string, so `reason` holds its source text. */
  hasDynamicReason: boolean;
  isParallel: boolean;
  /** Playwright only. */
  isSerial: boolean;
  /** Vitest only. */
  isShuffled: boolean;
  /** Declared with `.each` or `.for`. */
  isParameterized: boolean;
  /**
   * With `expandCases`, which case of its table or pass of its loop the describe is, from 0, as Vitest's `%#` counts;
   * null without `expandCases`, or when the describe isn't one of several.
   */
  caseIndex: Count | null;
  tags: string[];
  annotations: Annotation[];
  /** Playwright only. */
  locks: string[];
  /** Vitest only; literal values only. */
  meta: Record<string, MetaValue> | null;
  /** Hooks registered directly in the describe. */
  hooks: HookCounts;
  /** In milliseconds; null when nothing here sets it. */
  timeout: Count | null;
  /** Playwright `test.slow()` written in the describe, which triples the timeout of its tests. */
  isSlow: boolean;
  /** Source text of the `test.slow()` condition; null when unconditional or not slow. */
  slowCondition: string | null;
  retries: Count | null;
  /**
   * Milliseconds between retries: Vitest's from the `retry` object (4.1), Jest's from `waitBeforeRetry` of
   * `jest.retryTimes()` (30.0); null otherwise.
   */
  retryDelay: Count | null;
  /** Vitest only: source text of the `retry` object's `condition`, a RegExp or a function. */
  retryCondition: string | null;
  /** Vitest only: how many times the runner runs each test again after the first run. */
  repeats: Count | null;
}
```

:::

## Files

A file record is written for every scanned file, also one that has no tests, could not be read or failed to parse.

| Key                            | Type           | Meaning                                                                                              |
| ------------------------------ | -------------- | ---------------------------------------------------------------------------------------------------- |
| `relativeFilePath`, `fileName` | string         | As for tests.                                                                                        |
| `config`                       | string or null | The config the file uses, from the project root; see [configs](#configs). `null` when there is none. |
| `hooks`                        | object         | The hooks at the top level of the file, which run around every test in it.                           |
| `suiteCount`, `testCount`      | number         | The describes and tests in the file, all of them also when a filter keeps only some.                 |

`hooks` counts each kind: `beforeAll`, `beforeEach`, `afterEach` and `afterAll`, and Vitest's `aroundEach` and
`aroundAll` (4.1). A hook in a helper function with a name counts where the helper is called, and not at all when it is
never called; one in a function without a name, such as a callback, counts where it is written. Vitest's `onTestFailed`
and `onTestFinished` run inside a test, so they are not counted. A test's `hooks` adds up those of its file and of each
describe around it. In the web app, the price alerts open their page in a `beforeEach`:

```json
{
  "id": "006bcf2289191aef",
  "fullName": "price alerts > notifies when the price crosses above the alert",
  "hooks": {
    "beforeAll": 0,
    "beforeEach": 1,
    "afterEach": 0,
    "afterAll": 0,
    "aroundEach": 0,
    "aroundAll": 0
  }
}
```

::: details TypeScript

```ts
/** A scanned file, also one that has no tests or could not be read. */
export interface FileRecord {
  /** Path from the project root, with `/` separators. */
  relativeFilePath: string;
  fileName: string;
  /**
   * The config the file uses, from the project root: the outermost config at or above it that runs it, as the runner
   * started at the root would, else the nearest. Null when there is none.
   */
  config: string | null;
  /** Hooks at the top level of the file, which run around every test in it. */
  hooks: HookCounts;
  suiteCount: Count;
  testCount: Count;
}

/** How many hooks of each kind are registered, including by helper functions called there. */
export interface HookCounts {
  beforeAll: Count;
  beforeEach: Count;
  afterEach: Count;
  afterAll: Count;
  /** Vitest only. */
  aroundEach: Count;
  /** Vitest only. */
  aroundAll: Count;
}
```

:::

## Configs

`configs` lists the configs the scanned files use, sorted by path. A file uses the config the runner started at the
root would use for it: of the configs in its folder and the folders above it, up to the root, the outermost one that
runs it, and for Vitest `projects` the project that does. When none runs it, it uses the nearest one, and a file with
tests gets a `file-not-run` warning, as the runner doesn't collect them. In each folder, the config is
`playwright.config.*` for Playwright, and `vitest.config.*` for Vitest, or `vite.config.*` when there is no
`vitest.config.*`.

A config a package.json script starts the runner with counts too, for Vitest, Jest, Playwright, Cypress, WebdriverIO
and Mocha: a script in the file's folder or one above it, with the config the command names, as in
`vitest run --config vitest.config.integration.mts`, or else the one the runner finds where the script starts. A file
such a config runs uses it and gets no warning. Vitest and Cypress read the globs from the folder the script runs in,
or from its `--root` or `--project`; Jest, Playwright and WebdriverIO read them from the config's folder. When a
script names a config the scan can't read, such as a variable, the scan can't tell which files it runs and reports a
`config-value-unknown` warning on the package.json in place of `file-not-run`. The runner is found past variables
set before it, `cross-env`, `dotenv --`, `xvfb-run`, `xvfb-maybe`, the coverage tools `nyc`, `c8` and `mcr`, and the
package managers that start a binary. When a script runs `playwright test` with or without simple file arguments in a folder without a config,
discovery applies the default Playwright file matcher in that folder. The file's `config` is `null`.
Currents' `pwc` and `pwc-p` count as Playwright, with the `--config` they pass on, and its `cypress-cloud` as Cypress,
with `--config-file` and `--project`. Scripts that start the runner through a wrapper of their own, and configs only a
CI workflow names, aren't followed. A file that a collected test file
imports gets no warning either, as its tests run in that file.

During discovery, a config used by a filtered package command contributes the files selected by its scripts.
Vitest file filters support Windows short paths such as `C:/DESK~1/orders.spec.js`.
`jest --runTestsByPath` takes exact paths from the script's folder, `vitest run` takes case-insensitive path
substrings and `playwright test` matches regular expressions against full file paths. Several arguments or scripts
select their combined set. Playwright file filters also collect prerequisite projects and teardown for a project whose selected
files contain tests admitted by the project's title filters or may load tests from another module. An empty spec,
a hook by itself, or a module that only exports constants does not activate setup.
When a Playwright file filter matches only an enclosing describe, the matching tests keep their projects. Other
tests in the same file have an empty `projects` list unless another package script selects them.
A literal shell directory change such as `cd desk && jest --runTestsByPath tests/orders.spec.js` resolves the runner's paths from `desk`.
A command without filters keeps the full selection for that config. An independent
config can also select a file, and explicit scan globs can select files outside the commands' filters.

The scanner reads simple path arguments made of letters, digits, spaces, underscores, hyphens, dots and slashes.
It accepts the runner's config and root options, Jest's `--ci` and `--runInBand`, and Vitest's `--coverage` after
`run`. With variables, shell globs or other unmodeled options, it uses the configured file set. With no Playwright
config, discovery requires a plain command or supported file arguments.

A script can also discover files when no config above the file runs it, or the one there can't be read.
If a Playwright or Vitest config's projects are unknown but its top-level file settings are readable, discovery keeps
the candidates those settings select. Their `projects` is `null`; a `config-value-unknown` error warns that project
overrides may select other files or exclude these candidates. An unknown top-level file setting still needs explicit
globs. A known empty project list selects no files.

Jest started at the root reads only the config there: `jest.config.*`, else `package.json`,
which Jest reads also without a `jest` key, and from Jest 30 a `jest` key that is a string is the path to the config.
Other configs count only through its `projects`. Jest refuses to start with more than one config in a folder, which a
`config-value-unknown` warning says. Without a config in the root, Jest's defaults apply from the root, and the files
have no config.

Mocha reads one config for the whole run, the first of `.mocharc.cjs`, `.js`, `.mjs`, `.yaml`, `.yml`,
`.jsonc` and `.json` in the root or a folder above it, joined with the `mocha` key of the nearest package.json: the
lists of options such as `spec`, `extension` and `ignore` are joined, and the file's value of any other key wins; that
package.json is in `extends`. Without either, Mocha's defaults apply and the files have no
config.

Jasmine reads the first of `spec/support/jasmine.mjs`, from Jasmine 5,
`.json` and `.js` in the root. Without one it runs no file, unless it is given files, as Karma and Angular give it
theirs.

Cypress reads the first `cypress.config.*` in the root, and WebdriverIO the first of `wdio.conf.js`, `.ts`,
`.mjs`, `.mts`, `.cjs` and `.cts` there, its `config` export; without one, they run no file unless they are given files.

node:test has no config the scan reads: `node.config.json` holds no files, and Node.js reads it only with
`--config-file`, so its files have no config. Bun reads `bunfig.toml` in the root, its `[test]` table; without one, its
files have no config.

Which files a config runs is read as each runner decides it.

### Playwright file selection

For Playwright: the files under each project's `testDir`
that `testMatch` matches and `testIgnore` doesn't, matched against the full path in any case, without those that
`.gitignore` files in the test folder leave out when no `testDir` is set or `respectGitIgnore` is on.

### Vitest file selection

For Vitest: the
files under `test.dir`, `test.root` or `root` that `include` matches and `exclude` doesn't, with each version's
defaults, `includeSource` files that hold in-source tests, `typecheck.include` when `typecheck.enabled` is on, and
`benchmark.include`, whose files are marked `isBenchmark`. Paths and globs in `test.projects` start at `test.root`, then Vite's `root` if set.
If the scan cannot read the root, it reports unknown membership for those entries. A project written in `test.projects` inherits the root config
as each version decides, or the config its `extends` names. It runs from the config's root unless it sets its own, which
Vitest 5 resolves from the config's root and older versions from the config's folder. A config file or folder it names
is a project of its own, a folder without a config gets Vitest's defaults, and in Vitest 5 a config that lists projects
runs only those.

### Jest file selection

For Jest: the files under `roots` with an extension in `moduleFileExtensions` that `testMatch` or
`testRegex` match, without those `testPathIgnorePatterns` and `modulePathIgnorePatterns` leave out, with each version's
defaults and `<rootDir>` where Jest replaces it. Jest's `projects` takes folders, globs and config files, each with the
config Jest finds there, and objects, whose `rootDir` defaults to the config's folder; the config's own files then count
only when an entry names its folder, and an empty `projects` runs the config itself. A `preset` written as a path, such
as `'../../jest.preset.js'`, is read, with the config's own settings over it; one that is a package isn't.
If a required local preset is missing, Jest cannot start: config-based discovery finds no files, while explicit
globs retain declarations with empty `projects` and a `file-not-run` diagnostic.

### Mocha file selection

For Mocha:
from the root, each `spec` entry as a glob, a file, a file named without its extension, or a folder, whose files with
one of the `extension`s, `js`, `cjs` and `mjs` by default, are taken, those in folders below too with `recursive`,
without those its `ignore` or `exclude` entries match. Mocha applies ignores to each spec's lookup result before
resolving the path. A literal `./test/orders.js` keeps that prefix, while listing the directory `./test` returns
`test/orders.js`. Mocha loads `file` entries before the specs, including extensionless modules and directory indexes.
Ignores apply only to specs. An extension may have several parts, as `spec.js`. An extensionless spec can also match repeated suffixes, such as `orders.js.cjs`. Comma-separated extension and preload settings select every listed value. The
default `spec` is `./test`. Scanned with globs, every file they match counts as run, without those `ignore` matches, as
a project's scripts often give Mocha the spec on its command line, which no config shows. Without globs, a script that
starts `mocha`, `_mocha` or `ts-mocha` in a folder runs the files its command line and config give, read from that
folder: the `.mocharc` file `--config` names or that Mocha finds from there up, with the nearest package.json's `mocha`
key, unless `--no-config` or `--no-package` leave them out. Positional arguments and `--spec` add to configured specs.
The command's `--extension`, `--ignore` and `--file` also add to the configured lists. Its `--recursive`,
`--no-recursive` and `--ui` override the corresponding settings. Spec lookup checks for an existing literal
path before expanding a glob. Command-line globs are read as Mocha reads quoted ones. When the root
package has a readable Mocha command, discovery uses `./test` only for commands that have no spec. A separate
script that runs plain `mocha` can therefore still collect files directly under `test/`. The config's
`timeout`, which may be a string such as `'5s'`, and `retries` apply to every test.

### Jasmine file selection

For Jasmine: the files under `spec_dir` that a
`spec_files` glob matches, without those a glob starting with `!` matches. Without a config it runs no file; scanned
with globs, every file they match counts as run, as files given to Jasmine replace `spec_files`. `JASMINE_CONFIG_PATH`
and `--config` are not read.

### Cypress file selection

For Cypress: its testing types are the projects, `e2e` and, when the config sets up
component testing, `component`; each runs the files under the config's folder that its `specPattern` matches, by default
`cypress/e2e/**/*.cy.{js,jsx,ts,tsx}` and `**/*.cy.{js,jsx,ts,tsx}`, without dot files, those its `excludeSpecPattern`
matches, and those in `node_modules` unless a `specPattern` names it. As in `cypress run`, each pattern is matched
against the whole path from the config's folder, so `*.draft.cy.js` leaves out only files in that folder. As globby,
which Cypress uses, reads them, a `specPattern` that starts with `!` leaves files out, an `excludeSpecPattern` drops its
`!`, and a folder in either stands for every file below it. Component testing also leaves out the files e2e's
`specPattern` matches. Scanned with globs, a file counts as run only where its
testing type's `specPattern` takes it too, as `cypress run --spec` does. The testing type's `retries`, else the
config's, applies to every test, its `runMode` when it is an object, as `cypress run` takes.

### WebdriverIO file selection

For WebdriverIO: the files
under `rootDir`, the config's folder unless the config sets it, that a `specs` glob matches, also in the nested lists
that group files into one worker, with an extension WebdriverIO takes, such as `.js` or `.ts`, without dot files and
folders, less those `exclude` leaves out. A capability's own `wdio:specs`, or before WebdriverIO 10 its `specs`,
replace the config's for that capability, and its `wdio:exclude`, or before 10 its `exclude`, adds to the config's, read
inside its `alwaysMatch` when it has one; a file runs when a capability runs it. As in WebdriverIO, a glob without a
`/` matches a file's name at any depth, though `./` counts as one, a glob that starts with `!` matches nothing, and a
`\` is read as `/`; when every `exclude`
entry holds a `/`, `\` or `*`, they are globs too, and otherwise each leaves out every file whose path contains it.
`suites` run only with `--suite`, so they are not read. Scanned with globs, every file they match counts as run, less
the excludes, as files given with `--spec` replace `specs`. A file that two capabilities run, or that a group of files
and another entry both name, runs in two workers, but is listed once. The config's `framework`, Mocha by default, or
Jasmine, decides how the files are read, and
its `mochaOpts.timeout`, `retries` and `ui`, or `jasmineOpts.defaultTimeoutInterval`, apply to every test. Without them
the timeout is WebdriverIO's, 10 seconds, and a `defaultTimeoutInterval` of `0` is 60 seconds. Cucumber runs feature
files, which the scan doesn't read, and is reported. `mochaOpts.grep` and `jasmineOpts.grep` are not read.

### node:test file selection

For node:test: the files the `node --test` commands of the `test` script give, with those of the scripts it runs through
`npm run`, `pnpm`, `yarn`, `bun run`, `npm-run-all`, `run-s` or `run-p`, or when it runs none, of the first script that
runs `node --test`, each a glob or a path, and from Node.js 26.8 a folder, for the default patterns inside it; without
any, Node.js's default patterns. This holds for the `package.json` in the root, and for each one below it whose scripts
run `node --test`, from its folder, as a monorepo's packages run their own; the root runs the default patterns also
without such a script. The default patterns are
`**/*.test.*`, `**/*-test.*`, `**/*_test.*`, `**/test-*.*`, `**/test.*` and `**/test/**/*.*`, with the extensions `js`,
`mjs` and `cjs`, and from Node.js 22.18, which strips types by default, `ts`, `mts` and `cts`. Dot folders and
`node_modules` are left out. Scanned with globs, every file they match counts as run, as for the files given to
`node --test`.

### Bun file selection

For Bun: the files under `[test]
root`, the root by default, whose name without its extension ends with `.test`, `_test`, `.spec` or `_spec`, with the
extension `js`, `jsx`, `ts`, `tsx`, `mjs`, `cjs`, `mts` or `cts`, in any case, outside dot folders and `node_modules`,
and from Bun 1.3.11, read for all of 1.3, outside the folders and files a `pathIgnorePatterns` glob matches, from the
root. From Bun 1.3, `[test] retry` applies to every test. The tests of the files a `concurrentTestGlob` glob matches,
against the file's whole path, run at once. A
`pathIgnorePatterns` or `concurrentTestGlob` that isn't a string or a list of strings is reported, as Bun refuses the
config. Scanned with globs, every file they match counts as run, as for the files given to `bun test`.

A config is read as code and never run, with the settings it imports from other files: `defineConfig()`,
`defineProject()`, `mergeConfig()`, Playwright's `defineConfig(base, config)`, which merges `projects` by name and
`use`, `expect` and `build` key by key, spreads, also those a condition picks, constants, a function that returns the
config, a call of a function the config declares or that a local file or workspace package exports, as
`createVitestConfig('node')`, which gives what that function returns with its parameters set from the call's
arguments, defaults written with `??`, `||` or `&&` whose left side is known, regular expressions, and paths built with
`path.join()`, `path.resolve()`, `path.dirname()`, `fileURLToPath()` and `new URL()` from `__dirname`, `__filename` or
`import.meta`. A Jest config may also be JSON, or
a function, which Jest calls and awaits, and from Jest 30.3 use Jest's `defineConfig()` and `mergeConfig()`, or
next/jest's `createJestConfig()`. A Mocha
config may also be JSON, JSON with comments, or YAML with keys, lists and nested keys; YAML it doesn't read, such as an
anchor or a multi-line string, or that js-yaml, Mocha's reader, refuses, such as a key set twice, is reported, and the
scan reads none of that config's settings. A
config that `require()`s a local file, as a shared base, reads what that file exports, and a JSON file, required or
imported, is read as its value.

| Key                | Type          | Meaning                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------ | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `relativeFilePath` | string        | The config, from the project root.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `extends`          | array         | Files the config takes settings from through imports, such as a shared base config, in the order read.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `projects`         | array or null | The config's projects, each `{ name, testDir, dependencies }`: Playwright's `projects`, or one project for a config without them, named after its `name`; Vitest's, named as Vitest names them: after `test.name`, else the `name` in the package.json of the project's folder, else the folder, or an inline project after its place among the inline ones, such as `0`; with each browser instance as a project, such as `unit (chromium)`, while an instance whose browser or name can't be worked out leaves its files listed and their tests' `projects` `null`; and in Vitest 5, a project of a config another config lists inside that config's name, such as `web (unit)`; Jest's, named by `displayName`, else empty; Mocha's and Jasmine's one project, unnamed; Cypress's `e2e` and `component`. `testDir` is the folder its files are found in. `null` when the scan can't work them out. |

In the monorepo, the risk package builds on a config the packages share:

```ts excerpt
import { defineProject, mergeConfig } from 'vitest/config';
import shared from '../../vitest.shared';

export default mergeConfig(
  shared,
  defineProject({
    test: {
      name: 'risk',
    },
  }),
);
```

```json
{
  "relativeFilePath": "packages/risk/vitest.config.ts",
  "extends": ["vitest.shared.ts"]
}
```

Besides which files it runs, the scan reads Vitest's `test.globals` and Jest's `injectGlobals` from the file's project,
for the `globals-not-enabled` warning, and Mocha's `ui`, for which names declare tests. A setting it reads but can't
work out, such as one computed from `process.env` or taken from an installed package, gets a `config-value-unknown`
diagnostic that names it, and an explicitly selected file is taken to run. In Playwright and Vitest discovery, unknown
file selection is an error because tests may be missing; candidates retain unknown project membership. For Jest's
`testPathIgnorePatterns` and `modulePathIgnorePatterns` and Vitest's `exclude` lists, which only leave files out, the
entries the scan can read still apply, also beside a spread it can't work out, and the files the other settings pick
are kept.

::: details TypeScript

```ts
/**
 * A runner's config that scanned files use. For Playwright and Vitest, the outermost config at or above the file that
 * runs it, up to the root, else the nearest; for Jest, the one at the root and the projects it names; for the other
 * runners, the one config they read for the whole run. Read as code, never run.
 */
export interface ConfigRecord {
  /** Path from the project root, with `/` separators. */
  relativeFilePath: string;
  /** Files the config takes settings from through imports, such as a shared base config, in the order read. */
  extends: string[];
  /**
   * The projects the config runs tests in: Playwright's `projects`, or one for a config without them; Vitest's, with
   * each browser instance as one; Cypress's testing types, `e2e` and `component`; one for the other runners. Null when
   * the scan can't work them out.
   */
  projects: ProjectRecord[] | null;
}
```

:::

## Summary

Each count uses the same definition as the matching key: `skipCount` counts tests with `isSkipped: true`.

`fileCount`, `suiteCount`, `testCount`, `activeCount`, `skipCount`, `fixmeCount`, `todoCount`,
`expectedToFailCount`, `notLoadedCount`, `onlyCount`, `conditionalCount`, `parallelCount`, `serialCount`,
`parameterizedCount`, `inLoopCount`, `inConditionCount`, `inFunctionCount`, `typeTestCount`, `benchmarkCount`,
`diagnosticCount`.

`tagCounts` maps each tag to the number of tests with it. `annotationCounts` maps each annotation type to the number
of tests with at least one annotation of that type. Both are sorted by name.

::: details TypeScript

```ts
/** Counts over the whole scan. Each test count uses the same definition as the matching test key. */
export interface Summary {
  /** Test files scanned. */
  fileCount: Count;
  suiteCount: Count;
  testCount: Count;
  activeCount: Count;
  skipCount: Count;
  fixmeCount: Count;
  todoCount: Count;
  expectedToFailCount: Count;
  notLoadedCount: Count;
  onlyCount: Count;
  conditionalCount: Count;
  parallelCount: Count;
  serialCount: Count;
  parameterizedCount: Count;
  inLoopCount: Count;
  inConditionCount: Count;
  inFunctionCount: Count;
  typeTestCount: Count;
  benchmarkCount: Count;
  diagnosticCount: Count;
  /** Tests per tag. */
  tagCounts: Record<string, Count>;
  /** Tests per annotation type. */
  annotationCounts: Record<string, Count>;
}
```

:::

## Diagnostics

| Key                        | Type           | Meaning                                                                              |
| -------------------------- | -------------- | ------------------------------------------------------------------------------------ |
| `code`                     | string         | One of the [diagnostic codes](/reference/diagnostics).                               |
| `level`                    | string         | `error` when tests may be missing; `warning` when a value is missing or approximate. |
| `message`                  | string         | One sentence about the problem.                                                      |
| `relativeFilePath`         | string         | The file.                                                                            |
| `lineStart`, `columnStart` | number or null | Where the problem is. `null` for the whole file.                                     |
| `testId`                   | string or null | The test it concerns.                                                                |
| `source`                   | string or null | The code involved, cut at 200 characters.                                            |

::: details TypeScript

```ts
export interface Diagnostic {
  code: DiagnosticCode;
  level: DiagnosticLevel;
  /** One sentence describing the problem. */
  message: string;
  relativeFilePath: string;
  /** null for problems with the whole file. */
  lineStart: Position | null;
  /** null for problems with the whole file. */
  columnStart: Position | null;
  /** The affected test; null when none. */
  testId: Hash | null;
  /** Source text involved, shortened when long; null when none. */
  source: string | null;
}

/** `error`: tests may be missing from the output. `warning`: a value is missing or approximate. */
export type DiagnosticLevel = 'error' | 'warning';

export type DiagnosticCode =
  | 'unresolved-test-import'
  | 'parse-error'
  | 'read-error'
  | 'framework-mismatch'
  | 'unresolved-tag'
  | 'unresolved-annotation'
  | 'unresolved-cases'
  | 'cases-not-expanded'
  | 'test-in-loop'
  | 'dynamic-title'
  | 'duplicate-title'
  | 'duplicate-id'
  | 'internal-error'
  | 'invalid-hook'
  | 'invalid-chain'
  | 'skip-without-body'
  | 'test-without-body'
  | 'describe-not-called'
  | 'async-describe'
  | 'describe-throws'
  | 'nested-test'
  | 'tag-without-at'
  | 'removed-api'
  | 'invalid-fixture-argument'
  | 'only-in-skipped-describe'
  | 'config-may-change-state'
  | 'undefined-tag'
  | 'symlink-ignored'
  | 'invalid-import'
  | 'globals-not-enabled'
  | 'unknown-framework-version'
  | 'unsupported-framework-version'
  | 'local-test-object'
  | 'state-in-helper'
  | 'unresolved-option'
  | 'dynamic-reason'
  | 'no-files-matched'
  | 'unsupported-file'
  | 'approximate-framework-version'
  | 'test-in-function'
  | 'empty-title'
  | 'bench-outside-benchmark-file'
  | 'config-value-unknown'
  | 'file-not-run'
  | 'forbidden-only'
  | 'dependency-not-followed';
```

:::

## JSON Lines

With `--format jsonl` the same records are written one per line, each with a `type` key added in front: first an
`inventory` line with the keys of the top level, then a `config`, `file`, `suite`, `test` or `diagnostic` line for each
record, in the order of the JSON output, and a `summary` line last. Without its `type`, a line has exactly the keys of
the record described above, and filters and `--fields` work the same way.

```ts
/**
 * One line of the JSON Lines output (`--format jsonl`): the inventory with each record on its own line, marked by
 * `type`. The `inventory` line comes first, then the configs, files, suites, tests and diagnostics in the order of the
 * JSON output, and the `summary` line last.
 */
export type InventoryLine =
  | ({ type: 'inventory' } & Pick<Inventory, 'schemaVersion' | 'tool' | 'framework' | 'frameworkVersion'>)
  | ({ type: 'config' } & ConfigRecord)
  | ({ type: 'file' } & FileRecord)
  | ({ type: 'suite' } & SuiteRecord)
  | ({ type: 'test' } & TestRecord)
  | ({ type: 'diagnostic' } & Diagnostic)
  | ({ type: 'summary' } & Summary);
```

## Versioning

* The package follows semantic versioning. Before 1.0, a breaking change comes in a minor release.
* Adding a key, a diagnostic code or a value to an open set keeps `schemaVersion`. Read the output in a way that
  ignores keys you don't know; the published schema allows them.
* These sets are open, so a reader should expect values it doesn't know yet: `framework`, `state`, `stateSource` and
  the diagnostic `code`. The published schema lists the known values and accepts any string.
* Removing or renaming a key, or changing its type or meaning, raises `schemaVersion` by one and is a breaking release.
* Each `schemaVersion` has its own schema file, shipped in the package as `test-inventory/schema/v1.json` and
  published on this site.
* A key that is going away is marked deprecated in these pages and in the schema for at least one minor release first.
