Skip to content

process.argv mismatching between 1.6.0 and 2.0.x #6203

@nazarhussain

Description

@nazarhussain

Describe the bug

The default value for process.argv does not match between above mentioned versions, when run with the browsers mode.

  • With 1.6.0 it's was undefined
  • With 2.0.x it is an array with few values

If we use vite-plugin-node-polyfills to pollyfil the process it had different weird behavior.

  • With 1.6.0 it's was []
  • With 2.0.x it is undefined

The vite-plugin-node-polyfills version is same in both cases, so the shims does not change at all.

Reproduction

https://stackblitz.com/edit/vitest-2-env-argv
https://stackblitz.com/edit/vitest-1-env-argv

System Info

System:
    OS: macOS 14.5
    CPU: (11) arm64 Apple M3 Pro
    Memory: 200.19 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.4.0 - ~/.asdf/installs/nodejs/22.4.0/bin/node
    Yarn: 1.22.22 - ~/.asdf/installs/nodejs/22.4.0/bin/yarn
    npm: 10.8.1 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Brave Browser: 126.1.67.134
    Safari: 17.5

Used Package Manager

yarn

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerp3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    Status

    Has plan

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions