Skip to content

The Node process exits via Node APIs when no test files found #5913

@Jinjiang

Description

@Jinjiang

Describe the bug

When run Vitest via Node APIs, the Node process will exit when no test files found. What I expect is returning an error object or a special message instead (without the exit of the whole Node process).

Reproduction

https://github.com/Jinjiang/reproductions/tree/vitest-no-test-found-20240618

System Info

System:
    OS: macOS 15.0
    CPU: (8) arm64 Apple M1
    Memory: 75.66 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.local/share/mise/installs/node/20/bin/node
    Yarn: 1.22.18 - ~/.yarn/bin/yarn
    npm: 10.2.4 - ~/.local/share/mise/installs/node/20/bin/npm
    pnpm: 9.0.6 - ~/Library/pnpm/pnpm
    bun: 1.0.29 - ~/.local/share/mise/installs/bun/latest/bin/bun
  Browsers:
    Safari: 18.0
  npmPackages:
    vite: ^5.3.1 => 5.3.1 
    vitest: ^1.6.0 => 1.6.0

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-nice-to-haveNot breaking anything but nice to have (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions