Skip to content

Hanging process in test project with typecheck enabled on windows #9494

@8ctavio

Description

@8ctavio

Describe the bug

When running vitest run with the following vitest.config.ts and a single, empty test/foo.test-d.ts file

import { defineConfig } from 'vitest/config'

export default defineConfig({
    test: {
        projects: [{
            test: {
                typecheck: {
                    enabled: true,
                    only: true,
                }
            }
        }]
    }
})

I get the following output:

 ✓  0   TS  test/foo.test-d.ts (0 test)

 Test Files  1 passed (1)
      Tests  no tests
Type Errors  no errors
   Start at  14:16:17
   Duration  624ms (transform 0ms, setup 0ms, import 0ms, tests 0ms, environment 0ms, typecheck 596ms)

close timed out after 10000ms
Tests closed successfully but something prevents the main process from exiting

Disabling typechecking, or configuring it at the root level (outside projects) fixes the issue.

output with 'hanging-process' reporter
There are 6 handle(s) keeping the process running

# FILEHANDLE
(unknown stack trace)

# FILEHANDLE
(unknown stack trace)

# FILEHANDLE
(unknown stack trace)

# PIPEWRAP
(unknown stack trace)

# PIPEWRAP
(unknown stack trace)

# FILEHANDLE
(unknown stack trace)
close timed out after 10000ms
Tests closed successfully but something prevents the main process from exiting

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-32qdgkxj?file=vitest.config.ts&initialPath=__vitest__/

pnpm install
pnpm test

The reproduction works correctly in stackblitz, but not when I download it and run it locally (see below).

System Info

System:
    OS: Windows 11 10.0.26200
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
    Memory: 3.03 GB / 13.86 GB
  Binaries:
    Node: 22.17.1 - C:\Program Files\nvm4w\nodejs\node.EXE
    npm: 11.6.2 - C:\Program Files\nvm4w\nodejs\npm.CMD
    pnpm: 10.28.1 - C:\Program Files\nvm4w\nodejs\pnpm.CMD
  Browsers:
    Chrome: 144.0.7559.59
    Edge: Chromium (140.0.3485.54)
    Firefox: 143.0 - C:\Program Files\Mozilla Firefox\firefox.exe
    Firefox Developer Edition: 147.0 - C:\Program Files\Firefox Developer Edition\firefox.exe
  npmPackages:
    vite: 7.3.1 => 7.3.1
    vitest: 4.0.17 => 4.0.17

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions