Skip to content

"u" command (update snapshot) doesn't work during browser pool watch mode #4865

@hi-ogawa

Description

@hi-ogawa

Describe the bug

Currently pressing "u" command during browser watch mode is not working.

The issue seems to be that configOverride:

this.configOverride.snapshotOptions = {
updateSnapshot: 'all',

is not passed to browser client via getConfig API:

getConfig() {
return vitestOrWorkspace.config
},

It looks like other pools are using getSerializableConfig, so I suppose browse pool can do the same?

const _config = project.getSerializableConfig()

Reproduction

https://github.com/hi-ogawa/repro-vitest-browser-update-snapshot/

  • pnpm test to start watch mode
  • initially test fails with error: 2 (actual) != 1 (snapshot)
  • press "u" to update snapshot
  • still the same error: 2 (actual) != 1 (snapshot)

It looks like browser mode snapshot is completely stuck on stackblitz but the same code is here:
https://stackblitz.com/edit/vitest-dev-vitest-xqh7sx?file=package.json

System Info

System:
    OS: Linux 6.6 Arch Linux
    CPU: (12) x64 AMD Ryzen 5 5625U with Radeon Graphics
    Memory: 2.06 GB / 14.98 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 18.19.0 - ~/.volta/tools/image/node/18.19.0/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
    npm: 10.2.3 - ~/.volta/tools/image/node/18.19.0/bin/npm
    pnpm: 8.12.0 - ~/.volta/tools/image/node/18.19.0/bin/pnpm
  Browsers:
    Chromium: 120.0.6099.129
  npmPackages:
    @vitest/browser: latest => 1.1.1 
    vite: latest => 5.0.10 
    vitest: latest => 1.1.1

Used Package Manager

pnpm

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