-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (89 loc) · 3.04 KB
/
Copy pathci.yml
File metadata and controls
111 lines (89 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Test and Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run pre-check
run: npm run pre-check
# Coverage is optional - skip for now due to jsdom bundling issues in some tests
# - name: Run test coverage
# run: npm run test:coverage
smoke-test:
name: Smoke Test (${{ matrix.fixture }})
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
include:
- fixture: eslint8-legacy
node-version: 20.x
- fixture: eslint9-flat
node-version: 20.x
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install and build plugin
run: npm ci && npm run build
- name: Pack plugin tarball
run: npm pack
- name: Install fixture dependencies + plugin tarball
working-directory: tests/e2e/fixtures/${{ matrix.fixture }}
run: |
TARBALL=$(ls $GITHUB_WORKSPACE/eslint-plugin-a11y-*.tgz)
npm install
npm install "$TARBALL"
- name: Run ESLint and verify violations detected
working-directory: tests/e2e/fixtures/${{ matrix.fixture }}
run: |
# ESLint exits non-zero when it finds violations - we expect violations
# Include TypeScript/TSX/JS/JSX files explicitly so fixtures are linted
set +e
npx eslint src/ --ext .ts,.tsx,.js,.jsx --format json --no-error-on-unmatched-pattern > eslint-output.json 2>&1
EXIT_CODE=$?
set -e
echo "ESLint exit code: $EXIT_CODE"
cat eslint-output.json
# Exit code 1 = lint violations found (expected), 2 = config/fatal error (bad)
if [ "$EXIT_CODE" -eq 2 ]; then
echo "FATAL: ESLint crashed or had a config error"
exit 1
fi
# Verify we found the expected violations (image-alt, button-label, form-label)
if ! grep -q "image-alt" eslint-output.json; then
echo "FAIL: Expected image-alt violation not found"
exit 1
fi
if ! grep -q "button-label" eslint-output.json; then
echo "FAIL: Expected button-label violation not found"
exit 1
fi
if ! grep -q "form-label" eslint-output.json; then
echo "FAIL: Expected form-label violation not found"
exit 1
fi
echo "All expected violations detected - smoke test passed"