Skip to content

Console logs from playwright don't format strings #9030

@h-chal

Description

@h-chal

Describe the bug

Format strings in console logs are not properly formatted.

From reproduction:

const barVar = 'World';
console.log('%s', barVar);

gives:

stdout | test/playwright/bar.test.ts > playwright test > behaves
%s World

A real-world example:

Cannot update a component (`%s`) while rendering a different component (`%s`). To locate the bad setState() call inside `%s`, follow the stack trace as described in https://react.dev/link/setstate-in-render MyParentComponent MyChildComponent MyChildComponent 

Reproduction

https://github.com/h-chal/issue-MRE-vitest-playwright-format-string

cd basic
npm test
Image

System Info

System:
    OS: Linux 6.14 Ubuntu 24.04.3 LTS 24.04.3 LTS (Noble Numbat)
    CPU: (16) x64 AMD Ryzen AI 7 PRO 350 w/ Radeon 860M
    Memory: 76.06 GB / 86.07 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 20.19.5 - /usr/bin/node
    npm: 10.8.2 - /usr/bin/npm
  Browsers:
    Chrome: 141.0.7390.65
    Firefox: 145.0
    Firefox Developer Edition: 145.0
  npmPackages:
    @vitest/browser-playwright: ^4.0.9 => 4.0.9 
    @vitest/ui: latest => 4.0.9 
    vite: latest => 7.2.2 
    vitest: latest => 4.0.9

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerp3-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