Skip to content

vitest list fails when typecheck mode #6583

@hi-ogawa

Description

@hi-ogawa

Describe the bug

Running vitest list on https://github.com/vitest-dev/vitest/tree/main/examples/typecheck

❯ npx vitest list
Testing types with tsc and vue-tsc is an experimental feature.
Breaking changes might not follow SemVer, please pin Vitest's version when using it.

There were unhandled errors during test collection
TypeError: Cannot read properties of undefined (reading 'logger')
    at DefaultReporter.onCollected (file:///home/projects/vitest-dev-vitest-su1xq5/node_modules/vitest/dist/chunks/index.zPibhCkV.js:2188:46)
    at eval (file:///home/projects/vitest-dev-vitest-su1xq5/node_modules/vitest/dist/chunks/cli-api.BKkmK21J.js:10640:58)
    at Array.map (<anonymous>)
    at Vitest.report (file:///home/projects/vitest-dev-vitest-su1xq5/node_modules/vitest/dist/chunks/cli-api.BKkmK21J.js:10640:38)
    at Object.collectTests (file:///home/projects/vitest-dev-vitest-su1xq5/node_modules/vitest/dist/chunks/resolveConfig.-K5hHm0S.js:4847:17)
    at async Promise.all (index 4)
    at async executeTests (file:///home/projects/vitest-dev-vitest-su1xq5/node_modules/vitest/dist/chunks/resolveConfig.-K5hHm0S.js:5162:5)
    at async eval (file:///home/projects/vitest-dev-vitest-su1xq5/node_modules/vitest/dist/chunks/cli-api.BKkmK21J.js:10315:9)
    at async Vitest.collectFiles (file:///home/projects/vitest-dev-vitest-su1xq5/node_modules/vitest/dist/chunks/cli-api.BKkmK21J.js:10328:12)
    at async Vitest.collect (file:///home/projects/vitest-dev-vitest-su1xq5/node_modules/vitest/dist/chunks/cli-api.BKkmK21J.js:10104:5) {
  type: 'Unhandled Error'
}

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-su1xq5?file=vite.config.ts

System Info

(stackblitz)

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @vitest/ui: latest => 2.1.1 
    vite: latest => 5.4.8 
    vitest: latest => 2.1.1

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: typecheckIssues and PRs related to typechecking featurep3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    Status

    Approved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions