Skip to content

Latest commit

 

History

History
82 lines (65 loc) · 8.53 KB

File metadata and controls

82 lines (65 loc) · 8.53 KB

Settings reference

All settings live under playwrightBddRunner.* in your VS Code Settings (Cmd/Ctrl+,) or .vscode/settings.json.

Settings table

Setting Type Default Notes
playwrightCommand string npx playwright test Use pnpm exec playwright test, yarn playwright test, etc. as appropriate.
bddgenCommand string npx bddgen Set empty to skip codegen if your playwright.config.ts already runs bddgen via defineBddProject.
preRunCommand string `` Command to run before each test execution (e.g. npm run build:fixtures). Empty disables. A non-zero exit aborts the run and writes the error to the output channel.
featuresGenDir string .features-gen Directory where bddgen writes generated specs, relative to the working directory. Set it if you customized playwright-bdd's outputDir. Used to mirror .feature-file breakpoints into the generated specs when debugging — see runs.md.
workingDirectory string `` (inferred) Empty = inferred per run: the directory of the nearest playwright.config.* above the feature file, falling back to the file's workspace folder. In a monorepo this runs bddgen/playwright from the package that declares them — required with pnpm, which links binaries only into the declaring package's node_modules/.bin. Set explicitly to override.
testFilePattern string **/*.feature Glob for feature-file discovery. Also used by tag autocompletion.
tags string `` Default tag expression, e.g. @smoke and not @wip.
parallelExecution boolean false Adds --workers=<maxParallelProcesses> to Playwright.
maxParallelProcesses number (1–16) 4 Worker count when parallel is enabled.
reporter string list The Settings dropdown offers list/line/dot/html/json/junit, but the value also accepts a comma-separated list, the github/blob/null built-ins, and custom reporter module paths (edit settings.json directly for those). The JSON reporter is appended in addition, for result mapping.
useConfigReporters boolean false Run the reporters declared in your Playwright config instead of injecting --reporter flags, so a custom reporter can run alongside the extension's Test Results panel. Requires a bare ['json'] entry (no outputFile) in your config's reporter array — the extension steers it to its temp file via PLAYWRIGHT_JSON_OUTPUT_NAME and parses that.
dryRun boolean false Passes --list to Playwright.
enableCodeLens boolean true Run/debug CodeLens on feature files. Disable if conflicting with another extension.
enableStepDefinitionNavigation boolean true Go to Definition from a Gherkin step to its TypeScript step definition.
enableStepDiagnostics boolean true Master switch for the unmatched-step, ambiguous-step, and Scenario Outline diagnostics in .feature files.
enableStepsPanel boolean true Show the Specwright Steps panel in the Activity Bar. Disabling disposes the panel and releases its share of the step-usage index. See features.md → Steps panel.
enableStepAutocomplete auto / on / off auto Suggest existing playwright-bdd step definitions when typing a step.
enableTagAutocomplete auto / on / off auto Suggest existing tags when typing @.
enableStepHover auto / on / off auto Show the matching step-definition pattern and source location when hovering a step.
enableStepReferences auto / on / off auto Find All References on a step definition lists every matching Gherkin step.
enableStepUsageCodeLens auto / on / off auto Used N times CodeLens above each Given/When/Then definition.
enableUnusedStepDiagnostics auto / on / off auto Information diagnostic on step definitions that no .feature step matches.
enableStepLiteralPromotion auto / on / off auto Refactor: promote a hard-coded literal in a step to a {string}/{int}/{float} parameter, updating both files.
enableTableFormatting auto / on / off auto Auto-align Gherkin data tables on Format Document.
collapseMarkdownExportSections boolean false Render the collapsible sections in exported feature/step Markdown catalogs collapsed by default. Recommended for large catalogs so the document opens as a scannable outline.
stepDefinitionPaths string[] ["features/steps/**/*.ts", "features/steps/**/*.js", "tests/steps/**/*.ts", "steps/**/*.ts"] Globs for step-definition lookup. Used by navigation, autocompletion, references, the CodeLens, the unused-step diagnostic, the literal-promotion refactor, and the generator. Resource-scoped — set per workspace folder so each package in a monorepo can point at its own step directories.
stepDefinitionExcludePaths string[] [] Extra globs excluded from step-definition discovery, merged with the built-in excludes (node_modules, the generated featuresGenDir, playwright-report, test-results). Exclude generated/report directories whose files contain Given/When/Then invocations that would otherwise be mistaken for definitions — e.g. "**/reports/**". Resource-scoped.

Per-feature deep dives: features.md.

Example: scoping step discovery in a monorepo

stepDefinitionPaths and stepDefinitionExcludePaths are resource-scoped, so each package can configure its own step directories in that package's .vscode/settings.json:

// packages/web/.vscode/settings.json
{
  // Look for step definitions only inside this package's step folder.
  "playwrightBddRunner.stepDefinitionPaths": ["tests/steps/**/*.ts"],

  // Exclude a custom report/output directory whose generated files contain
  // Given/When/Then invocations that would otherwise be read as definitions.
  "playwrightBddRunner.stepDefinitionExcludePaths": ["**/reports/**"]
}

Why the exclude matters: bddgen's generated specs (and some report formats) call Given("…"), When("…"), Then("…") as invocations, which look identical to step definitions to the matcher. If discovery reaches those files, a single step appears to match several definitions and gets flagged as ambiguous. The built-in excludes already cover node_modules, the generated featuresGenDir (default .features-gen), playwright-report, and test-results; use stepDefinitionExcludePaths for any additional directory specific to your setup.

auto / on / off semantics

Eight providers in this extension share a tri-state setting because they overlap with the Cucumber (Gherkin) Full Support extension:

Setting Provider
enableStepAutocomplete Step completions on Gherkin step lines
enableTagAutocomplete Tag completions on @-prefix
enableStepHover Hover tooltip on Gherkin steps
enableStepReferences Find All References on step definitions
enableStepUsageCodeLens "Used N times" CodeLens
enableUnusedStepDiagnostics Unused-step Information diagnostic
enableStepLiteralPromotion Promote literal to parameter refactor
enableTableFormatting Format Document for data tables

Each setting accepts three values:

  • auto (default) — registers the provider only when alexkrechik.cucumberautocomplete is not installed. Auto-defers when it is, so the IntelliSense list, Problems panel, References panel, and formatter never produce duplicates.
  • on — always register. Keeps both providers active. Use this when you want both extensions to contribute (each entry from this extension has detail prefixed with Playwright-BDD so you can tell them apart).
  • off — never register. Use this to defer to cucumberautocomplete unconditionally, or to disable the feature entirely.

Cucumberautocomplete coexistence

The auto-defer detection uses VS Code's vscode.extensions.getExtension("alexkrechik.cucumberautocomplete") and re-evaluates on vscode.extensions.onDidChange, so installing or uninstalling cucumberautocomplete mid-session re-reconciles every auto-mode provider without a window reload.

The enableCodeLens, enableStepDefinitionNavigation, and enableStepDiagnostics settings are plain booleans because they don't overlap with cucumberautocomplete's surface (run/debug CodeLens, navigation that targets playwright-bdd specifically, and our distinct diagnostic codes).