eslint-plugin-playwright 0.22.0 → 0.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -4
- package/dist/index.mjs +14 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -273,7 +273,8 @@ var expectPlaywrightMatchers = [
|
|
|
273
273
|
"toMatchText",
|
|
274
274
|
"toMatchTitle",
|
|
275
275
|
"toMatchURL",
|
|
276
|
-
"toMatchValue"
|
|
276
|
+
"toMatchValue",
|
|
277
|
+
"toPass"
|
|
277
278
|
];
|
|
278
279
|
var playwrightTestMatchers = [
|
|
279
280
|
"toBeChecked",
|
|
@@ -355,7 +356,6 @@ var missing_playwright_await_default = {
|
|
|
355
356
|
return {
|
|
356
357
|
CallExpression(node) {
|
|
357
358
|
const result = getCallType(node, awaitableMatchers);
|
|
358
|
-
console.log(result);
|
|
359
359
|
const isValid = result ? checkValidity(result.node) : false;
|
|
360
360
|
if (result && !isValid) {
|
|
361
361
|
context.report({
|
|
@@ -1502,7 +1502,7 @@ var prefer_to_have_count_default = {
|
|
|
1502
1502
|
return;
|
|
1503
1503
|
}
|
|
1504
1504
|
const [argument] = node.arguments;
|
|
1505
|
-
if (argument.type !== "AwaitExpression" || argument.argument.type !== "CallExpression" || argument.argument.callee.type !== "MemberExpression") {
|
|
1505
|
+
if (argument.type !== "AwaitExpression" || argument.argument.type !== "CallExpression" || argument.argument.callee.type !== "MemberExpression" || !isPropertyAccessor(argument.argument.callee, "count")) {
|
|
1506
1506
|
return;
|
|
1507
1507
|
}
|
|
1508
1508
|
const callee = argument.argument.callee;
|
|
@@ -1603,7 +1603,11 @@ var methods3 = {
|
|
|
1603
1603
|
},
|
|
1604
1604
|
innerText: { matcher: "toHaveText", type: "string" },
|
|
1605
1605
|
inputValue: { matcher: "toHaveValue", type: "string" },
|
|
1606
|
-
isChecked: {
|
|
1606
|
+
isChecked: {
|
|
1607
|
+
matcher: "toBeChecked",
|
|
1608
|
+
prop: "checked",
|
|
1609
|
+
type: "boolean"
|
|
1610
|
+
},
|
|
1607
1611
|
isDisabled: {
|
|
1608
1612
|
inverse: "toBeEnabled",
|
|
1609
1613
|
matcher: "toBeDisabled",
|
|
@@ -1691,6 +1695,11 @@ var prefer_web_first_assertions_default = {
|
|
|
1691
1695
|
const [matcherArg] = args ?? [];
|
|
1692
1696
|
if (matcherArg && isBooleanLiteral(matcherArg)) {
|
|
1693
1697
|
fixes.push(fixer.remove(matcherArg));
|
|
1698
|
+
} else if (methodConfig.prop && matcherArg) {
|
|
1699
|
+
const propArg = methodConfig.prop;
|
|
1700
|
+
const variable = getStringValue(matcherArg);
|
|
1701
|
+
const args2 = `{ ${propArg}: ${variable} }`;
|
|
1702
|
+
fixes.push(fixer.replaceText(matcherArg, args2));
|
|
1694
1703
|
}
|
|
1695
1704
|
const hasOtherArgs = !!methodArgs.filter(
|
|
1696
1705
|
(arg2) => !isBooleanLiteral(arg2)
|
package/dist/index.mjs
CHANGED
|
@@ -306,7 +306,8 @@ var init_missing_playwright_await = __esm({
|
|
|
306
306
|
"toMatchText",
|
|
307
307
|
"toMatchTitle",
|
|
308
308
|
"toMatchURL",
|
|
309
|
-
"toMatchValue"
|
|
309
|
+
"toMatchValue",
|
|
310
|
+
"toPass"
|
|
310
311
|
];
|
|
311
312
|
playwrightTestMatchers = [
|
|
312
313
|
"toBeChecked",
|
|
@@ -368,7 +369,6 @@ var init_missing_playwright_await = __esm({
|
|
|
368
369
|
return {
|
|
369
370
|
CallExpression(node) {
|
|
370
371
|
const result = getCallType(node, awaitableMatchers);
|
|
371
|
-
console.log(result);
|
|
372
372
|
const isValid = result ? checkValidity(result.node) : false;
|
|
373
373
|
if (result && !isValid) {
|
|
374
374
|
context.report({
|
|
@@ -1671,6 +1671,7 @@ var matchers2, prefer_to_have_count_default;
|
|
|
1671
1671
|
var init_prefer_to_have_count = __esm({
|
|
1672
1672
|
"src/rules/prefer-to-have-count.ts"() {
|
|
1673
1673
|
"use strict";
|
|
1674
|
+
init_ast();
|
|
1674
1675
|
init_fixer();
|
|
1675
1676
|
init_parseExpectCall();
|
|
1676
1677
|
matchers2 = /* @__PURE__ */ new Set(["toBe", "toEqual", "toStrictEqual"]);
|
|
@@ -1683,7 +1684,7 @@ var init_prefer_to_have_count = __esm({
|
|
|
1683
1684
|
return;
|
|
1684
1685
|
}
|
|
1685
1686
|
const [argument] = node.arguments;
|
|
1686
|
-
if (argument.type !== "AwaitExpression" || argument.argument.type !== "CallExpression" || argument.argument.callee.type !== "MemberExpression") {
|
|
1687
|
+
if (argument.type !== "AwaitExpression" || argument.argument.type !== "CallExpression" || argument.argument.callee.type !== "MemberExpression" || !isPropertyAccessor(argument.argument.callee, "count")) {
|
|
1687
1688
|
return;
|
|
1688
1689
|
}
|
|
1689
1690
|
const callee = argument.argument.callee;
|
|
@@ -1801,7 +1802,11 @@ var init_prefer_web_first_assertions = __esm({
|
|
|
1801
1802
|
},
|
|
1802
1803
|
innerText: { matcher: "toHaveText", type: "string" },
|
|
1803
1804
|
inputValue: { matcher: "toHaveValue", type: "string" },
|
|
1804
|
-
isChecked: {
|
|
1805
|
+
isChecked: {
|
|
1806
|
+
matcher: "toBeChecked",
|
|
1807
|
+
prop: "checked",
|
|
1808
|
+
type: "boolean"
|
|
1809
|
+
},
|
|
1805
1810
|
isDisabled: {
|
|
1806
1811
|
inverse: "toBeEnabled",
|
|
1807
1812
|
matcher: "toBeDisabled",
|
|
@@ -1889,6 +1894,11 @@ var init_prefer_web_first_assertions = __esm({
|
|
|
1889
1894
|
const [matcherArg] = args ?? [];
|
|
1890
1895
|
if (matcherArg && isBooleanLiteral(matcherArg)) {
|
|
1891
1896
|
fixes.push(fixer.remove(matcherArg));
|
|
1897
|
+
} else if (methodConfig.prop && matcherArg) {
|
|
1898
|
+
const propArg = methodConfig.prop;
|
|
1899
|
+
const variable = getStringValue(matcherArg);
|
|
1900
|
+
const args2 = `{ ${propArg}: ${variable} }`;
|
|
1901
|
+
fixes.push(fixer.replaceText(matcherArg, args2));
|
|
1892
1902
|
}
|
|
1893
1903
|
const hasOtherArgs = !!methodArgs.filter(
|
|
1894
1904
|
(arg2) => !isBooleanLiteral(arg2)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-playwright",
|
|
3
3
|
"description": "ESLint plugin for Playwright testing.",
|
|
4
|
-
"version": "0.22.
|
|
4
|
+
"version": "0.22.2",
|
|
5
5
|
"repository": "https://github.com/playwright-community/eslint-plugin-playwright",
|
|
6
6
|
"author": "Mark Skelton <mark@mskelton.dev>",
|
|
7
7
|
"packageManager": "pnpm@8.12.0",
|