Skip to content

process.env.VITEST_POOL_ID not set in custom environments #9058

@hornta

Description

@hornta

Describe the bug

We wanted to update from vitest 3 to 4 but it came to a halt because we rely on process.env.VITEST_POOL_ID being set in the setup method of our custom environment. We use this pool id to ensure a postgresql database schema is cleaned and prepared for the test suite to run.

Reproduction

Setup a simple custom environment and do console.log(process.env.VITEST_POOL_ID) in the setup function logs undefined, but it's expected to log a numeric ID.

System Info

System:
    OS: macOS 26.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 120.97 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - /Users/anfr/.nvm/versions/node/v22.14.0/bin/node
    npm: 10.9.2 - /Users/anfr/.nvm/versions/node/v22.14.0/bin/npm
    pnpm: 9.13.2 - /Users/anfr/.nvm/versions/node/v22.14.0/bin/pnpm
  Browsers:
    Chrome: 142.0.7444.162
    Safari: 26.1
  npmPackages:
    vitest: ^4.0.10 => 4.0.10

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions