> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/resources/reporters/currents-playwright/pwc-p/pwc-p-discover.md).

# pwc-p discover

pwc-p discover command documentation - test discovery and filtering for Playwright orchestration

`pwc-p discover` runs Playwright test discovery and writes the test list to a file for use by [`pwc-p run`](/resources/reporters/currents-playwright/pwc-p/pwc-p-run.md) during orchestration.

The discover command accepts Playwright filter flags to narrow down the test suite before orchestration. See the [Playwright docs](https://playwright.dev/docs/test-cli#reference) for complete filter flag documentation.

## Examples

Discover all tests (no filters):

```bash
npx pwc-p discover --pwc-discovery-file tests.txt
```

Filter tests by tag:

```bash
npx pwc-p discover --pwc-discovery-file tests.txt --grep @smoke
```

Discover only failed tests from the last run:

```bash
npx pwc-p discover --pwc-discovery-file tests.txt --last-failed
```

Discover tests from a specific project:

```bash
npx pwc-p discover --pwc-discovery-file tests.txt --project chromium
```

Discover tests from specific spec files:

```bash
npx pwc-p discover --pwc-discovery-file tests.txt tests/auth.spec.ts tests/checkout.spec.ts
```

## Options

### `--pwc-discovery-file <path>`

Path to the discovery output file written by `pwc-p discover` and read by `pwc-p run`. Also available as `CURRENTS_DISCOVERY_FILE` environment variable or `orchestration.discoveryFile` in `currents.config.ts` (recommended for CI so both commands use the same path).

### `--grep <pattern>`

Filter tests by title using a regex pattern (Playwright passthrough). For example, `--grep @smoke` filters to tests with the `@smoke` tag.

### `--last-failed`

Discover only tests that failed in the previous run (Playwright passthrough).

### `--project <name>`

Filter tests by project name (Playwright passthrough). For example, `--project chromium` filters to tests configured for Chromium only.

### Spec files

Specify test files or directories directly without a flag:

```bash
npx pwc-p discover --pwc-discovery-file tests.txt tests/auth.spec.ts tests/checkout.spec.ts
```

### `--pwc-config <path>`

Path to currents config file `currents.config.[ts|js]`. See [Configuration](/resources/reporters/currents-playwright/configuration.md#configuration-sources).

### `-V, --version`

Show package version.

### `-h, --help`

Show help message.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.currents.dev/resources/reporters/currents-playwright/pwc-p/pwc-p-discover.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
