Skip to content

Is the $env variable available at the top-level in TypeScript tests? #3688

@danidiaz

Description

@danidiaz

The Using environment variables section of the docs gives an example of a TypeScript configuration that uses $env:

export const scenarios = [{
  flow: [{
    get: {
      url: '/',
      headers: {
        'x-api-key': '{{ $env.SERVICE_API_KEY }}'
      }
    }
  }]

However, I can's get it to work. Trying to console.log($env) results in

Error: $env is not defined

When running the test. Is this an oversight in the docs?

$env does seem to be available as a field of the VUContext that the test function receives (I'm using the Playwright engine).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions