Skip to content

Regression: 4.0.5 broke Angular tests’ isolation? #8944

@arty-name

Description

@arty-name

Describe the bug

My Angular project uses Vite and Vitest.

After a recent upgrade from 4.0.4 to 4.0.5 the tests started failing with errors:

On a test level in configureTestingModule:

Cannot configure the test module when the test module has already been instantiated. Make sure you are not using inject before TestBed.configureTestingModule

On a suite level in initTestEnvironment:

Cannot set base providers because it has already been called

Reproduction

https://github.com/arty-name/vitest-repro

System Info

System:
    OS: Linux 6.14 Ubuntu 25.04 25.04 (Plucky Puffin)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 11.53 GB / 30.63 GB
    Container: Yes
    Shell: 4.0.1 - /usr/bin/fish
  Binaries:
    Node: 24.11.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 11.6.1 - /usr/bin/npm
    pnpm: 10.19.0 - /usr/bin/pnpm
  Browsers:
    Chrome: 142.0.7444.59
    Firefox: 144.0.2
    Firefox Developer Edition: 144.0.2
  npmPackages:
    @vitest/coverage-v8: ^4.0.5 => 4.0.5 
    @vitest/ui: ^4.0.5 => 4.0.5 
    vitest: ^4.0.5 => 4.0.5

Used Package Manager

npm

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