Skip to content

Tests stop failing after including regular tests in typecheck #5019

@murolem

Description

@murolem

Describe the bug

After enabling typecheck and including regular test files (using include typecheck config option), when running the tests, only typecheck is performed, with the tests themselves passing regardless of any value assertions.

Setting only typecheck option to false doesn't seem to do anything.

Upd1: Current solution is to separate the regular tests and type tests to different files.

Upd2: Separating regular tests and type tests seems to result in an issue when saving the regular test file. Instead of rerunning the just-saved regular test file, instead the type test file is being rerun. Created an issue: #5020

Reproduction

Repo: https://github.com/murolem/vitest-issue-when-typecheck-is-used-tests-are-not-failing

Run npm run test.

Enable/disable typecheck in the config to see the issue.

System Info

System:
    OS: Windows 11 10.0.22621
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 8.01 GB / 31.93 GB
  Binaries:
    Node: 21.1.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (120.0.2210.144)
  npmPackages:
    vite: ^5.0.11 => 5.0.11
    vitest: ^1.2.1 => 1.2.0

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions