playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature]: Run both global setup & teardown from VS Code “Run Test”

Open vitalets opened this issue 3 months ago • 3 comments

🚀 Feature Request

In https://github.com/microsoft/playwright-vscode/pull/524 a toggle was added to the VS Code extension to automatically run global setup when executing a test via the editor. But it does not automatically run global teardown. Global teardown runs only when I re-run a test.

This leads to inconsistent behavior:

  • CLI with test.only() → runs global setup and global teardown
  • VS Code “Run Test” → runs global setup but not global teardown (only runs on re-run)

Proposal

When the toggle is enabled, executing a test from VS Code should run both global setup (before the test), and global teardown (after the test) for every single run, without requiring a re-run.

This was briefly discussed in https://github.com/microsoft/playwright/issues/33193, but I’d like to formally request this feature.

Example

No response

Motivation

  • Aligns VS Code behavior with the CLI (test.only()).
  • Ensures proper cleanup

vitalets avatar Sep 22 '25 17:09 vitalets

Yes please, I believe this should be implemented as it's a core feature.

MahmoudElSharkawy avatar Oct 01 '25 15:10 MahmoudElSharkawy

yes please, because beginners may think their global teardown aren't working, at least a warning saying "You have a global teardown file to execute, want to execute this every time all tests finishes?"

DiegoFelipe avatar Oct 24 '25 20:10 DiegoFelipe

Surely this is less feature request, more bug? If it's been defined in the projects as a project to run or added via a teardown prop in the config, this should run each time?

@agg23 could this be bumped as a bug and picked up soon? It's pretty annoying when running large test suites that require a large amount of teardown (in our case, data deletion).

jamesmhaley avatar Nov 17 '25 10:11 jamesmhaley