Add extra playwright test functions (#17876)

This commit is contained in:
Ben Scott authored and GitHub committed 2025-09-10 11:22:31 +08:00
1 parent 53b83f2058
commit 7e3288f4cf
4 files changed
+94

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
#### Add additional Playwright test functions (#17876 by @BPScott)
Prettier already avoids changing indentation for test functions when you add `.skip` to
them. It now also treats the Playwright functions [`test.fixme`](https://playwright.dev/docs/api/class-test#test-fixme), [`test.describe.skip`](https://playwright.dev/docs/api/class-test#test-describe-skip) and [`test.describe.fixme`](https://playwright.dev/docs/api/class-test#test-describe-fixme) similar to `test.skip`.
<!-- prettier-ignore -->
```js
// Input
test.fixme("does something really long and complicated so I have to write a very long name for the test", () => {
// code
});
test.describe.skip("does something really long and complicated so I have to write a very long name for the test", () => {
// code
});
test.describe.fixme("does something really long and complicated so I have to write a very long name for the test", () => {
// code
});
// Prettier stable
test.fixme(
"does something really long and complicated so I have to write a very long name for the test",
() => {
// code
},
);
test.describe.skip(
"does something really long and complicated so I have to write a very long name for the test",
() => {
// code
},
);
test.describe.fixme(
"does something really long and complicated so I have to write a very long name for the test",
() => {
// code
},
);
// Prettier main
test.fixme("does something really long and complicated so I have to write a very long name for the test", () => {
// code
});
test.describe
.skip("does something really long and complicated so I have to write a very long name for the test", () => {
// code
});
test.describe
.fixme("does something really long and complicated so I have to write a very long name for the test", () => {
// code
});
```
+3
View File
@@ -331,9 +331,12 @@ const testCallCalleePatterns = [
"test",
"test.only",
"test.skip",
"test.fixme",
"test.step",
"test.describe",
"test.describe.only",
"test.describe.skip",
"test.describe.fixme",
"test.describe.parallel",
"test.describe.parallel.only",
"test.describe.serial",
@@ -1031,6 +1031,8 @@ test.only(\`does something really long and complicated so I have to write a very
test.skip(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
test.fixme(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
ftest("does something really long and complicated so I have to write a very long name for the describe block", () => {});
xtest("does something really long and complicated so I have to write a very long name for the describe block", () => {});
@@ -1049,6 +1051,10 @@ test.describe(\`does something really long and complicated so I have to write a
test.describe.only("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe.skip("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe.fixme("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe.only(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
test.describe.parallel("does something really long and complicated so I have to write a very long name for the test", () => {});
@@ -1195,6 +1201,8 @@ test.only(\`does something really long and complicated so I have to write a very
test.skip(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
test.fixme(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
ftest("does something really long and complicated so I have to write a very long name for the describe block", () => {});
xtest("does something really long and complicated so I have to write a very long name for the describe block", () => {});
@@ -1214,6 +1222,12 @@ test.describe(\`does something really long and complicated so I have to write a
test.describe
.only("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe
.skip("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe
.fixme("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe
.only(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
@@ -1400,6 +1414,8 @@ test.only(\`does something really long and complicated so I have to write a very
test.skip(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
test.fixme(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
ftest("does something really long and complicated so I have to write a very long name for the describe block", () => {});
xtest("does something really long and complicated so I have to write a very long name for the describe block", () => {});
@@ -1418,6 +1434,10 @@ test.describe(\`does something really long and complicated so I have to write a
test.describe.only("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe.skip("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe.fixme("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe.only(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
test.describe.parallel("does something really long and complicated so I have to write a very long name for the test", () => {});
@@ -1564,6 +1584,8 @@ test.only(\`does something really long and complicated so I have to write a very
test.skip(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
test.fixme(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
ftest("does something really long and complicated so I have to write a very long name for the describe block", () => {});
xtest("does something really long and complicated so I have to write a very long name for the describe block", () => {});
@@ -1583,6 +1605,12 @@ test.describe(\`does something really long and complicated so I have to write a
test.describe
.only("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe
.skip("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe
.fixme("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe
.only(\`does something really long and complicated so I have to write a very long name for the test\`, () => {});
@@ -77,6 +77,8 @@ test.only(`does something really long and complicated so I have to write a very
test.skip(`does something really long and complicated so I have to write a very long name for the test`, () => {});
test.fixme(`does something really long and complicated so I have to write a very long name for the test`, () => {});
ftest("does something really long and complicated so I have to write a very long name for the describe block", () => {});
xtest("does something really long and complicated so I have to write a very long name for the describe block", () => {});
@@ -95,6 +97,10 @@ test.describe(`does something really long and complicated so I have to write a v
test.describe.only("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe.skip("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe.fixme("does something really long and complicated so I have to write a very long name for the test", () => {});
test.describe.only(`does something really long and complicated so I have to write a very long name for the test`, () => {});
test.describe.parallel("does something really long and complicated so I have to write a very long name for the test", () => {});