Skip to content

[BUG] VS Code extension: playwright.env is not applied to config file #22818

@OliverJAsh

Description

@OliverJAsh

Context:

  • Playwright Version: 1.33.0
  • Operating System: macOS
  • Node.js version: 16.3.0
  • Visual Studio Code version: 1.77.3
  • Playwright for VSCode extension version: 1.0.10
  • Browser: N/A
  • Extra:

Code Snippet

.vscode/settings.json:

{
  "playwright.env": {
    "FOO": "bar"
  }
}

At the top of playwright.config.ts:

if (process.env.FOO === undefined) {
  throw new Error("FOO env variable is not defined");
}

We can see that the environment variable does not exist because the error is thrown.

It seems that playright.env is only applied for spec files, but I feel like it should apply to the config file as well. Failing that, it would be helpful to document this behaviour.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions