Skip to content

Commit 4bf2fbb

Browse files
authored
test: add test package and workflow (#41)
* test: add test package and workflow * typecheck ignore test package * test eslint output with diff * test vue rules
1 parent 705a7dd commit 4bf2fbb

File tree

12 files changed

+671
-56
lines changed

12 files changed

+671
-56
lines changed

.github/workflows/test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
name: Test with eslint@${{ matrix.eslint-version }} on node@${{ matrix.node-version }} and ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
node-version: [14, 16]
18+
eslint-version: [7]
19+
os: [ubuntu-latest]
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
with:
24+
fetch-depth: 0
25+
26+
- uses: actions/setup-node@v2
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
30+
- name: Cache pnpm modules
31+
uses: actions/cache@v2
32+
env:
33+
cache-name: cache-pnpm-modules
34+
with:
35+
path: ~/.pnpm-store
36+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
37+
restore-keys: |
38+
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
39+
40+
- uses: pnpm/[email protected]
41+
with:
42+
version: 6
43+
run_install: true
44+
45+
- name: Install eslint@${{ matrix.eslint-version }}
46+
run: pnpm --filter eslint-config-test install eslint@${{ matrix.eslint-version }}
47+
48+
- name: Run eslint@${{ matrix.eslint-version }}
49+
run: pnpm run test

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"format": "prettier --check .",
1717
"format:fix": "prettier --write .",
1818
"release": "semantic-release",
19+
"test": "cd test && pnpm eslint --format codeframe . > eslint-output.snap.tmp || true && diff eslint-output.snap eslint-output.snap.tmp && rm eslint-output.snap.tmp",
20+
"test:update": "cd test && pnpm eslint --format codeframe . > eslint-output.snap || true",
1921
"typecheck": "tsc"
2022
},
2123
"dependencies": {

0 commit comments

Comments
 (0)