diff --git a/tests/playwright-test/types-2.spec.ts b/tests/playwright-test/types-2.spec.ts index ed9df2c033..519c6e21aa 100644 --- a/tests/playwright-test/types-2.spec.ts +++ b/tests/playwright-test/types-2.spec.ts @@ -206,3 +206,25 @@ test('step should inherit return type from its callback ', async ({ runTSC }) => }); expect(result.exitCode).toBe(0); }); + +test('should only run the failing test', async ({ runTSC }) => { + const result = await runTSC({ + 'a.spec.ts': ` + import { test, expect } from '@playwright/test'; + test('should not run this test', async () => { + // This test should be skipped because of test.fail.only + expect(true).toBe(true); + }); + + test.fail.only('should only run this failing test', async () => { + // This test is expected to fail + expect(true).toBe(false); + }); + + test('should also not run this test', async () => { + // This test should be skipped because of test.fail.only + expect(true).toBe(true); + }); + ` + }); +}); \ No newline at end of file