Skip to content

Commit 22b273f

Browse files
committed
test(linter/plugins): Add eslint-plugin-cypress to the conformance suite for JS Plugins.
This adds eslint-plugin-cypress, based on the same changes from the last 2 additions I've done. See the repo here: https://github.com/cypress-io/eslint-plugin-cypress
1 parent 2674748 commit 22b273f

File tree

4 files changed

+162
-0
lines changed

4 files changed

+162
-0
lines changed

apps/oxlint/conformance/init.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ E18E_SHA="1dc399be6eb9dcee207e5cd63ef184bd6c902492" # 0.1.4
99
TESTING_LIBRARY_SHA="b8ef3772487a32c886cb5c338da2a144560a437b" # 7.15.4
1010
STORYBOOK_SHA="99aa48989f6798ae24d9867bc2b5fe6991a2e341" # v10.3.0-alpha.12
1111
PLAYWRIGHT_SHA="7e16bd565cfccd365a6a8f1f7f6fe29a1c868036" # v2.9.0
12+
CYPRESS_SHA="de98a5de648694518873ad85b41250e40a67be95" # v6.2.0
1213

1314
# Shallow clone a repo at a specific commit, and `cd` into the cloned directory.
1415
# Git commands copied from `.github/scripts/clone-parallel.mjs`.
@@ -230,3 +231,16 @@ yarn install
230231

231232
# Return to `submodules` directory
232233
cd ..
234+
235+
###############################################################################
236+
# Cypress
237+
###############################################################################
238+
239+
# Clone `eslint-plugin-cypress` repo into `submodules/cypress`
240+
clone cypress https://github.com/cypress-io/eslint-plugin-cypress.git "$CYPRESS_SHA"
241+
242+
# Install dependencies
243+
npm install
244+
245+
# Return to `submodules` directory
246+
cd ..
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Conformance test results - cypress
2+
3+
## Summary
4+
5+
### Rules
6+
7+
| Status | Count | % |
8+
| ----------------- | ----- | ------ |
9+
| Total rules | 12 | 100.0% |
10+
| Fully passing | 11 | 91.7% |
11+
| Partially passing | 1 | 8.3% |
12+
| Fully failing | 0 | 0.0% |
13+
| Load errors | 0 | 0.0% |
14+
| No tests run | 0 | 0.0% |
15+
16+
### Tests
17+
18+
| Status | Count | % |
19+
| ----------- | ----- | ------ |
20+
| Total tests | 150 | 100.0% |
21+
| Passing | 147 | 98.0% |
22+
| Failing | 3 | 2.0% |
23+
| Skipped | 0 | 0.0% |
24+
25+
## Fully Passing Rules
26+
27+
- `assertion-before-screenshot` (18 tests)
28+
- `no-assigning-return-values` (19 tests)
29+
- `no-async-before` (8 tests)
30+
- `no-async-tests` (8 tests)
31+
- `no-chained-get` (4 tests)
32+
- `no-debug` (6 tests)
33+
- `no-force` (22 tests)
34+
- `no-pause` (6 tests)
35+
- `no-xpath` (3 tests)
36+
- `require-data-selectors` (22 tests)
37+
- `unsafe-to-chain-command` (8 tests)
38+
39+
## Rules with Failures
40+
41+
- `no-unnecessary-waiting` - 23 / 26 (88.5%)
42+
43+
## Rules with Failures Detail
44+
45+
### `no-unnecessary-waiting`
46+
47+
Pass: 23 / 26 (88.5%)
48+
Fail: 3 / 26 (11.5%)
49+
Skip: 0 / 26 (0.0%)
50+
51+
#### no-unnecessary-waiting > invalid
52+
53+
```js
54+
function customWait (ms = 1) { cy.wait(ms) }
55+
```
56+
57+
```json
58+
{
59+
"errors": [
60+
{
61+
"messageId": "unexpected"
62+
}
63+
]
64+
}
65+
```
66+
67+
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
68+
69+
0 !== 1
70+
71+
at assertErrorCountIsCorrect (apps/oxlint/dist/plugins-dev.js)
72+
at assertInvalidTestCasePasses (apps/oxlint/dist/plugins-dev.js)
73+
at runInvalidTestCase (apps/oxlint/dist/plugins-dev.js)
74+
at apps/oxlint/dist/plugins-dev.js
75+
76+
77+
#### no-unnecessary-waiting > invalid
78+
79+
```js
80+
const customWait = (ms = 1) => { cy.wait(ms) }
81+
```
82+
83+
```json
84+
{
85+
"errors": [
86+
{
87+
"messageId": "unexpected"
88+
}
89+
]
90+
}
91+
```
92+
93+
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
94+
95+
0 !== 1
96+
97+
at assertErrorCountIsCorrect (apps/oxlint/dist/plugins-dev.js)
98+
at assertInvalidTestCasePasses (apps/oxlint/dist/plugins-dev.js)
99+
at runInvalidTestCase (apps/oxlint/dist/plugins-dev.js)
100+
at apps/oxlint/dist/plugins-dev.js
101+
102+
103+
#### no-unnecessary-waiting > invalid
104+
105+
```js
106+
const customWait = (ms = 1) => { cy.get(".some-element").wait(ms) }
107+
```
108+
109+
```json
110+
{
111+
"errors": [
112+
{
113+
"messageId": "unexpected"
114+
}
115+
]
116+
}
117+
```
118+
119+
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
120+
121+
0 !== 1
122+
123+
at assertErrorCountIsCorrect (apps/oxlint/dist/plugins-dev.js)
124+
at assertInvalidTestCasePasses (apps/oxlint/dist/plugins-dev.js)
125+
at runInvalidTestCase (apps/oxlint/dist/plugins-dev.js)
126+
at apps/oxlint/dist/plugins-dev.js
127+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { TestGroup } from "../index.ts";
2+
3+
const group: TestGroup = {
4+
name: "cypress",
5+
6+
submoduleName: "cypress",
7+
testFilesDirPath: "tests/lib/rules",
8+
9+
transformTestFilename(filename: string) {
10+
if (!filename.endsWith(".js")) return null;
11+
return filename.slice(0, -".js".length);
12+
},
13+
14+
ruleTesters: [{ specifier: "eslint", propName: "RuleTester" }],
15+
16+
parsers: [],
17+
};
18+
19+
export default group;

apps/oxlint/conformance/src/groups/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import e18e from "./e18e.ts";
88
import testingLibrary from "./testing_library.ts";
99
import storybook from "./storybook.ts";
1010
import playwright from "./playwright.ts";
11+
import cypress from "./cypress.ts";
1112

1213
export const TEST_GROUPS: TestGroup[] = [
1314
eslint,
@@ -18,4 +19,5 @@ export const TEST_GROUPS: TestGroup[] = [
1819
testingLibrary,
1920
storybook,
2021
playwright,
22+
cypress,
2123
];

0 commit comments

Comments
 (0)