Skip to content

[Bug]: VS Code Extension Test Run Hangs Indefinitely with Async onExit in Custom Reporter #37867

Closed

Description

Version

1.56.0

Steps to reproduce

  1. Clone my repo: https://github.com/aslushnikov/repo-pw-custom-report-vscode-extension-bug
  2. npm install
  3. code . to open vscode
  4. run test from vscode
  5. run test the second time (will not work)

Expected behavior

Tests can be run the second time.

Actual behavior

Unable to run tests for the second time.

Additional context

I'm trying to implement a similar experience as Playwright's HTML report using my custom reporter: when onExit callback is called, I launch an HTTP server and serve my report's HTML.

However, this makes the tests to stuck when launched via VSCode.

At the very least, I'd love to have a way to detect when tests a launched via VSCode extension so that I can avoid starting HTTP server.

Ideally, maybe Playwright VSCode extension can force-kill the on-going process when tests are being re-run?

Thanks,
Andrey

Environment

System:
    OS: macOS 15.6.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 1.03 GB / 32.00 GB
  Binaries:
    Node: 24.6.0 - /Users/aslushnikov/.nvm/versions/node/v24.6.0/bin/node
    npm: 11.5.1 - /Users/aslushnikov/.nvm/versions/node/v24.6.0/bin/npm
    pnpm: 9.15.0 - /opt/homebrew/bin/pnpm
    bun: 1.2.2 - /Users/aslushnikov/.bun/bin/bun
    Deno: 2.0.4 - /Users/aslushnikov/.deno/bin/deno
  IDEs:
    VSCode: 1.105.0 - /usr/local/bin/code
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.56.0 => 1.56.0

Activity

  1. yury-s commented on Oct 16, 2025

    @yury-s
    Member

    Would something like _isTestServer in the public API help your reporter not to hang when launched from the VS Code extension? We could probably have hard kill on stop/test restart but I guess this wouldn't be great for your reporter.

  2. aslushnikov commented on Oct 16, 2025

    @aslushnikov
    ContributorAuthor

    yep, isTestServer would be nice!

  3. Skn0tt commented on Oct 17, 2025

    @Skn0tt
    Contributor

    Another thing that's interesting is that we're having trouble listing tests for this repo. Seems like your reporter is being executed where it shouldn't be.

  4. Skn0tt commented on Oct 17, 2025

    @Skn0tt
    Contributor

    Hmm, the test listing problem seems to be on the VS Code end. The test runner doesn't show the should work test under the a.test.ts tree item, even though when I open a.test.ts the editor shows the Play button annotation for the test. Let me file that upstream.

    Edit: Doesn't happen outside of your repro, not sure why.

  5. pavelfeldman commented on Oct 24, 2025

    @pavelfeldman
    Member

    If we make it public, let's make it based on the terminal interactivity. I.e. onExit will only be blocked by HTML reporter in interactive TTY shells.

  6. Skn0tt commented on Oct 28, 2025

    @Skn0tt
    Contributor

    Mirroring our offline discussion: Let's not introduce a new API, but ensure that process.stdin.isTTY is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions