Skip to content

Undefined define constants error when --pool=forks #5273

@IanVS

Description

@IanVS

Describe the bug

I attempted to set --pool='forks' to debug some hanging tests that I've been having intermittently, and started to get a few test failures about global constants not being defined. I'm guessing it's a consequence of running the tests using child_process, but it surprised me a bit nonetheless.

I'm not sure if anything can be done to address this from vitest, but it might be worth at the very least adding a note in the documentation to clarify that define values should not be undefined?

Reproduction

https://github.com/IanVS/reproduction-vitest-define-pool-forks

System Info

System:
    OS: macOS 14.0
    CPU: (12) arm64 Apple M2 Max
    Memory: 1.81 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - ~/Library/Caches/fnm_multishells/35181_1708624240853/bin/node
    Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/35181_1708624240853/bin/yarn
    npm: 9.5.1 - ~/Library/Caches/fnm_multishells/35181_1708624240853/bin/npm
    pnpm: 8.8.0 - ~/Library/Caches/fnm_multishells/35181_1708624240853/bin/pnpm
  Browsers:
    Safari: 17.0
  npmPackages:
    vite: ^5.1.4 => 5.1.4
    vitest: ^1.3.1 => 1.3.1

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

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions